© 2015 Carnegie Mellon University Building Program Verifiers from Compilers and Theorem Provers Software Engineering Institute Carnegie Mellon University.

Slides:



Advertisements
Similar presentations
Model Checking Base on Interoplation
Advertisements

The behavior of SAT solvers in model checking applications K. L. McMillan Cadence Berkeley Labs.
Exploiting SAT solvers in unbounded model checking
Quantified Invariant Generation using an Interpolating Saturation Prover Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
Exploiting SAT solvers in unbounded model checking K. L. McMillan Cadence Berkeley Labs.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
© 2013 Carnegie Mellon University UFO: From Underapproximations to Overapproximations and Back! Arie Gurfinkel (SEI/CMU) with Aws Albarghouthi and Marsha.
50.530: Software Engineering Sun Jun SUTD. Week 10: Invariant Generation.
Proofs from SAT Solvers Yeting Ge ACSys NYU Nov
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
© Anvesh Komuravelli Spacer Automatic Abstraction in SMT-Based Unbounded Software Model Checking Anvesh Komuravelli Carnegie Mellon University Joint work.
© Anvesh Komuravelli Quantified Invariants in Rich Domains using Model Checking and Abstract Interpretation Anvesh Komuravelli, CMU Joint work with Ken.
© 2010 Carnegie Mellon University B OXES : A Symbolic Abstract Domain of Boxes Arie Gurfinkel and Sagar Chaki Software Engineering Institute Carnegie Mellon.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
© Anvesh Komuravelli IC3/PDR Overview of IC3/PDR Anvesh Komuravelli Carnegie Mellon University.
© 2015 Carnegie Mellon University The SeaHorn Verification Framework Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie.
Panel on Decision Procedures Panel on Decision Procedures Randal E. Bryant Lintao Zhang Nils Klarlund Harald Ruess Sergey Berezin Rajeev Joshi.
© 2013 Carnegie Mellon University Academy for Software Engineering Education and Training, 2013 Session Architect: Tony Cowling Session Chair: Nancy Mead.
© 2012 Carnegie Mellon University UFO: Verification with Interpolants and Abstract Interpretation Arie Gurfinkel and Sagar Chaki Software Engineering Institute.
© 2015 Carnegie Mellon University Property Directed Polyhedral Abstraction Nikolaj Bjørner and Arie Gurfinkel VMCAI 2015.
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:
Revisiting Generalizations Ken McMillan Microsoft Research Aws Albarghouthi University of Toronto.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
© 2011 Carnegie Mellon University Binary Decision Diagrams Part Bug Catching: Automated Program Verification and Testing Sagar Chaki September.
Plan for today Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Nikolaj Bjørner Microsoft Research Lecture 3. DayTopicsLab 1Overview of SMT and applications. SAT solving, Z3 Encoding combinatorial problems with Z3.
© 2011 Carnegie Mellon University Should-Cost: A Use for Parametric Estimates Additional uses for estimation tools Presenters:Bob Ferguson (SEMA) Date:November.
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Formal Verification Group © Copyright IBM Corporation 2008 IBM Haifa Labs SAT-based unbounded model checking using interpolation Based on a paper “Interpolation.
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Invisible Invariants: Underapproximating to Overapproximate Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
On Solving Presburger and Linear Arithmetic with SAT Ofer Strichman Carnegie Mellon University.
Ofer Strichman, Technion Deciding Combined Theories.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Deciding a Combination of Theories - Decision Procedure - Changki pswlab Combination of Theories Daniel Kroening, Ofer Strichman Presented by Changki.
© 2015 Carnegie Mellon University Interpolating Property Directed Reachability Software Engineering Institute Carnegie Mellon University Pittsburgh, PA.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Ethan Jackson, Nikolaj Bjørner and Wolfram Schulte Research in Software Engineering (RiSE), Microsoft Research 1. A FORMULA for Abstractions and Automated.
Incremental formal verification of hardware Hana Chockler Alexander Ivrii Arie Matsliah Shiri Moran Ziv Nevo IBM Research - Haifa.
© 2014 Carnegie Mellon University Synthesizing Safe Bit-Precise Invariants Arie Gurfinkel (SEI / CMU) Anton Belov (UCD / Synopsys) Joao Marques-Silva (UCD)
Predicate Abstraction. Abstract state space exploration Method: (1) start in the abstract initial state (2) use to compute reachable states (invariants)
Author Software Engineering Institute
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Nikolaj Bjørner Microsoft Research DTU Winter course January 2 nd 2012 Organized by Flemming Nielson & Hanne Riis Nielson.
© 2015 Carnegie Mellon University Parametric Symbolic Reachability Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
SAT-Based Model Checking Without Unrolling Aaron R. Bradley.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Complexity 24-1 Complexity Andrei Bulatov Interactive Proofs.
© Anvesh Komuravelli Spacer Compositional Verification of Procedural Programs using Horn Clauses over Integers and Arrays Anvesh Komuravelli work done.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
© Anvesh Komuravelli Spacer Model Checking with Proofs and Counterexamples Anvesh Komuravelli Carnegie Mellon University Joint work with Arie Gurfinkel,
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Building Program Verifiers from Compilers and Theorem Provers
Inference and search for the propositional satisfiability problem
Solving Constrained Horn Clauses by Property Directed Reachability
Interpolating Property Directed Reachability
SMT-Based Verification of Parameterized Systems
Solving Linear Arithmetic with SAT-based MC
Property Directed Reachability
Parametric Symbolic Reachability
Introduction to Software Verification
Lifting Propositional Interpolants to the Word-Level
Inferring Simple Solutions to Recursion-free Horn Clauses via Sampling
Property Directed Reachability with Word-Level Abstraction
Scalability in Model Checking
Verifying Clausal Proofs, DRUPing and Interpolants SAT/SMT Seminar
Presentation transcript:

