Scalability in Model Checking

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
Exploiting SAT solvers in unbounded model checking K. L. McMillan Cadence Berkeley Labs.
Abstraction in Model Checking Nishant Sinha. Model Checking Given a: –Finite transition system M –A temporal property p The model checking problem: –Does.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
Lecture 24 MAS 714 Hartmut Klauck
SAT Based Abstraction/Refinement in Model-Checking Based on work by E. Clarke, A. Gupta, J. Kukula, O. Strichman (CAV’02)
Game-theoretic approach to the simulation checking problem Peter Bulychev Vladimir Zakharov Lomonosov Moscow State University.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
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:
Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Strichman Carnegie Mellon University.
Weizmann Institute Tuning SAT-checkers for Bounded Model-Checking A bounded guided tour Ofer Shtrichman Weizmann Institute & IBM (HRL)
Proof-based Abstraction Presented by Roman Gershman Ken McMillan, Nina Amla.
1 Introduction to Computability Theory Lecture15: Reductions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
1 Completeness and Complexity of Bounded Model Checking Ed Clarke Daniel Kroening Joel Ouaknine Carnegie Mellon University, Pittsburgh, USA Ofer Strichman.
Formal Verification Group © Copyright IBM Corporation 2008 IBM Haifa Labs SAT-based unbounded model checking using interpolation Based on a paper “Interpolation.
Computing Over­Approximations with Bounded Model Checking Daniel Kroening ETH Zürich.
1 Completeness and Complexity of Bounded Model Checking.
1 Abstraction Refinement for Bounded Model Checking Anubhav Gupta, CMU Ofer Strichman, Technion Highly Jet Lagged.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Regular Model Checking Ahmed Bouajjani,Benget Jonsson, Marcus Nillson and Tayssir Touili Moran Ben Tulila
7/13/2003BMC A SAT-Based Approach to Abstraction Refinement in Model Checking Bing Li, Chao Wang and Fabio Somenzi University of Colorado at Boulder.
1 Completeness and Complexity of Bounded Model Checking.
1 Automatic Refinement and Vacuity Detection for Symbolic Trajectory Evaluation Orna Grumberg Technion Haifa, Israel Joint work with Rachel Tzoref.
TECH Computer Science NP-Complete Problems Problems  Abstract Problems  Decision Problem, Optimal value, Optimal solution  Encodings  //Data Structure.
Incremental formal verification of hardware Hana Chockler Alexander Ivrii Arie Matsliah Shiri Moran Ziv Nevo IBM Research - Haifa.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
On the Relation between SAT and BDDs for Equivalence Checking Sherief Reda Rolf Drechsler Alex Orailoglu Computer Science & Engineering Dept. University.
SAT-Based Model Checking Without Unrolling Aaron R. Bradley.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Bounded Model Checking A. Biere, A. Cimatti, E. Clarke, Y. Zhu, Symbolic Model Checking without BDDs, TACAS’99 Presented by Daniel Choi Provable Software.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
Bernd Fischer RW714: SAT/SMT-Based Bounded Model Checking of Software.
Abstraction and Abstract Interpretation. Abstraction (a simplified view) Abstraction is an effective tool in verification Given a transition system, we.
Complexity Relief Techniques for Model Checking METU, Aug SOFTWARE VERIFICATION WORKSHOP Hüsnü Yenigün Sabanci University Informatics Institute,
Counterexample-Guided Abstraction Refinement By Edmund Clarke, Orna Grumberg, Somesh Jha, Yuan Lu, and Helmut Veith Presented by Yunho Kim Provable Software.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part Bug Catching: Automated Program Verification.
The NP class. NP-completeness
P & NP.
Basic concepts of Model Checking
Symbolic model checking with SAT/SMT
Introduction to Software Verification
SS 2017 Software Verification Bounded Model Checking, Outlook
Model Checking Java Programs (Java PathFinder)
Synthesis for Verification
Solving Linear Arithmetic with SAT-based MC
Structural testing, Path Testing
Introduction to Software Verification
Tutorial - Propositional Logic
Property Directed Reachability with Word-Level Abstraction
Introduction to Formal Verification
Alternating tree Automata and Parity games
Over-Approximating Boolean Programs with Unbounded Thread Creation
NP-Complete Problems.
CSCI1600: Embedded and Real Time Software
CS154, Lecture 13: P vs NP.
Instructor: Aaron Roth
Linear Time Properties
Predicate Abstraction
Instructor: Aaron Roth
Course: CS60030 Formal Systems
SAT Based Abstraction/Refinement in Model-Checking
Presentation transcript:

Scalability in Model Checking Course: CS60030 FORMAL Systems Pallab Dasgupta Professor, Dept. of Computer Sc & Engg

