Lazy Proofs for DPLL(T)-Based SMT Solvers

Slides:



Advertisements
Similar presentations
SMELS: Sat Modulo Equality with Lazy Superposition Christopher Lynch – Clarkson Duc-Khanh Tran - MPI.
Advertisements

Automated Theorem Proving
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Satisfiability modulo the Theory of Bit Vectors
Boolean Satisfiability
50.530: Software Engineering
Satisfiability Modulo Theories (An introduction)
SMT Solvers (an extension of SAT) Kenneth Roe. Slide thanks to C. Barrett & S. A. Seshia, ICCAD 2009 Tutorial 2 Boolean Satisfiability (SAT) ⋁ ⋀ ¬ ⋁ ⋀
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)
Interpolants from Z3 proofs Ken McMillan Microsoft Research TexPoint fonts used in EMF: A A A A A.
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
Proof translation from CVC3 to Hol light Yeting Ge Acsys Mar 5, 2008.
PROOF TRANSLATION AND SMT LIB CERTIFICATION Yeting Ge Clark Barrett SMT 2008 July 7 Princeton.
Willis Lemasters Grant Conklin. Searching a tree recursively one branch at a time, abandoning any branch which does not satisfy the search constraints.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
Interpolants [Craig 1957] G(y,z) F(x,y)
1 Satisfiability Modulo Theories Sinan Hanay. 2 Boolean Satisfiability (SAT) Is there an assignment to the p 1, p 2, …, p n variables such that  evaluates.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
1 Abstraction Refinement for Bounded Model Checking Anubhav Gupta, CMU Ofer Strichman, Technion Highly Jet Lagged.
Using Decision Procedures for Program Verification Christopher Lynch Clarkson University.
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.
SAT Solver Math Foundations of Computer Science. 2 Boolean Expressions  A Boolean expression is a Boolean function  Any Boolean function can be written.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
Logics for Data and Knowledge Representation Propositional Logic: Reasoning Originally by Alessandro Agostini and Fausto Giunchiglia Modified by Fausto.
Boolean Satisfiability and SAT Solvers
CMU, Oct 4 DPLL-based Checkers for Satisfiability Modulo Theories Cesare Tinelli Department of Computer Science The University of Iowa Joint work with.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Introduction to Satisfiability Modulo Theories
Leonardo de Moura Microsoft Research. Is formula F satisfiable modulo theory T ? SMT solvers have specialized algorithms for T.
1 MVD 2010 University of Iowa New York University Comparing Proof Systems for Linear Real Arithmetic Using LFSC Andrew Reynolds September 17, 2010.
Lazy Annotation for Program Testing and Verification Speaker: Chen-Hsuan Adonis Lin Advisor: Jie-Hong Roland Jiang November 26,
Decision methods for arithmetic Third summer school on formal methods Leonardo de Moura Microsoft Research.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
Automated tactics for separation logic VeriML Reconstruct Z3 Proof Safe incremental type checker Certifying code transformation Proof carrying hardware.
Symbolic and Concolic Execution of Programs Information Security, CS 526 Omar Chowdhury 10/7/2015Information Security, CS 5261.
© 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.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Theory-Aided Model Checking of Concurrent Transition Systems Guy Katz, Clark Barrett, David Harel New York University Weizmann Institute of Science.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
AN INTERPOLATING THEOREM PROVER K.L. McMillan Cadence Berkley Labs.
1 Boolean Satisfiability (SAT) Class Presentation By Girish Paladugu.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Finding Conflicting Instances of Quantified Formulas in SMT Andrew Reynolds Cesare Tinelli Leonardo De Moura July 18, 2014.
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
EA C461 Artificial Intelligence
Inference in Propositional Logic (and Intro to SAT)
Inference and search for the propositional satisfiability problem
Gábor Kusper University of Linz RISC Austria
EA C461 – Artificial Intelligence Logical Agent
8/2/2018 4:21 AM Lifting SAT to richer theories: bit-vectors, finite bases, and theory combination Christoph M. Wintersteiger © 2013 Microsoft Corporation.
Solving Linear Arithmetic with SAT-based MC
Introduction to Software Verification
Lecture 2 Propositional Logic
Satisfiability Modulo Theories
Propositional Calculus: Boolean Algebra and Simplification
ECE 667 Synthesis and Verification of Digital Circuits
Logics for Data and Knowledge Representation
Artificial Intelligence: Agents and Propositional Logic.
A Progressive Approach for Satisfiability Modulo Theories
Resolution Proofs for Combinational Equivalence
Methods of Proof Chapter 7, second half.
Verifying Clausal Proofs, DRUPing and Interpolants SAT/SMT Seminar
Presentation transcript:

