Download presentation
Presentation is loading. Please wait.
1
Knowledge Representation & Reasoning
Lecture 6: Logic Programming in First Order Logic (FOL) By : SHEREENA ARIF Room : T2//8, BLOK 4 OR
2
Conversion to CNF Conjunctive Normal Form : a conjunction of clauses
Where each clause is a disjunction of literals Example : x. American(x) ∧ Weapon(y) ∧ Sells(x,y,z) ∧ Hostile(z) Criminal(x) In CNF (implication elimination rule): ¬American(x) ∨ ¬Weapon(y) ∨ ¬Sells(x,y,z) ∨ ¬Hostile(z) ∨ Criminal(x) 20/5/2011 TP2623 by Shereena Arif
3
Conversion to CNF 1. Convert to negated normal form
a) Eliminate biconditional & implications b) Move inwards using negation rules 2. Standardize variables e.g (x y) to (x ∨ y) (x y) to ((x y) ∧ (y x)) ∃x. p becomes ∀x. p OR ∀x. p becomes ∃x. p ( x) to x == double elimination (x ∧ y) to (x) ∨ ( y) == De Morgan 1 (x ∨ y) to (x) ∧ ( y) == De Morgan 2 (∀x P(x)) ∨ (∃x Q(x)) == change the name of one of the variables to avoid confusion (i.e x) 20/5/2011 TP2623 by Shereena Arif
4
3. Skolemize : remove existential quantifiers by elimination.
Translate [x P(x)] into P(A), A is the new constant. Each existential variable is replaced by a Skolem function of the enclosing universally quantified variables 4. Drop universal quantifiers: 5. Distribute over (or vice versa) using rules given: x [y Animal(y) ∧ Loves(x, y)] ∨ [z Loves(z,x)] becomes x [Animal(F(x)) ∧ Loves(x, F(x))] ∨ [Loves(G(x),x)] [Animal(F(x)) ∧ Loves(x, F(x))] ∨ [Loves(G(x),x)] [Animal(F(x)) ∨ Loves(G(x),x)] ∧ [Loves(x, F(x))∨ Loves(G(x),x)] 20/5/2011 TP2623 by Shereena Arif
5
What we have in the KB ... it is a crime for an American to sell weapons to hostile nations: American(x) ∧ Weapon(y) ∧ Sells(x,y,z) ∧ Hostile(z) Criminal(x) CNF : ¬American(x) ∨ ¬Weapon(y) ∨ ¬Sells(x,y,z) ∨ ¬Hostile(z) ∨ Criminal(x) Owns(Nono,M1) and Missile(M1) … already in CNF … all of its missiles were sold to it by Colonel West Missile(x) ∧ Owns(Nono,x) Sells(West,x,Nono) CNF : ¬Missile(x) ∨ ¬Owns(Nono,x) ∨ Sells(West,x,Nono) Missile(x) Weapon(x) CNF : ¬Missile(x) ∨ Weapon(x) An enemy of America counts as "hostile“: Enemy(x,America) Hostile(x) CNF : ¬Enemy(x,America) ∨ Hostile(x) American(West) … already in CNF Enemy(Nono,America) … already in CNF
6
Resolution proof: backward chaining
20/5/2011 TP2623 by Shereena Arif
7
Example All ducks are bird All birds can fly
If it quacks, it is a duck Daffy quacks Question : Use resolution to prove that Daffy can fly… 20/5/2011 TP2623 by Shereena Arif
8
Latihan Diberi predicate & constants berikut dalam FOL :
G(x) : x ialah seorang guru di sekolah S(x) : x ialah seorang murid di sekolah M(x) : x menghadiri mesyuarat kecemerlangan murid A(x, y) : x disertai oleh y P(x,y) : y ialah bapa kepada x Mariam ialah seorang murid Suria ialah seorang murid 20/5/2011 TP2623 by Shereena Arif
9
Tuliskan pernyataan berikut dalam FOL :
A) Semua murid dan guru menghadiri mesyuarat kecemerlangan B) Tidak seorang pun murid yang menghadiri mesyuarat kecemerlangan disertai oleh bapa mereka C)Beberapa orang bapa daripada murid tidak menghadiri mesyuarat kecemerlangan. D) Jika semua guru menghadiri mesyuarat kecemerlangan, maka sebahagian murid sahaja yang disertai oleh bapa mereka. Mariam dan Suria menghadiri mesyuarat kecemerlangan, tetapi tidak seorangpun di antara mereka yang disertai oleh bapa masing-masing. 20/5/2011 TP2623 by Shereena Arif
10
Terjemahkan ayat FOL berikut ke dalam bentuk CNF :
∃x.∀y. p(x) ⇒ r(x,y) ∀x. ∃y. p(x) ∧ r(x,y) ¬∀x. ∃y. p(x) ∧ r(x,y) 20/5/2011 TP2623 by Shereena Arif
11
End of Topic FOL
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.