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

Slides:



Advertisements
Similar presentations
Exploiting SAT solvers in unbounded model checking
Advertisements

Automated Theorem Proving
Challenges for SAT and QBF Prof. Toby Walsh Cork Constraint Computation Centre University College Cork Ireland
Propositional Satisfiability (SAT) Toby Walsh Cork Constraint Computation Centre University College Cork Ireland 4c.ucc.ie/~tw/sat/
Boolean Satisfiability
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.
Propositional and First Order Reasoning. Terminology Propositional variable: boolean variable (p) Literal: propositional variable or its negation p 
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Effective Propositional Reasoning CSE 473 – Autumn 2003.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Mar, 4, 2015 Slide credit: some slides adapted from Stuart.
Generating Hard Satisfiability Problems1 Bart Selman, David Mitchell, Hector J. Levesque Presented by Xiaoxin Yin.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Willis Lemasters Grant Conklin. Searching a tree recursively one branch at a time, abandoning any branch which does not satisfy the search constraints.
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.
Presented by Ed Clarke Slides borrowed from P. Chauhan and C. Bartzis
GRASP-an efficient SAT solver Pankaj Chauhan. 6/19/ : GRASP and Chaff2 What is SAT? Given a propositional formula in CNF, find an assignment.
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.
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.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
GRASP: A Search Algorithm for Propositional Satisfiability EE878C Homework #2 2002/11/1 KAIST, EECS ICS Lab Lee, Dongsoo.
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]
Satisfiability Introduction to Artificial Intelligence COS302 Michael L. Littman Fall 2001.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
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)
Solvers for the Problem of Boolean Satisfiability (SAT) Will Klieber Aug 31, 2011 TexPoint fonts used in EMF. Read the TexPoint manual before you.
1 Agenda Modeling problems in Propositional Logic SAT basics Decision heuristics Non-chronological Backtracking Learning with Conflict Clauses SAT and.
Non-clausal Reasoning Fahiem Bacchus, Christian Thiffault, Toronto Toby Walsh, UCC & Uppsala (soon UNSW, NICTA, Uppsala)
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. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
CSE 473 Propositional Logic SAT Algorithms Dan Weld (With some slides from Mausam, Stuart Russell, Dieter Fox, Henry Kautz, Min-Yen Kan…) Irrationally.
First-Order Logic and Inductive Logic Programming.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
/425 Declarative Methods - J. Eisner 1 Random 3-SAT  sample uniformly from space of all possible 3- clauses  n variables, l clauses Which are.
CPSC 422, Lecture 21Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 21 Oct, 30, 2015 Slide credit: some slides adapted from Stuart.
Review of Propositional Logic Syntax
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Finding Models for Blocked 3-SAT Problems in Linear Time by Systematical Refinement of a Sub- Model Gábor Kusper Eszterházy Károly.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
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.
A Decision-Making Procedure for Resolution-Based SAT-solvers Eugene Goldberg Cadence Research Labs (USA) SAT-2008, Guangzhou, P.R. China.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
Inference in Propositional Logic (and Intro to SAT)
EA C461 – Artificial Intelligence Logical Agent
First-Order Logic and Inductive Logic Programming
Logical Inference: Through Proof to Truth
Lecture 2 Propositional Logic
ECE 667 Synthesis and Verification of Digital Circuits
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
Methods of Proof Chapter 7, second half.
GRASP-an efficient SAT solver
Presentation transcript:

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

Every morning … I cycle across the River Lee in Cork … And see this rather drab house …

Every morning … I read the plaque on the wall of this house … Dedicated to the memory of George Boole … Professor of Mathematics at Queens College (now University College Cork)

George Boole ( ) Boolean algebra The Mathematical Analysis of Logic, Cambridge, 1847 The Calculus of Logic, Cambridge and Dublin Mathematical journal, vol. 3, 1848 Reduced propositional logic to algebraic manipulations

George Boole ( ) Boolean algebra The Mathematical Analysis of Logic, Cambridge, 1847 The Calculus of Logic, Cambridge and Dublin Mathematical journal, vol. 3, 1848 Reduced propositional logic to algebraic manipulations

Outline What is SAT? How do we solve SAT? Why is SAT important?

Propositional logic Long history Aristotle Leibnitz Boole Foundation for formalizing deductive reasoning Used extensively to automate such reasoning in Artificial Intelligence

