Upload
qamar
View
60
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Reasoning Algorithms in Propositional Logic. Examination will be a take-home exam; confirmation coming as soon as signed course evaluation is received in registrar’s office. Knowledge representation and reasoning. Propositions, general knowledge, facts, KB, model -> big truth table. - PowerPoint PPT Presentation
Citation preview
Reasoning Algorithmsin Propositional Logic
Examination will be a take-home exam;confirmation coming as soon as signed course
evaluation is received in registrar’s office
D Goforth - COSC 4117, fall 2006 2
Knowledge representationand reasoning
Propositions, general knowledge, facts, KB, model-> big truth table
Propositions KB: general knowledge & facts
t t f t f t f f f t t t t t t t t t t t t t t t t t t t t t t t t t t t t model
The reasoning problems:
1. Find t/f assignment(s) model(s) where KB is true
2. Answering questions “entailed” by KB
D Goforth - COSC 4117, fall 2006 3
Approaches to reasoning
N propositions to satisfy KB1. Search through 2N rows of truth table:
goal-based search, fitness is truth of KB (SAT)
2. Use inference: restrict attention to relevant propositions (assumes many models satisfy the KB and many propositions might be “don’t care”)
D Goforth - COSC 4117, fall 2006 4
Approaches to Reasoning:strategies
1. Searcha) Depth-first exhaustive search from start
state of ‘empty’ truth tableb) Hill-climbing from random start state of
true-false assignments
2. Inferencea) Forward chaining from KB to queryb) Backward chaining from query into KB
D Goforth - COSC 4117, fall 2006 5
Propositional satisfiability Problem (SAT)
Definition (Hoos & Stutzle, 2005)“Given a propositional formula F, the
problem is to decide whether or not F is satisfiable.”
F = KB (facts + general knowledge)
D Goforth - COSC 4117, fall 2006 6
Propositional satisfiability Problem (SAT)
State: a vector of truth values for the n propositions
State space: 2n nodesGoal state(s): KB is true (a model)e.g., n = 5, {P1,P2,P3,P4,P5}
t t f t f f t f t f
t t t t f
t - f
t - f
KB = (P1P2) (P2P1)
(P1 P2 P3)
(P2P1) (P4P3)
(P5P3) etc.
1 b)
D Goforth - COSC 4117, fall 2006 7
Propositional satisfiability Problem (SAT)
TT-ENTAILS is depth-first search, exhaustive, incremental Improvement in efficiency by pruning: DPLL –
p.221 early termination pure symbol heuristic unit clause heuristic
WALKSAT: complete state algorithm – reduce number of false clauses by flipping propositions
true<->false
D Goforth - COSC 4117, fall 2006 8
Propositional satisfiability Problem (SAT)
Answers a question: Is a sentence a true in the KB?i.e., is the sentence true in all models of the KB which
are true? OR is (KBa) true?
t t t t f
t t t
f
t
KB = (P1P2) (P2P1)
(P1 P2 P3)
(P2P1) (P4P3)
(P5P3) etc.
Question: (P1P5) ?
1 a)
at root – no truth values assigned
KB, α both true?
KB false
P both true and false
1 a)
t t t t f
t t t
f
t
KB = (P1P2) (P2P1)
(P1 P2 P3)
(P2P1) (P4P3)
(P5P3) etc.
Question: (P1P5) ?
Propositions KB
P1 P2 P3 P4 P5 (P1P2)(P2P1)(P1P2P3)(P2P1)(P4P3)(P5P3) (P1P5)
Question
t t t t t t tt f t t t
t t t t f t tt f t t t
f f f f f t ft t f t t
… … … …
KB Q
t
t
t
TT-ENTAILS returns true if KB Q is true for all cases;
i.e., there is no row with KB true and Q false
TT-ENTAILS1 a)
D Goforth - COSC 4117, fall 2006 11
Variations on TT-ENTAILS
For efficiency: (see p.221) Early termination (pruning) Pure symbol heuristic Unit clause heuristic
D Goforth - COSC 4117, fall 2006 12
Propositional satisfiability Problem (SAT)
WALKSAT, p.223 (complete state search)Checks satisfiabilityi.e., are there models of the KB which are true?
t t f t f f t f t f
t t t t f
t - f
t - f
KB = (P1P2) (P2P1)
(P1 P2 P3)
(P2P1) (P4P3)
(P5P3) etc.
Question: KB satisfiable?1 b)
1 b)
t t f t f f t f t f
t t t t f
t - f
t - f
KB = (P1P2) (P2P1)
(P1 P2 P3)
(P2P1) (P4P3)
(P5P3) etc.
Question: KB satisfiable?
f t f t frandom Satisfied? truey
flip t/f of random proposition in clause
flip t/f of proposition in clause that
minimizes number of false clauses
Probability p
pick random false clause
Give up? falsey
WALKSAT
1 b)
D Goforth - COSC 4117, fall 2006 15
WALKSAT performance
Not guaranteed to find solution(not exhaustive like TT-ENTAILS)
More effective in practice thanTT-ENTAILS, even with efficiencyheuristics (DPLL)
1 b)
D Goforth - COSC 4117, fall 2006 16
Approaches to reasoning
N propositions to satisfy KB1. Search through 2N rows of truth table:
goal-based search, fitness is truth of KB (SAT)
2. Use inference: restrict attention to relevant propositions (assumes many models satisfy the KB and many propositions might be “don’t care”)
D Goforth - COSC 4117, fall 2006 17
Inference rule: Resolution
elimination of complementary literals from sentences in CNF
(~W \/ ~Q \/ T) Λ (W \/ P) (~Q \/ T \/ P)
inference by resolution is Sound – only infers true statements Complete – anything entailed is derivable
Part of KB
New proposition
D Goforth - COSC 4117, fall 2006 18
Resolution: Example (P11 \/ P22 \/ P13) ~P11
~P22
resolve (P11 \/ P22 \/ P13), ~P11
(P22 \/ P13) resolve (P22 \/ P13), ~P22
P13
(from Wumpus world)
Part of KB
D Goforth - COSC 4117, fall 2006 19
Resolution algorithm
goal-directed proof by contradiction to prove P
assume ~P add ~P to KB resolve in KB till resulting sentence is
1. in KB (therefore P is false)2. empty (therefore ~P is contradictory so P is
true)
Figure 7.12 p.216
α leads to
contradition
therefore
α is true
α is consistent
with KB so
α is false
D Goforth - COSC 4117, fall 2006 21
Horn clause inference method compromise representation that is
human-readable basic of logic programming (Prolog) uses modus ponens, not resolution like CNF but restricted to only one
positive proposition(~W \/ ~Q \/ ~S \/ T)
=> ~(W Λ Q Λ S) \/ T => (W Λ Q Λ S) T
2 a)
D Goforth - COSC 4117, fall 2006 22
Forward chaining inference with Horn clauses
algorithm to determine if a particular proposition is true
O(n) in size of KB!! p. 219, Fig 7.14
2 a)
Figure 7.14 p.219
Reasoning by FORWARD chaining
•From the known data “forward” to unknown
•Doesn’t need goal – self-directed agent
2 a)
D Goforth - COSC 4117, fall 2006 24
Reasoning by BACKWARD chaining
Goal-directed reasoning – question answering agent
Backward (KB, Q) //answer query Q If Q true in KB, return true For each Horn clause (P=>Q) in KB,
If Backward (KB, P), return true Return false
2 b)