KEMBAR78
L03 ai - knowledge representation using logic | PPT
Knowledge representationKnowledge representation
using Predicate logicusing Predicate logic
Dr.V.Manjula ,
Prof/CSE,
VEL TECH HIGH TECH Dr. RANGARAJAN Dr. SAKUNTHALA
ENGINEERING COLLEGE.
LogicLogic
2
Formal Language and their ontological and epistemological commitments
3
Review of PropositionalReview of Propositional
LogicLogic
Let P: Today is Sunday
Q: We have guests
P ∧ Q : Today is Sunday and We have guests
P ∨ Q : Today is Sunday or We have guests
¬P : Today is not Sunday.
P → Q : if today is Sunday then we have guests.
P ↔ Q : Today is Sunday if and only if we have guests.
Propositional variables
Propositional constants: T, F
Logical connectives
4
SemanticsSemantics
Propositions and expressions have
truth values: can be true or false.
The truth value of an expression is
determined by truth tables, e.g.:
P Q P v Q
T T T
T F T
F T T
F F F
5
Propositional Proof TheoryPropositional Proof Theory
Propositional proof theory: A set of axioms
(logical identities) and inference rules used to
manipulate expressions and to obtain true
expressions out of other true expressions.
Inference rules: give a mechanical procedure to
obtain true expressions out of other true
expressions.
Modus ponens: P, P → Q |= Q
6
Knowledge representationKnowledge representation
using predicate logicusing predicate logic
Some books are interesting.
∃ x (book(x) Λ interesting(x))
Anybody that has a friend is not lonely
(If someone has a friend, they are not lonely)
∀x (∃ y friend(x,y)  ~lonely(x))
7
Predicate LogicPredicate Logic
Represents properties and relations by
using predicates with arguments.
likes(mary,apples) ∧ ¬likes(mary,grapes)
Quantifiers: indicate the scope of the predicate
Universal quantifier:
∀ X likes ( mary , X) Mary likes everything
Existential quantifier
∃ X likes ( mary , X)
there is something which Mary likes.
8
Proof Theory for Predicate LogicProof Theory for Predicate Logic
Based on the resolution procedure.
Unification: matching predicates with variables
to atomic sentences (matching variables to
constants.)
Example: Is Socrates mortal?
∀ X (human(X)  mortal(X))
human(socrates)
human(plato)
alien(spock)
Inferencing in Predicate LogicInferencing in Predicate Logic
 Forward chainingForward chaining
 Given P,Given P, , to infer Q, to infer Q
 P, matchP, match L.H.SL.H.S ofof
 Assert Q fromAssert Q from R.H.SR.H.S
 Backward chainingBackward chaining
 Q, MatchQ, Match R.H.SR.H.S ofof
 assert Passert P
 Check if P existsCheck if P exists
 Resolution – RefutationResolution – Refutation
 Negate goalNegate goal
 Convert all pieces of knowledge into clausal form (disjunction ofConvert all pieces of knowledge into clausal form (disjunction of
literals)literals)
 See if contradiction indicated by null clause can be derivedSee if contradiction indicated by null clause can be derived
QP →
QP →
10
ResolutionResolution
A ∨ B, ¬B ∨ C |= A ∨ C
compare with: B, ¬B ∨ C |= C
(B →C = ¬B ∨ C)
If B is true, then C must be true, if B is false
than A must be true.
This means that WHENEVER the conjunction
(A ∨ B) ∧ (¬B ∨ C) is true, A ∨ C is also true.
11
How resolution worksHow resolution works
¬P1 v P2 ¬P2
¬P1 P1 v P3 v P4
P3 v P4 This is the conclusion
Eliminate opposite literals and rewrite two
expressions as one
12
Proof by refutationProof by refutation
P4 v ¬P6 P6
P4 ¬P4
Add the negation of the
statement to be proved
contradiction
Resolution in First-Order LogicResolution in First-Order Logic
13
Basic steps for proving a conclusion S given premises
Premise1, …, Premisen
(all expressed in FOL):
1. Convert all sentences to CNF
2. Negate conclusion S & convert result to CNF
3. Add negated conclusion S to the premise clauses
4. Repeat until contradiction or no progress is made:
a. Select 2 clauses (call them parent clauses)
b. Resolve them together, performing all required
unifications
c. If resolvent is the empty clause, a contradiction
has been found (i.e., S follows from the premises)
d. If not, add resolvent to the premises
If we succeed in Step 4, we have proved the conclusion
March 14, 2006
AI: Chapter 9: Inference in
First-Order Logic14
UnificationUnification
 UnificationUnification: The process of finding all legal: The process of finding all legal
