SAT Solver CS 680 Formal Methods Jeremy Johnson. 2 Disjunctive Normal Form  A Boolean expression is a Boolean function  Any Boolean function can be.

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

1 A B C
Scenario: EOT/EOT-R/COT Resident admitted March 10th Admitted for PT and OT following knee replacement for patient with CHF, COPD, shortness of breath.
Simplifications of Context-Free Grammars
Variations of the Turing Machine
Adders Used to perform addition, subtraction, multiplication, and division (sometimes) Half-adder adds rightmost (least significant) bit Full-adder.
Angstrom Care 培苗社 Quadratic Equation II
AP STUDY SESSION 2.
1
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
David Burdett May 11, 2004 Package Binding for WS CDL.
We need a common denominator to add these fractions.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
Properties of Real Numbers CommutativeAssociativeDistributive Identity + × Inverse + ×
CALENDAR.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt BlendsDigraphsShort.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt RhymesMapsMathInsects.
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Break Time Remaining 10:00.
Factoring Quadratics — ax² + bx + c Topic
Turing Machines.
Table 12.1: Cash Flows to a Cash and Carry Trading Strategy.
PP Test Review Sections 6-1 to 6-6
Bright Futures Guidelines Priorities and Screening Tables
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
Chapter 3 Logic Gates.
LIAL HORNSBY SCHNEIDER
Outline Minimum Spanning Tree Maximal Flow Algorithm LP formulation 1.
Bellwork Do the following problem on a ½ sheet of paper and turn in.
CS 6143 COMPUTER ARCHITECTURE II SPRING 2014 ACM Principles and Practice of Parallel Programming, PPoPP, 2006 Panel Presentations Parallel Processing is.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Copyright © 2013, 2009, 2006 Pearson Education, Inc. 1 Section 5.5 Dividing Polynomials Copyright © 2013, 2009, 2006 Pearson Education, Inc. 1.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
1 RA III - Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Buenos Aires, Argentina, 25 – 27 October 2006 Status of observing programmes in RA.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
Chapter 1: Expressions, Equations, & Inequalities
1..
CONTROL VISION Set-up. Step 1 Step 2 Step 3 Step 5 Step 4.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
Subtraction: Adding UP
: 3 00.
5 minutes.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Types of selection structures
Speak Up for Safety Dr. Susan Strauss Harassment & Bullying Consultant November 9, 2012.
Essential Cell Biology
Converting a Fraction to %
CSE20 Lecture 15 Karnaugh Maps Professor CK Cheng CSE Dept. UC San Diego 1.
Clock will move after 1 minute
PSSA Preparation.
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Physics for Scientists & Engineers, 3rd Edition
Energy Generation in Mitochondria and Chlorplasts
Select a time to count down from the clock above
How to create Magic Squares
1 Decidability continued…. 2 Theorem: For a recursively enumerable language it is undecidable to determine whether is finite Proof: We will reduce the.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Satisfiability and SAT Solvers CS 270 Math Foundations of CS Jeremy Johnson.
Boolean Expression Evaluation CS 270: Math Foundations of CS Jeremy Johnson.
Propositional Calculus: Boolean Algebra and Simplification
Presentation transcript:

SAT Solver CS 680 Formal Methods Jeremy Johnson

2 Disjunctive Normal Form  A Boolean expression is a Boolean function  Any Boolean function can be written as a Boolean expression  Disjunctive normal form (sums of products)  For each row in the truth table where the output is true, write a product such that the corresponding input is the only input combination that is true  Not unique  E.G. (multiplexor function) s x 0 x 1 f

3 Conjunctive Normal Form s x 0 x 1 f

Satisfiability  A formula is satisfiable if there is an assignment to the variables that make the formula true  A formula is unsatisfiable if all assignments to variables eval to false  A formula is falsifiable if there is an assignment to the variables that make the formula false  A formula is valid if all assignments to variables eval to true (a valid formula is a theorem or tautology)

Satisfiability  Checking to see if a formula f is satisfiable can be done by searching a truth table for a true entry  Exponential in the number of variables  Does not appear to be a polynomial time algorithm (satisfiability is NP-complete)  There are efficient satisfiability checkers that work well on many practical problems  Checking whether f is satisfiable can be done by checking if  f is not valid  An assignment that evaluates to false provides a counter example to validity

DNF vs CNF  It is easy to determine if a boolean expression in DNF is satisfiable but difficult to determine if it is valid  It is easy to determine if a boolean expression in CNF is valid but difficult to determine if it is satisfiable  It is possible to convert any boolean expression to DNF or CNF; however, there can be exponential blowup