Lazy Proofs for DPLL(T)-Based SMT Solvers Guy Katz Schloss Dagstuhl, October 2016

Acknowledgements Based on joint work with Clark Barrett, Cesare Tinelli, Andrew Reynolds and Liana Hadarean (FMCAD’16) Stanford University The University of Iowa Synopsys

Producing Checkable Artifacts SMT solvers used in verification & analysis tools Verifying safety-critical systems Increase reliability by producing checkable artifacts Input Query SMT Solver Result 𝑥⋅2>6 𝑥<5 SAT Check Model: 𝑥 = 4

The UNSAT Case No satisfying model exists Input Query SMT Solver Result ? 𝑥⋅2>11 𝑥<5 UNSAT Check Proof Certificate 𝑥⋅2>11 𝑥<5 ⊥

SMT Proofs: Use Cases Increase confidence in verification tools Interpolant generation Skeptical Proof-Assistants (Coq, Isabelle/HOL) Discharge goals using SMT-Solver Reconstruct internal proof from certificate

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

Boolean Resolution The Boolean Resolution rule: A proof of unsatisfiability: Start with input clauses Apply resolution Derive empty clause Can always do this for UNSAT formulas 𝑝 1 ∨ 𝑝 2 ∨…∨ 𝑝 𝑛 ∨𝑐 ~𝑐∨ 𝑞 1 ∨ 𝑞 2 ∨…∨ 𝑞 𝑚 𝑝 1 ∨…∨ 𝑝 𝑛 ∨ 𝑞 1 ∨…∨ 𝑞 𝑚 Heule & Biere. Proofs for Satisfiability Problems. APPA, 2015

The DPLL Architecture An abstract algorithm for solving SAT Incrementally assign variables to true/false Decide assignments Deduce assignments If formula is satisfied, done If a conflict is found, backjump Undo previous decisions, try something else Davis & Putnam. A Computing Procedure for Quantification Theory. JACM, 1960 Davis, Logemann & Loveland. A Machine Program for Theorem Proving. CACM, 1962

Conflict: ~3∨2 Not satisfied by assignment DPLL: Example Input clauses (CNF): 1∨~2, ~1∨~2, 2∨3, ~3∨2 Partial Assignment Formula Conflict Rule Being Applied 1∨~2, ~1∨~2, 2∨3, ~3∨2 Decide 1 𝑑 1∨~2, ~1∨~2, 2∨3, ~3∨2 Propagate ~1∨~2 1 𝑑 , ~2 1∨~2, ~1∨~2, 2∨3, ~3∨2 Propagate (2∨3) 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2 Conflict (~3∨2) 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2 ~3∨2 Explain (2∨3) 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2 2 Explain (~1∨~2) 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2 ~1 Learn (~1) Clause: ~1∨~2 1 is true ⇒2 is false 2 ~3∨2 2∨3 Conflict: ~3∨2 Not satisfied by assignment 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 ~1 Backjump ~1 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 Propagate (1∨~2)

DPLL: Example (cnt’d) 2 ~3∨2 2∨3 Partial Assignment Formula Conflict Rule Being Applied ~1 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 Propagate (1∨~2) ~1, ~2 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 Propagate 2∨3 ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 Conflict ~3∨2 ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 ~3∨2 Explain (2∨3) ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 2 Explain (1∨~2) ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 1 Explain (~1) ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 ⊥ Fail 2 ~3∨2 2∨3

