3/11/2002copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams 16.412/6.834 October 7 th, 2002.

Slides:



Advertisements
Similar presentations
Russell and Norvig Chapter 7
Advertisements

Agents that reason logically Tuomas Sandholm Carnegie Mellon University Computer Science Department.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
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.
Knowledge Representation I (Propositional Logic) CSE 473.
Methods of Proof Chapter 7, second half.
Knoweldge Representation & Reasoning
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)
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
3/19/2003copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams November 22 nd, 2004.
Logic - Part 2 CSE 573. © Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]
Logical Agents. Knowledge bases Knowledge base = set of sentences in a formal language Declarative approach to building an agent (or other system): 
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
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,
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
An Introduction to Artificial Intelligence – CE Chapter 7- Logical Agents Ramin Halavati
S P Vimal, Department of CSIS, BITS, Pilani
Planning as Propositional Satisfiabililty Brian C. Williams Oct. 30 th, J/6.834J GSAT, Graphplan and WalkSAT Based on slides from Bart Selman.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module Logic Representations.
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.
LECTURE LECTURE Propositional Logic Syntax 1 Source: MIT OpenCourseWare.
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Logical Agents Chapter 7. Outline Knowledge-based agents Logic in general Propositional (Boolean) logic Equivalence, validity, satisfiability.
CS6133 Software Specification and Verification
First-Order Logic and Inductive Logic Programming.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
Review of Propositional Logic Syntax
© Copyright 2008 STI INNSBRUCK Intelligent Systems 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.
9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams J/6.834J October 10, 2001.
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.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Artificial Intelligence Logical Agents Chapter 7.
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.
Inference in Propositional Logic (and Intro to SAT)
Planning as Satisfiability
EA C461 – Artificial Intelligence Logical Agent
Logical Inference: Through Proof to Truth
Logics for Data and Knowledge Representation
Logical Agents Chapter 7 Selected and slightly modified slides from
Logical Agents Reading: Russell’s Chapter 7
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
Artificial Intelligence: Agents and Propositional Logic.
CS 416 Artificial Intelligence
Automated Reasoning in Propositional Logic
Model-based Diagnosis
Fast SAT through Incremental Unit Propagation
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Presentation transcript:

3/11/2002copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams /6.834 October 7 th, 2002

3/11/2002copyright Brian Williams2 Reading Assignments: Propositional Logic AIMA Ch. 6 – Propositional Logic

3/11/2002copyright Brian Williams3 Outline Motivation Propositional Logic Syntax Semantics Propositional Satisfiability Systematic methods Characteristics of systematic search Through local search Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams4 How can Logic Help Us to Perform Diagnosis? Helium tank Fuel tankOxidizer tank Main Engines Flow 1 = zero Pressure 1 = nominal Pressure 2 = nominal Acceleration = zero

3/11/2002copyright Brian Williams5 Consistency-based Diagnosis Given: Observations “no thrust” Device schematic Component models Specifies all correct and faulty modes Constraints describe behavior of each mode. Find: Component mode assignment that is consistent with the Obs, Schematic & Models.

3/11/2002copyright Brian Williams6 Candidate: Assignment to all component modes Or1 Or2 Or3 And1 And2 A B C D E F G X Y Z 1 And(i): G(i): Out(i) = In1(i) AND In2(i) U(i): 0 Diagnosis identifies consistent modes Candidate = {G(And1) & G(And2) & G(Or1) & G(Or2) & G(Or3)}

3/11/2002copyright Brian Williams7 Diagnosis identifies consistent modes AND(i): G(i): Out(i) = In1(i) AND In2(i) U(i): Candidate: Assignment to all component modes. Diagnosis D: Candidate consistent with model Phi and observables OBS Or1 Or3 And1 A B C D E F G X Y Z Diagnosis = {G(And1) & U(And2) & G(Or1) & G(Or2) & G(Or3)} Or2

3/11/2002copyright Brian Williams8 How do we write down the constraints? Helium tank Fuel tankOxidizer tank Main Engines Flow 1 = zero Pressure 1 = nominal Pressure 2 = nominal Acceleration = zero