© 2015 Carnegie Mellon University Building Program Verifiers from Compilers and Theorem Provers Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Arie Gurfinkel based on joint work with Teme Kahsai, Jorge A. Navas, Anvesh Komuravelli, and Nikolaj Bjorner

2 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Copyright 2015 Carnegie Mellon University This material is based upon work funded and supported by the Department of Defense under Contract No. FA C-0003 with Carnegie Mellon University for the operation of the Software Engineering Institute, a federally funded research and development center. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the United States Department of Defense. NO WARRANTY. THIS CARNEGIE MELLON UNIVERSITY AND SOFTWARE ENGINEERING INSTITUTE MATERIAL IS FURNISHED ON AN “AS-IS” BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. This material has been approved for public release and unlimited distribution. This material may be reproduced in its entirety, without modification, and freely distributed in written or electronic form without requesting formal permission. Permission is required for any other use. Requests for permission should be directed to the Software Engineering Institute at DM

3 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University The Lab Download SeaHorn v rc2 (Optionally) If you need a virtual machine, see instructions at: Clone for exampleshttp://github.com/seahorn/seahorn-tutoral PLEASE DO THIS BEFORE THE LAB For THIS lecture, additional material at

4 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Constrained Horn Clauses (CHC) A Constrained Horn Clause (CHC) is a FOL formula of the form 8 V. (Á Æ p 1 [X 1 ] Æ…Æ p n [X n ]  h[X]), where A is a background theory (e.g., Linear Arithmetic, Arrays, Bit-Vectors, or combinations of the above) Á is a constrained in the background theory A p 1, …, p n, h are n-ary predicates p i [X] is an application of a predicate to first-order terms

5 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University CHC Terminology Ruleh[X] à p 1 [X 1 ],…, p n [X n ], Á. Queryfalse à p 1 [X 1 ],…, p n [X n ], Á. Facth[X] à Á. Linear CHCh[X] à p[X 1 ], Á. Non-Linear CHC h[X] à p 1 [X 1 ],…, p n [X n ], Á. for n > 1 head body constraint

6 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Example Horn Encoding

