first order logic first order logic
play

First Order Logic First Order Logic Course: CS40002 Course: - PowerPoint PPT Presentation

First Order Logic First Order Logic Course: CS40002 Course: CS40002 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering Department of Computer Science & Engineering Indian


  1. First Order Logic First Order Logic Course: CS40002 Course: CS40002 Instructor: Dr. Pallab Dasgupta Pallab Dasgupta Instructor: Dr. Department of Computer Science & Engineering Department of Computer Science & Engineering Indian Institute of Technology Kharagpur Kharagpur Indian Institute of Technology

  2. Knowledge and Reasoning Knowledge and Reasoning � Representation, Reasoning and Logic Representation, Reasoning and Logic � � Propositional Propositional Logic Logic � � First First- -Order Logic Order Logic � � Inference in first Inference in first- -order logic order logic � CSE, IIT Kharagpur Kharagpur CSE, IIT 2

  3. First- -order Logic order Logic First → Constant → � Constant � A | 5 | Kolkata Kolkata | | … … A | 5 | → Variable → � Variable � a | x | s | … … a | x | s | → Predicate → � Predicate � Before | HasColor HasColor | Raining | | Raining | … … Before | → Function → � Function � Mother | Cosine | Headoflist Headoflist | | … … Mother | Cosine | CSE, IIT Kharagpur Kharagpur CSE, IIT 3

  4. First- -order Logic order Logic First → Sentence → � Sentence AtomicSentence AtomicSentence � | Sentence Connective Sentence | Sentence Connective Sentence | Quantifier Variable, … … Sentence Sentence | Quantifier Variable, ¬ Sentence | (Sentence) | ¬ Sentence | (Sentence) | AtomicSentence → → � AtomicSentence � Predicate(Term, … …) | Term = Term ) | Term = Term Predicate(Term, → Term → � Term � Function(Term, … …) | Constant | Variable ) | Constant | Variable Function(Term, → ⇒ | ∧ | ∨ | ⇔ Connective → ⇒ | ∧ | ∨ | ⇔ � Connective � → ∀ | ∃ Quantifier → ∀ | ∃ � Quantifier � CSE, IIT Kharagpur Kharagpur CSE, IIT 4

  5. Examples Examples � Not all students take both History & Biology Not all students take both History & Biology � � Only one student failed History Only one student failed History � � Only one student failed both History & Biology Only one student failed both History & Biology � � The best score in History is better than the The best score in History is better than the � best score in Biology best score in Biology � No person likes a professor unless the No person likes a professor unless the � professor is smart professor is smart � Politicians can fool some of the people all the Politicians can fool some of the people all the � time, and they can fool all the people some of time, and they can fool all the people some of the time, but they cant fool all the people all the time, but they cant fool all the people all the time the time CSE, IIT Kharagpur Kharagpur CSE, IIT 5

  6. Examples Examples � Russel’s Russel’s Paradox: Paradox: � � There is a single barber in town. There is a single barber in town. � � Those and only those who do not shave Those and only those who do not shave � themselves are shaved by the barber. themselves are shaved by the barber. � Who shaves the barber? Who shaves the barber? � CSE, IIT Kharagpur Kharagpur CSE, IIT 6

  7. Inference rules Inference rules � Universal elimination: Universal elimination: � � ∀ ∀ x Likes( x, x Likes( x, IceCream IceCream ) ) with the with the � substitution {x / Einstein} {x / Einstein} gives us gives us substitution Likes( Einstein, IceCream IceCream ) ) Likes( Einstein, � The substitution has to be done by a The substitution has to be done by a � ground term ground term CSE, IIT Kharagpur Kharagpur CSE, IIT 7

  8. Inference rules Inference rules � Existential elimination: Existential elimination: � ∃ x Likes( x, From ∃ � From x Likes( x, IceCream IceCream ) ) we may we may � infer Likes( Man, Likes( Man, IceCream IceCream ) ) as long as as long as infer Man does not appear elsewhere in the Man does not appear elsewhere in the Knowledge base Knowledge base � Existential introduction: Existential introduction: � � From From Likes( Likes( Monalisa Monalisa, , IceCream IceCream ) ) we can we can � ∃ x Likes( x, infer ∃ x Likes( x, IceCream IceCream ) ) infer CSE, IIT Kharagpur Kharagpur CSE, IIT 8

  9. Reasoning in first- -order logic order logic Reasoning in first � The law says that it is a crime for a Gaul The law says that it is a crime for a Gaul � to sell potion formulas to hostile nations. to sell potion formulas to hostile nations. � The country Rome, an enemy of Gaul, The country Rome, an enemy of Gaul, � has acquired some potion formulas, and has acquired some potion formulas, and all of its formulas were sold to it by Druid all of its formulas were sold to it by Druid Traitorix. . Traitorix � Traitorix Traitorix is a Gaul. is a Gaul. � � Is Is Traitorix Traitorix a criminal? a criminal? � CSE, IIT Kharagpur Kharagpur CSE, IIT 9

  10. Generalized Modus Ponens Ponens Generalized Modus � For atomic sentences p For atomic sentences p i , p i ’, and q, where i , p i ’, and q, where � θ such that there is a substitution θ such that there is a substitution θ , p θ , p for all i: SUBST( θ ) = SUBST( θ ), for all i: , p i ’) = SUBST( , p i SUBST( i ’ i ), ′ ′ ′ ∧ ∧ ∧ ⇒ p , p ,..., p , ( p p ... p q ) 1 2 n 1 2 n θ SUBST ( , q ) CSE, IIT Kharagpur Kharagpur CSE, IIT 10

  11. Unification Unification θ ,p) = SUBST( θ ,q) where SUBST( θ ,p) = SUBST( θ θ where SUBST( ,q) UNIFY(p,q) = θ UNIFY(p,q) = Examples: Examples: UNIFY( Knows(Erdos Erdos, x),Knows( , x),Knows(Erdos Erdos, , Godel Godel)) )) UNIFY( Knows( = {x / Godel Godel} } = {x / UNIFY( Knows(Erdos Erdos, x), Knows(y, , x), Knows(y,Godel Godel)) )) UNIFY( Knows( = {x/Godel Godel, y/ , y/Erdos Erdos} } = {x/ CSE, IIT Kharagpur Kharagpur CSE, IIT 11

  12. Unification Unification θ ,p) = SUBST( θ ,q) where SUBST( θ ,p) = SUBST( θ θ where SUBST( ,q) UNIFY(p,q) = θ UNIFY(p,q) = Examples: Examples: UNIFY( Knows(Erdos Erdos, x), Knows(y, Father(y))) , x), Knows(y, Father(y))) UNIFY( Knows( = { y/Erdos Erdos, x/Father( , x/Father(Erdos Erdos) } ) } = { y/ UNIFY( Knows(Erdos Erdos, x), Knows(x, , x), Knows(x, Godel Godel)) = F )) = F UNIFY( Knows( We require the most general unifier We require the most general unifier CSE, IIT Kharagpur Kharagpur CSE, IIT 12

  13. Reasoning with Horn Logic Reasoning with Horn Logic � We can convert Horn sentences to a We can convert Horn sentences to a � canonical form and then use generalized canonical form and then use generalized Modus Ponens Ponens with unification. with unification. Modus � We We skolemize skolemize existential formulas and existential formulas and � remove the universal ones remove the universal ones � This gives us a conjunction of clauses, that This gives us a conjunction of clauses, that � are inserted in the KB are inserted in the KB � Modus Modus Ponens Ponens help us in inferring new help us in inferring new � clauses clauses � Forward and backward chaining Forward and backward chaining � CSE, IIT Kharagpur Kharagpur CSE, IIT 13

  14. Completeness issues Completeness issues � Reasoning with Modus Reasoning with Modus Ponens Ponens is incomplete is incomplete � � Consider the example Consider the example – – � ∀ x P(x) ⇒ Q(x) ∀ x ¬ P(x) ⇒ R(x) ∀ x P(x) ⇒ ∀ x ¬ P(x) ⇒ Q(x) R(x) ∀ x Q(x) ⇒ S(x) ∀ x R(x) ⇒ S(x) ∀ x Q(x) ⇒ ∀ x R(x) ⇒ S(x) S(x) � We should be able to conclude S(A) We should be able to conclude S(A) � ∀ x ¬ P(x) ⇒ R(x) cannot The problem is that ∀ x ¬ P(x) ⇒ � The problem is that R(x) cannot � be converted to Horn form, and thus cannot be converted to Horn form, and thus cannot be used by Modus Ponens Ponens be used by Modus CSE, IIT Kharagpur Kharagpur CSE, IIT 14

  15. Godel’s Completeness Theorem Completeness Theorem Godel’s � For first For first- -order logic, any sentence that is order logic, any sentence that is � entailed by another set of sentences can be entailed by another set of sentences can be proved from that set proved from that set � Godel Godel did not suggest a proof procedure did not suggest a proof procedure � � In 1965 Robinson published his resolution In 1965 Robinson published his resolution � algorithm algorithm � Entailment in first Entailment in first- -order logic is semi order logic is semi- -decidable, decidable, � that is, we can show that sentences follow from that is, we can show that sentences follow from premises if they do, but we cannot always show if premises if they do, but we cannot always show if they do not. they do not. CSE, IIT Kharagpur Kharagpur CSE, IIT 15

  16. The validity problem of first- -order logic order logic The validity problem of first � [Church] [Church] The validity problem of the first The validity problem of the first- - � order predicate calculus is partially solvable. order predicate calculus is partially solvable. � Consider the following formula: Consider the following formula: � n ∧ [ p ( f ( a ), g ( a )) i i = i 1 n ∧ ∀ ∀ ⇒ ∧ x y [ p ( x , y ) p ( f ( x ), g ( x ))]] i i = i 1 ⇒ ∃ z p ( z , z ) CSE, IIT Kharagpur Kharagpur CSE, IIT 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend