Presentation is loading. Please wait.

Presentation is loading. Please wait.

Automated Reasoning in Propositional Logic Problem Given: KB: a set of sentence  : a sentence Answer: KB  ?

Similar presentations


Presentation on theme: "Automated Reasoning in Propositional Logic Problem Given: KB: a set of sentence  : a sentence Answer: KB  ?"— Presentation transcript:

1

2 Automated Reasoning in Propositional Logic

3 Problem Given: KB: a set of sentence  : a sentence Answer: KB  ?

4 KB  iff {KB,  } is unsatisfiable Deduction vs. Satisfiability Test Hence: Deciding whether a set of sentences entails another sentence, or not Testing whether a set of sentences is satisfiable, or not are closely related problems

5 Computational Approaches Enumeration of models Construction of a proof 1. Battery-OK  Bulbs-OK  Headlights-Work 2. Battery-OK  Starter-OK   Empty-Gas-Tank  Engine-Starts 3. Engine-Starts   Flat-Tire  Car-OK 4. Headlights-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9. Battery-OK  Starter-OK  (5+6) 10. Battery-OK  Starter-OK   Empty-Gas-Tank  (9+7) 11. Engine-Starts  (2+10) 12.  Engine-Starts  Flat-Tire  (3+8) 13. Flat-Tire  (11+12)

6 Enumeration of Models P : Set of propositional symbols in {KB,  } n: Size of P ENTAILS?( KB,  ) For each of the 2 n models on P do If it is a model of {KB,  } then return no Return yes

7 Satisfiability Test as CSP Each propositional symbol is a variable The domain of each variable is {True, False} Each sentence in {KB,  } is a constraint on the value(s) taken by one or several variables Recursive backtracking CSP techniques and heuristics are applicable

8 Construction of a Proof 1. Battery-OK  Bulbs-OK  Headlights-Work 2. Battery-OK  Starter-OK   Empty-Gas-Tank  Engine-Starts 3. Engine-Starts   Flat-Tire  Car-OK 4. Headlights-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9. Battery-OK  Starter-OK  (5+6) 10. Battery-OK  Starter-OK   Empty-Gas-Tank  (9+7) 11. Engine-Starts  (2+10) 12.  Engine-Starts  Flat-Tire  (3+8) 13. Flat-Tire  (11+12)

9 Construction of a Proof 1. Battery-OK  Bulbs-OK  Headlights-Work 2. Battery-OK  Starter-OK   Empty-Gas-Tank  Engine-Starts 3. Engine-Starts   Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9. Battery-OK  Starter-OK  (5+6) 10. Battery-OK  Starter-OK   Empty-Gas-Tank  (9+7) 11. Engine-Starts  (2+10) 12.  Engine-Starts  Flat-Tire  (3+8) 13. Flat-Tire  (11+12) What do we need? A complete set of sound inference rules A complete search algorithm to decide which rule to apply next and to which sentences

10 Complementary Literals A literal is a either an atomic sentence or the negated atomic sentence, e.g.: P or  P Two literals are complementary if one is the negation of the other, e.g.: P and  P

11 Unit Resolution Rule Given two sentences: L 1  …  L p and M where L i,…, L p and M are all literals, and M and L i are complementary literals Infer: L 1  …  L i-1  L i+1  …  L p

12 Examples From:  Engine-Starts  Car-OK Engine-Starts Infer: Car-OK From:  Engine-Starts  Car-OK  Car-OK Infer:  Engine-Starts Modus ponens Modus tolens Engine-Starts  Car-OK

13 Another Example 1.  Engine-Starts  Flat-Tire  Car-OK 2. Engine-Starts 3.  Flat-Tire 4. Flat-Tire  Car-OK 5. Car-OK

14 Detection of Unsatisfiability 1.Car-OK 2.  Car-OK 3.False

15 Soundness of Unit Resolution Let m be a model of: L 1  …  L p and M where M and L i are complementary literals L i must be False in m, hence L 1  …  L i-1  L i+1  …  L p must be True

16 Shortcoming of Unit Resolution From:   Engine-Starts  Flat-Tire  Car-OK  Engine-Starts  Empty-Gas-Tank we can infer nothing!

17 Full Resolution Rule Given two sentences: L 1  …  L p and M 1  …  M q where L 1,…, L p, M 1,…, M q are all literals, and L i and M j are complementary literals Infer: L 1  …  L i-1  L i+1  …  L k  M 1  …  M j-1  M j+1  …  M k in which only one copy of each literal is retained (factoring)

18 Example From:  Engine-Starts  Flat-Tire  Car-OK Engine-Starts  Empty-Gas-Tank Infer: Empty-Gas-Tank  Flat-Tire  Car-OK

19 Example From:  P  Q (  P  Q)  Q  R (  Q  R) Infer:  P  R (  P  R)

20 Not All Inferences are Useful! From:  Engine-Starts  Flat-Tire  Car-OK Engine-Starts   Flat-Tire Infer:  Flat-Tire  Flat-Tire  Car-OK

21 Not All Inferences are Useful! From:  Engine-Starts  Flat-Tire  Car-OK Engine-Starts   Flat-Tire Infer:  Flat-Tire  Flat-Tire  Car-OK tautology

22 Not All Inferences are Useful! From:  Engine-Starts  Flat-Tire  Car-OK Engine-Starts   Flat-Tire Infer:  Flat-Tire  Flat-Tire  Car-OK  True tautology

23 Soundness of Full Resolution Left as an exercise