Propositional Logic in ACL2  In beginner mode and above ACL2S B !>QUERY (thm (implies (and (booleanp p) (booleanp q)) (iff (implies p q) (or (not p) q)))) > Q.E.D. Summary Form: ( THM...) Rules: NIL Time: 0.00 seconds (prove: 0.00, print: 0.00, proof tree: 0.00, other: 0.00) Proof succeeded.

Propositional Logic in ACL2 ACL2 >QUERY (thm (implies (and (booleanp p) (booleanp q)) (iff (xor p q) (or p q)))) … **Summary of testing** We tested 500 examples across 1 subgoals, of which 1 (1 unique) satisfied the hypotheses, and found 1 counterexamples and 0 witnesses. We falsified the conjecture. Here are counterexamples: [found in : "Goal''"] (IMPLIES (AND (BOOLEANP P) (BOOLEANP Q) P) (NOT Q)) -- (P T) and (Q T)

SAT Solvers  Input expected in CNF  Using DIMACS format  One clause per line delimited by 0  Variables encoded by integers, not variable encoded by negating integer  We will use MiniSAT (minisat.se)

MiniSAT Example  (x1 | -x5 | x4) & (-x1 | x5 | x3 | x4) & (-x3 | x4).  DIMACS format  (c = comment, “p cnf” = SAT problem in CNF) c SAT problem in CNF with 5 variables and 3 clauses p cnf

MiniSAT Example  (x1 | -x5 | x4) & (-x1 | x5 | x3 | x4) & (-x3 | x4). This is MiniSat 2.0 beta ============================[ Problem Statistics ]================== | | | Number of variables: 5 | | Number of clauses: 3 | | Parsing time: 0.00 s | …. SATISFIABLE v

Avionics Application  Aircraft controlled by (real time) software applications (navigation, control, obstacle detection, obstacle avoidance …)  Applications run on computers in different cabinets  500 apps  20 cabinets  Apps 1, 2 and 3 must run in separate cabinets  Problem: Find assignment of apps to cabinets that satisfies constraints

Corresponding SAT problem

Constaints in CNF

DIMACS Format

Avionics Example

p cnf c clauses for valid map forall a exists c AC^c_a

Avionics Example c constaints ~AC^c_1 + ~AC^c_2 and ~AC^c_1 + ~AC^c_ c constraint ~AC^c_2 + ~AC^c_

Avionics Example Programs]$./MiniSat_v1.14_linux aircraft assignment ==================================[MINISAT]=================================== | Conflicts | ORIGINAL | LEARNT | Progress | | | Clauses Literals | Limit Clauses Literals Lit/Cl | | ============================================================================== | 0 | | nan | % | ============================================================================== restarts : 1 conflicts : 0 (nan /sec) decisions : 39 (inf /sec) propagations : 50 (inf /sec) conflict literals : 0 ( nan % deleted) Memory used : 1.67 MB CPU time : 0 s SATISFIABLE

Avionics Assignment SAT True indicator variables: 3 = 5*0 + 3 => AC(1,3) 7 = 5*1 + 2 => AC(2,2) 11 = 5*2 + 1 => AC(3,1) 16 = 5*3+1 => AC(4,1) 21 = 5*4+1 => AC(5,1) 26 = 5*5=1 => AC(6,1) 31 = 5*6+1 => AC(7,1) 36 = 5*7+1 => AC(8,1) 41 = 5*8 + 1 => AC(9,1) 46 = 5*9+1 => AC(10,1)

DPLL Algorithm  Tries to incrementally build a satisfying assignment A: V  {T,F} (partial assignment) for a formula  in CNF  A is grown by either  Deducing a truth value for a literal  Whenever all literals except one are F then the remaining literal must be T (unit propagation)  Guessing a truth value  Backtrack when guess (leads to inconsistency) is wrong

DPLL Example OperationAssignFormula

DPLL Example OperationAssignFormula Deduce1

DPLL Example OperationAssignFormula Deduce1

DPLL Example OperationAssignFormula Deduce1 Guess

DPLL Example OperationAssignFormula Deduce1 Guess Deduce Inconsistency

DPLL Example OperationAssignFormula Deduce 11 Guess 3 Deduce 4 Undo 3 Backtrack

DPLL Example OperationAssignFormula Deduce 11 Guess 3 Deduce 4 Undo 3 Assignment found