Constructing a Proof Input clauses: 1∨~2, ~1∨~2, 2∨3, ~3∨2 ~3∨2 2∨3 2 ~1, ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2,~1 ~3∨2 Explain (2∨3) 2 Explain (1∨~2) 1 Explain (~1) ⊥ Fail 1 𝑑 , ~2, 3 1∨~2, ~1∨~2, 2∨3, ~3∨2 ~3∨2 Explain (2∨3) 2 Explain (~1∨~2) ~1 Learn (~1) ~3∨2 2∨3 2 ~1∨~2 ~3∨2 2∨3 ~1 2 1∨~2 1 ~1 ⊥

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

Satisfiability Modulo Theories Input: a first order logic formula In general, undecidable Focus on decidable fragments Uninterpreted functions, arithmetic, bitvectors, arrays 𝑔 𝑎 =𝑐 ∧ 𝑓 𝑔 𝑎 ≠𝑓 𝑐 ∨𝑔 𝑎 =𝑑 ∧(𝑐≠𝑑) Is there a model that satisfies the formula?

The DPLL(T) Architecture Arithmetic Uninterpreted Functions Sets SAT Solver Bitvectors Arrays Nieuwenhuis, Oliveras & Tinelli. Solving SAT and SAT Modulo Theories: From an abstract Davis-Putnam-Logemann-Loveland procedure to DPLL(T). JACM, 2006

Adding the Theory Solvers DPLL(T): DPLL + Background theory T T can represent multiple theories Theory atoms mapped to Boolean atoms SAT solver constructs (partial) assignment Theory solver checks if it is T-consistent Theory solvers can: Report conflicts (T-conflict) Propagate literals (T-propagate) Learn new clauses (T-Learn) Justified by Theory Lemmas

Example: Uninterpreted Functions 𝑔 𝑎 =𝑐, 𝑓 𝑔 𝑎 ≠𝑓 𝑐 ∨𝑔 𝑎 =𝑑, 𝑐≠𝑑 1 ~2 3 ~4 Partial Assignment Formula Conflict Rule Being Applied 1, ~2∨3, ~4 Propagate 1 , (~4) 1, ~4 1, ~2∨3, ~4 Decide 1, ~4, ~ 2 𝑑 1, ~2∨3, ~4 T-Conflict (~1∨2) 1, ~4, ~ 2 𝑑 1, ~2∨3, ~4 ~1∨2 Explain (1) 1 is true: 𝑔 𝑎 =𝑐 3 is true: 𝑔 𝑎 =𝑑 4 is false: 𝑐≠𝑑 1, ~4, ~ 2 𝑑 1, ~2∨3, ~4 2 Learn (2) 1 is true: 𝑔 𝑎 =𝑐 Congruence: 𝑓 𝑔 𝑎 =𝑓(𝑐) Contradicts ~2 1, ~4, ~ 2 𝑑 1, ~2∨3, ~4, 2 2 Backjump 1, ~4, 2 1, ~2∨3, ~4, 2 Propagate ~2∨3 1, ~4, 2, 3 1, ~2∨3, ~4, 2 T-Conflict (~1∨~3∨4) Explain 1, ~4, 2, 3 1, ~2∨3, ~4, 2 ⊥ Fail

Example: Uninterpreted Functions 𝑔 𝑎 =𝑐, 𝑓 𝑔 𝑎 ≠𝑓 𝑐 ∨𝑔 𝑎 =𝑑, 𝑐≠𝑑 1 ~2 3 ~4 1, ~4, ~ 2 𝑑 1, ~2∨3, ~4 T-Conflict (~1∨2) 1, ~4, 2, 3 1, ~2∨3, ~4, 2 T-Conflict (~1∨~3∨4) Theory Proof Theory Proof ~1∨~3∨4 ~2∨3 2 ~1∨2 1 ~1∨~2∨4 1 ~2∨4 ~4 ~2 2 ⊥

Proofs with Theory Lemmas Construct refutation tree as before Leaves may be theory lemmas T-solver needs to support a produceProof() method Use sub-proof to justify the lemma Each theory-lemma owned by a specific T-solver Complex lemmas may have multiple steps Invoke produceProof() for each step Combine with Boolean resolution

