Chapter7 2
Chapter7 2
Chapter 7
Propositional Logic
Reasoning
1
Knowledge Based Agents
2
Note
3
The Wumpus World
4
Sensors
5
Environment?
6
stench [Wumpus] stench
Glitter stench,
[gold] breeze
7
Wumpus
• Main difficulty: player doesn’t know locations of pits, gold, and wumpus
• Reason about configuration
• Knowledge evolves as new percepts arrive and actions are taken.
8
Examples of reasoning [diagram in lecture]
9
Fundamental Concepts of logical representation and reasoning
10
Which are true?
Which are not true but useful?
11
Entailment (reminder)
• A |= B
• Under all interpretations in which A is true, B is true as well
• All models of A are models of B
• Whenever A is true, B is true as well
• A entails B
• B logically follows from A
12
Inference
KB |-i A
13
Inference Algorithm Examples
1. {A,B} |- (^intro) A ^ B
2. {A, AB} |- (MP) B
3. {A, B A} |- (abduction) B
4. Internet says P|- (gullibility) P
5. Professor says P |- (trust in authority) P
14
Inference Algorithms
• Notes:
implication, piece of syntax
|= entailment, used to describe semantics
|- can be derived from*
Inference algorithm, inference procedure, rule of inference, inference
rule: procedure that derives sentences from sentences
• [Definition of soundness of inference algorithm i]
• [Definition of completeness of inference algorithm i]
• * Though it can mean different things in different math/logic contexts; see “turnstile”
in Wikipedia
15
Monotonicity
16
Propositional Logic Syntax
17
Propositional Logic Sentences
18
Semantics of Prop Logic
19
Logical Equivalences
20
Validity
21
Satisfiability
22
Entailment
• A |= B
• All interpretations that satisfy A also satisfy B
23
Propositional Logic Inference
24
A B C A A BC
B C
F F F F F F A^C, C
F F T F F F does not
entail
F T F F F F BC
F T T F F T
T F F F F F A,B,
T F T F T F Entails
AB
T T F T F F
T T T T T T
25
Example Proof by Deduction
• Knowledge
S1: B22 ( P21 P23 P12 P32 ) rule
S2: B22 observation
• Inferences
S3: (B22 (P21 P23 P12 P32 ))
((P21 P23 P12 P32 ) B22) S1,bi elim
S4: ((P21 P23 P12 P32 ) B22) S3, and elim
S5: (B22 ( P21 P23 P12 P32 )) S4,contrapos
S6: (P21 P23 P12 P32 ) S2,S5, MP
S7: P21 P23 P12 P32 S6, DeMorg
26
Proofs
• A derivation
• A sequence of applications of rules of inference
• Reasoning by search
• Successor function: all possible applications of inference rules
• Monotonicity means search can be local, and more efficient
27
Resolution
28
Resolution
• winter v summer
• ~winter v cold
• Either winter or ~winter is true, so we know that summer or cold is true
• Resolution rule:
– Given: P1 P2 P3 … Pn, and P1 Q1 … Qm
– Conclude: P2 P3 … Pn Q1 … Qm
Complementary literals P1 and P1 “cancel out”
29
Resolution in Wumpus World
30
Resolution
• Any complete search algorithm, applying only the resolution rule, can derive
any conclusion entailed by any KB in propositional logic.
31
Proof using Resolution
32
B22 ( P21 P23 P12 P32 )
Conversion to CNF
33
Previous Slide: Sentence is in CNF
34
Finally…
– Add the negation of the goal to the set of clauses, and perform
resolution. If you reach the empty clause, you have proved the goal
35
Simple Resolution EG
36
Horn Clauses
37
Reasoning with Horn Clauses
• Forward Chaining
– For each new piece of data, generate all new facts, until the desired
fact is generated
– Data-directed reasoning
• Backward Chaining
– To prove the goal, find a clause that contains the goal as its head, and
prove the body recursively
– Goal-directed reasoning
• The state space is an AND-OR graph; see 7.5.4
38
Wrap-up
39