substitutions that make logical expressions looksubstitutions that make logical expressions look
identicalidentical
 This is a recursive algorithmThis is a recursive algorithm
March 14, 2006
AI: Chapter 9: Inference in
First-Order Logic15
UnificationUnification
 We can get the inference immediately if we canWe can get the inference immediately if we can
find a substitutionfind a substitution θθ such that King(x) andsuch that King(x) and
Greedy(x) match King(John) and Greedy(y)Greedy(x) match King(John) and Greedy(y)
 θθ = {x/John, y/John} works= {x/John, y/John} works
 Unify(Unify(αα,,ββ) =) = θθ ifif αα θθ == ββ θθ
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Resolution ExamplesResolution Examples
30
31
Resolution ExamplesResolution Examples
32
33
Predicate CalculusPredicate Calculus
 Introduction through an exampleIntroduction through an example (Zohar Manna, 1974):(Zohar Manna, 1974):
 Problem: A, B and C belong to the Himalayan club. EveryProblem: A, B and C belong to the Himalayan club. Every
member in the club is either a mountain climber or a skier ormember in the club is either a mountain climber or a skier or
both. A likes whatever B dislikes and dislikes whatever Bboth. A likes whatever B dislikes and dislikes whatever B
likes. A likes rain and snow. No mountain climber likes rain.likes. A likes rain and snow. No mountain climber likes rain.
Every skier likes snow.Every skier likes snow. Is there a member who is a mountain climberIs there a member who is a mountain climber
and not a skier?and not a skier?
 Given knowledge has:Given knowledge has:
 FactsFacts
 RulesRules
Predicate Calculus: ExamplePredicate Calculus: Example
contd.contd.
 LetLet mcmc denote mountain climber anddenote mountain climber and sksk denotes skier. Knowledgedenotes skier. Knowledge
representation in the given problem is as follows:representation in the given problem is as follows:
1.1. member(A)member(A)
2.2. member(B)member(B)
3.3. member(C)member(C)
4.4. ∀∀x[member(x) → (mc(x) sk(x))]∨x[member(x) → (mc(x) sk(x))]∨
5.5. ∀∀x[mc(x) → ~like(x,rain)]x[mc(x) → ~like(x,rain)]
6.6. ∀∀x[sk(x) → like(x, snow)]x[sk(x) → like(x, snow)]
7.7. ∀∀x[like(B, x) → ~like(A, x)]x[like(B, x) → ~like(A, x)]
8.8. ∀∀x[~like(B, x) → like(A, x)]x[~like(B, x) → like(A, x)]
9.9. like(A, rain)like(A, rain)
10.10. like(A, snow)like(A, snow)
11.11. Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧
 We have to infer the 11We have to infer the 11thth
expression from the given 10.expression from the given 10.
 Done through Resolution Refutation.Done through Resolution Refutation.
1.1. PP
2.2. converted toconverted to
3.3.
Draw the resolution tree (actually an invertedDraw the resolution tree (actually an inverted
tree). Every node is a clausal form andtree). Every node is a clausal form and
branches are intermediate inference steps.branches are intermediate inference steps.
QP → QP ∨~
Q~
Q~
QP ∨~
P~ P
TerminologyTerminology
 Pair of clauses beingPair of clauses being resolvedresolved is called theis called the
