Non-clausal Reasoning Fahiem Bacchus, Christian Thiffault, Toronto Toby Walsh, UCC & Uppsala (soon UNSW, NICTA, Uppsala)

Slides:



Advertisements
Similar presentations
Exploiting SAT solvers in unbounded model checking
Advertisements

Automated Theorem Proving
Hybrid BDD and All-SAT Method for Model Checking Orna Grumberg Joint work with Assaf Schuster and Avi Yadgar Technion – Israel Institute of Technology.
Boolean Satisfiability
Propositional Satisfiability (SAT) Toby Walsh Cork Constraint Computation Centre University College Cork Ireland 4c.ucc.ie/~tw/sat/
Time-Space Tradeoffs in Resolution: Superpolynomial Lower Bounds for Superlinear Space Chris Beck Princeton University Joint work with Paul Beame & Russell.
Presented by Monissa Mohan 1.  A highly optimized BCP algorithm  Two watched literals  Fast Backtracking  Efficient Decision Heuristic  Focused on.
Chaff: Engineering an Efficient SAT Solver Matthew W.Moskewicz, Concor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik Princeton University Presenting:
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 
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
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.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View SAT.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
1/30 SAT Solver Changki PSWLAB SAT Solver Daniel Kroening, Ofer Strichman.
Abstract Answer Set Solver. Todolist Print the rules of Fig 1.
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
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.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Boolean Satisfiability Solvers Wonhong Nam
1 Boolean Satisfiability in Electronic Design Automation (EDA ) By Kunal P. Ganeshpure.
Heuristics for Efficient SAT Solving As implemented in GRASP, Chaff and GSAT.
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.
Efficient SAT Solving for Non- clausal Formulas using DPLL, Graphs, and Watched-cuts Himanshu Jain Edmund M. Clarke.
1 Satisfiability Checking of Non-clausal Formulas using General Matings Himanshu Jain Constantinos Bartzis Edmund Clarke Carnegie Mellon University.
Methods of Proof Chapter 7, second half.
State-of-the-art in SAT solvers
GRASP SAT solver Presented by Constantinos Bartzis Slides borrowed from Pankaj Chauhan J. Marques-Silva and K. Sakallah.
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.
SAT Algorithms in EDA Applications Mukul R. Prasad Dept. of Electrical Engineering & Computer Sciences University of California-Berkeley EE219B Seminar.
1 Abstraction Refinement for Bounded Model Checking Anubhav Gupta, CMU Ofer Strichman, Technion Highly Jet Lagged.
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.
Penn ESE 535 Spring DeHon 1 ESE535: Electronic Design Automation Day 21: April 21, 2008 Modern SAT Solvers ({z}Chaff, GRASP,miniSAT)
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Boolean Satisfiability and SAT Solvers
Quantified Formulas - Decision Procedure Daniel Kroening, Ofer Strichman Presented by Changki Hong 07 NOV 08.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
INTRODUCTION TO ARTIFICIAL INTELLIGENCE COS302 MICHAEL L. LITTMAN FALL 2001 Satisfiability.
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.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
SAT 2009 Ashish Sabharwal Backdoors in the Context of Learning (short paper) Bistra Dilkina, Carla P. Gomes, Ashish Sabharwal Cornell University SAT-09.
© 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.
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
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. 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.
CS137: Electronic Design Automation
Hybrid BDD and All-SAT Method for Model Checking
Inference and search for the propositional satisfiability problem
Recovering and Exploiting Structural Knowledge from CNF Formulas
ECE 667 Synthesis and Verification of Digital Circuits
Artificial Intelligence: Agents and Propositional Logic.
Decision Procedures An Algorithmic Point of View
Methods of Proof Chapter 7, second half.
Solving Non-clausal Formulas with DPLL search
GRASP-an efficient SAT solver
Presentation transcript:

Non-clausal Reasoning Fahiem Bacchus, Christian Thiffault, Toronto Toby Walsh, UCC & Uppsala (soon UNSW, NICTA, Uppsala)

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, 1848 Reduce 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, 1848 Reduce propositional logic to algebraic manipulations

How do we automate reasoning with propositional formulae?

Propositional SATisfiability Rapid progress being made 10 years ago, < 50 vars Today, > 1000 vars Algorithmic advances Learning Watched literals.. Heuristic advances VSIDS branching

Propositional SATisfiability Efficient implementations Chaff, Berkmin, Forklift, … SAT competition has new winner almost every year Practical applications Hardware verification Planning …

SAT folklore Need to solve in CNF Everything is a clause Efficient reasoning Optimize code with simple data structures … Effective reasoning Conversion into CNF does not hinder unit propagation

