Reasoning/Inference
description
Transcript of Reasoning/Inference
(c) 2003 Thomas G. Dietterich and Devika Subramanian
1
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Reasoning/Inference
Given a set of facts/beliefs/rules/evidence Evaluate a given statement
Determine the truth of a statement Determine the probability of a statement
Find a statement that satisfies a set of constraints SAT
Find a statement that optimizes a set of constraints MAX-SAT (Assignment that maximizes the number of
satisfied constraints.) Most probable explanation (MPE) (Setting of hidden
variables that best explains observations.)
(c) 2003 Thomas G. Dietterich and Devika Subramanian
2
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Examples of Reasoning Problems
Evaluate a given statement Chess: status(position,LOST)? Backgammon: Pr(game-is-lost)?
Find a satisfying assignment Chess: Find a sequence of moves that will win the
game Optimize
Backgammon: Find the move that is most likely to win
Medical Diagnosis: Find the most likely disease of the patient
(c) 2003 Thomas G. Dietterich and Devika Subramanian
3
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Facts, Beliefs, Evidence must be
represented somehow
Propositional Logic Statements about a fixed, finite number of objects
First-Order Logic Statements about a variable, possibly-infinite, set of
objects and relations among them Probabilistic Propositional Logic
Statements of probability over the rows of the truth table
Probabilistic First-Order Logic Statements of probability over the possible models
of the axioms
(c) 2003 Thomas G. Dietterich and Devika Subramanian
4
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Propositional Logic
Sentence ::= AtomicSentence | ComplexSentence
AtomicSentence ::= True | False | symbolSymbol ::= P | Q | R | …ComplexSentence ::= : Sentence
| (Sentence Æ Sentence)| (Sentence Ç Sentence)| (Sentence ) Sentence)| (Sentence , Sentence)
(c) 2003 Thomas G. Dietterich and Devika Subramanian
5
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Application: WUMPUS
Maze of caves A WUMPUS is in one of the caves Some of the caves have pits One of the caves has gold Agent has an arrow
Performance measure: +1000 for picking up the goal; –1000 for being eaten by the WUMPUS or falling into a pit; –1 for each action; –10 for shooting the arrow
Actions: forward, turn left, turn right, shoot arrow, grab gold
Sensors: Stench (cave containing WUMPUS and its
four neighbors) Breeze (cave containing pit and its four
neighbors) Glitter (cave containing gold) Scream (if arrow kills WUMPUS) Bump (if agent hits wall)
Exactly one WUMPUS in cave choosen uniformly at random (except for Start state)
Each cave has probability 0.2 of pit
(c) 2003 Thomas G. Dietterich and Devika Subramanian
6
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Inference from Sensors
Reasoning problem: Given sensors, what can we infer about the state of the world?
(c) 2003 Thomas G. Dietterich and Devika Subramanian
7
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Some Sentences
There is no wumpus in 1,1: : W1,1
If there is a wumpus in 2,2, then there is a stench in 1,2 and 2,3 and 3,2 and 2,1 W2,2 ) S1,2 Æ S2,3 Æ S3,2 Æ S2,1
There is gold in 3,3 iff there is glitter in 3,3: Go3,3 , Gl3,3
There is only one wumpus: W1,1 Ç W1,2 Ç … Ç W4,4 W1,1 ) : W1,2 Æ : W1,3 Æ … Æ : W4,4 W1,2 ) : W1,1 Æ : W1,3 Æ … Æ : W4,4
(c) 2003 Thomas G. Dietterich and Devika Subramanian
8
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Sensor Readings = Sentences
Starting state: no glitter, no stench, no breeze : Gl1,1
: S1,1
: B1,1
(c) 2003 Thomas G. Dietterich and Devika Subramanian
9
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Is there a WUMPUS in 2,1?
Logical Reasoning allows us to draw inferences: : B1,1
W1,2 ) B1,1 Æ B2,2 Æ B1,3
These imply (by the rule of “deny consequent”) : W1,2
(c) 2003 Thomas G. Dietterich and Devika Subramanian
10
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Rules of Logical Inference
Modus Ponens Given: ) and Conclude:
Deny Consequent Given: ) and : Conclude: :
AND Elimination Given: Æ Conclude:
Deny Disjunct Given: Ç and : Conclude
Resolution Given: Ç and : Ç Conclude: Ç
(c) 2003 Thomas G. Dietterich and Devika Subramanian
11
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Resolution: A useful inference rule
for computation
Convert all statements to conjunctive normal form (CNF) ) becomes {: Ç } Æ becomes {}, {} , becomes {: Ç }, { Ç : }
Negate query Apply resolution to search for the empty clause
(contradiction). Useful primarily for First-Order Logic (see
below)
(c) 2003 Thomas G. Dietterich and Devika Subramanian
12
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Satisfiability
Given a set of sentences, is there a satisfying assignment of True and False to each proposition symbol that makes the sentences true?
To decide if is true given , we check if Æ is satisfiable
(c) 2003 Thomas G. Dietterich and Devika Subramanian
13
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Complete Inference Procedure
The Davis-Putnam algorithm is a complete inference procedure for propositional logic If there exists a satisfying assignment, it will
find it. Can be very efficient. But can be very slow,
too. SAT is NP-Complete
(c) 2003 Thomas G. Dietterich and Devika Subramanian
14
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Incomplete Inference Procedure
WALKSAT is a stochastic procedure (a form of stochastic hill climbing) that finds a satisfying assignment rapidly but only with high probability
Can be extended to handle MAX-SAT problems where the goal is to find an assignment that maximizes the number of satisfied clauses
(c) 2003 Thomas G. Dietterich and Devika Subramanian
15
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI First-Order Logic
Propositional Logic requires that the number of objects in the world be fixed so that we can give each one a name: W1,1, W1,2, … B1,1, B1,2, … G1,1, G1,2, …
This does not scale to worlds of variable or unknown size
It is also very tedious to write down all of the clauses describing the Wumpus world
(c) 2003 Thomas G. Dietterich and Devika Subramanian
16
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI First-Order Logic permits variables
that range over objects
Sentence ::= AtomicSentence | Sentence Connective Sentence| Quantifier Variable, … Sentence| : Sentence| (Sentence)
AtomicSentence ::= Predicate(Term),…) | Term = term
Term ::= Function(Term,…)| Constant| Variable
Connective ::= ) | Æ | Ç | ,Quantifier ::= 8 | 9Constant ::= A | X1 | JohnVariable ::= a | x | sPredicate ::= Before | HasColor | Raining | …Function ::= Mother | LeftLegOf | …
(c) 2003 Thomas G. Dietterich and Devika Subramanian
17
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Compact Description of
Wumpus Odor
If a wumpus is in a cave, then all adjacent caves are smelly 8 ℓ1, ℓ2 At(Wumpus, ℓ1) Æ Adjacent(ℓ1, ℓ2) )
Smelly(ℓ2)
Compare propositional logic: W2,2 ) S2,1 Æ S2,3 Æ S1,2 Æ S3,2
(and 15 similar sentences in the 4x4 world)
(c) 2003 Thomas G. Dietterich and Devika Subramanian
18
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Definition of Adjacent
8 ℓ1, ℓ2 Adjacent(ℓ1, ℓ2) ,
(row(ℓ1) = row(ℓ2) Æ
(col(ℓ1) = col(ℓ2) + 1 Ç
col(ℓ1) = col(ℓ2) – 1)) Ç
(col(ℓ1) = col(ℓ2) Æ
(row(ℓ1) = row(ℓ2) + 1 Ç
row(ℓ1) = row(ℓ2) – 1))
(c) 2003 Thomas G. Dietterich and Devika Subramanian
19
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Inference Rules for Quantifiers
Universal Elimination: Given 8 x Conclude SUBST({x/g},)
[g must be term that does not contain variables]
Example: Given 8 x Likes(x,IceCream) Conclude Likes(Ben,IceCream)SUBST(x/Ben, Likes(x,IceCream)) ´
Likes(Ben,IceCream) Many other rules…
(c) 2003 Thomas G. Dietterich and Devika Subramanian
20
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Unification
Unification is a pattern matching operation that finds a substitution that makes two sentences match: UNIFY(p,q) = iff SUBST(,p) = SUBST(,q)
Example: UNIFY(Knows(John,x), Knows(John,Jane)) =
{x/Jane} UNIFY(Knows(John,x), Knows(y,Mother(y))) =
{y/John,x/Mother(John)}
(c) 2003 Thomas G. Dietterich and Devika Subramanian
21
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI First-Order Resolution
Given: Ç , : Ç and UNIFY(,)= Conclude: SUBST(, Ç )
Resolution is a refutation complete inference procedure for First-Order Logic If a set of sentences contains a contradiction, then a
finite sequence of resolutions will prove this. If not, resolution may loop forever (“semi-
decidable”)
(c) 2003 Thomas G. Dietterich and Devika Subramanian
22
Ore
gon
Sta
te U
nive
rsit
y –
CS
430
Intr
o to
AI Summary
Propositional logic finite worlds logical entailment is decidable Davis-Putnam is complete inference
procedure First-Order logic
infinite worlds logical entailment is semi-decidable Resolution procedure is refutation complete