1 / 11

Knowledge Representation & Reasoning

Knowledge Representation & Reasoning. Lecture 6: Logic Programming in First Order Logic (FOL). By : SHEREENA ARIF Room : T2//8, BLOK 4 Email : shereen@ftsm.ukm.my OR shereen.ma@gmail.com. Conversion to CNF. Conjunctive Normal Form : a conjunction of clauses

xerxes
Download Presentation

Knowledge Representation & Reasoning

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Knowledge Representation & Reasoning Lecture 6: Logic Programming in First Order Logic (FOL) By : SHEREENA ARIF Room : T2//8, BLOK 4 Email : shereen@ftsm.ukm.my OR shereen.ma@gmail.com

  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) 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.ex) TP2623 by Shereena Arif

  4. 3. Skolemize : remove existential quantifiers by elimination. • Translate [xP(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)] 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) Nono … has some missiles, i.e., x Owns(Nono,x)  Missile(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) Missiles are weapons: 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) West, who is American … American(West) … already in CNF The country Nono, an enemy of America … Enemy(Nono,America) … already in CNF

  6. Resolution proof: backward chaining 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… TP2623 by Shereena Arif

  8. Latihan • Diberipredicate & constantsberikutdalam FOL : • G(x) : x ialahseorang guru disekolah • S(x) : x ialahseorangmuriddisekolah • M(x) : x menghadirimesyuaratkecemerlanganmurid • A(x, y) : x disertaioleh y • P(x,y) : y ialahbapakepada x • Mariamialahseorangmurid • Suriaialahseorangmurid TP2623 by Shereena Arif

  9. Tuliskanpernyataanberikutdalam FOL : • A) Semuamuriddan guru menghadirimesyuaratkecemerlangan • B) Tidakseorang pun murid yang menghadirimesyuaratkecemerlangandisertaiolehbapamereka • C)Beberapaorangbapadaripadamuridtidakmenghadirimesyuaratkecemerlangan. • D) Jikasemua guru menghadirimesyuaratkecemerlangan, makasebahagianmuridsahaja yang disertaiolehbapamereka. • MariamdanSuriamenghadirimesyuaratkecemerlangan, tetapitidakseorangpundiantaramereka yang disertaiolehbapamasing-masing. TP2623 by Shereena Arif

  10. Terjemahkanayat FOL berikutkedalambentuk CNF : • ∃x.∀y. p(x)⇒ r(x,y) • ∀x. ∃y. p(x)∧r(x,y) • ¬∀x. ∃y. p(x)∧r(x,y) TP2623 by Shereena Arif

  11. End of Topic FOL

More Related