Presentation is loading. Please wait.

Presentation is loading. Please wait.

Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.

Similar presentations


Presentation on theme: "Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence."— Presentation transcript:

1 Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence

2 CIS 391-Intro to AI 2 Automatic Propositional Theorem Proving Methods  Resolution  Forward Chaining  Backward Chaining  Practical Propositional Theorem Proving

3 CIS 391-Intro to AI 3 Proof methods: application of inference rules Each application yields the legitimate (sound) generation of a new sentence from old Proof = a sequence of sound inference rule applications Proofs can be found using search —Inference Rules as operators for a standard search algorithm Typically require transformation of sentences into a normal form Methods: 1.Resolution 2.Forward Chaining 3.Backward Chaining

4 CIS 391-Intro to AI 4 Proof methods: model checking 1.Truth table enumeration (always exponential in n) 2.Improved backtracking —Davis--Putnam-Logemann-Loveland (DPLL) 3.Heuristic search in model space (sound but incomplete) e.g., min-conflicts-like hill-climbing algorithms

5 CIS 391-Intro to AI 5 Resolution Conjunctive Normal Form (CNF) conjunction of disjunctions of literals clauses E.g., (A   B)  (B   C   D)  Resolution inference rule (for CNF): l 1  …  l i  …  l k, m 1  …  m j  …  m n l 1  …  l i-1  l i+1  …  l k  m 1  …  m j-1  m j+1 ...  m n where l i and m j are complementary literals, i.e. l i =  m j e.g. P 1,3  P 2,2,  P 2,2 P 1,3  Resolution is sound and complete for propositional logic

6 CIS 391-Intro to AI 6 Resolution Soundness of resolution inference rule:  ( l 1  …  l i-1  l i+1  …  l k )  l i  m j  ( m 1  …  m j-1  m j+1 ...  m n )  ( l 1  …  l i-1  l i+1  …  l k )  ( m 1  …  m j-1  m j+1 ...  m n )

7 CIS 391-Intro to AI 7 Conversion to CNF: General Procedure Example: B 1,1  (P 1,2  P 2,1 ) 1.Eliminate , replacing α  β with (α  β)  (β  α). (B 1,1  (P 1,2  P 2,1 ))  ((P 1,2  P 2,1 )  B 1,1 ) 2. Eliminate , replacing α  β with  α  β. (  B 1,1  P 1,2  P 2,1 )  (  (P 1,2  P 2,1 )  B 1,1 ) 3. Move  inwards using de Morgan's rules and (often, but not here) double-negation: (  B 1,1  P 1,2  P 2,1 )  ((  P 1,2   P 2,1 )  B 1,1 ) 4. Apply distributivity law (  over  ) and flatten: (  B 1,1  P 1,2  P 2,1 )  (  P 1,2  B 1,1 )  (  P 2,1  B 1,1 )

8 CIS 391-Intro to AI 8 Resolution algorithm  Proof by contradiction, i.e., show KB  α unsatisfiable

9 CIS 391-Intro to AI 9 Resolution example  KB = (B 1,1  (P 1,2  P 2,1 ))  B 1,1 α =  P 1,2

10 CIS 391-Intro to AI 10 Forward and backward chaining  Horn Form (restricted) KB = conjunction of Horn clauses Horn clause = —proposition symbol; or —(conjunction of symbols)  symbol E.g., C  ( B  A)  (C  D  B)  Modus Ponens (for Horn Form): complete for Horn KBs α 1, …,α n,α 1  …  α n  β β  Can be used with forward chaining or backward chaining  These algorithms are very natural and run in linear time

11 CIS 391-Intro to AI 11 Forward chaining  Idea: fire any rule whose premises are satisfied in the KB add its conclusion to the KB, until query is found

12 CIS 391-Intro to AI 12 Forward chaining algorithm  Forward chaining is sound and complete for Horn KB

13 CIS 391-Intro to AI 13 Forward chaining example

14 CIS 391-Intro to AI 14 Forward chaining example

15 CIS 391-Intro to AI 15 Forward chaining example

16 CIS 391-Intro to AI 16 Forward chaining example

17 CIS 391-Intro to AI 17 Forward chaining example

18 CIS 391-Intro to AI 18 Forward chaining example

19 CIS 391-Intro to AI 19 Forward chaining example

20 CIS 391-Intro to AI 20 Forward chaining example

21 CIS 391-Intro to AI 21 Proof of completeness FC derives every atomic sentence that is entailed by KB 1.FC reaches a fixed point where no new atomic sentences are derived 2.Consider the final state as a model m, assigning true/false to symbols 3.Every clause in the original KB is true in m a 1  …  a k  b 4.Hence m is a model of KB 5.If KB╞ q, q is true in every model of KB, including m