7 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University CHC Satisfiability A model of a set of clauses ¦ is an interpretation of each predicate p i that makes all clauses in ¦ valid A set of clauses is satisfiable if it has a model, and is unsatisfiable otherwise A model is A-definable, it each p i is definable by a formula à i in A In the context of program verification a program satisfies a property iff corresponding CHCs are satisfiable verification certificates correspond to models counterexamples correspond to derivations of false

8 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University SOLVING CHC WITH SMT

9 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3, PDR, and Friends (1) IC3: A SAT-based Hardware Model Checker Incremental Construction of Inductive Clauses for Indubitable Correctness A. Bradley: SAT-Based Model Checking without Unrolling. VMCAI 2011 PDR: Explained and extended the implementation Property Directed Reachability N. Eén, A. Mishchenko, R. K. Brayton: Efficient implementation of property directed reachability. FMCAD 2011 PDR with Predicate Abstraction (easy extension of IC3/PDR to SMT) A. Cimatti, A. Griggio, S. Mover, St. Tonetta: IC3 Modulo Theories via Implicit Predicate Abstraction. TACAS 2014 J. Birgmeier, A. Bradley, G. Weissenbacher: Counterexample to Induction- Guided Abstraction-Refinement (CTIGAR). CAV 2014

10 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3, PDR, and Friends (2) GPDR: Non-Linear CHC with Arithmetic constraints Generalized Property Directed Reachability K. Hoder and N. Bjørner: Generalized Property Directed Reachability. SAT 2012 SPACER: Non-Linear CHC with Arithmetic fixes an incompleteness issue in GPDR and extends it with under- approximate summaries A. Komuravelli, A. Gurfinkel, S. Chaki: SMT-Based Model Checking for Recursive Programs. CAV 2014 PolyPDR: Convex models for Linear CHC simulating Numeric Abstract Interpretation with PDR N. Bjørner and A. Gurfinkel: Property Directed Polyhedral Abstraction. VMCAI 2015

11 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Cormac Flanagan, K. Rustan M. Leino: Houdini, an Annotation Assistant for ESC/Java. FME 2001:

12 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Program Verification by Houdini Inductive Invariant Lemma2Lemma1Lemma3 Safe? YesNo guess new lemmas

13 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Guessing Lemmas by Evolving Approximations Safe? No verifier approx. 1 approx. 2 approx. 3

14 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Linear CHC Satisfiability Satisfiability of a set of linear CHCs is reducible to satisfiability of THREE clauses of the form where, X’ = {x’ | x 2 X}, P a fresh predicate, and Init, Bad, and Tr are constraints Proof: add extra arguments to distinguish between predicates Q(y) Æ Á  W(y, z) P(id=‘Q’, y) Æ Á  P(id=‘W’, y, z)

15 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Programs, Cexs, Invariants A program P = (V, Init, Tr, Bad) Notation: F(X) = 9 u. (X Æ Tr) Ç Init P is UNSAFE if and only if there exists a number N s.t. P is SAFE if and only if there exists a safe inductive invariant Inv s.t. Inductive Safe

16 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3/PDR Algorithm Overview bounded safety strengthen result

17 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3/PDR in Pictures PdrMkSafe

18 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3/PDR in Pictures Cex Queue Trace Frame F 0 Frame F 1 lemma cex PdrMkSafe

19 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Inductive IC3/PDR in Pictures PdrPush

20 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Inductive IC3/PDR in Pictures PdrPush PDR Invariants F i  : Bad Init  F i F i  F i+1 F i Æ Tr  F i+1 PDR Invariants F i  : Bad Init  F i F i  F i+1 F i Æ Tr  F i+1

21 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3/PDR