3/11/2002copyright Brian Williams9 What formal languages exist for describing constraints? Logic: Propositional logictruth of facts First order logicfacts,objects,relations Temporal logictime, …. Modal logicsknowledge, belief … Probability ….

3/11/2002copyright Brian Williams10 Logic in General Logics formal languages for representing information such that conclusions can be drawn. Syntax defines the sentences in the language. Semantics define the “meaning” of sentences; i.e., truth of a sentence in a world.

3/11/2002copyright Brian Williams11 Outline Motivation Propositional Logic Syntax Semantics Propositional Satisfiability Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams12 Propositional Logic: Syntax Proposition Statement that is true or false (valve v1) (= voltage high) Propositional sentence (S) S ::= proposition | (NOT S) | (OR S1... Sn) | (AND S1... Sn) Defined Constructs (implies S1 S2) => ((not S1) OR S2) (IFF S1 S2) => (AND (IMPLIES S1 S2)(IMPLIES S2 S1))...

3/11/2002copyright Brian Williams13 Engine Example: propositional logic sentence (mode(E1) = ok implies (thrust(E1) = on if and only if flow(V1) = on and flow(V2) = on)) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) E1 V1V2

3/11/2002copyright Brian Williams14 Propositional Logic: Semantics A model assigns true/false to every proposition symbol P i A = True, B = False, C = False The truth of sentence S is defined as a composition of boolean operators applied to the model (S, S 1 and S 2 are sentences): Not S is True iff S is False S 1 and S 2 is True iff S 1 is True and S 2 is True S 1 or S 2 is True iff S 1 is True or S 2 is True S 1 implies S 2 is True iff S 1 is False or S 2 is True S 1 iff S 2 is True iff S 1 implies S 2 is True and S 2 implies S 1 is True