Example: A Complex Lemma Partial assignment: T-Propagation from uninterpreted functions: T-Propagation from arrays: T-Conflict from uninterpreted functions: The resulting learned clause: ~1: 𝑔 𝑥, 𝑓 𝑥 , 𝑧 𝑓 𝑥 := 𝑥 𝑓 𝑦 ≠𝑔 𝑦, 𝑓 𝑦 , 𝑦 2: 𝑥=𝑦 3: 𝑓(𝑥)=𝑓(𝑦) Cause: 2 4: 𝑧 𝑓 𝑥 := 𝑥 𝑓 𝑦 =𝑦 Cause: 2∧3 1∨~2∨~3∨~4 1∨~2

Example: A Complex Lemma Goal: prove 1∨~2 Uninterpreted functions conflict: 1∨~2∨~3∨~4 Array propagation: 2∧3⇒4 Uninterpreted functions propagation: 2⇒3 Uninterpreted Functions proof Array proof Uninterpreted Functions proof 1∨~2∨~3∨~4 ~2∨~3∨4 1∨~2∨~3 ~2∨3 1∨~2

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

Theory-Specific Proofs For SAT proofs, Boolean Resolution is enough For background theories, need additional rules Proof rules correspond to theory solver’s decision procedure

Uninterpreted Functions Axioms: Reflexivity: 𝑥=𝑥 Symmetry: (𝑥=𝑦)⇒(𝑦=𝑥) Transitivity: (𝑥=𝑦)∧(𝑦=𝑧)⇒(𝑥=𝑧) Congruence: (𝑥=𝑦)⇒(𝑓 𝑥 =𝑓 𝑦 ) Decision procedure: congruence closure Construct equivalence class of terms If two terms are equal, merge their classes Proof rules: symmetry, transitivity and congruence Fontaine, Marion, Merz, Nieto & Tiu. Expressiveness + Automation + Soundness: Towards Combining SMT Solvers and Interactive Proof Assistants. TACAS, 2006

Uninterpreted Functions (cnt’d) Example: 𝑥=𝑦 ∧ 𝑧=𝑓 𝑦 ∧ 𝑓 𝑥 ≠𝑧 𝑥=𝑦 𝑧=𝑓(𝑦) Congruence Symmetry 𝑓 𝑥 =𝑓(𝑦) 𝑓 𝑦 =𝑧 Transitivity 𝑓 𝑥 ≠𝑧 𝑓 𝑥 =𝑧 ⊥

Arrays with Extensionality Axioms: Read-over-Write 1: i≠𝑗⇒ 𝑎 𝑖 ≔𝑥 𝑗 =𝑎 𝑗 Read-over-Write 2: 𝑎 𝑖 ≔𝑥 𝑖 =𝑥 Extensionality: 𝑎≠𝑏⇒∃𝑘.𝑎 𝑘 ≠𝑏[𝑘] NP-complete Decision procedure: similar to congruence closure

Arrays (cnt’d) Example: 𝑖≠𝑗 ∧ 𝑎 𝑗 ≔𝑦 𝑖 =𝑥 ∧(𝑎 𝑖 ≠𝑥) 𝑖≠𝑗 𝑎 𝑗 ≔𝑦 𝑖 =𝑥 𝑎 𝑗 ≔𝑦 𝑖 =𝑥 Read-over-Write 1 𝑎 𝑖 =𝑥 𝑎 𝑖 ≠𝑥 ⊥

Fixed-Width Bitvectors Axioms for: Bit-wise operation: and, not, xor Bitvector arithmetic: +, -, ∗, / Concatenation, shifts NP-complete Decision procedure: Bitblasting, with some word-level reasoning

Fixed-Width Bitvectors (cnt’d) Example: 𝑏 1 ≠ 𝑏 2 ∨ 𝑏 2 ≠10 ∨( 𝑏 1 ≠00) 𝑏 1 = 𝑏 2 𝑏 2 =10 BB BB 𝑏 1 1 = 𝑏 2 1 𝑏 2 1 =1 𝑏 1 =00 Transitivity BB 𝑏 1 1 =1 𝑏 1 1 =0 ⊥ Hadarean, Barrett, Reynolds, Tinelli & Deters. Fine-grained SMT Proofs for the Theory of Fixed-width Bitvectors. LPAR, 2015

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