Overturning SAT folklore Deciding arbitrary Boolean formulae Without converting into CNF Efficient reasoning Raw speed as good as optimized CNF solvers Effective reasoning More inference than unit propagation Exploit structure More exotic gates, …

Davis Putnam procedure DPLL(S) if S empty then SAT if S contains {} then UNSAT if S contains unit, l then DPLL(S u {l}) else chose literal, l if DPLL(S u {l}) then SAT else DPLL(S u {-l})

Unit Propagation If the formula has a unit clause then the literal in that clause must be true Set the literal to true and reduce the formula. Unit propagation is the most commonly used type of constraint propagation One of the most important parts of current SAT solvers

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g)

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) a=true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) a=true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) a=true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) a=true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) b=false

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) b=false

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) b=false

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) c = true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) c = true

Unit Propagation (a) (-a, b, c) (-b) (a, d, e) (-c, d, g) c = true

Implementing Unit Propagation UP is main (often only) inference rule applied at each search node. Performing UP occupies most of the time in these solvers. More efficient implementations of UP has been one of the recent advances.

Implementing Unit Propagation Most DPLL solvers do not build an explicit representation of the reduced formula Too expensive in time and space to do this. Rather they keep original formula and mark the changes made All changes generated by UP undone when we backtrack.

Tableau [Crawford and Auton 95] We number the variables and clauses. Each variable has a field to store its current value, true, false or unvalued the list of clauses it appears positively in the list of clauses it appears negatively in Each clause has a list of its literals a flag to indicate whether or not it is satisfied the number of unvalued literals it contains

Tableau [Crawford and Auton 95] Unit propagated literal put on a stack pop the literal on top of the stack mark the variable with the appropriate value. mark each clause it appears positively in as satisfied. for each clause it appears negatively in if the clause is not already satisfied decrement the clause’s counter if the counter is equal to 1, the clause is unit find the single unvalued literal in the clause and add that literal to the UP stack. remember all changes so that they can be undone on backtrack.

Watch literals [SATO, Chaff] Tableau’s technique requires visiting each clause a variable appears in when we value a variable. When clause learning is employed, and 100,000’s of long new clauses are added to the original formula this becomes slow. The watch literal technique is more efficient.

Watch literals [SATO, Chaff] For each clause, pick two literals to watch. At least one of these literals must be false for the clause to be unit. For each variable instead of lists of all of the clauses it appears in positively and negatively, we only have lists of the clauses it is a watch for. reduces the total size of these lists from O(kn) to O(n)

Watch literals [SATO, Chaff] When we assign a value to a variable we Ignore the clauses it watches positively For each clause it watches negatively, we search the clause: if we find an unvalued literal or a true literal not equal to the other watch we replace this literal the watch otherwise the clause is unit and we UP the other watch literal if it is not already true. On backtrack we do nothing! The new watch literals retain the property that at least one of them must become false if the clause is to become unit.

Solving non-CNF formulae Convert into CNF Use efficient DPLL solver like Chaff Adapt DPLL solver to reason with non-CNF Exploit structure Permit complex gates (eg counting, XOR,..)

Encoding into CNF Most common (and relatively efficient?) is that of [Tseitin 1970]. Recusively converts a formula by adding a new variable for every subformula. Linear space

Tseitin Encoding A  (C & D)

1.(~V 1, C) 2.(~V 1, D) 3.(~C,~D,V 1 ) Tseitin Encoding A  (C & D) V1  (C & D) (~V1, C), (~V1, D), (~C,~D,V1)

1.(~V 1, C) 2.(~V 1, D) 3.(~C,~D,V 1 ) 4. (~V2, ~A, V1) 5.(A, V2) 6. (~V1, V2) Tseitin Encoding A  (C & D) V1  (C & D) (~V1, C), (~V1, D), (~C,~D,V1) V2  (A  V1) (~V2,~A,V1), (A, V2), (~V1, V2)

1.(~V 1, C) 2.(~V 1, D) 3.(~C,~D,V 1 ) 4. (~V2, ~A, V1) 5.(A, V2) 6.(~V1, V2) 7. (V2) Tseitin Encoding A  (C & D) V1  (C & D) (~V1, C), (~V1, D), (~C,~D,V1) V2  (A  V1) (~V2,~A,V1), (A, V2), (~V1, V2)

Disadvantage of CNF Structural information is lost Flattens formulae into clauses. In a Boolean circuit Which variables are inputs? Which are internal wires? … Additional variables are added. Potentially increases the size of the DPLL search.

Structural Information Not all structural information can be recovered [Lang & Marquis, 1989]. Recovering structural information can improve performance [EqSatZ, LSAT]. Why lose this information in the first place? In addition, we can exploit more complex gates

