1 / 24

Reasoning Algorithms in Propositional Logic

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.

qamar
Download Presentation

Reasoning Algorithms in Propositional Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 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

  2. Knowledge representationand reasoning • Propositions, general knowledge, facts, KB, model -> big truth table Propositions KB: general knowledge & facts model 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 • The reasoning problems: • Find t/f assignment(s) model(s) where KB is true • Answering questions “entailed” by KB D Goforth - COSC 4117, fall 2006

  3. Approaches to reasoning N propositions to satisfy KB • Search through 2N rows of truth table: goal-based search, fitness is truth of KB (SAT) • 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 • Search • Depth-first exhaustive search from start state of ‘empty’ truth table • Hill-climbing from random start state of true-false assignments • Inference • Forward chaining from KB to query • 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. KB = (P1P2)  (P2P1)  (P1  P2  P3)  (P2P1)  (P4P3)  (P5P3) t - f t t f t f f t f t f t - f etc. t t t t f Propositional satisfiability Problem (SAT) State: a vector of truth values for the n propositions State space: 2n nodes Goal state(s): KB is true (a model) e.g., n = 5, {P1,P2,P3,P4,P5} 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 (KBa) true? Question: (P1P5) ? KB = (P1P2)  (P2P1)  (P1  P2  P3)  (P2P1)  (P4P3)  (P5P3) 1 a) f t t t t f t etc. t t t D Goforth - COSC 4117, fall 2006

  9. 1 a) at root – no truth values assigned KB,α both true? KB false P both true and false

  10. Question: (P1P5) ? KB = (P1P2)  (P2P1)  (P1  P2  P3)  (P2P1)  (P4P3)  (P5P3) f t t t t f t etc. t t t TT-ENTAILS 1 a) Propositions KB Question KB  Q (P1P5) P1 P2 P3 P4 P5 (P1P2)(P2P1)(P1P2P3)(P2P1)(P4P3)(P5P3) t t t t t t t t f t t t t t t t t t f t t f t t t t … … … … f f f f f f t t t f 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

  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. KB = (P1P2)  (P2P1)  (P1  P2  P3)  (P2P1)  (P4P3)  (P5P3) t - f t t f t f f t f t f t - f etc. t t t t f Propositional satisfiability Problem (SAT) WALKSAT, p.223 (complete state search) Checks satisfiability i.e., are there models of the KB which are true? Question: KB satisfiable? 1 b) D Goforth - COSC 4117, fall 2006

  13. 1 b)

  14. Question: KB satisfiable? KB = (P1P2)  (P2P1)  (P1  P2  P3)  (P2P1)  (P4P3)  (P5P3) t - f t t f t f f t f t f t - f etc. t t t t f 1 b) WALKSAT Satisfied? y random f t f t f true Give up? y false pick random false clause Probability p flip t/f of proposition in clause that minimizes number of false clauses flip t/f of random proposition in clause

  15. WALKSAT performance • Not guaranteed to find solution (not exhaustive like TT-ENTAILS) • More effective in practice than TT-ENTAILS, even with efficiency heuristics (DPLL) 1 b) D Goforth - COSC 4117, fall 2006

  16. Approaches to reasoning N propositions to satisfy KB • Search through 2N rows of truth table: goal-based search, fitness is truth of KB (SAT) • 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 • in KB (therefore P is false) • empty (therefore ~P is contradictory so P is true) D Goforth - COSC 4117, fall 2006

  20. αleads to contradition therefore αis true αis consistent with KB so αis false Figure 7.12 p.216

  21. Horn clause inference method 2 a) • 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 D Goforth - COSC 4117, fall 2006

  22. 2 a) 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 D Goforth - COSC 4117, fall 2006

  23. Reasoning by FORWARD chaining • From the known data “forward” to unknown • Doesn’t need goal – self-directed agent Figure 7.14 p.219 2 a)

  24. Reasoning by BACKWARD chaining 2 b) • 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 D Goforth - COSC 4117, fall 2006

More Related