22 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University IC3 Data-Structures A trace F = F 0, …, F N is a sequence of frames. A frame F i is a set of clauses. Elements of F i are called lemmas. Invariants: – Bounded Safety: 8 i < N. F i  :Bad – Monotonicity: 8 i < N. F i+1 µ F i – Inductiveness: 8 i < N. F i Æ Tr  F’ i+1 A priority queue Q of counterexamples to induction (CTI) (m, i) 2 Q is a pair, where m is a cube and i a level if (m, i) 2 Q then there exists a path of length (N-i) from a state in m to a state in Bad Q is ordered by level – (m, i) < (k, j) iff i < j

23 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Termination and Progress

24 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Inductive Generalization A clause  is inductive relative to F iff Init   (Initialization) and  Æ F Æ Tr   ’ (Inductiveness) Implemented by first letting  = :m and generalizing  by iteratively dropping literals while checking the inductiveness condition Theorem: Let F 0, F 1, …, F N be a valid IC3 trace. If  is inductive relative to F i, 0 · i < N, then, for all j · i,  is inductive relative to F j. Follows from the monotonicity of the trace – if j < i then F j  F i – if F j  F i  then (  Æ F i Æ Tr   ’)  (  Æ F j Æ Tr   ’)

25 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Prime Implicants A formula  is an implicant of a formula psi iff  ) à A propositional implicant of à is a conjunction of literals  such that  is an implicant of à  is a conjunction of literals  ) à  is a partial assignment that makes à true A propositonal implicant  of à is called prime if no subset of  is an implicant of à  is a conjunction of literals  ) à 8 p. (p   Æ  ) p) ) (p ; Ã)

26 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Generalizing Predecessors Decide rule chooses a (generalized) predecessor m 0 of m that is consistent with the current frame Simplest implementation is to extract a predecessor m o from a satisfying assignment of M ² FiÆTrÆm’ m 0 cab be further generalized using ternary simulation by dropping literals and checking that m’ remains forced An alternative is to let m 0 be an implicant (not necessarily prime) of F i Æ9 X’.(Tr Æ m’) finding a prime implicant is difficult because of the existential quantification we settle for an arbitrary implicant. The side conditions ensure it is not trivial

27 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Strengthening a trace Also known as Push or Propagate Bounded safety proofs are usually very weak towards the end not much is needed to show that error will not happen in one or two steps This tends to make them non-inductive a weakness of interpolation-based model checking, like IMPACT in IMPACT, this is addressed by forced covering heuristic Induction “applies” forced cover one lemma at a time whenever all lemmas are pushed F i+1 is inductive (and safe) (optionally) combine strengthening with generalization Implementation Apply Induction from 0 to N whenever Conflict and Decide are not applicable

28 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Long Counterexamples Whenever a counterexample m is blocked at level i, it is known that there is no path of length i from Init to m (because got blocked) there is a path of length (N-i) from m to Bad Can check whether there exists a path of length (i+1) from Init to m (Leaf) check eagerly by placing the CTI back into the queue at a higher level (No Leaf) check lazily by waiting until the same (or similar) CTI is discovered after N is increased by Unfold Leaf allows IC3 to discover counterexamples much longer than the current unfolding depth N each CTI re-enqueued by Leaf adds one to the depth of the longest possible counterexample found a real counterexample might chain through multiple such CTI’s

29 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Queue Management for Long Counterexamples A queue element is a triple (m, i, d) m is a CTI, i a level, d a depth Decide sets m and i as before, and sets d to 0 Leaf increases i and d by one i determines how far the CTI can be pushed back d counts number of times the CTI was pushed forward Queue is ordered first by level, then by depth (m, i, d) < (k, j, e), i < j Ç (i=j Æ d < e) Overall exploration mimics iterative deepening with non-uniform exploration depth go deeper each time before backtracking

30 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University PDR FOR ARITHMETIC

31 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Arithmetic PDR

32 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Craig Interpolation Theorem Theorem (Craig 1957) Let A and B be two First Order (FO) formulae such that A ) :B, then there exists a FO formula I, denoted ITP(A, B), such that A ) I I ) :B atoms(I) 2 atoms(A) Å atoms(B) A Craig interpolant ITP(A, B) can be effectively constructed from a resolution proof of unsatisfiability of A Æ B In Model Cheching, Craig Interpolation Theorem is used to safely over- approximate the set of (finitely) reachable states