Extra Variables Potentially “increase” search space Do not branch on any on the newly introduced “subformula” variables. Theoretically this can increase exponentially the size of smallest DPLL proof [Jarvisalo et al. 2004] Empirically solvers restricted in this way can perform poorly

Extra Variables The alternative is unrestricted branching. However, with unrestricted branching, a CNF solver can waste a lot of time branching on variables that have become “irrelevant”.

Irrelevant Variables A  (C & D) A=false formula satisfied

1. (~V 1, C) 2. (~V 1, D) 3. (~C,~D,V 1 ) 4. (~V 2, ~A,V 1 ) 5. (A,V 2 ) 6. (~V 1,V 2 ) 7. (V 2 ) 8. (~A) Solver must still determine that the remaining clauses are SAT Irrelevant Variables A  (C & D) V1  (C & D) V2  (A  V1)

Converting to CNF is Unnecessary Search can be performed on the original formula. This has been noted in previous work on circuit based solvers, e.g. [Ganai et al. 2002] Reasoning with the original formula may permit other efficiencies E.g. exploiting structure, & complex gates

DPLL on formulae View formulae as DAGs Every node has a label (True/ False/ Unassigned) Branch on the truth value of any unassigned node Use Boolean logic to propagate truth values to neighbouring nodes Contradiction when node is labeled both True and False Find consistent labeling with truth values that assigns True to root (SAT) Or exhaust all possibilities (UNSAT)

\/  xor A B & CD True False \/ & CD 

Labeling  unit propagation Labeling a node  assigning a truth value to corresponding var in CNF encoding Propagating labels in the DAG  unit propagation in the CNF encoding

Learning Once a contradiction is detected a conflict clause can be learned set of impossible node assignments can use 1-UIP scheme (as in CNF solvers) Learned clauses stored and used to unit propagate node truth values

Complex gates Gates can have arbitrary degree n-ary AND, n-ary OR, … Gates can be complicated Boolean functions n-ary XOR (which requires exponential number of CNF clauses) cardinality gates (at least one, k out of n,..)

Label propagation Use lazy data structures as in CNF solvers For example. assign one child as a true watch for an AND gate Don’t check if AND gate can be labeled true until its true watch becomes true Some benchmarks have AND gates with thousands of children No intrinsic loss of efficiency in using the DAG over CNF.

Structure based optimizations We can also exploit the extra structural information the DAG provides Two such optimizations Don’t care propagation to deal with irrelevant subformulae Conflict clause reduction

Don’t Care labeling Add a third “truth” value to the DAG: “don’t care” A node C is don’t care wrt a particular parent P If its truth value can no longer affect the truth value of P nor any of its P siblings. Or P is don’t care. A node C is don’t care if it is don’t care wrt to all of its parents No need to branch on don’t cares!

Don’t Care labeling Assign a don’t care watch parent for each node. When P is labeled, C can becom don’t care wrt to its watch parent P If C becomes don’t care wrt to its don’t care watch we look for another watch. If we can’t find one we know, C has become don’t care

\/  xor B & CD True False \/ & CD  Don’t care AA xor B

Conflict Clause Reductions If one learns (L1,L2,...) and one has (~L1, L2) then we can reduce the conflict clause (~L1,L2) resolves with (L1,L2,...) to give (L2,...) Result subsumes the original conflict clause In CNF, we would have to search the clause database to detect this situation Probably not going to be effective

Conflict Clause Reductions Suppose P is an AND node, and C is a child Then ~C implies ~P If we have the conflict clause: (~P,~C,X,…) This reduces to (~P,X,…) Equivalent to a resolution step against (C,~P)

Conflict Clause Reductions When conflict clause generated Search neighbours in DAG for such reductions More useful on “shorter” clauses Experimentally found it only worth looking for such reductions on clauses of length 100 or less

Empirical Results. We compared with Zchaff Tried to isolate impact of CNF v non-CNF Made the two solvers as close as possible Same magic numbers (e.g., clause database cleanup criteria, restart intervals etc.) Same branching heuristics Expect similar improvements could be obtained with others CNF solvers

Empirical Results caveats Lack of non-clausal benchmarks Hope SAT-05 competition will include non- CNF Benchmarks we did obtain had already been transformed into simpler formulas No complex XOR or IFF gates

FVP-UNSAT-2.0 (Velev) Time

FVP-UNSAT-2.0 Decisions

FVP-UNSAT-2.0 Don’t Cares

FVP-UNSAT-2.0 Clause Reduction

Other Series

Conclusions No intrinsic reason to convert to CNF Many other structure based optimizations remain to be investigated Branching heuristics Non-clausal conflicts More complex gates …