3/11/2002copyright Brian Williams15 Example: Determining the truth of a sentence (mode(E1) = ok implies [(thrust(E1) = on if and only if (flow(V1) = on and flow(V2) = on)) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams16 Example: Determining the truth of a sentence (True implies [(thrust(E1) = on if and only if (flow(V1) = on and flow(V2) = on)) and (True or mode(E1) = unknown) and not (True and mode(E1) = unknown)]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams17 Example: Determining the truth of a sentence (True implies [(False if and only if (True and False)) and (True or False) and not (True and False)]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams18 Example: Determining the truth of a sentence (True implies [(False if and only if (True and False)) and (True or False) and not (True and False)]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams19 Example: Determining the truth of a sentence (True implies [(False if and only if (True and False)) and (True or False) and not False]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams20 Example: Determining the truth of a sentence (True implies [(False if and only if (True and False)) and (True or False) and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams21 Example: Determining the truth of a sentence (True implies [(False if and only if False) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams22 Example: Determining the truth of a sentence (True implies [(False if and only if False) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams23 Example: Determining the truth of a sentence (True implies [(False implies False ) and (False implies False )) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams24 Example: Determining the truth of a sentence (True implies [(not False or False ) and (not False or False )) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams25 Example: Determining the truth of a sentence (True implies [(True or False ) and (True or False )) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams26 Example: Determining the truth of a sentence (True implies [(True and True) and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams27 Example: Determining the truth of a sentence (True implies [True and True and True]) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams28 Example: Determining the truth of a sentence (True implies True) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams29 Example: Determining the truth of a sentence (not True or True) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams30 Example: Determining the truth of a sentence (False or True) Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams31 Example: Determining the truth of a sentence True! Model: mode(E1) = ok is True thrust(E1) = on is False flow(V1) = on is True flow(V2) = on is False mode(E1) = unknown is False

3/11/2002copyright Brian Williams32 Outline Motivation Propositional Logic Syntax Semantics Propositional Satisfiability Clausal Form Systematic methods Characteristics of systematic search Through local search Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams33 Propositional Satisfiability Find a model M that satisfies sentence T (called a theory): Reduce sentence T to clausal form. Perform search similar to Forward Checking Propositional satisfiability testing: 1990: 100 variables / 200 clauses (constraints) 1998: 10, ,000 vars / 10^6 clauses Novel applications: e.g. diagnosis, planning, software / circuit testing, machine learning, and protein folding

3/11/2002copyright Brian Williams34 Propositional Clauses: A Simpler Form Literal: proposition or its negation B, Not A Clause: disjunction of literals (not A or B or E) Conjunctive Normal Form Phi = (A or B or C) and (not A or B or E) and (not B or C or D) Viewed as a set of clauses

3/11/2002copyright Brian Williams35 Engine Example: Clausal Model (mode(E1) = ok implies (thrust(E1) = on iff flow(V1) = on and flow(V2) = on)) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on; not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on; not (mode(E1) = ok) or not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on; mode(E1) = ok or mode(E1) = unknown; not (mode(E1) = ok) or not (mode(E1) = unknown);

3/11/2002copyright Brian Williams36 Outline Propositional Satisfiability Clausal form Systematic methods Backtrack Search Deduction by Resolution DPLL: Combining search and deduction Characteristics of DPLL local search using GSAT Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams37 Propositional Satisfiability by Enumeration Assign true or false to an unassigned proposition. Backtrack as soon as a clause is violated. Example: C1: Not A or B C2: Not C or A C3: Not B or C A FT B FT C FT C FT B FT CC FTFT

3/11/2002copyright Brian Williams38 Backtrack Search Procedure BT(phi,A) Input: A cnf theory phi, an assignment A to propositions in phi Output: A decision of whether phi is satisfiable. 1. If a clause is violated return(false); 2. Else if all propositions are assigned return(true); 3. ElseQ = some unassigned proposition in phi; 4.Return (BT(phi, A[Q = True]) or 5. BT(phi, A[Q = False])

3/11/2002copyright Brian Williams39 Outline Propositional Satisfiability Clausal form Systematic methods Backtrack Search Deduction by Resolution DPLL: Combining search and deduction Characteristics of DPLL local search using GSAT Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams40 Inference: Resolution on Clauses  or B, not B or   or  Example: Checking Satisfiability of C1 – C4: C1: A C2: Not A or B C3: Not B or C C4: Not C or Not A C5: Not A or CResolving C2 and C3 using B C6: CResolving C1 and C5 using A C7: Not AResolving C6 and C4 using C C8: FalseResolving C7 and C1 using A

3/11/2002copyright Brian Williams41 Outline Propositional Satisfiability Clausal form Systematic methods Backtrack Search Deduction by Resolution DPLL: Combining search and deduction Characteristics of DPLL local search using GSAT Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams42 How Do We Combine Resolution and Back Track Search? Backtrack Search Assign true or false to an unassigned proposition. Backtrack as soon as a clause is violated. Satisfiable if assignment is complete. Example: C1: Not A or B C2: Not C or A C3: Not B or C A FT B FT C FT C FT B FT CC FTFT  Similar to Forward Checking:  Perform limited form of inference  apply inference rule after assigning each variable.

3/11/2002copyright Brian Williams43 Perform limited inference: Unit Clause Resolution Idea: Conclude propositions, not disjunctive clauses Unit clause: a clause with a single literal. Not A Unit resolution: resolution with unit clauses: not A (A or B or C) (B or C) Unit propagation: unit resolve until only a unit clause is left: (not A) (not B) (A or B or C) C

3/11/2002copyright Brian Williams44 Unit Propagation Examples C1: Not A or B C2: Not C or A C3: Not B or C C4: A C4 A True C1 B True C3 C True Satisfied

3/11/2002copyright Brian Williams45 Unit Propagation Examples C1: Not A or B C2: Not C or A C3: Not B or C C4: A C4’: Not B C1C3C4 C1 C2 C4’ A True B C A False B C C4 A True Satisfied

3/11/2002copyright Brian Williams46 C 1 : ¬r  q  p C 2 : ¬ p  ¬ t r true q false p t procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate Unit Propagation

3/11/2002copyright Brian Williams47 C 1 : ¬r  q  p C 2 : ¬ p  ¬ t r true q false p t procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate Unit Propagation

3/11/2002copyright Brian Williams48 C 1 : ¬r  q  p rq p C 2 : ¬ p  ¬ t truefalse true t procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate Unit Propagation

3/11/2002copyright Brian Williams49 C 1 : ¬r  q  p rq p C 2 : ¬ p  ¬ t truefalse true t procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate Unit Propagation

3/11/2002copyright Brian Williams50 rq p truefalse true procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate C 2 : ¬ p  ¬ t t C 1 : ¬r  q  p Unit Propagation

3/11/2002copyright Brian Williams51 rq p C 2 : ¬ p  ¬ t truefalse true t false procedure propagate(C)// C is a clause if all literals in C are false except l, and l is unassigned then assign true to l and record C as a support for l and for each clause C’ mentioning “not l”, propagate(C’) end propagate C 1 : ¬r  q  p Unit Propagation

3/11/2002copyright Brian Williams52 Propositional Satisfiability by DPLL Initially: Unit propagate. Repeat: Assign true or false to an unassigned proposition. Unit propagate. Backtrack as soon as a clause is violated. Satisfiable if assignment is complete. Propagate: C = F B = F A = F A F T Propagate: B = T C = T A = T Example: C1: Not A or B C2: Not C or A C3: Not B or C

3/11/2002copyright Brian Williams53 DPLL Procedure [Davis, Putnam Logmann, Loveland, 1962] DPLL(phi,A) Input: A cnf theory phi, an assignment A to propositions in phi Output: A decision of whether phi is satisfiable. 1. propagate(phi); 2. If a clause is violated return(false); 3. Else if all propositions are assigned return(true); 4. ElseQ = some unassigned proposition in phi; 6.Return (DPLL(phi, A[Q = True]) or 7. DPLL(phi, A[Q = False])

3/11/2002copyright Brian Williams54 Outline Motivation Propositional Logic Propositional Satisfiability Systematic methods Characteristics of systematic search Through local search Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams55

3/11/2002copyright Brian Williams56

3/11/2002copyright Brian Williams57

3/11/2002copyright Brian Williams58 Intuition At low ratios: few clauses (constraints) many assignments easily found At high ratios: many clauses inconsistencies easily detected

3/11/2002copyright Brian Williams59 Fraction of Formulae Unsatisfied Phase Transitions for Different Numbers of Variables

3/11/2002copyright Brian Williams60 Phase transition 2-, 3-, 4-, 5-, and 6-SAT

3/11/2002copyright Brian Williams61 Outline Motivation Propositional Logic Propositional Satisfiability Systematic methods Characteristics of systematic search Through local search Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams62 GSAT Example C1: Not A or B C2: Not C or Not A C3: or B or Not C C1, C2, C3 violated A True B False C True C3 violated False C2 violated True C1 violated False 1.Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses 3.Pick assignment with fewest violations.

3/11/2002copyright Brian Williams63 GSAT Example C1: Not A or B C2: Not C or Not A C3: or B or Not C C1 violated A True B False C Satisfied False Satisfied True C1,C2,C3 violated True 1.Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses 3.Pick assignment with fewest violations.

3/11/2002copyright Brian Williams64 GSAT Example C1: Not A or B C2: Not C or Not A C3: or B or Not C Satisfied A True B C False 1.Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses 3.Pick assignment with fewest violations.

3/11/2002copyright Brian Williams65 Outline Motivation Propositional Logic Propositional Satisfiability Systematic methods Characteristics of systematic search Through local search Summary Appendix: Reduction to Clausal Form

3/11/2002copyright Brian Williams66 Satisfiability Testing Procedures Reduce to CNF (Clausal Form) then: Systematic, complete procedures Depth-first backtrack search (Davis, Putnam, & Loveland 1961) unit propagation, shortest clause heuristic State-of-the-art implementations: ntab (Crawford & Auton 1997) itms (Nayak & Williams 1997) many others! See SATLIB 1998 / Hoos & Stutzle Stochastic, incomplete procedures GSAT (Selman et. al 1993) Walksat (Selman & Kautz 1993) greedy local search + noise to escape local minima

3/11/2002copyright Brian Williams67 Summary Logical agents apply inference to a knowledge base to derive new information and make decisions. Basic concepts in logic Syntax: formal structure of sentences. Semantics: truth of sentence wrt models. Entailment: necessary truth of a sentence given another. Inference: deriving sentences from others. Soundness: derivations produce only entailed sentences. Completeness: derivations can produce all entailed sentences. Enumeration, Resolution, DPLL and DPLL+TMS are sound and complete methods for propositional logic. Local repair methods (e.g., GSAT) are sound but incomplete.

3/11/2002copyright Brian Williams68 Appendix: Reduction to Clauses Note: You are responsible for reading this material

3/11/2002copyright Brian Williams69 Engine Example: Mapping to a Clausal Model (mode(E1) = ok implies (thrust(E1) = on iff flow(V1) = on and flow(V2) = on)) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on; not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on; not (mode(E1) = ok) or not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on; mode(E1) = ok or mode(E1) = unknown; not (mode(E1) = ok) or not (mode(E1) = unknown);

3/11/2002copyright Brian Williams70 Reducing Propositional Formula to Clauses (CNF) Eliminate IFF and Implies E1 iff E2 => (E1 implies E2) and (E2 implies E1) E1 implies E2 => not E1 or E2

3/11/2002copyright Brian Williams71 Engine Example: Eliminate IFF (mode(E1) = ok implies (thrust(E1) = on iff (flow(V1) = on and flow(V2) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

3/11/2002copyright Brian Williams72 Engine Example: Eliminate IFF (mode(E1) = ok implies (thrust(E1) = on iff (flow(V1) = on and flow(V2) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) (mode(E1) = ok implies ((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and ((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

3/11/2002copyright Brian Williams73 Engine Example: Eliminate Implies (mode(E1) = ok implies ((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and ((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

3/11/2002copyright Brian Williams74 Engine Example: Eliminate Implies (mode(E1) = ok implies ((thrust(E1) = on implies (flow(V1) = on and flow(V2) = on)) and ((flow(V1) = on and flow(V2) = on) implies thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

3/11/2002copyright Brian Williams75 Reducing Propositional Formula to Clauses (CNF) Move negations in to propositions (De Morgan) Not (E1 and E2) => (not E1) or (not E2) Not (E1 or E2) => (not E1) and (not E2) Not (not E1) => E1

3/11/2002copyright Brian Williams76 Engine Example: Move Negations In (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown)

3/11/2002copyright Brian Williams77 Engine Example: Move Negations In (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on and flow(V2) = on)) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and not (mode(E1) = ok and mode(E1) = unknown) (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on)) or thrust(E1) = on) ) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown)))

3/11/2002copyright Brian Williams78 Reducing Propositional Formula to Clauses (CNF) Move conjunction out (Distribution) E1 or (E2 and E3) =>(E1 or E2) and (E1 or E3)

3/11/2002copyright Brian Williams79 Engine Example: Move Conjunctions Out (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown))

3/11/2002copyright Brian Williams80 Engine Example: Move Conjunctions Out (not (mode(E1) = ok) or ((not (thrust(E1) = on) or (flow(V1) = on and flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown)) (not (mode(E1) = ok) or (((not (thrust(E1) = on) or flow(V1) = on) and (not (thrust(E1) = on) or flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown))

3/11/2002copyright Brian Williams81 Engine Example: Move Conjunctions Out (not (mode(E1) = ok) or (((not (thrust(E1) = on) or flow(V1) = on) and (not (thrust(E1) = on) or flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown))

3/11/2002copyright Brian Williams82 Engine Example: Move Conjunctions Out (not (mode(E1) = ok) or (((not (thrust(E1) = on) or flow(V1) = on) and (not (thrust(E1) = on) or flow(V2) = on)) and (not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on))) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown)) (not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V1) = on) and (not (mode(E1) = ok) or not (thrust(E1) = on) or flow(V2) = on)) and (not (mode(E1) = ok) or not (flow(V1) = on) or not (flow(V2) = on) or thrust(E1) = on) and (mode(E1) = ok or mode(E1) = unknown) and (not (mode(E1) = ok) or not (mode(E1) = unknown))