33 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Alternative Definition of an Interpolant Let F = A(x, z) Æ B(z, y) be UNSAT, where x and y are distinct Note that for any assignment v to z either – A(x, v) is UNSAT, or – B(v, y) is UNSAT An interpolant is a circuit I(z) such that for every assignment v to z I(v) = A only if A(x, v) is UNSAT I(v) = B only if B(v, y) is UNSAT A proof system S has a feasible interpolation if for every refutation ¼ of F in S, F has an interpolant polynomial in the size of ¼ propositional resolution has feasible interpolation extended resolution does not have feasible interpolation

34 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Farkas Lemma Let M = t 1 ¸ b 1 Æ … Æ t n ¸ b n, where t i are linear terms and b i are constants M is unsatisfiable iff 0 ¸ 1 is derivable from M by resolution M is unsatisfiable iff M ` 0 ¸ 1 e.g., x + y > 10, -x > 5, -y > 3 ` (x+y-x-y) > ( ) ` 0 > 18 M is unsatisfiable iff there exist Farkas coefficients g 1, …, g n such that g i ¸ 0 g 1 £t 1 + … + g n £t n = 0 g 1 £b 1 + … + g n £b n ¸ 1

35 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Interpolation for Linear Real Arithmetic Let M = A Æ B be UNSAT, where A = t 1 ¸ b 1 Æ … Æ t i ¸ b i, and B = t i+1 ¸ b i Æ … Æ t n ¸ b n Let g 1, …, g n be the Farkas coefficients witnessing UNSAT Then g 1 £(t 1 ¸ b 1 ) + … + g i £(t i ¸ b i ) is an interpolant between A and B g i+1 £(t i+1 ¸ b i ) + … + g n £ (t n ¸ b n ) is an interpolant between B and A g 1 £t 1 +…+g i £t i = - (g i+1 £t i+1 + … + g n £t n ) :(g i+1 £(t i+1 ¸ b i ) + … + g n £ (t n ¸ b n )) is an interpolant between A and B

36 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Craig Interpolation for Linear Arithmetic Useful properties of existing interpolation algorithms [CGS10] [HB12] I 2 ITP (A, B) then :I 2 ITP (B, A) if A is syntactically convex (a monomial), then I is convex if B is syntactically convex, then I is co-convex (a clause) if A and B are syntactically convex, then I is a half-space A = F(R i ) B = P I = lemma

37 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Arithmetic Conflict Counterexample is blocked using Craig Interpolation summarizes the reason why the counterexample cannot be extended Generalization is not inductive weaker than IC3/PDR inductive generalization for arithmetic is still an open problem

38 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University 1.find (e.g. specific pre-post pair that needs to be generalized) Expensive to find a quantifier-free Models of Lazy Quantifier Elimination! 2. choose disjunct “covering” N using virtual substitution Model Based Projection

39 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Model Based Projection Definition: Let  be a formula, U a set of variables, and M a model of . Then à = MBP (U, M,  ) is a Model Based Project of U, M and  iff 1. à is a monomial (optional) 2.Vars(Ã) µ Vars(  ) n U 3.M ² à 4. à ) 9 U.  For a fixed set of variables U and a formula , MBP is a function from models to formulas MBP is finite if its range (as a function defined above) is finite

40 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University MBP for Linear Rational Arithmetic et pick a disjunct that covers a given model [1] Loos and Weispfenning, Applying Linear Quantifier Elimination, 1993 [2] Tobias Nipkow, Linear Quantifier Elimination, 2008 [3] Bjorner, Linear Quantifier Elimination as an Abstract Decision Procedure, 2010 [1] Loos and Weispfenning, Applying Linear Quantifier Elimination, 1993 [2] Tobias Nipkow, Linear Quantifier Elimination, 2008 [3] Bjorner, Linear Quantifier Elimination as an Abstract Decision Procedure, 2010

41 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Arithmetic Decide Compute a predecessor using an under-approximation of quantifier elimination – called Model Based Projection To ensure progress, Decide must be finite finitely many possible predecessors when all other arguments are fixed Alternatives Completeness can follow from the Conflict rule only – for Linear Arithmetic this means using Fourier-Motzkin implicants Completeness can follow from an interaction of Decide and Conflict

42 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University PDR FOR NON-LINEAR CHC

43 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Non-Linear CHC Satisfiability Satisfiability of a set of arbitrary (i.e., linear or non-linear) CHCs is reducible to satisfiability of THREE clauses of the form where, X’ = {x’ | x 2 X}, X o = {x o | x 2 X}, P a fresh predicate, and Init, Bad, and Tr are constraints Proof: factor rules with more than 2 predicates in the body replace P 1 (x) Æ P 2 (y) Æ P 3 (z) Æ Á(x,y,z)  H(x, y, z) by P 1 (x) Æ W(y,z) Æ phi(x,y,z)  H(x,y,z). P 2 (y) Æ P 3 (z)  W(y, z). add extra arguments to distinguish between predicates P(id=‘P 2 ’, y) Æ P(id=‘P 3 ’, z)  P(id=‘W’, y, z).

44 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Non-linear CHC by reduction to linear CHC Can non-linear CHC satisfiability be reduced to (multiple) linear CHC satisfiability problems?

45 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Generalized GPDR counterexample is a tree two predecessors theory-aware Conflict

46 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Counterexamples to non-linear CHC A set S of CHC is unsatisfiable iff S can derive FALSE we call such a derivation a counterexample For linear CHC, the counterexample is a path For non-linear CHC, the counterexample is a tree FALSEs’4 2 s2 Æ so3 Æ Trs2 2 Inits3 2 Init s’5 2 s0 Æ so 1 Æ Tr s0 2 Inits1 2 Init

47 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University GPDR Search Space At each step, one CTI in the frontier is chosen and its two children are expanded Level Bad queue element

48 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University GPDR: Deciding predecessors Compute two predecessors at each application of GPDR/Decide Can explore both predecessors in parallel e.g., BFS or DFS exploration order Number of predecessors is unbounded incomplete even for finite problem (i.e., non-recursive CHC) Is compatible with MBP approach of APDR? No caching/summarization of previous decisions worst-case exponential for Boolean Push-Down Systems

49 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Spacer Same queue as in IC3/PDR Same Conflict as in APDR/GPDR Three variants of Decide Cache Reachable states

50 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Computing Reachable States Computing new reachable states by under-approximating forward image using MBP since MBP is finite, guarantee to exhaust all reachable states Second use of MBP orthogonal to the use of MBP in Decide REACH can contain auxiliary variables, but might get too large For Boolean CHC, the number of reachable states is bounded complexity is polynomial in the number of states same as reachability in Push Down Systems

51 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Must and May refinement DecideMust use computed summary to skip over a call site DecideMay use over-approximation of a calling context to guess an approximation of the call-site the call-site either refutes the approximation (Conflict) or refines it with a witness (Successor)

52 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Conclusion A program verifier is a compiler reusing an existing compiler is good idea, but comes with many caveats Verification is Logic reduce verification to decidability of logic formulas CHC is a great target fragment for many verification tasks Greatly simplifies reasoning by discharging program semantics An exciting direction with many extensions and open problems termination and model counting abstraction refinement and predicate abstraction abstract interpretation as model finding beyond arithmetic: arrays, memory, quantified models, separation logic, … program transformation for verification proof search strategies …

53 Building Verifiers from Comp and SMT Gurfinkel, 2015 © 2015 Carnegie Mellon University Contact Information Arie Gurfinkel, Ph. D. Sr. Researcher CSC/SSD Telephone: U.S. Mail Software Engineering Institute Customer Relations 4500 Fifth Avenue Pittsburgh, PA USA Web Customer Relations Telephone: SEI Phone: SEI Fax: