240 likes | 507 Views
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
E N D
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
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
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
Propositional Logic Sentence ::= AtomicSentence | ComplexSentence AtomicSentence ::= True | False | symbol Symbol ::= P | Q | R | … ComplexSentence ::= :Sentence | (SentenceÆSentence) | (SentenceÇSentence) | (Sentence)Sentence) | (Sentence,Sentence) (c) 2003 Thomas G. Dietterich and Devika Subramanian
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
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
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
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
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
Modus Ponens Given: ) and Conclude: Deny Consequent Given: ) and : Conclude: : AND Elimination Given: Æ Conclude: Deny Disjunct Given: Ç and : Conclude Rules of Logical Inference • Resolution • Given: Ç and :Ç • Conclude: Ç (c) 2003 Thomas G. Dietterich and Devika Subramanian
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
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
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
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
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
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| 9 Constant ::= A | X1 | John Variable ::= a | x | s Predicate ::= Before | HasColor | Raining | … Function ::= Mother | LeftLegOf | … (c) 2003 Thomas G. Dietterich and Devika Subramanian
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
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
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
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
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
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 (c) 2003 Thomas G. Dietterich and Devika Subramanian