3/19/2003copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams 16.410-13 November 22 nd, 2004.

Slides:



Advertisements
Similar presentations
Propositional Satisfiability (SAT) Toby Walsh Cork Constraint Computation Centre University College Cork Ireland 4c.ucc.ie/~tw/sat/
Advertisements

Agents that reason logically Tuomas Sandholm Carnegie Mellon University Computer Science Department.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
Dana Nau: Lecture slides for Automated Planning Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License:
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.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
Review: Constraint Satisfaction Problems How is a CSP defined? How do we solve CSPs?
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.
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Ryan Kinworthy 2/26/20031 Chapter 7- Local Search part 1 Ryan Kinworthy CSCE Advanced Constraint Processing.
Methods of Proof Chapter 7, second half.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
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…
ENGG3190 Logic Synthesis “Boolean Satisfiability” Winter 2014 S. Areibi School of Engineering University of Guelph.
SAT Solving Presented by Avi Yadgar. The SAT Problem Given a Boolean formula, look for assignment A for such that.  A is a solution for. A partial assignment.
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]
Boolean Satisfiability and SAT Solvers
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
3/11/2002copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams /6.834 October 7 th, 2002.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 3 Logic Representations (Part 2)
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
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.
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.
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.
© Daniel S. Weld 1 Logistics Problem Set 2 Due Wed A few KR problems Robocode 1.Form teams of 2 people 2.Write design document.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
CSCI 5582 Fall 2006 CSCI 5582 Artificial Intelligence Lecture 11 Jim Martin.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
9/18/2000copyright Brian Williams1 Propositional Logic Brian C. Williams J/6.834J October 10, 2001.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
SAT Solving As implemented in - DPLL solvers: GRASP, Chaff and
Inference in Propositional Logic (and Intro to SAT) CSE 473.
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.
Logical Agents Chapter 7. Outline Knowledge-based agents Wumpus world Logic in general - models and entailment Propositional (Boolean) logic Equivalence,
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)
Inference and search for the propositional satisfiability problem
Planning as Satisfiability
EA C461 – Artificial Intelligence Logical Agent
First-Order Logic and Inductive Logic Programming
Logical Inference: Through Proof to Truth
Logical Agents Reading: Russell’s Chapter 7
Introduction to the Boolean Satisfiability Problem
ECE 667 Synthesis and Verification of Digital Circuits
Artificial Intelligence: Agents and Propositional Logic.
Introduction to the Boolean Satisfiability Problem
Automated Reasoning in Propositional Logic
Fast SAT through Incremental Unit Propagation
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Presentation transcript:

3/19/2003copyright Brian Williams1 Propositional Logic and Satisfiability Brian C. Williams November 22 nd, 2004

3/19/2003copyright Brian Williams2 How Do We Reason About Complex Systems at a Commonsense Level? Helium tank Fuel tankOxidizer tank Main Engines Flow 1 = zero Pressure 1 = nominal Pressure 2 = nominal Acceleration = zero Model using propositional logic. Reason from model to operate, diagnose and repair.

3/19/2003copyright Brian Williams3 Propositional Satisfiability Find a truth assignment that satisfies logical sentence T: Reduce sentence T to clausal form. Perform search similar to MAC = (BT+CP) 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/19/2003copyright Brian Williams4 Reading Assignment: Propositional Logic & Satisfiability AIMA Ch. 6 – Propositional Logic

3/19/2003copyright Brian Williams5 Outline Propositional Logic Syntax Semantics Clausal Reduction Propositional Satisfiability Appendices

3/19/2003copyright Brian Williams6 What formal languages exist for describing constraints? Logic: Propositional logictruth of facts First order logicfacts,objects,relations Temporal logictime, …. Modal logicsknowledge, belief … Probabilitydegree of belief Algebravalues of variables

3/19/2003copyright Brian Williams7 Logic in General Logics formal languages for representing information such that conclusions can be drawn. Syntax defines the sentences in the language. Semantics defines the “meaning” of sentences;  truth of a sentence in a world.

3/19/2003copyright Brian Williams8 Propositional Logic: Syntax Propositions A statement that is true or false (valve v1) (= voltage high) Propositional Sentences (S) S ::= proposition | (NOT S) | (OR S1... Sn) | (AND S1... Sn) Some Defined Constructs (implies S1 S2) => ((not S1) OR S2) (IFF S1 S2) => (AND (IMPLIES S1 S2)(IMPLIES S2 S1))

3/19/2003copyright Brian Williams9 Propositional Sentences: Engine Example (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/19/2003copyright Brian Williams10 Outline Propositional Logic Syntax Semantics Clausal Reduction Propositional Satisfiability Appendices

3/19/2003copyright Brian Williams11 Propositional Logic: Semantics Interpretation I of sentence S assigns true or false to every proposition P of S S = (A or B) and C I = {A=True, B=False, C=True} I = {A=False, B=True, C=False} ABC True False TrueFalseTrue False True FalseTrueFalse True False All Interpretations

3/19/2003copyright Brian Williams12 Propositional Logic: Semantics The truth of sentence S wrt interpretation I is defined by a composition of boolean operators applied to I: “Not S” is True iff “S” is False Not SS FalseTrue False

3/19/2003copyright Brian Williams13 Propositional Logic: Semantics The truth of sentence S i wrt Interpretation I: “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 S1 and S2S1S2 True FalseTrueFalse True False S1 or S2S1S2 True False TrueFalseTrue False

3/19/2003copyright Brian Williams14 Propositional Logic: Semantics The truth of sentence S i wrt Interpretation I: “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/19/2003copyright 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)]) Interpretation: 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/19/2003copyright Brian Williams16 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)]) Interpretation: 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/19/2003copyright 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)]) Interpretation: 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/19/2003copyright 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 False]) Interpretation: 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/19/2003copyright Brian Williams19 Example: Determining the truth of a sentence (True implies [(False if and only if (True and False)) and (True or False) and True]) Interpretation: 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/19/2003copyright Brian Williams20 Example: Determining the truth of a sentence (True implies [(False if and only if False) and True and True]) Interpretation: 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/19/2003copyright Brian Williams21 Example: Determining the truth of a sentence (True implies [(False if and only if False) and True and True]) Interpretation: 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/19/2003copyright Brian Williams22 Example: Determining the truth of a sentence (True implies [(False implies False ) and (False implies False )) and True and True]) Interpretation: 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/19/2003copyright Brian Williams23 Example: Determining the truth of a sentence (True implies [(not False or False ) and (not False or False )) and True and True]) Interpretation: 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/19/2003copyright Brian Williams24 Example: Determining the truth of a sentence (True implies [(True or False ) and (True or False )) and True and True]) Interpretation: 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/19/2003copyright Brian Williams25 Example: Determining the truth of a sentence (True implies [(True and True) and True and True]) Interpretation: 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/19/2003copyright Brian Williams26 Example: Determining the truth of a sentence (True implies [True and True and True]) Interpretation: 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/19/2003copyright Brian Williams27 Example: Determining the truth of a sentence (True implies True) Interpretation: 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/19/2003copyright Brian Williams28 Example: Determining the truth of a sentence (not True or True) Interpretation: 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/19/2003copyright Brian Williams29 Example: Determining the truth of a sentence (False or True) Interpretation: 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/19/2003copyright Brian Williams30 Example: Determining the truth of a sentence True! Interpretation: 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 If a sentence S evaluates to True in interpretation I, then: I satisfies S I is a Model of S

3/19/2003copyright Brian Williams31 Outline Propositional Logic Syntax Semantics Clausal Reduction Propositional Satisfiability Appendices

3/19/2003copyright Brian Williams32 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/19/2003copyright Brian Williams33 Reduction to Clausal Form: Engine Example (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/19/2003copyright Brian Williams34 Reducing Propositional Formula to Clauses (CNF) See Appendix for Detailed Example: 1) Eliminate IFF and Implies E1 iff E2 => (E1 implies E2) and (E2 implies E1) E1 implies E2 => not E1 or E2 2) Move negations in towards propositions using De Morgan’s Theorem: Not (E1 and E2) => (not E1) or (not E2) Not (E1 or E2) => (not E1) and (not E2) Not (not E1) => E1 3) Move conjunctions out using Distributivity E1 or (E2 and E3) =>(E1 or E2) and (E1 or E3)

3/19/2003copyright Brian Williams35 Outline Propositional Logic Syntax Semantics Clausal Reduction Propositional Satisfiability Backtrack Search Unit Propagation DPLL: Unit Propagation + Backtrack Search Appendices

3/19/2003copyright Brian Williams36 Propositional Clauses form a Constraint Satisfaction Problem Variables:Propositions Domain:{True, False} Constraints:Clauses that must be true Clause(not A or B or E) A disjunction of Literals Literal:Proposition or its negation Positive LiteralB Negative LiteralNot A