22 CIS 391-Intro to AI 22 Backward chaining Idea: work backwards from the query q: to prove q by BC, check if q is known already, or prove by BC all premises of some rule concluding q Avoid loops: check if new subgoal is already on the goal stack Avoid repeated work: check if new subgoal 1.has already been proved true, or 2.has already failed

23 CIS 391-Intro to AI 23 Backward chaining example

24 CIS 391-Intro to AI 24 Backward chaining example

25 CIS 391-Intro to AI 25 Backward chaining example

26 CIS 391-Intro to AI 26 Backward chaining example

27 CIS 391-Intro to AI 27 Backward chaining example

28 CIS 391-Intro to AI 28 Backward chaining example

29 CIS 391-Intro to AI 29 Backward chaining example

30 CIS 391-Intro to AI 30 Backward chaining example

31 CIS 391-Intro to AI 31 Backward chaining example

32 CIS 391-Intro to AI 32 Backward chaining example

33 CIS 391-Intro to AI 33 Forward vs. backward chaining  FC is data-driven, automatic, unconscious processing, e.g., object recognition, routine decisions  May do lots of work that is irrelevant to the goal  BC is goal-driven, appropriate for problem- solving, e.g., Where are my keys? How do I get into a PhD program?  Complexity of BC can be much less than linear in size of KB

34 Proof Methods for Propositional Logic Part III CIS 391 – Introduction to Artificial Intelligence

35 CIS 391-Intro to AI 35 Efficient propositional inference Two families of efficient algorithms for propositional inference:  Complete backtracking search algorithms DPLL algorithm (Davis, Putnam, Logemann, Loveland)  Incomplete local search algorithms WalkSAT algorithm

36 CIS 391-Intro to AI 36 Practical Propositional Theorem Proving  Problem to solve is in CNF Is Marvin a Martian? M == true? Given: —Marvin is green G=true —Marvin is little L=true —(little and green) implies Martian (L  G) => M ~(L  G)  M ~L  ~G  M  Proof by contradiction… Are there true/false values for G, L, and M that are consistent with knowledge base and Marvin not being a Martian? —G  L  (~L  ~G  M)  ~M == false?

37 CIS 391-Intro to AI 37 Searching for variable values  Want to find values such that: G  L  (~L  ~G  M)  ~M == false Randomly consider all true/false assignments to variables until we exhaust them all or find match (model checking) —(G, L, M) = (t, f, f)… no = (f, t, f)… no = (f, f, f)… no = (t, t, f)… no Alternatively…

38 CIS 391-Intro to AI 38 Search through possible assignments to (G, L, M) via depth-first search —(f, f, f) to (f, f, t) to (f, t, f)… —Each clause of CNF must be true –Terminate consideration when clause evaluates to false —Exponential in worst case (3-SAT) —Some culling of tree is possible using heuristics/logic –E.g. if variable appears with same “sign” in all clauses Davis-Putnam Algorithm (DPLL) enhances this.. Backtracking Search for a False Assignment G L M

39 CIS 391-Intro to AI 39 The WalkSAT algorithm  A practical, simple algorithm for propositional inference  Sound  Incomplete  A hill-climbing search algorithm  Balance between greediness and randomness Evaluation function: The min-conflict heuristic of minimizing the number of unsatisfied clauses Uses random jumps to escape local minima

40 CIS 391-Intro to AI 40 The WalkSAT algorithm

41 CIS 391-Intro to AI 41 Hard satisfiability problems  Consider random 3-CNF sentences. e.g., (  D  B  C)  (B  A  C)  (  C   B  E)  (E  D  B)  (B  E  C) m = number of clauses n = number of symbols Hard problems seem to cluster near m/n = 4.3 (critical point)

42 CIS 391-Intro to AI 42 Hard satisfiability problems

43 CIS 391-Intro to AI 43 Hard satisfiability problems  Median runtime for 100 satisfiable random 3-CNF sentences, n = 50

44 CIS 391-Intro to AI 44 Encoding Wumpus in propositional logic  4x4 Wumpus World The “physics” of the game — At least one wumpus on board — A most one wumpus on board (for any two squares, one is free) —n(n-1)/2 rules like: ~W 1,1 V ~W 1,2 No instant death: —  P 1,1 —  W 1,1 Total of 155 sentences containing 64 distinct symbols

45 CIS 391-Intro to AI 45

46 CIS 391-Intro to AI 46  KB contains "physics" sentences for every single square  For every time t and every location [x,y], L x,y  FacingRight t  Forward  L t x+1,y  Rapid proliferation of clauses Expressiveness limitation of propositional logic t t

47 CIS 391-Intro to AI 47 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


Download ppt "Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence."

Similar presentations


Ads by Google