Upcoming SlideShare
×

Lec10

216 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
216
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
1
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lec10

1. 1. CS1502 Formal Methods in Computer Science Lecture Notes 10 Resolution and Horn Sentences
2. 2. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then tosets of clausesAt each step, a new clause is derived from twoclauses you already haveProof steps all use the same ruleIf reach  (_|_), sentences were not satisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
3. 3. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then tosets of clausesAt each step, a new clause is derived from twoclauses you already haveProof steps all use the same ruleIf reach  (_|_), sentences were not satisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
4. 4. Conversion to Clausal FormUse P  Q equiv ~P v Q to remove Use P  Q equiv ((~P v Q) ^ (~Q v P)) to remove  New 1st Step! We hadn’t done conditionals yetUse DeMorgan’s laws and ~Elim to move ~ as far inwardas possible (gives NNF)Use the distributive laws until the sentence is in CNF
5. 5. Clausal FormGiven a sentence S written in CNF S = ( ) ∧( ) ∧ . . . ∧ ( )Convert each ( ) into a clause - a setconsisting of each of the literals in ( ).Example: S= (A) ∧ (¬B ∨ C ∨ D) ∧ (¬A∨ D)Clauses are: {A}, {¬ B, C, D}, {¬ A, D}
6. 6. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then to sets ofclausesAt each step, a new clause is derived from two clausesyou already haveProof steps all use the same ruleIf reach  (_|_), sentences were notsatisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
7. 7. Satisfying a Set of ClausesAssigning truth-values to the atomicsentences so the CNF sentence the setcorresponds to is true.{{A, ¬C, D}, {C},{¬A},{A, D}} is satisfied by A = False C = True D = True
8. 8. Empty Clause{} denoted by .The empty clause is not satisfiableWe want {{A}, {¬ A}} to lead to {} ()The basic resolution step involves “canceling”pos and neg matching literals from two clausesSo, we derive {} () from {{A}, {¬ A}}
9. 9. Example: not satisfiable¬P ∨ Q {¬P, Q}P {P}¬Q {¬Q} {¬P, Q} {P} {¬Q}
10. 10. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then tosets of clausesAt each step, a new clause is derived from twoclauses you already haveProof steps all use the same ruleIf reach  (_|_), sentences were not satisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
11. 11. Resolution Step
12. 12. Res. Step with Larger Clauses
13. 13. ResolventClause R is a resolvent of clauses C 1 andC2 if there is a literal in C1 whose negationis in C2 and R consists of all the remainingliterals in either clause.Example: {A, C , ¬D} and {B, ¬C} haveresolvent {A, B, ¬D}
14. 14. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then tosets of clausesAt each step, a new clause is derived from twoclauses you already haveProof steps all use the same ruleIf reach  (_|_), sentences were notsatisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
15. 15. Resolution TheoremFor any set of clauses that are notsatisfiable, it is possible to arrive at theempty clause by using successiveresolutions.
16. 16. Resolution Theorem ProvingMethod for searching for proofs automaticallySentences are translated into CNF, and then to sets ofclausesAt each step, a new clause is derived from two clausesyou already haveProof steps all use the same ruleIf reach  (_|_), sentences were not satisfiableStart: premises + negation of goalEnd: if reach , premises |= goal
17. 17. Using Resolution to Determine Validity of ArgumentsQ is a logical consequence of P1, P2, …,Pn iff P1 ^ P2 ^ … ^ Pn ^ ~Q is notsatisfiableFor sentences in clausal form:Q is a logical consequence of a set ofclauses S iff S ∪ {¬Q} is not satisfiable.So, convert premises + negation of goal toclausal form, and do resolution steps, trying toreach {} ()
18. 18. Is this Argument Valid?BvC~C v ~DAvD~B v ~DA
19. 19. ExampleShow ¬A ∧ (B ∨ C) ∧ (¬C ∨ ¬D) ∧ (A ∨ D) ∧ (¬B ∨ ¬D) isnot satisfiable.Clauses: {¬ A}, {B, C}, {¬C, ¬D}, {A, D}, {¬B, ¬D}.{¬A} {A,D} {B,C} {¬C, ¬D} {D} { B, ¬D} {¬B, ¬D} { ¬D} 
20. 20. ExampleModus PonesP→Q ¬P∨Q or {¬P,Q}P {P}Q negate to get {¬Q}Apply resolution: {¬P,Q} { P} { Q} { ¬Q}
21. 21. What is a Horn sentence?A positive literal is any literal that is notpreceded with a ¬. For example, Cube(b)and P are positive literals.A sentence S is a Horn sentence if andonly if it is in CNF and every conjunct hasat most one positive literal.
22. 22. Examples(A ∨ ¬B ∨ ¬C) ∧ (¬A ∨ ¬B) Horn sentence(A ∨ ¬B ∨ C) ∧ (D) Not Horn sentence(A ∧ B) ∨ (¬C ∧ ¬D) Horn sentence (A ∨ ¬C) ∧ (B ∨ ¬C) ∧ (A ∨ ¬D) ∧ (B ∨ ¬D)
23. 23. Alternate Form of Horn Conjunct¬A1∨ ¬A2∨...∨ ¬An∨ B ¬(A1 ∧ A2 ∧... ∧ An) ∨ B (A1 ∧ A2 ∧... ∧ An) → B B :- A1, A2, …, An. Conditional Form In Prolog: of HornRule sentence B if A1, A2, …, An
24. 24. Special CasesNo positive literal¬A1∨ ¬A2∨...∨ ¬An In Prolog, this is a query!(A1 ∧ A2 ∧... ∧ An) → FalseNo negative literalsB In Prolog, this True → B is a fact!
25. 25. Why are Horn sentences important?Very efficient algorithms exist for determining if aset of Horn sentences is satisfiable
26. 26. CNF to PROLOG¬A ∨ B ∨ ¬C is ¬(A∧C) ∨ B is (A ∧ C)→BB :- A, C.A.C.Query: :- B.Answer: Yes.
27. 27. Example Prolog Programgrandfather(X,Y) :- father(X,Z), father(Z,Y).grandfather(X,Y) :- father(X,Z), mother(Z,Y).mother(ann,bill).father(carl,ed).father(nick,ann).father(ed,sam).