3/19/2003copyright Brian Williams37 Propositional Satisfiability An interpretation (truth assignment to all propositions) such that all clauses are satisfied: A clause is satisfied if and only if at least one literal is true. A clause is violated if and only if all literals are false. C1: Not A or B C2: Not C or A C3: Not B or C

3/19/2003copyright Brian Williams38 Satisfiability Testing Procedures Reduce to CNF (Clausal Form) then: 1.Apply systematic, complete procedure Depth-first backtrack search (Davis, Putnam, & Loveland 1961) unit propagation, shortest clause heuristic 2.Apply stochastic, incomplete procedure GSAT (Selman et. al 1993) – see Appendix

3/19/2003copyright Brian Williams39 Outline Propositional Logic Propositional Satisfiability Backtrack Search Unit Propagation DPLL: Unit Propagation + Backtrack Search Appendices

3/19/2003copyright Brian Williams40 Propositional Satisfiability using Backtrack Search 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 F F B C F S S S

3/19/2003copyright Brian Williams41 Propositional Satisfiability using Backtrack Search 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 F F B C FT S u S

3/19/2003copyright Brian Williams42 Propositional Satisfiability using Backtrack Search 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 F F B C FT T C F S S v

3/19/2003copyright Brian Williams43 Propositional Satisfiability using Backtrack Search 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 F F B C FT T C TF S S v

3/19/2003copyright Brian Williams44 Propositional Satisfiability using Backtrack Search 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 F F B C FT T C TF B T C F S S v

3/19/2003copyright Brian Williams45 Propositional Satisfiability using Backtrack Search 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 F F B C FT T C TF B T C FT C F S S v

3/19/2003copyright Brian Williams46 Propositional Satisfiability using Backtrack Search 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 F F B C FT T C TF B T C FT C TF S S S

3/19/2003copyright Brian Williams47 Clausal Backtrack Search: Recursive Definition 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/19/2003copyright Brian Williams48 Outline Propositional Logic Propositional Satisfiability Backtrack Search Unit Propagation DPLL: Unit Propagation + Backtrack Search Appendices

3/19/2003copyright Brian Williams49 Unit Propagation Idea: Arc consistency (AC-3) on binary clauses (not A or B) {F} {T,F} ? {T} {T,F} ? Unit resolution rule: If all literals are false save L, then assign true to L: (not A) (not B) (A or B or C) C

3/19/2003copyright Brian Williams50 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/19/2003copyright Brian Williams51 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/19/2003copyright Brian Williams52 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/19/2003copyright Brian Williams53 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/19/2003copyright Brian Williams54 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/19/2003copyright Brian Williams55 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/19/2003copyright Brian Williams56 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/19/2003copyright Brian Williams57 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/19/2003copyright Brian Williams58 Outline Propositional Logic Propositional Satisfiability Backtrack Search Unit Propagation DPLL: Unit Propagation + Backtrack Search Appendices

3/19/2003copyright Brian Williams59 How Do We Combine Unit Resolution and Back Track Search ? Backtrack Search Assign true or false to an unassigned proposition. Backtrack as soon as a clause is violated. Theory is 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 MAC and Forward Checking:  Perform limited form of inference  apply inference rule after assigning each variable.

3/19/2003copyright Brian Williams60 Propositional Satisfiability by DPLL [Davis, Putnam, Logmann, Loveland, 1962] Initially: Unit propagate. Repeat: 1.Assign true or false to an unassigned proposition. 2.Unit propagate. 3.Backtrack as soon as a clause is violated. 4.Satisfiable if assignment is complete. Propagate: C = F B = F A F Example: C1: Not A or B C2: Not C or A C3: Not B or C S S S

3/19/2003copyright Brian Williams61 Initially: Unit propagate. Repeat: 1.Assign true or false to an unassigned proposition. 2.Unit propagate. 3.Backtrack as soon as a clause is violated. 4.Satisfiable if assignment is complete. Propagate: C = F B = F A F T Propagate: B = T C = T Example: C1: Not A or B C2: Not C or A C3: Not B or C S S S Propositional Satisfiability by DPLL [Davis, Putnam, Logmann, Loveland, 1962]

