cs621: artificial intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · microsoft powerpoint...
TRANSCRIPT
![Page 1: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/1.jpg)
CS621: Artificial Intelligence
Pushpak BhattacharyyaCSE Dept., CSE Dept., IIT Bombay
Lecture 21– Predicate Calculus and Knowledge Representation
7th September, 2010
![Page 2: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/2.jpg)
Logic and inferencing
Vision NLP
Expert Systems
Robotics
• Search• Reasoning• Learning• Knowledge
Planning
• Knowledge
Obtaining implication of given facts and rules -- Hallmark of intelligence
![Page 3: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/3.jpg)
Inferencing through
− Deduction (General to specific)− Induction (Specific to General)− Abduction (Conclusion to hypothesis in absence of any other evidence
to contrary)
Deduction
Given: All men are mortal (rule)Shakespeare is a man (fact)Shakespeare is a man (fact)
To prove: Shakespeare is mortal (inference)
Induction
Given: Shakespeare is mortal Newton is mortal (Observation)Dijkstra is mortal
To prove: All men are mortal (Generalization)
![Page 4: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/4.jpg)
If there is rain, then there will be no picnic
Fact1: There was rainConclude: There was no picnic
Deduction
Fact2: There was no picnicConclude: There was no rain (?)
Induction and abduction are fallible forms of reasoning. Their conclusions are Induction and abduction are fallible forms of reasoning. Their conclusions are susceptible to retraction
Two systems of logic
1) Propositional calculus2) Predicate calculus
![Page 5: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/5.jpg)
Propositions
− Stand for facts/assertions− Declarative statements
− As opposed to interrogative statements (questions) or imperative statements (request, order)
Operators
)((~),),(),( ⇒∨∧ NIMPLICATIONOTORAND
=> and ¬ form a minimal set (can express other operations)- Prove it.
Tautologies are formulae whose truth value is always T, whatever the assignment is
)((~),),(),( ⇒∨∧ NIMPLICATIONOTORAND
![Page 6: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/6.jpg)
Model
In propositional calculus any formula with n propositions has 2n models (assignments)- Tautologies evaluate to T in all models.
Examples: 1) PP ¬∨
2)
-e Morgan with AND
)()( QPQP ¬∨¬⇔∧¬
![Page 7: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/7.jpg)
Inferencing in PC
Resolution Forward chaining
Backward chaining
![Page 8: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/8.jpg)
Knowledge
Declarative Procedural
• Declarative knowledge deals with factoid questions • Declarative knowledge deals with factoid questions (what is the capital of India? Who won the Wimbledon in 2005? etc.)
• Procedural knowledge deals with “How”
• Procedural knowledge can be embedded in declarative knowledge
![Page 9: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/9.jpg)
Example: Employee knowledge base
Employee record
Emp id : 1124
Age : 27
Salary : 10L / annumSalary : 10L / annum
Tax : Procedure to calculate tax from basic salary, Loans, medical factors, and # of children
![Page 10: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/10.jpg)
Predicate Calculus
![Page 11: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/11.jpg)
Predicate Calculus: well known examples
� Man is mortal : rule
∀x[man(x) → mortal(x)]
� shakespeare is a manman(shakespeare)man(shakespeare)
� To infer shakespeare is mortalmortal(shakespeare)
![Page 12: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/12.jpg)
Forward Chaining/ Inferencing
� man(x) → mortal(x)� Dropping the quantifier, implicitly Universal
quantification assumedquantification assumed
� man(shakespeare)
� Goal mortal(shakespeare)� Found in one step
� x = shakespeare, unification
![Page 13: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/13.jpg)
Backward Chaining/ Inferencing
� man(x) → mortal(x)
� Goal mortal(shakespeare)� Goal mortal(shakespeare)� x = shakespeare
� Travel back over and hit the fact asserted
� man(shakespeare)
![Page 14: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/14.jpg)
Wh-Questions and Knowledgewhat
where
who
when
Factoid / Declarative
how
why
which
when
procedural
Reasoning
![Page 15: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/15.jpg)
Fixing Predicates
� Natural Sentences
<Subject> <verb> <object>
Verb(subject,object)
predicate(subject)
![Page 16: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/16.jpg)
Examples
� Ram is a boy
� Boy(Ram)?
� Is_a(Ram,boy)?� Is_a(Ram,boy)?
� Ram Playes Football
� Plays(Ram,football)?
� Plays_football(Ram)?
![Page 17: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/17.jpg)
Knowledge Representation of Complex Sentence
� “In every city there is a thief who is beaten by every policeman in the city”
y)))}](z,beaten_by x)n(z,z(polecemax))(y,lives_in )y((thief(y{x[city(x) →∀∧∧∃→∀
![Page 18: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/18.jpg)
Himalayan Club example
![Page 19: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/19.jpg)
Himalayan Club example
� Introduction through an example (Zohar Manna, 1974):� Problem: A, B and C belong to the Himalayan club.
Every member in the club is either a mountain climber or a skier or both. A likes whatever B climber or a skier or both. A likes whatever B dislikes and dislikes whatever B likes. A likes rain and snow. No mountain climber likes rain. Every skier likes snow. Is there a member who is a mountain climber and not a skier?
� Given knowledge has: � Facts
� Rules
![Page 20: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/20.jpg)
Example contd.
� Let mc denote mountain climber and sk denotes skier. Knowledge representation in the given problem is as follows:1. member(A)2. member(B)3. member(C)4. ∀x[member(x) → (mc(x) ∨ sk(x))]
∀
∀
4. ∀x[member(x) → (mc(x) ∨ sk(x))]5. ∀x[mc(x) → ~like(x,rain)]6. ∀x[sk(x) → like(x, snow)]7. ∀x[like(B, x) → ~like(A, x)]8. ∀x[~like(B, x) → like(A, x)]9. like(A, rain)10. like(A, snow)11. Question: ∃x[member(x) ∧ mc(x) ∧ ~sk(x)]
� We have to infer the 11th expression from the given 10. � Done through Resolution Refutation.
![Page 21: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/21.jpg)
Club example: Inferencing1. member(A)
2. member(B)
3. member(C)
4.
– Can be written as
–
))]()(()([ xskxmcxmemberx ∨→∀
))]()(()([ xskxmcxmember ∨→ )()()(~ xskxmcxmember ∨∨–
5.
–
6.
–
7.
–
)()()(~ xskxmcxmember ∨∨)],()([ snowxlkxskx →∀
),()(~ snowxlkxsk ∨)],(~)([ rainxlkxmcx →∀
),(~)(~ rainxlkxmc ∨)],(~),([ xBlkxAlikex →∀
),(~),(~ xBlkxAlike ∨
![Page 22: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/22.jpg)
8.
–
9.
10.
11.
– Negate–
)],(),([~ xBlkxAlkx →∀
),(),( xBlkxAlk ∨
),( rainAlk
),( snowAlk
)](~)()([ xskxmcxmemberx ∧∧∃)]()(~)([~ xskxmcxmemberx ∨∨∀– Negate– )]()(~)([~ xskxmcxmemberx ∨∨∀
![Page 23: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/23.jpg)
� Now standardize the variables apart which results in the following
1. member(A)
2. member(B)
3. member(C)
4.
5.
)()()(~ 111 xskxmcxmember ∨∨
),()(~ 22 snowxlkxsk ∨5.
6.
7.
8.
9.
10.
11.
),()(~ 22 snowxlkxsk ∨),(~)(~ 33 rainxlkxmc ∨
),(~),(~ 44 xBlkxAlike ∨),(),( 55 xBlkxAlk ∨
),( rainAlk
),( snowAlk)()(~)(~ 666 xskxmcxmember ∨∨
![Page 24: CS621: Artificial Intelligencecs621-2011/lectures_2010/... · 2010. 9. 11. · Microsoft PowerPoint - cs621-lect21-predicate-calculus-2010-09-07.pptx Author: Pushpak Bhattacharya](https://reader036.vdocument.in/reader036/viewer/2022062611/6126773760803a231925cc2f/html5/thumbnails/24.jpg)
),(~),(~ 44 xBlkxAlike ∨ ),( snowAlk
),(~ snowBlk ),()(~ 22 snowxlkxsk ∨
)()()(~ 111 xskxmcxmember ∨∨)(~ Bsk
)()(~ BmcBmember ∨ )(Bmember
710
12 5
13 4
14 2
)(Bmc)()(~)(~ 666 xskxmcxmember ∨∨
)()(~ BskBmember ∨ )(~ Bsk
)(~ Bmember )(Bmember
1115
16 13
17 2