Handling Large State Spaces State Explosion If M has k state variables, then it has 2k states Not all these states are reachable Not all state variables are relevant for a property we wish to prove Representation Symbolic – we will never actually generate the explicit state space Reduced – throw out those state variables that are inconsequential Decision strategies Proving the property on an abstraction of M may be sufficient Proving the property assuming all states are reachable may be sufficient

More on scalability BDD, SAT, SMT Not good enough for many of the state spaces where we wish to use formal methods OPTIONS (we will elaborate each of these) BOUNDED SEARCH In many cases we may know an upper-bound on the length of potential counter-examples We can unfold only up to that depth INDUCTION We can inductively prove certain properties with limited unfolding ABSTRACTION – REFINEMENT We reduce the complexity of the STS by dropping some of its variables and prove that the abstraction is safe INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

BOUNDED MODEL CHECKING INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Bounded Model Checking Represent sets of states and the transition relation as Boolean logic formulas Instead of computing the fixpoints, unroll the transition relation up to certain fixed bound and search for violations of the property within that bound Transform this search to a Boolean satisfiability problem and solve it using a SAT solver

Example: Bound=2 r1 g1 g2 r2 Is there a witness of length=2? Clauses from Transition Relation: C11: r20   r10   g10  g21 C21: r10  g11 Clauses from Initial State: I: g20  g10 Clauses from Property: F( r1  (Xg1  XXg1) ) Z1: r10   g11 SAT Check: Is Z1  I  C11  C21 satisfiable? Answer: No, since Z1 conflicts with C21

Example: Bound=3 r1 g1 g2 r2 Is there a witness of length=3? Clauses from Transition Relation: C11, C21: from previous iteration C12: r21   r11   g11  g22 C22: r11  g12 Clauses from Initial State: I: g20  g10 Clauses from Property: F( r1  (Xg1  XXg1) ) Z2: (r10  ( g11  g12 ))  (r11  g12) SAT Check: Is Z2  I  C11  C21  C12  C22 satisfiable? Yes: Witness: r10 = 1, r11 = 0, g11 = 1, g12 = 0, rest are don’t cares Conclusion: We have found a bug!!

What Can We Guarantee? Note that we are checking only for bounded paths (paths which have at most k+1 distinct states) So if the property is violated by only paths with more than k+1 distinct states, we would not find a counter-example using bounded model checking Hence if we do not find a counter-example using bounded model checking we are not sure that the property holds However, if we find a counter-example, then we are sure that the property is violated since the generated counter-example is never spurious (i.e., it is always a concrete counter-example)

Proving Correctness If we can find a way to figure out when we should stop then we would be able to provide guarantee of correctness. There is a way to define a diameter of a transition system so that a property holds for the transition system if and only if it is not violated on a path bounded by the diameter. So if we do bounded model checking using the diameter of the system as our bound, then we can guarantee correctness if no counter-example is found.

Formal Methodology Bound on path length k Clauses describing the system M : - Initial state : I(s1) - Unrolled transition relation : Λi=1..k-1 T(si , si+1) Loop clause loopk = Vi=1..k T(sk , si) [f]i,k means that temporal property f is true at runs starting from si and provable in k BMC iterations. For the property f to hold on the system M Λ [f]1,k must be valid.

Translation of LTL to SAT Xf is true at state si , iff f is provable starting from si+1 [ X f ]i,k = (i < k ) Λ [ f ]i+1,k Ff is true in state si , iff f is provable within k iterations from some future state sj [ F f ]ik = Vj=i..k [ f ]j,k Gf is true in state si , iff f is true at all states reachable in k iterations and all paths loop [ G f ]i,k = Λj=i..k [ f ]j,k Λ loopk f U g is true at si , iff g is provable from some state reachable within k iterations and f is provable from all preceding states within k iterations [ f U g ]i,k = Vj=i..k( [ g ]j,k Λ Λn=i..j-1[ f ]n,k)

INDUCTION INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

The intuitive basis for induction State transition system Is any bad state reachable from any initial state? BAD STATES Suppose we prove the following: All initial states are good, and The transition relation does not allow any transition from a good state to a bad state Then inductively, we are safe INITIAL STATES Let p be the formula representing bad states Then we check: Whether Q0  p is empty Whether PreImage(p)  p is empty If both are true, then we have inductively shown that bad states are unreachable INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

The notion of k-induction Is any bad state reachable from any initial state? INITIAL STATES BAD State transition system For k= 0, 1, …. 1. Check whether any state reachable from Q0 in k or fewer steps is bad. If so, report counterexample and exit. 2. Check whether R guarantees that there is no transition to a bad state after k safe steps If so, exit with success. 3. Otherwise continue to the next iteration For finite state systems we can guarantee that the above will terminate in a finite number of iterations. INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

ABSTRACTION REFINEMENT INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

Cone-of-influence reduction a x y f b z w g S1 S2 Two state variables b and d The value of f is influenced by: Input a State S1 The value of g is influenced by: Input b State S2 State S1, because S2 is influenced by it Input a, because S1 is influenced by it Computable using static analysis