ResolventsResolvents. The resulting clause is called the. The resulting clause is called the
ResoluteResolute..
 Choosing the correct pair of resolvents is aChoosing the correct pair of resolvents is a
matter of search.matter of search.
Club example revisitedClub example revisited
1. member(A)
2. member(B)
3. member(C)
4.
– Can be written as
–
5.
–
6.
–
7.
–
))]()(()([ xskxmcxmemberx ∨→∀
))]()(()([ xskxmcxmember ∨→
)()()(~ xskxmcxmember ∨∨
)],()([ snowxlkxskx →∀
),()(~ snowxlkxsk ∨
)],(~)([ rainxlkxmcx →∀
),(~)(~ rainxlkxmc ∨
)],(~),([ xBlkxAlkx →∀
),(~),(~ xBlkxAlk ∨
8.8.
–
9.9.
10.10.
11.11.
– Negate–Negate–
)],(),([~ xBlkxAlkx →∀
),(),( xBlkxAlk ∨
),( rainAlk
),( snowAlk
)](~)()([ xskxmcxmemberx ∧∧∃
)]()(~)([~ xskxmcxmemberx ∨∨∀
 Now standardize the variables apart whichNow standardize the variables apart which
results in the followingresults in the following
1. member(A)
2. member(B)
3. member(C)
4.
5.
6.
7.
8.
9.
10.
11.
)()()(~ 111 xskxmcxmember ∨∨
),()(~ 22 snowxlkxsk ∨
),(~)(~ 33 rainxlkxmc ∨
),(~),(~ 44 xBlkxAlk ∨
),(),( 55 xBlkxAlk ∨
),( rainAlk
),( snowAlk
)]()(~)([~ 666 xskxmcxmemberx ∨∨∀
),(~),(~ 44 xBlkxAlk ∨ ),( snowAlk
),(~ snowBlk ),()(~ 22 snowxlkxsk ∨
)()()(~ 111 xskxmcxmember ∨∨)(~ Bsk
)()(~ BmcBmember ∨ )(Bmember
)(Bmc)]()(~)([~ 666 xskxmcxmemberx ∨∨∀
)()(~ BskBmember ∨ )(~ Bsk
)(~ Bmember )(Bmember
7
10
12 5
13 4
14 2
11
15
16 13
17 2
42
Prolog exampleProlog example
Predicate logic representation is used only on paper.
Computational implementation: logic
programming languages
In Logic and in Prolog:
∀ X ∀ Y (father(X,Y) v mother(X,Y)  parent(X,Y))
∀ X ∀ Y( (∃ Z(parent(Z,X) ∧ parent(Z,Y)) 
siblings(X,Y))
parent(X,Y):- father(X,Y).
parent(X,Y):- mother(X,Y).
siblings(X,Y):- parent(Z,X),parent(Z,Y).
Example -2Example -2
43
Converting Statements into Predicate Logic Formulae (WFFs):
1.All employees earning Rs 500000 or more per year pay taxes.
2.Some employees are sick today.
3.No employees earns more than the president.
Let
• E(x) : for x is an employee
• P(x) : for x is a President
• i(x) : for the income of x (lower case – denotes function not
predicate)
• GE(u,v) for u is greater than or equal to v
• S(x) for x is sick today
• T(x) for x pays taxes
Then : Formulae in FOPL are :
1 : x ((E(x)∀ ∧ GE(i(x), 500000)) ⇒T(x))
2 : x(E(y)∃ ⇒ S(x))
3 : x y((E(x)∀ ∀ ∧ P(y)) ⇒ ~GE(i(x), i(y)))
Example -3Example -3
44
i. John likes all kinds of food.
ii. Apples are food.
iii.Chicken is food.
iv.Anything anyone eats and isn’t killed by is
food.
v. Bill eats peanuts, and is still alive.
vi.Sue eats everything that Bill eats.
Prove that “John likes peanuts”
45
John likes all kinds of
food
∀x food (x) ⇒ eats(John, x)
Apples are food. food(apples)
Chicken is food. food(chicken)
Anything anyone eats and
isn’t killed by is food.
∀x,y eats(x,y) ∧ ¬killed(x)
⇒ food(y)
Bill eats peanuts, and is
still alive.
eats(Bill,Peanuts) ∧
¬killed(Bill)
Sue eats everything that
Bill eats.
∀x eats (Bill,x) ⇒
eats(Sue,x)
Another way of writingAnother way of writing
46
(a) Well Formed Formulas
1.  x Food(x) → Likes(John, x)∀
2. Food(Apples)
3. Food(Chicken)
4.  x y Eats(y, x)   ¬KilledBy(y, x) → Food(x)∀ ∃ ∧
5. Eats(Bill, Peanuts)   ¬KilledBy(Bill, Peanuts)∧
6.  x Eats(Bill, x) → Eats(Sue, x)∀
(b) Convert the formulas of part (a) into clause form.
1. ¬Food(x)   Likes(John, x)∨
2. Food(Apples)
3. Food(Chicken)
4. ¬Eats(y, x)   KilledBy(y, x)   Food(x)∨ ∨
5. Eats(Bill, Peanuts)
6. ¬KilledBy(Bill, Peanuts)
7. ¬Eats(Bill, x)   Eats(Sue, x)∨
ResolutionResolution
47
(d) Use resolution to prove that John likes
peanuts.
8. ¬Likes(John, Peanuts) negated conclusion
9. ¬Food(Peanuts) 1 and 8
10. ¬Eats(y, Peanuts)   KilledBy(y, Peanuts) 4 and 9∨
11. KilledBy(Bill, Peanuts) 5 and 10
12.   6 and 11⊥
(e) Use resolution to answer the question, “What
food does Sue eat?”
13. ¬Eats(Sue, x) negated query
14. ¬Eats(Bill, x) 7 and 13
15.   5 and 14, unifying Peanuts/x⊥

L03 ai - knowledge representation using logic

  • 1.
    Knowledge representationKnowledge representation usingPredicate logicusing Predicate logic Dr.V.Manjula , Prof/CSE, VEL TECH HIGH TECH Dr. RANGARAJAN Dr. SAKUNTHALA ENGINEERING COLLEGE.
  • 2.
    LogicLogic 2 Formal Language andtheir ontological and epistemological commitments
  • 3.
    3 Review of PropositionalReviewof Propositional LogicLogic Let P: Today is Sunday Q: We have guests P ∧ Q : Today is Sunday and We have guests P ∨ Q : Today is Sunday or We have guests ¬P : Today is not Sunday. P → Q : if today is Sunday then we have guests. P ↔ Q : Today is Sunday if and only if we have guests. Propositional variables Propositional constants: T, F Logical connectives
  • 4.
    4 SemanticsSemantics Propositions and expressionshave truth values: can be true or false. The truth value of an expression is determined by truth tables, e.g.: P Q P v Q T T T T F T F T T F F F
  • 5.
    5 Propositional Proof TheoryPropositionalProof Theory Propositional proof theory: A set of axioms (logical identities) and inference rules used to manipulate expressions and to obtain true expressions out of other true expressions. Inference rules: give a mechanical procedure to obtain true expressions out of other true expressions. Modus ponens: P, P → Q |= Q
  • 6.
    6 Knowledge representationKnowledge representation usingpredicate logicusing predicate logic Some books are interesting. ∃ x (book(x) Λ interesting(x)) Anybody that has a friend is not lonely (If someone has a friend, they are not lonely) ∀x (∃ y friend(x,y)  ~lonely(x))
  • 7.
    7 Predicate LogicPredicate Logic Representsproperties and relations by using predicates with arguments. likes(mary,apples) ∧ ¬likes(mary,grapes) Quantifiers: indicate the scope of the predicate Universal quantifier: ∀ X likes ( mary , X) Mary likes everything Existential quantifier ∃ X likes ( mary , X) there is something which Mary likes.
  • 8.
    8 Proof Theory forPredicate LogicProof Theory for Predicate Logic Based on the resolution procedure. Unification: matching predicates with variables to atomic sentences (matching variables to constants.) Example: Is Socrates mortal? ∀ X (human(X)  mortal(X)) human(socrates) human(plato) alien(spock)
  • 9.
    Inferencing in PredicateLogicInferencing in Predicate Logic  Forward chainingForward chaining  Given P,Given P, , to infer Q, to infer Q  P, matchP, match L.H.SL.H.S ofof  Assert Q fromAssert Q from R.H.SR.H.S  Backward chainingBackward chaining  Q, MatchQ, Match R.H.SR.H.S ofof  assert Passert P  Check if P existsCheck if P exists  Resolution – RefutationResolution – Refutation  Negate goalNegate goal  Convert all pieces of knowledge into clausal form (disjunction ofConvert all pieces of knowledge into clausal form (disjunction of literals)literals)  See if contradiction indicated by null clause can be derivedSee if contradiction indicated by null clause can be derived QP → QP →
  • 10.
    10 ResolutionResolution A ∨ B,¬B ∨ C |= A ∨ C compare with: B, ¬B ∨ C |= C (B →C = ¬B ∨ C) If B is true, then C must be true, if B is false than A must be true. This means that WHENEVER the conjunction (A ∨ B) ∧ (¬B ∨ C) is true, A ∨ C is also true.
  • 11.
    11 How resolution worksHowresolution works ¬P1 v P2 ¬P2 ¬P1 P1 v P3 v P4 P3 v P4 This is the conclusion Eliminate opposite literals and rewrite two expressions as one
  • 12.
    12 Proof by refutationProofby refutation P4 v ¬P6 P6 P4 ¬P4 Add the negation of the statement to be proved contradiction
  • 13.
    Resolution in First-OrderLogicResolution in First-Order Logic 13 Basic steps for proving a conclusion S given premises Premise1, …, Premisen (all expressed in FOL): 1. Convert all sentences to CNF 2. Negate conclusion S & convert result to CNF 3. Add negated conclusion S to the premise clauses 4. Repeat until contradiction or no progress is made: a. Select 2 clauses (call them parent clauses) b. Resolve them together, performing all required unifications c. If resolvent is the empty clause, a contradiction has been found (i.e., S follows from the premises) d. If not, add resolvent to the premises If we succeed in Step 4, we have proved the conclusion
  • 14.
    March 14, 2006 AI:Chapter 9: Inference in First-Order Logic14 UnificationUnification  UnificationUnification: The process of finding all legal: The process of finding all legal substitutions that make logical expressions looksubstitutions that make logical expressions look identicalidentical  This is a recursive algorithmThis is a recursive algorithm
  • 15.
    March 14, 2006 AI:Chapter 9: Inference in First-Order Logic15 UnificationUnification  We can get the inference immediately if we canWe can get the inference immediately if we can find a substitutionfind a substitution θθ such that King(x) andsuch that King(x) and Greedy(x) match King(John) and Greedy(y)Greedy(x) match King(John) and Greedy(y)  θθ = {x/John, y/John} works= {x/John, y/John} works  Unify(Unify(αα,,ββ) =) = θθ ifif αα θθ == ββ θθ
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
    Predicate CalculusPredicate Calculus Introduction through an exampleIntroduction through an example (Zohar Manna, 1974):(Zohar Manna, 1974):  Problem: A, B and C belong to the Himalayan club. EveryProblem: A, B and C belong to the Himalayan club. Every member in the club is either a mountain climber or a skier ormember in the club is either a mountain climber or a skier or both. A likes whatever B dislikes and dislikes whatever Bboth. A likes whatever B dislikes and dislikes whatever B likes. A likes rain and snow. No mountain climber likes rain.likes. A likes rain and snow. No mountain climber likes rain. Every skier likes snow.Every skier likes snow. Is there a member who is a mountain climberIs there a member who is a mountain climber and not a skier?and not a skier?  Given knowledge has:Given knowledge has:  FactsFacts  RulesRules
  • 35.
    Predicate Calculus: ExamplePredicateCalculus: Example contd.contd.  LetLet mcmc denote mountain climber anddenote mountain climber and sksk denotes skier. Knowledgedenotes skier. Knowledge representation in the given problem is as follows:representation in the given problem is as follows: 1.1. member(A)member(A) 2.2. member(B)member(B) 3.3. member(C)member(C) 4.4. ∀∀x[member(x) → (mc(x) sk(x))]∨x[member(x) → (mc(x) sk(x))]∨ 5.5. ∀∀x[mc(x) → ~like(x,rain)]x[mc(x) → ~like(x,rain)] 6.6. ∀∀x[sk(x) → like(x, snow)]x[sk(x) → like(x, snow)] 7.7. ∀∀x[like(B, x) → ~like(A, x)]x[like(B, x) → ~like(A, x)] 8.8. ∀∀x[~like(B, x) → like(A, x)]x[~like(B, x) → like(A, x)] 9.9. like(A, rain)like(A, rain) 10.10. like(A, snow)like(A, snow) 11.11. Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧Question: x[member(x) mc(x) ~sk(x)]∃ ∧ ∧  We have to infer the 11We have to infer the 11thth expression from the given 10.expression from the given 10.  Done through Resolution Refutation.Done through Resolution Refutation.
  • 36.
    1.1. PP 2.2. convertedtoconverted to 3.3. Draw the resolution tree (actually an invertedDraw the resolution tree (actually an inverted tree). Every node is a clausal form andtree). Every node is a clausal form and branches are intermediate inference steps.branches are intermediate inference steps. QP → QP ∨~ Q~ Q~ QP ∨~ P~ P
  • 37.
    TerminologyTerminology  Pair ofclauses beingPair of clauses being resolvedresolved is called theis called the ResolventsResolvents. The resulting clause is called the. The resulting clause is called the ResoluteResolute..  Choosing the correct pair of resolvents is aChoosing the correct pair of resolvents is a matter of search.matter of search.
  • 38.
    Club example revisitedClubexample revisited 1. member(A) 2. member(B) 3. member(C) 4. – Can be written as – 5. – 6. – 7. – ))]()(()([ xskxmcxmemberx ∨→∀ ))]()(()([ xskxmcxmember ∨→ )()()(~ xskxmcxmember ∨∨ )],()([ snowxlkxskx →∀ ),()(~ snowxlkxsk ∨ )],(~)([ rainxlkxmcx →∀ ),(~)(~ rainxlkxmc ∨ )],(~),([ xBlkxAlkx →∀ ),(~),(~ xBlkxAlk ∨
  • 39.
    8.8. – 9.9. 10.10. 11.11. – Negate–Negate– )],(),([~ xBlkxAlkx→∀ ),(),( xBlkxAlk ∨ ),( rainAlk ),( snowAlk )](~)()([ xskxmcxmemberx ∧∧∃ )]()(~)([~ xskxmcxmemberx ∨∨∀
  • 40.
     Now standardizethe variables apart whichNow standardize the variables apart which results in the followingresults in the following 1. member(A) 2. member(B) 3. member(C) 4. 5. 6. 7. 8. 9. 10. 11. )()()(~ 111 xskxmcxmember ∨∨ ),()(~ 22 snowxlkxsk ∨ ),(~)(~ 33 rainxlkxmc ∨ ),(~),(~ 44 xBlkxAlk ∨ ),(),( 55 xBlkxAlk ∨ ),( rainAlk ),( snowAlk )]()(~)([~ 666 xskxmcxmemberx ∨∨∀
  • 41.
    ),(~),(~ 44 xBlkxAlk∨ ),( snowAlk ),(~ snowBlk ),()(~ 22 snowxlkxsk ∨ )()()(~ 111 xskxmcxmember ∨∨)(~ Bsk )()(~ BmcBmember ∨ )(Bmember )(Bmc)]()(~)([~ 666 xskxmcxmemberx ∨∨∀ )()(~ BskBmember ∨ )(~ Bsk )(~ Bmember )(Bmember 7 10 12 5 13 4 14 2 11 15 16 13 17 2
  • 42.
    42 Prolog exampleProlog example Predicatelogic representation is used only on paper. Computational implementation: logic programming languages In Logic and in Prolog: ∀ X ∀ Y (father(X,Y) v mother(X,Y)  parent(X,Y)) ∀ X ∀ Y( (∃ Z(parent(Z,X) ∧ parent(Z,Y))  siblings(X,Y)) parent(X,Y):- father(X,Y). parent(X,Y):- mother(X,Y). siblings(X,Y):- parent(Z,X),parent(Z,Y).
  • 43.
    Example -2Example -2 43 ConvertingStatements into Predicate Logic Formulae (WFFs): 1.All employees earning Rs 500000 or more per year pay taxes. 2.Some employees are sick today. 3.No employees earns more than the president. Let • E(x) : for x is an employee • P(x) : for x is a President • i(x) : for the income of x (lower case – denotes function not predicate) • GE(u,v) for u is greater than or equal to v • S(x) for x is sick today • T(x) for x pays taxes Then : Formulae in FOPL are : 1 : x ((E(x)∀ ∧ GE(i(x), 500000)) ⇒T(x)) 2 : x(E(y)∃ ⇒ S(x)) 3 : x y((E(x)∀ ∀ ∧ P(y)) ⇒ ~GE(i(x), i(y)))
  • 44.
    Example -3Example -3 44 i.John likes all kinds of food. ii. Apples are food. iii.Chicken is food. iv.Anything anyone eats and isn’t killed by is food. v. Bill eats peanuts, and is still alive. vi.Sue eats everything that Bill eats. Prove that “John likes peanuts”
  • 45.
    45 John likes allkinds of food ∀x food (x) ⇒ eats(John, x) Apples are food. food(apples) Chicken is food. food(chicken) Anything anyone eats and isn’t killed by is food. ∀x,y eats(x,y) ∧ ¬killed(x) ⇒ food(y) Bill eats peanuts, and is still alive. eats(Bill,Peanuts) ∧ ¬killed(Bill) Sue eats everything that Bill eats. ∀x eats (Bill,x) ⇒ eats(Sue,x)
  • 46.
    Another way ofwritingAnother way of writing 46 (a) Well Formed Formulas 1.  x Food(x) → Likes(John, x)∀ 2. Food(Apples) 3. Food(Chicken) 4.  x y Eats(y, x)   ¬KilledBy(y, x) → Food(x)∀ ∃ ∧ 5. Eats(Bill, Peanuts)   ¬KilledBy(Bill, Peanuts)∧ 6.  x Eats(Bill, x) → Eats(Sue, x)∀ (b) Convert the formulas of part (a) into clause form. 1. ¬Food(x)   Likes(John, x)∨ 2. Food(Apples) 3. Food(Chicken) 4. ¬Eats(y, x)   KilledBy(y, x)   Food(x)∨ ∨ 5. Eats(Bill, Peanuts) 6. ¬KilledBy(Bill, Peanuts) 7. ¬Eats(Bill, x)   Eats(Sue, x)∨
  • 47.
    ResolutionResolution 47 (d) Use resolutionto prove that John likes peanuts. 8. ¬Likes(John, Peanuts) negated conclusion 9. ¬Food(Peanuts) 1 and 8 10. ¬Eats(y, Peanuts)   KilledBy(y, Peanuts) 4 and 9∨ 11. KilledBy(Bill, Peanuts) 5 and 10 12.   6 and 11⊥ (e) Use resolution to answer the question, “What food does Sue eat?” 13. ¬Eats(Sue, x) negated query 14. ¬Eats(Bill, x) 7 and 13 15.   5 and 14, unifying Peanuts/x⊥