3/19/2003copyright Brian Williams62 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. A’ = propagate(Phi); 2. If a clause is violated given A’ return(false); 3. Else if all propositions in A’ 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/19/2003copyright Brian Williams63 Satisfiability Testing Procedures Reduce to CNF (Clausal Form) then: Apply systematic, complete procedure 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 Apply stochastic, incomplete procedures GSAT (Selman et. al 1993) Walksat (Selman & Kautz 1993) greedy local search + noise to escape local minima

3/19/2003copyright Brian Williams64 Required Appendices You are responsible for reading and knowing this material: 1. Characteristics of DPLL 2. Local Search using GSAT 3. Reduction to Clausal Form

3/19/2003copyright Brian Williams65

3/19/2003copyright Brian Williams66

3/19/2003copyright Brian Williams67

3/19/2003copyright Brian Williams68 Intuition At low ratios: few clauses (constraints) many assignments easily found At high ratios: many clauses inconsistencies easily detected

3/19/2003copyright Brian Williams69 Fraction of Formulae Unsatisfied Phase Transitions for Different Numbers of Variables

3/19/2003copyright Brian Williams70 Phase transition 2-, 3-, 4-, 5-, and 6-SAT

3/19/2003copyright Brian Williams71 Required Appendices You are responsible for reading and knowing this material: 1. Characteristics of DPLL 2. Local Search using GSAT 3. Reduction to Clausal Form

3/19/2003copyright Brian Williams72 Incremental Repair (min-conflict heuristic) 1. Initialize a candidate solution using “greedy” heuristic – get solution “near” correct one. 2. Select a variable in conflict and assign it a value that minimizes the number of conflicts (break ties randomly). R,G,B GR, G Graph Coloring Initial Domains Different-color constraint V1V1 V2V2 V3V3 Spike Hubble Telescope Scheduler [Minton et al.]

3/19/2003copyright Brian Williams73 GSAT 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.Init: Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses. 3.Pick assignment with fewest violations, 4.End if consistent, Else goto 2

3/19/2003copyright Brian Williams74 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.Init: Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses. 3.Pick assignment with fewest violations, 4.End if consistent, Else goto 2 GSAT

3/19/2003copyright Brian Williams75 C1: Not A or B C2: Not C or Not A C3: or B or Not C Satisfied A True B C False 1.Init: Pick random assignment 2.Check effect of flipping each assignment, counting violated clauses. 3.Pick assignment with fewest violations, 4.End if consistent, Else goto 2 GSAT Problem: Pure hill climbers get stuck in local minima. Solution: Add random moves to get out of minima (WalkSAT)

3/19/2003copyright Brian Williams76 Required Appendices You are responsible for reading and knowing this material: 1. Local Search using GSAT 2. Characteristics of DPLL 3. Reduction to Clausal Form

3/19/2003copyright Brian Williams77 Reduction to Clausal Form: Engine Example (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/19/2003copyright Brian Williams78 Reducing Propositional Formula to Clauses (CNF) 1) Eliminate IFF and Implies E1 iff E2 => (E1 implies E2) and (E2 implies E1) E1 implies E2 => not E1 or E2

3/19/2003copyright Brian Williams79 Eliminate IFF: Engine Example (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/19/2003copyright Brian Williams80 Eliminate Implies: Engine Example (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/19/2003copyright Brian Williams81 Reducing Propositional Formula to Clauses (CNF) 2) Move negations in towards propositions using De Morgan’s Theorem: Not (E1 and E2) => (not E1) or (not E2) Not (E1 or E2) => (not E1) and (not E2) Not (not E1) => E1

3/19/2003copyright Brian Williams82 Move Negations In: Engine Example (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/19/2003copyright Brian Williams83 Reducing Propositional Formula to Clauses (CNF) 3) Move conjunctions out using distributivity E1 or (E2 and E3) =>(E1 or E2) and (E1 or E3)

3/19/2003copyright Brian Williams84 Move Conjunctions Out: Engine Example (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/19/2003copyright Brian Williams85 Move Conjunctions Out: Engine Example (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))

3/19/2003copyright Brian Williams86 Reducing Propositional Formula to Clauses (CNF) 1) Eliminate IFF and Implies E1 iff E2 => (E1 implies E2) and (E2 implies E1) E1 implies E2 => not E1 or E2 2) Move negations in towards propositions using De Morgan’s Theorem: Not (E1 and E2) => (not E1) or (not E2) Not (E1 or E2) => (not E1) and (not E2) Not (not E1) => E1 3) Move conjunctions out using Distributivity E1 or (E2 and E3) =>(E1 or E2) and (E1 or E3)