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

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Logic.
Knowledge and reasoning – second part
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
ITCS 3153 Artificial Intelligence Lecture 12 Logical Agents Chapter 7 Lecture 12 Logical Agents Chapter 7.
Logical Agents Chapter 7.
Methods of Proof Chapter 7, second half.
INTRODUÇÃO AOS SISTEMAS INTELIGENTES Prof. Dr. Celso A.A. Kaestner PPGEE-CP / UTFPR Agosto de 2011.
Knoweldge Representation & Reasoning
Logic Agents and Propositional Logic CS 271: Fall 2007 Instructor: Padhraic Smyth.
Logical Agents Chapter 7 Feb 26, Knowledge and Reasoning Knowledge of action outcome enables problem solving –a reflex agent can only find way from.
1 CS 4700: Foundations of Artificial Intelligence Carla P. Gomes Module: Satisfiability (Reading R&N: Chapter 7)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7.
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
February 20, 2006AI: Chapter 7: Logical Agents1 Artificial Intelligence Chapter 7: Logical Agents Michael Scherger Department of Computer Science Kent.
Propositional Logic: Methods of Proof (Part II)
Logical Agents (NUS) Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations (Part 2)
Logical Agents Logic Propositional Logic Summary
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
1 Problems in AI Problem Formulation Uninformed Search Heuristic Search Adversarial Search (Multi-agents) Knowledge RepresentationKnowledge Representation.
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
Logic Agents and Propositional Logic 부산대학교 전자전기컴퓨터공학과 인공지능연구실 김민호
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module Logic Representations.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
1 Logical Agents Chapter 7. 2 A simple knowledge-based agent The agent must be able to: –Represent states, actions, etc. –Incorporate new percepts –Update.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
1 Logical Inference Algorithms CS 171/271 (Chapter 7, continued) Some text and images in these slides were drawn from Russel & Norvig’s published material.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Dr. Shazzad Hosain Department of EECS North South Universtiy Lecture 04 – Part B Propositional Logic.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
1 Logical Agents Chapter 7. 2 Logical Agents What are we talking about, “logical?” –Aren’t search-based chess programs logical Yes, but knowledge is used.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Russell & Norvig Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents Chapter 7 Part I. 2 Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
Logical Agents. Inference : Example 1 How many variables? 3 variables A,B,C How many models? 2 3 = 8 models.
CS666 AI P. T. Chung Logic Logical Agents Chapter 7.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Notes 7: Knowledge Representation, The Propositional Calculus
EA C461 Artificial Intelligence
EA C461 – Artificial Intelligence Logical Agent
Logical Agents Chapter 7.
Artificial Intelligence Logical Agents
EE562 ARTIFICIAL INTELLIGENCE FOR ENGINEERS
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
CS 416 Artificial Intelligence
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Problems in AI Problem Formulation Uninformed Search Heuristic Search
Presentation transcript:

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

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

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

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

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

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 )

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 )

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

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

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

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

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

CIS 391-Intro to AI 13 Forward chaining example

CIS 391-Intro to AI 14 Forward chaining example

CIS 391-Intro to AI 15 Forward chaining example

CIS 391-Intro to AI 16 Forward chaining example

CIS 391-Intro to AI 17 Forward chaining example

CIS 391-Intro to AI 18 Forward chaining example

CIS 391-Intro to AI 19 Forward chaining example

CIS 391-Intro to AI 20 Forward chaining example

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

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

CIS 391-Intro to AI 23 Backward chaining example

CIS 391-Intro to AI 24 Backward chaining example

CIS 391-Intro to AI 25 Backward chaining example

CIS 391-Intro to AI 26 Backward chaining example

CIS 391-Intro to AI 27 Backward chaining example

CIS 391-Intro to AI 28 Backward chaining example

CIS 391-Intro to AI 29 Backward chaining example

CIS 391-Intro to AI 30 Backward chaining example

CIS 391-Intro to AI 31 Backward chaining example

CIS 391-Intro to AI 32 Backward chaining example

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

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

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

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?

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…

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

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

CIS 391-Intro to AI 40 The WalkSAT algorithm

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)

CIS 391-Intro to AI 42 Hard satisfiability problems

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

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

CIS 391-Intro to AI 45

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

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