24 Full Resolution Rule Given two sentences: L 1  …  L p and M 1  …  M q Infer: L 1  …  L i-1  L i+1  …  L k  M 1  …  M j-1  M j+1  …  M k clauses

25 Sentence  Clause Form Example: (A   B)  (C  D)

26 Sentence  Clause Form Example: (A   B)  (C  D) 1. Eliminate   (A   B)  (C  D)

27 Sentence  Clause Form Example: (A   B)  (C  D) 1. Eliminate   (A   B)  (C  D) 2. Reduce scope of  (  A  B)  (C  D)

28 Sentence  Clause Form Example: (A   B)  (C  D) 1. Eliminate   (A   B)  (C  D) 2. Reduce scope of  (  A  B)  (C  D) 3. Distribute  over  (  A  (C  D))  (B  (C  D)) (  A  C)  (  A  D)  (B  C)  (B  D)

29 Sentence  Clause Form Example: (A   B)  (C  D) 1. Eliminate   (A   B)  (C  D) 2. Reduce scope of  (  A  B)  (C  D) 3. Distribute  over  (  A  (C  D))  (B  (C  D)) (  A  C)  (  A  D)  (B  C)  (B  D) Set of clauses: {  A  C,  A  D, B  C, B  D}

30 Resolution Refutation Algorithm RESOLUTION-REFUTATION(KB  ) clauses  set of clauses obtained from KB and  new  {} Repeat: For each C, C’ in clauses do res  RESOLVE(C,C’) If res contains the empty clause then return yes new  new U res If new  clauses then return no clauses  clauses U new

31 Completeness of Resolution Refutation Left as an exercise

32 Example 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlights-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire 10.  Starter-OK  Empty-Gas-Tank  Engine-Starts 11.  Battery-OK  Empty-Gas-Tank  Engine-Starts 12.  Battery-OK   Starter-OK  Engine-Starts 13.  Engine-Starts  Flat-Tire 14.  Engine-Starts  Car-OK

33 Example 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire 10.  Starter-OK  Empty-Gas-Tank  Engine-Starts 11.  Battery-OK  Empty-Gas-Tank  Engine-Starts 12.  Battery-OK   Starter-OK  Engine-Starts 13.  Engine-Starts  Flat-Tire 14.  Engine-Starts  Car-OK

34 Example … Battery-OK Starter-OK  Empty-Gas-Tank  Car-OK  Flat-Tire …  Battery-OK   Starter-OK  Engine-Starts  Engine-Starts  Flat-Tire …

35 Example Battery-OK Starter-OK  Empty-Gas-Tank  Car-OK  Flat-Tire …  Battery-OK   Starter-OK  Engine-Starts  Engine-Starts  Flat-Tire …  Battery-OK   Starter-OK  Flat-Tire …  Starter-OK  Flat-Tire … Flat-Tire … False (empty clause)

36 Resolution Heuristics Set-of-support heuristics: At least one ancestor of every inferred clause comes from  Shortest-clause heuristics: Generate a clause with the fewest literals first Simplifications heuristics: Remove any clause containing two complementary literals (tautology) Remove any clause C that contains all the literals of another clause C’ If a symbol always appears with the same “sign”, remove all the clauses that contain it (pure symbol)

37 Example (Set-of-Support) 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire

38 Example (Set-of-Support) 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire 10.  Engine-Starts  Car-OK 11.  Engine-Starts 12.  Battery-OK   Starter-OK  Empty-Gas-Tank 13.  Starter-OK  Empty-Gas-Tank 14. Empty-Gas-Tank 15. False Note the goal-directed flavor

39 Resolution Heuristics Set-of-support heuristics: At least one ancestor of every inferred clause comes from  Shortest-clause heuristics: Generate a clause with the fewest literals first Simplifications heuristics: Remove any clause containing two complementary literals (tautology) Remove any clause C that contains all the literals of another clause C’ If a symbol always appears with the same “sign”, remove all the clauses that contain it (pure symbol)

40 Example (Shortest-Clause) 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire

41 Example (Shortest-Clause) 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlight-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire 10.  Engine-Starts  Car-OK 11.  Engine-Starts 12.  Bulbs-OK  Headlights-Work 13.  Battery-OK   Starter-OK  Empty-Gas-Tank 14.  Starter-OK  Empty-Gas-Tank 15. Empty-Gas-Tank 16. False

42 Resolution Heuristics Set-of-support heuristics: At least one ancestor of every inferred clause comes from  Shortest-clause heuristics: Generate a clause with the fewest literals first Simplifications heuristics: Remove any clause containing two complementary literals (tautology) Remove any clause C that contains all the literals of another clause C’ If a symbol always appears with the same “sign”, remove all the clauses that contain it (pure symbol)

43 Example (Pure Literal) 1.  Battery-OK   Bulbs-OK  Headlights-Work 2.  Battery-OK   Starter-OK  Empty-Gas-Tank  Engine-Starts 3.  Engine-Starts  Flat-Tire  Car-OK 4. Headlights-Work 5. Battery-OK 6. Starter-OK 7.  Empty-Gas-Tank 8.  Car-OK 9.  Flat-Tire

44 When to Use Logic? When the knowledge base is large and can be made explicit When formulating a problem as a CSP problem would yield complex constraints When the agent’s environment is conveniently described by true or false sentences

45 Summary Entailment problem Resolution rule Clause form of a set of sentences Resolution refutation algorithm Resolution heuristics


Download ppt "Automated Reasoning in Propositional Logic Problem Given: KB: a set of sentence  : a sentence Answer: KB  ?"

Similar presentations


Ads by Google