Week 7 - Propositional Logic Programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

19 Terms

1
New cards

Conjunctive Normal Form

Writing a formula as the conjunction of disjunction of literals. Each clause contains literals and disjunctions, and are conjuncted to form a more complex formula.

2
New cards

What to remember about CNF (corresponds to DNF too)

Only requires conjunction if joining a clause. A single clause (therefore containing disjunction and literals) can exist by itself and still be in CNF

3
New cards

What are the clauses in this formula?

(P V Q) ^ ¬R ^ (¬P V Q V R)

P V Q

¬R

¬P V Q V R

4
New cards

Implicational/Rule Form

Writing a formula only in terms of positive literals, conjunction, disjunction and implication.

5
New cards

What should you notice about the structure of the implicational form?

The antecedent/tail is always conjunctive whereas the consequent/head is always disjunctive.

6
New cards

What is a Horn clause?

A clause that has at most one positive literal (and any number of negative literals).

7
New cards

What is a definite clause?

A Horn clause containing exactly one positive literal.

8
New cards

What is a unit clause/fact?

A definite clause containing no negative literals

9
New cards

What is a (propositional) logic program?

An ordered list of definite Horn clauses written in implicational form


10
New cards

What is a (conjunctive) query? What else must you remember about them?

An ordered list of positive literals.

They are normally prefaced with a question mark to distinguish them from the rules in the logic programs.

e.g. ? Q1, Q2 … Qn

11
New cards

How are queries and logic programs related?

We want to decide whether a query can be proven using a logic program. This is achieved through a process called resolution.

12
New cards

What does the resolution procedure do?

Takes a logic program P and a query ?q as an input. The aim is to verify if ?q can be true under P, so the resolution procedure returns true of false once completed.

13
New cards

State the steps of the resolution procedure.

  1. Take the first conjunct in the query.

  2. Search for the first rule in the logic program whose consequent/head matches the conjunct. If found, replace the conjunct in the query with the corresponding antecedent/tail for its consequent/head.

  3. Repeat these steps onto the new iterations of the query, moving along the conjuncts of the query from left to right.

    • If the query becomes empty, return true

    • Else, return false


14
New cards

How do we denote that a query is empty? What does this mean?

With an white square □/■

This means the query logically follows from the logic program, and that there is a successful derivation tree.

15
New cards

How do we denote an unsuccessful derivation? What is another way to say that the query is false?

With a black square ■

“The procedure terminates in failure”

16
New cards

Show that T follows logically from the following logic program and draw its derivation tree:

  1. → P

  2. P → Q

  3. P → R

  4. Q → S

  5. R, S → T




17
New cards

What is a derivation tree?

A tree generated through a resolution procedure. It looks like an upside down binary tree, where each query (besides the initial query) has two children: the preceding query and the matched rule that transformed the preceding query into it.

18
New cards

What do we do if there are multiple rules that can be matched to the current query, and the first one we encounter leads to failure but any subsequent ones lead to success?

Backtracking.

If the first rule leads to failure, return to the last branching point and skip over the previously matched rule. Repeat until a match that results in success is found.

19
New cards

Write out the full derivation tree for ?T given the following rules:

  1. → P

  2. Q → R

  3. P → R

  4. R → T