A diplomatic problem As chief of staff, you are to sent out invitations to the embassy ball. The ambassador instructs you to invite Peru or exclude Qatar. The vice-ambassador wants you to invite Qatar or Romania or both. A recent diplomatic incidents means that you cannot invite both Romania and Peru Who do you invite?

A diplomatic problem As chief of staff, you are to sent out invitations to the embassy ball. The ambassador instructs you to invite Peru or exclude Qatar. The vice-ambassador wants you to invite Qatar or Romania or both. A recent diplomatic incidents means that you cannot invite both Romania and Peru Who do you invite? P v -Q Q v R -(R & P)

A diplomatic problem As chief of staff, you are to sent out invitations to the embassy ball. The ambassador instructs you to invite Peru or exclude Qatar. The vice-ambassador wants you to invite Qatar or Romania or both. A recent diplomatic incidents means that you cannot invite both Romania and Peru Who do you invite? P v -Q Q v R -(R & P) P,Q,-R or -P,-Q,R

Propositional satisfiability (SAT) Given a propositional formula, does it have a “model” (satisfying assignment)? 1st decision problem shown to be NP- complete Usually focus on formulae in clausal normal form (CNF)

Clausal Normal Form Formula is a conjunction of clauses C1 & C2 & … Each clause is a disjunction of literals L1 v L2 v L3, … Empty clause contains no literals (=False) Unit clauses contains single literal Each literal is variable or its negation P, -P, Q, -Q, …

Clausal Normal Form k-CNF Each clause has k literals 3-CNF NP-complete Best current complete methods are exponential 2-CNF Polynomial (indeed, linear time)

Converting to CNF Eliminate iff and implies P iff Q => P implies Q, Q implies P P implies Q => -P v Q Push negation down -(P & Q) => -P v -Q -(P v Q) => -P & -Q

Converting to CNF Clausify using De Morgan’s laws E.g. P v (Q & R) => (P v Q) & (P v R) In worst case, formula may grow exponentially in size Can introduce new literals to prevent this blow up

How do we solve SAT? Systematic methods Truth tables Davis Putnam procedure Local search methods GSAT WalkSAT Tabu search, SA, … Exotic methods DNA, quantum computing,

Truth tables Enumerate all possible truth assignments P Q R C1=P v Q C2=-Q v -R C1&C2 T T T T F F T T F T T T T F T T T T T F F …

Davis Putnam procedure Introduced by Davis & Putnam in 1960 Resolution rule required exponential space Modified by Davis, Logemann and Loveland in 1962 Resolution rule replaced by splitting rule Trades space for time Modified algorithm usually inaccurately called Davis Putnam procedure

Davis Putnam procedure Consider (X or Y) & (-X or Z) & (-Y or Z) & … Basic idea Try X=true

Davis Putnam procedure Consider (X or Y) & (-X or Z) & (-Y or Z) & … Basic idea Try X=true Remove clauses which must be satisfied

Davis Putnam procedure Consider (-X or Z) & (-Y or Z) & … Basic idea Try X=true Remove clauses which must be satisfied Simplify clauses containing -X

Davis Putnam procedure Consider ( Z) & (-Y or Z) & … Basic idea Try X=true Remove clauses which must be satisfied Simplify clauses containing -X Can now deduce that Z must be true

Davis Putnam procedure Consider ( Z) & (-Y or Z) & … Basic idea Try X=true Remove clauses which must be satisfied Simplify clauses containing -X Can now deduce that Z must be true At any point, may have to backtrack and try X=false instead

Procedure DPLL(C) (SAT) if C={} then SAT (Empty) if empty clause in C then UNSAT (Unit) if unit clause, {l} then DPLL(C[l/True]) (Split) if DPLL(C[l/True]) then SAT else DPLL(C[l/False])

Procedure DPLL(C) (Pure) if l is pure in C then DPLL(C[l/True]) (Taut) if l v -l in C then DPLL(C - {l v -l}) Neither rules are needed for completeness and do not tend to improve solving efficiency

Procedure DPLL(C) (SAT) if C={} then SAT (Empty) if empty clause in C then UNSAT (Unit) if unit clause, {l} then DPLL(C[l/True]) (Split) if DPLL(C[l/True]) then SAT else DPLL(C[l/False]) Unit rule not needed for completeness but improves efficiency greatly

Procedure DPLL(C) Non-deterministic Which literal do we branch upon? Good choice can reduce solving time significantly Popular heuristics include: MOM’s (most occurrences in minimal size clauses) Literal that gives “most” unit propagation