Abstraction Cone-of-influence reduction with respect to a property does not loose any relevant information The problem is that quite often COI is not enough Abstractions further reduce the size of the state machine What kind of abstractions do we want? Bugs must not escape detection. This is guaranteed by the following constraint: Any run which exists in the original state machine must also exist in the abstract state machine This is achieved by existential abstraction of the transition relation

Existential Abstraction 10 In this example, we eliminate x2 Let h(s) denote the abstract state corresponding to a state s in the original machine Existential abstraction: T(sa, sb)  T( h(sa), h(sb) ) In other words: T( si, sj )   sa, sb T(sa, sb) such that h(sa) = si and h(sb) = sj 00 11 01 T(x1, x2) 1 T(x1)

Existential Abstraction Corresponding to every run in the original state machine, we have a run in the abstract state machine Therefore counterexamples in the original machine (if any) are preserved in the abstract state machine If a property holds on the abstract state machine, then it also holds in the original state machine Problem: A counterexample found in the abstract state machine is not necessarily real

False counterexample Consider the property 10 Consider the property G( x1  G ( x1) ) Whenever x1 goes high, it stays high This is true in the original state machine (look at the reachable states only) But it is false in the abstract state m/c 00 11 01 T(x1, x2) 1 T(x1)

Abstraction Refinement Abstract State M/C + Properties model checker PASS? yes Refine the abstraction no counterexample analysis Real Cex? no yes

Checking the Counterexample Counterexample: (c1, …,cm) Each ci is an assignment to the set of remaining state variables. Concrete traces corresponding to the counterexample: 𝝋=𝑰 𝒔 𝟏 ∧ 𝒊=𝟏 𝒎−𝟏 𝑹( 𝒔 𝒊 , 𝒔 𝒊+𝟏 ) ∧ 𝒊=𝟏 𝒎 𝒉 𝒔 𝒊 = 𝒄 𝒊 Unrolled Transition Relation Initial State Compliance with counterexample

Abstraction/Refinement with conflict analysis Simulate counterexample on concrete model with SAT If the instance is unsatisfiable, analyze conflict Make visible one of the variables in the clauses that lead to the conflict Source: Chauhan, Clarke, Kukula, Sapra, Veith, Wang, FMCAD 2002

Why do we get spurious counterexample? Deadend states Bad States Failure State f

Refinement Problem: Deadend and Bad States are in the same abstract state. Solution: Refine abstraction function. The sets of Deadend and Bad states should be separated into different abstract states. I Deadend states Bad States Failure State f

Refinement h’ h’ h’ h’ h’ h’ h’ Refinement : h’

Refinement Deadend States 𝜑 𝐷 =𝑰 𝒔 𝟏 ∧ 𝒊=𝟏 𝒇−𝟏 𝑹( 𝒔 𝒊 , 𝒔 𝒊+𝟏 ) ∧ 𝒊=𝟏 𝒇 𝒉 𝒔 𝒊 = 𝒄 𝒊

Refinement 𝜑 𝐷 =𝑰 𝒔 𝟏 ∧ 𝒊=𝟏 𝒇−𝟏 𝑹( 𝒔 𝒊 , 𝒔 𝒊+𝟏 ) ∧ 𝒊=𝟏 𝒇 𝒉 𝒔 𝒊 = 𝒄 𝒊 𝜑 𝐷 =𝑰 𝒔 𝟏 ∧ 𝒊=𝟏 𝒇−𝟏 𝑹( 𝒔 𝒊 , 𝒔 𝒊+𝟏 ) ∧ 𝒊=𝟏 𝒇 𝒉 𝒔 𝒊 = 𝒄 𝒊 Deadend States Bad States Is D  B =  ? 𝜑 𝐵 =𝑹( 𝒔 𝑓 , 𝒔 𝑓+𝟏 )∧𝒉 𝒔 𝒇 = 𝒄 𝒇 ∧𝒉 𝒔 𝒇+𝟏 = 𝒄 𝒇+𝟏

Refinement as Separation d1 0 1 0 0 1 0 1 1 Invisible b1 0 0 1 0 0 1 0 Visible b2 0 1 1 1 0 1 0 Refinement: Find subset U of I that separates between all pairs of dead-end and bad states. Make them visible. U must be minimal !

Refinement as Separation d1 0 1 0 1 0 1 0 1 I b1 0 0 1 0 0 1 0 V b2 0 1 1 1 0 1 0 Refinement: Find subset U of I that separates between all pairs of dead-end and bad states. Make them visible. U must be minimal !

Refinement as Separation The state separation problem Input: Sets D, B Output: Minimal U  I s.t.:  d D,  b B, u U. d(u)  b(u) The refinement h’ is obtained by adding U to V.

Separation methods ILP-based separation Minimal separating set. Computationally expensive. Decision Tree Learning based separation. Not optimal. Polynomial.