introduction to artificial intelligence · p: it is a tuesday. q: it is raining. r: harry will go...
TRANSCRIPT
![Page 1: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/1.jpg)
Introduction to Artificial Intelligence
with Python
![Page 2: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/2.jpg)
Knowledge
![Page 3: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/3.jpg)
knowledge-based agents
agents that reason by operating on internal representations of knowledge
![Page 4: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/4.jpg)
If it didn't rain, Harry visited Hagrid today.
Harry visited Hagrid or Dumbledore today, but not both.
Harry visited Dumbledore today.
It rained today.
Harry did not visit Hagrid today.
![Page 5: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/5.jpg)
Logic
![Page 6: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/6.jpg)
sentence
an assertion about the world in a knowledge representation language
![Page 7: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/7.jpg)
Propositional Logic
![Page 8: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/8.jpg)
Proposition Symbols
P Q R
![Page 9: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/9.jpg)
Logical Connectives
¬not
∧and
∨or
→implication
↔biconditional
![Page 10: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/10.jpg)
Not (¬)
P ¬Pfalse true
true false
![Page 11: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/11.jpg)
And (∧)
P Q P ∧ Qfalse false false
false true false
true false false
true true true
![Page 12: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/12.jpg)
Or (∨)
P Q P ∨ Qfalse false false
false true true
true false true
true true true
![Page 13: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/13.jpg)
Implication (→)
P Q P → Qfalse false true
false true true
true false false
true true true
![Page 14: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/14.jpg)
Biconditional (↔)
P Q P ↔ Qfalse false true
false true false
true false false
true true true
![Page 15: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/15.jpg)
model
assignment of a truth value to every propositional symbol (a "possible world")
![Page 16: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/16.jpg)
modelP: It is raining.
Q: It is a Tuesday.
{P = true, Q = false}
![Page 17: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/17.jpg)
knowledge base
a set of sentences known by a knowledge-based agent
![Page 18: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/18.jpg)
Entailment
α ⊨ β
In every model in which sentence α is true, sentence β is also true.
![Page 19: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/19.jpg)
If it didn't rain, Harry visited Hagrid today.
Harry visited Hagrid or Dumbledore today, but not both.
Harry visited Dumbledore today.
It rained today.
Harry did not visit Hagrid today.
![Page 20: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/20.jpg)
inference
the process of deriving new sentences from old ones
![Page 21: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/21.jpg)
P: It is a Tuesday.
Q: It is raining.
R: Harry will go for a run.
KB: (P ∧ ¬Q) → R P ¬Q
Inference: R
![Page 22: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/22.jpg)
Inference Algorithms
![Page 23: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/23.jpg)
Does
?
KB ⊨ α
![Page 24: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/24.jpg)
Model Checking
![Page 25: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/25.jpg)
Model Checking
• To determine if KB ⊨ α:
• Enumerate all possible models.
• If in every model where KB is true, α is true, then KB entails α.
• Otherwise, KB does not entail α.
![Page 26: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/26.jpg)
P: It is a Tuesday. Q: It is raining. R: Harry will go for a run.
KB: (P ∧ ¬Q) → R P ¬QQuery: R
P Q R KBfalse false falsefalse false truefalse true falsefalse true truetrue false falsetrue false truetrue true falsetrue true true
![Page 27: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/27.jpg)
P: It is a Tuesday. Q: It is raining. R: Harry will go for a run.
KB: (P ∧ ¬Q) → R P ¬QQuery: R
P Q R KBfalse false false falsefalse false true falsefalse true false falsefalse true true falsetrue false false falsetrue false true truetrue true false falsetrue true true false
![Page 28: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/28.jpg)
P: It is a Tuesday. Q: It is raining. R: Harry will go for a run.
KB: (P ∧ ¬Q) → R P ¬QQuery: R
P Q R KBfalse false false falsefalse false true falsefalse true false falsefalse true true falsetrue false false falsetrue false true truetrue true false falsetrue true true false
![Page 29: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/29.jpg)
Knowledge Engineering
![Page 30: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/30.jpg)
Clue
![Page 31: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/31.jpg)
Clue
Col. Mustard
People
Prof. Plum
Ms. Scarlet
Ballroom
Rooms
Kitchen
Library
Knife
Weapons
Revolver
Wrench
![Page 32: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/32.jpg)
Clue
Col. Mustard
People
Prof. Plum
Ms. Scarlet
Ballroom
Rooms
Kitchen
Library
Knife
Weapons
Revolver
Wrench
![Page 33: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/33.jpg)
Clue
Col. Mustard
People
Prof. Plum
Ms. Scarlet
Ballroom
Rooms
Kitchen
Library
Knife
Weapons
Revolver
Wrench
![Page 34: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/34.jpg)
Col. Mustard
People
Prof. Plum
Ms. Scarlet
Ballroom
Rooms
Kitchen
Library
Knife
Weapons
Revolver
Wrench
![Page 35: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/35.jpg)
Col. Mustard
People
Prof. Plum
Ms. Scarlet
Ballroom
Rooms
Kitchen
Library
Knife
Weapons
Revolver
Wrench
![Page 36: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/36.jpg)
Clue
Propositional Symbols
mustard plum scarlet
ballroom kitchen library
knife revolver wrench
![Page 37: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/37.jpg)
Clue(mustard ∨ plum ∨ scarlet)
(ballroom ∨ kitchen ∨ library)(knife ∨ revolver ∨ wrench)
¬plum
¬mustard ∨ ¬library ∨ ¬revolver
![Page 38: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/38.jpg)
Logic Puzzles
• Gilderoy, Minerva, Pomona and Horace each belong to a different one of the four houses: Gryffindor, Hufflepuff, Ravenclaw, and Slytherin House.
• Gilderoy belongs to Gryffindor or Ravenclaw.
• Pomona does not belong in Slytherin.
• Minerva belongs to Gryffindor.
![Page 39: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/39.jpg)
Logic Puzzles
Propositional Symbols
GilderoyGryffindor GilderoyHufflepuff GilderoyRavenclaw GilderoySlytherin
MinervaGryffindor MinervaHufflepuff MinervaRavenclaw MinervaSlytherin
PomonaGryffindor PomonaHufflepuff PomonaRavenclaw PomonaSlytherin
HoraceGryffindor HoraceHufflepuff HoraceRavenclaw HoraceSlytherin
![Page 40: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/40.jpg)
Logic Puzzles
(GilderoyGryffindor ∨ GilderoyRavenclaw)
(PomonaSlytherin → ¬PomonaHufflepuff)
(MinervaRavenclaw → ¬GilderoyRavenclaw)
![Page 41: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/41.jpg)
Mastermind
2
0
4
![Page 42: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/42.jpg)
Inference Rules
![Page 43: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/43.jpg)
If it is raining, then Harry is inside.
It is raining.
Harry is inside.
Modus Ponens
![Page 44: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/44.jpg)
α → β
α
β
Modus Ponens
![Page 45: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/45.jpg)
Harry is friends with Ron and Hermione.
Harry is friends with Hermione.
And Elimination
![Page 46: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/46.jpg)
α ∧ β
α
And Elimination
![Page 47: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/47.jpg)
It is not true that Harry did not pass the test.
Harry passed the test.
Double Negation Elimination
![Page 48: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/48.jpg)
¬(¬α)
α
Double Negation Elimination
![Page 49: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/49.jpg)
If it is raining, then Harry is inside.
It is not raining or Harry is inside.
Implication Elimination
![Page 50: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/50.jpg)
α → β
¬α ∨ β
Implication Elimination
![Page 51: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/51.jpg)
It is raining if and only if Harry is inside.
If it is raining, then Harry is inside, and if Harry is inside, then it is raining.
Biconditional Elimination
![Page 52: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/52.jpg)
α ↔ β
(α → β) ∧ (β → α)
Biconditional Elimination
![Page 53: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/53.jpg)
It is not true that both Harry and Ron passed the test.
Harry did not pass the test or Ron did not pass the test.
De Morgan's Law
![Page 54: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/54.jpg)
¬(α ∧ β)
¬α ∨ ¬β
De Morgan's Law
![Page 55: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/55.jpg)
It is not true that Harry or Ron passed the test.
Harry did not pass the test and Ron did not pass the test.
De Morgan's Law
![Page 56: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/56.jpg)
¬(α ∨ β)
¬α ∧ ¬β
De Morgan's Law
![Page 57: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/57.jpg)
(α ∧ (β ∨ γ))
(α ∧ β) ∨ (α ∧ γ)
Distributive Property
![Page 58: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/58.jpg)
(α ∨ (β ∧ γ))
(α ∨ β) ∧ (α ∨ γ)
Distributive Property
![Page 59: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/59.jpg)
Search Problems
• initial state
• actions
• transition model
• goal test
• path cost function
![Page 60: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/60.jpg)
Theorem Proving
• initial state: starting knowledge base
• actions: inference rules
• transition model: new knowledge base after inference
• goal test: check statement we're trying to prove
• path cost function: number of steps in proof
![Page 61: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/61.jpg)
Resolution
![Page 62: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/62.jpg)
(Ron is in the Great Hall) ∨ (Hermione is in the library)
Ron is not in the Great Hall
Hermione is in the library
![Page 63: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/63.jpg)
P ∨ Q
¬P
Q
![Page 64: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/64.jpg)
P ∨ Q1 ∨ Q2 ∨ ...∨ Qn
¬P
Q1 ∨ Q2 ∨ ...∨ Qn
![Page 65: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/65.jpg)
(Ron is in the Great Hall) ∨ (Hermione is in the library)
(Ron is not in the Great Hall) ∨ (Harry is sleeping)
(Hermione is in the library) ∨ (Harry is sleeping)
![Page 66: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/66.jpg)
P ∨ Q
¬P ∨ R
Q ∨ R
![Page 67: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/67.jpg)
P ∨ Q1 ∨ Q2 ∨ ...∨ Qn
¬P ∨ R1 ∨ R2 ∨ ...∨ Rm
Q1 ∨ Q2 ∨ ...∨ Qn ∨ R1 ∨ R2 ∨ ...∨ Rm
![Page 68: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/68.jpg)
clause
a disjunction of literals
e.g. P ∨ Q ∨ R
![Page 69: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/69.jpg)
conjunctive normal form
logical sentence that is a conjunction of clauses
e.g. (A ∨ B ∨ C) ∧ (D ∨ ¬E) ∧ (F ∨ G)
![Page 70: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/70.jpg)
Conversion to CNF
• Eliminate biconditionals
• turn (α ↔ β) into (α → β) ∧ (β → α)
• Eliminate implications
• turn (α → β) into ¬α ∨ β
• Move ¬ inwards using De Morgan's Laws
• e.g. turn ¬(α ∧ β) into ¬α ∨ ¬β
• Use distributive law to distribute ∨ wherever possible
![Page 71: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/71.jpg)
Conversion to CNF
(P ∨ Q) → R
¬(P ∨ Q) ∨ R
(¬P ∧ ¬Q) ∨ R
(¬P ∨ R) ∧ (¬Q ∨ R)
eliminate implication
De Morgan's Law
distributive law
![Page 72: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/72.jpg)
Inference by Resolution
![Page 73: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/73.jpg)
P ∨ Q
¬P ∨ R
(Q ∨ R)
![Page 74: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/74.jpg)
P ∨ Q ∨ S
¬P ∨ R ∨ S
(Q ∨ S ∨ R ∨ S)
![Page 75: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/75.jpg)
P ∨ Q ∨ S
¬P ∨ R ∨ S
(Q ∨ R ∨ S)
![Page 76: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/76.jpg)
P
¬P
( )
![Page 77: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/77.jpg)
Inference by Resolution
• To determine if KB ⊨ α:
• Check if (KB ∧ ¬α) is a contradiction?
• If so, then KB ⊨ α.
• Otherwise, no entailment.
![Page 78: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/78.jpg)
Inference by Resolution
• To determine if KB ⊨ α:
• Convert (KB ∧ ¬α) to Conjunctive Normal Form.
• Keep checking to see if we can use resolution to produce a new clause.
• If ever we produce the empty clause (equivalent to False), we have a contradiction, and KB ⊨ α.
• Otherwise, if we can't add new clauses, no entailment.
![Page 79: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/79.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(A ∨ B) (¬B ∨ C) (¬C) (¬A)
![Page 80: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/80.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(A ∨ B) (¬B ∨ C) (¬C) (¬A)
![Page 81: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/81.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A)
![Page 82: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/82.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A)
![Page 83: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/83.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A)
![Page 84: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/84.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A) (A)
![Page 85: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/85.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A) (A)
![Page 86: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/86.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A) (A)
![Page 87: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/87.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A) (A) ( )
![Page 88: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/88.jpg)
Inference by Resolution
Does (A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) entail A?
(A ∨ B) ∧ (¬B ∨ C) ∧ (¬C) ∧ (¬A)
(¬B)(A ∨ B) (¬B ∨ C) (¬C) (¬A) (A) ( )
![Page 89: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/89.jpg)
First-Order Logic
![Page 90: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/90.jpg)
Propositional Logic
MinervaGryffindorMinervaHufflepuff
Propositional Symbols
MinervaRavenclawMinervaSlytherin…
![Page 91: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/91.jpg)
First-Order Logic
Minerva Pomona Horace Gilderoy Gryffindor Hufflepuff Ravenclaw Slytherin
Constant Symbol Predicate Symbol
Person House BelongsTo
![Page 92: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/92.jpg)
First-Order Logic
Person(Minerva) Minerva is a person.
House(Gryffindor) Gryffindor is a house.
¬House(Minerva) Minerva is not a house.
BelongsTo(Minerva, Gryffindor)Minerva belongs to Gryffindor.
![Page 93: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/93.jpg)
Universal Quantification
![Page 94: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/94.jpg)
Universal Quantification
∀x. BelongsTo(x, Gryffindor) → ¬BelongsTo(x, Hufflepuff)
For all objects x, if x belongs to Gryffindor, then x does not belong to Hufflepuff.
Anyone in Gryffindor is not in Hufflepuff.
![Page 95: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/95.jpg)
Existential Quantification
![Page 96: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/96.jpg)
Existential Quantification
∃x. House(x) ∧ BelongsTo(Minerva, x)
There exists an object x such that x is a house and Minerva belongs to x.
Minerva belongs to a house.
![Page 97: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/97.jpg)
Existential Quantification
∀x. Person(x) → (∃y. House(y) ∧ BelongsTo(x, y))
For all objects x, if x is a person, then there exists an object y such that
y is a house and x belongs to y.
Every person belongs to a house.
![Page 98: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/98.jpg)
Knowledge
![Page 99: Introduction to Artificial Intelligence · P: It is a Tuesday. Q: It is raining. R: Harry will go for a run. KB: (P ∧ ¬Q) → R P ¬QQuery: R P Q R KB false false false false](https://reader030.vdocument.in/reader030/viewer/2022040411/5eda7142b3745412b5715920/html5/thumbnails/99.jpg)
Introduction to Artificial Intelligence
with Python