The Eager Approach When should we prove theory lemmas? Eagerly: when lemma is generated Easy to produce a proof Many lemmas generated during search Not all are needed!

The Lazy Approach No proof production during search Produce proofs on demand When theory lemma encountered in refutation tree Fewer theory proofs generated But, need to redo some theory reasoning

So, Eager or Lazy? Eager: more lemmas, less work for each lemma Lazy: fewer lemmas, each lemma more expensive Can differ between theory solvers! Evaluation: For uninterpreted functions: Lazy For arrays: Lazy

Lazily Proving Lemmas Theory lemmas: Lemmas are disjunctions: ⇒ 𝑇 𝑙 1 ∨ 𝑙 2 ∨…∨ 𝑙 𝑛 To prove a previous lemma: Create a fresh theory solver Assert: ~ 𝑙 1 , ~ 𝑙 2 ,…, ~ 𝑙 𝑛 When ⊥ is derived, call produceProof() T-Propagation 𝑝 1 ∧ 𝑝 2 ⇒ 𝑇 𝑝 3 ⇒ 𝑇 ~ 𝑝 1 ∨~ 𝑝 2 ∨ 𝑝 3 T-Conflict 𝑝 1 ∧ 𝑝 2 ⇒ 𝑇 ⊥ ⇒ 𝑇 ~ 𝑝 1 ∨~ 𝑝 2 T-Learn ⇒ 𝑇 𝑝 1 ∨ 𝑝 2

Storing “Hints” Sometimes a fresh solver isn’t enough Array theory: extensionality 𝑎≠𝑏⇒∃𝑘.𝑎 𝑘 ≠𝑏 𝑘 Need to remember this specific 𝑘 Allow bookkeeping during search

Handling Rewrites Array solver generates a lemma: 𝑏+1≠1⇒ 𝑎 𝑏+1 ≔𝑥 1 =𝑎 1 Bitvector solver performs a rewrite: 𝑏≠0⇒ 𝑎 𝑏+1 ≔𝑥 1 =𝑎 1 Later: ask array solver to prove ℓ 2 Error! ℓ 1 : 𝑇 𝐴𝑋 -valid ℓ 2 : not 𝑇 𝐴𝑋 -valid

Handling Rewrites (cnt’d) Solution: track rewrites Remember a recipe for proving ℓ 2 : Prove ℓ 1 Prove rewrite: 𝑏+1≠1 →(𝑏≠0) Prove rewrites lazily, with lemmas

Agenda Background: SAT Solvers and Proofs SMT Solvers and Proofs Theory-Specific Proofs Lazy Proof Production Experimental Results

Implementation Implemented this technique in CVC4 A state-of-the-art SMT solver, available online Currently supported theories: Uninterpreted functions Arrays with extensionality Fixed-width Bitvectors And combinations thereof… Proofs generated in LFSC format

Generate and Check Proof Evaluation on SMT-LIB Tested relevant families from SMT-LIB: QF_UF, QF_AX, QF_BV QF_UFBV, QF_ABV, QF_AUFBV Benchmark Category Default Solved Time Generate Proof Generate and Check Proof QF_UF 4083 7523 4067 19097 4029 61650 QF_AX 277 450 264 3170 260 3193 QF_BV 20517 49884 20430 67072 17602 132975 QF_UFBV 12 1391 2623 4 170 QF_ABV 4487 16223 4410 19900 4127 22768 QF_AUFBV 31 93 245 30 1751 Symbolic Execution 94 1735 89 4364 71 2348 Total Solved 100% 99% 88%

Eager VS Lazy On average, the lazy approach is: 23% faster for uninterpreted functions 20% faster for arrays Bitvectors: work in progress

Conclusion Proof production increases confidence in SMT solvers An extension to DPLL(T) that supports proofs Extensible, modular and robust The lazy approach: prove only as needed

Next Steps Support additional theory solvers: arithmetic, strings Support quantified formulas Rewrites and preprocessing

Thank You! Questions