m07 Logic
m07 Logic
Chapter 7
Outline
• Knowledge-based agents
• Wumpus world
• Logic in general - models and entailment
• Propositional (Boolean) logic
• Equivalence, validity, satisfiability
• Inference rules and theorem proving
– forward chaining
– backward chaining
– resolution
–
Knowledge bases
–
–
A simple knowledge-based agent
• Environment
– Squares adjacent to wumpus are smelly
– Squares adjacent to pit are breezy
– Glitter iff gold is in the same square
– Shooting kills wumpus if you are facing it
– Shooting uses up the only arrow
– Grabbing picks up gold if in same square
– Releasing drops the gold in same square
–
•
•
•
Entailment in the wumpus world
Situation after detecting
nothing in [1,1], moving
right, breeze in [2,1]
3 Boolean choices 8
possible models
Wumpus models
Wumpus models
•
Wumpus models
»
Truth tables for inference
Inference by enumeration
• Depth-first enumeration of all models is sound and complete
– Model checking
• truth table enumeration (always exponential in n)
• improved backtracking, e.g., Davis--Putnam-Logemann-Loveland
(DPLL)
• heuristic search in model space (sound but incomplete)
e.g., min-conflicts-like hill-climbing algorithms
•
•
Resolution
Conjunctive Normal Form (CNF)
conjunction of disjunctions of literals
clauses
E.g., (A B) (B C D)
•
The DPLL algorithm
Determine if an input propositional logic sentence (in CNF) is
satisfiable.
m = number of clauses
n = number of symbols
P1,1
W1,1
Bx,y (Px,y+1 Px,y-1 Px+1,y Px-1,y)
Sx,y (Wx,y+1 Wx,y-1 Wx+1,y Wx-1,y)
W1,1 W1,2 … W4,4
W1,1 W1,2
W1,1 W1,3
…
•
•
Summary
• Logical agents apply inference to a knowledge base to derive new
information and make decisions
• Basic concepts of logic:
– syntax: formal structure of sentences
– semantics: truth of sentences wrt models
– entailment: necessary truth of one sentence given another
– inference: deriving sentences from other sentences
– soundness: derivations produce only entailed sentences
– completeness: derivations can produce all entailed sentences
• Wumpus world requires the ability to represent partial and negated
information, reason by cases, etc.
• Resolution is complete for propositional logic
Forward, backward chaining are linear-time, complete for Horn
clauses
• Propositional logic lacks expressive power
•
»