Procedure DPLL(C) Other refinements Non-chronological backtracking (conflict directed backjumping, …) Clause learning (at end of branch, identify cause for failure and add this as an additional clause) Fast data structures (two literal watching for fast unit propagation)

Procedure DPLL(C) Space complexity O(n) Time complexity O(1.618^n) Average and best case often much better than this worst case (see next lecture)

Brief History of DP 1st generation (1960s) DP, DLL 2nd generation (1980s/90s) POSIT, Tableau, … 3rd generation (mid 1990s) SATO, satz, grasp, … 4th generation (2000s) Chaff, BerkMin, … 5th generation? Actual Japanese 5th Generation Computer (from FGC Museum archive)

Brief History of DP 1st generation (1960s) DP, DLL 2nd generation (1980s/90s) POSIT, Tableau, … 3rd generation (mid 1990s) SATO, satz, grasp, … 4th generation (2000s) Chaff, BerkMin, … 5th generation? Will it need a paradigm shift? Actual Japanese 5th Generation Computer (from FGC Museum archive)

Moore’s Law Are we keeping up with Moore’s law? Number of transistors doubles every 18 months Number of variables reported in random 3SAT experiments doubles every 3 or 4 years  We’re falling behind each year!  Even though we’re getting better performance due to Moore’s law!

Local search for SAT Repair based methods Instead of building up a solution, take complete assignment and flip variable to satisfy “more” clauses Cannot prove UNSATisfiability Often will solve MAX-SAT problem

Papadimitrou’s procedure T:= random truth assignment Repeat until T satisfies all clauses v := variable in UNSAT clause T := T with v’s value flipped Semi-decision procedure Solves 2-SAT in expected O(n^2) time

GSAT [Selman, Levesque, Mitchell AAAI 92] Repeat MAX-TRIES times or until clauses satisfied T:= random truth assignment Repeat MAX-FLIPS times or until clauses satisfied v := variable which flipping maximizes number of SAT clauses T := T with v’s value flipped Adds restarts and greediness Sideways flips important (large plateaus to explore)

WalkSAT [Selman, Kautz, Cohen AAAI 94] Repeat MAX-TRIES times or until clauses satisfied T:= random truth assignment Repeat MAX-FLIPS times or until clauses satisfied c := unsat clause chosen at random v:= var in c chosen either greedily or at random T := T with v’s value flipped Focuses on UNSAT clauses

Novelty [McAllester, Selman, Kautz AAAI 97] Repeat MAX-TRIES times or until clauses satisfied T:= random truth assignment Repeat MAX-FLIPS times or until clauses satisfied c := unsat clause chosen at random v:= var in c chosen greedily If v was last var in clause flipped and rand(1)<p then v:= var in c with 2nd highest score T := T with v’s value flipped Encourages diversity (like Tabu search)

Other local search methods Simulated annealing Tabu search Genetic algorithms Hybrid methods Combine best features of systematic methods (eg unit propagation) and local search (eg quick recovery from failure)

Exotic methods Quantum computing DNA computing Ant computing …

Beyond the propositional Linear 0/1 inequalities Quantified Boolean satisfiability Stochastic satisfiability Modal satisfiability …

Linear 0/1 inequalities Constraints of the form: Sum ai. Xi >= c SAT can easily be expressed as linear 0/1 problem X v -Y v Z => X + (1-Y) + Z >= 1 …

Linear 0/1 inequalities Often good for describing problems involving arithmetic Counting constraints Objective functions Solution methods Complete Davis-Putnam like methods Local search methods like WalkSAT(PB)

Quantified Boolean formulae Propositional SAT can be expressed as: Exists P, Q, R. (P v Q) & (-Q v R) & … Can add universal quantifiers: Forall P. Exists Q, R. (P v Q) & (-Q v R) &.. Useful in formal methods, conditional planning …

Quantified Boolean formulae SAT of QBF is PSPACE complete Can be seen as game Existential quantifiers trying to make it SAT Universal quantifiers trying to make it UNSAT Solution methods Extensions of the DPLL procedure Local search methods just starting to appear

Stochastic satisfiability Randomized quantifier in addition to the existential With prob p, Q is True With prob (1-p), Q is False Can we satisfy formula in some fraction of possible worlds? Useful for modelling uncertainty present in real world (eg planning under uncertainty)

Conclusions Defined propositional SAT Complete methods Davis Putnam, DPLL, … Local search procedures GSAT, WalkSAT, Novelty, … Extensions