Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part 1 15-414 Bug Catching: Automated Program Verification.

Slides:



Advertisements
Similar presentations
Copyright 2000 Cadence Design Systems. Permission is granted to reproduce without modification. Introduction An overview of formal methods for hardware.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
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 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
SAT Based Abstraction/Refinement in Model-Checking Based on work by E. Clarke, A. Gupta, J. Kukula, O. Strichman (CAV’02)
Verification of Evolving Software Natasha Sharygina Joint work with Sagar Chaki and Nishant Sinha Carnegie Mellon University.
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
François Fages MPRI Bio-info 2006 Formal Biology of the Cell Modeling, Computing and Reasoning with Constraints François Fages, Constraints Group, INRIA.
Game-theoretic approach to the simulation checking problem Peter Bulychev Vladimir Zakharov Lomonosov Moscow State University.
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
1 Software Verification Computer Science Club, Steklov Math Institute Lecture 1 Natasha Sharygina The University of Lugano, Carnegie Mellon University.
Chair of Software Engineering Software Verification Stephan van Staden Lecture 10: Model Checking.
Thomas Ball, Rupak Majumdar, Todd Millstein, Sriram K. Rajamani Presented by Yifan Li November 22nd In PLDI 01: Programming Language.
Review of topics Final exam : -May 2nd to May 7 th - Projects due on May 7th.
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:
Demonstration Of SPIN By Mitra Purandare
CSEP590 – Model Checking and Software Verification University of Washington Department of Computer Science and Engineering Summer 2003.
Using Statically Computed Invariants Inside the Predicate Abstraction and Refinement Loop Himanshu Jain Franjo Ivančić Aarti Gupta Ilya Shlyakhter Chao.
A … Framework for Verifying Concurrent C Programs Sagar Chaki Thesis Defense Talk.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
State-Event Software Verification for Branching-Time Specifications Sagar Chaki, Ed Clarke, Joel Ouaknine, Orna Grumberg Natasha Sharygina, Tayssir Touili,
1 Predicate Abstraction of ANSI-C Programs using SAT Edmund Clarke Daniel Kroening Natalia Sharygina Karen Yorav (modified by Zaher Andraus for presentation.
CS 267: Automated Verification Lectures 14: Predicate Abstraction, Counter- Example Guided Abstraction Refinement, Abstract Interpretation Instructor:
Automatically Validating Temporal Safety Properties of Interfaces Thomas Ball and Sriram K. Rajamani Software Productivity Tools, Microsoft Research Presented.
1 2-Valued and 3-Valued Abstraction- Refinement Frameworks for Model Checking Orna Grumberg Technion Haifa, Israel Tutorials at ATVA, 2009.
Predicate Abstraction for Software and Hardware Verification Himanshu Jain Model checking seminar April 22, 2005.
Carnegie Mellon University Symbolic Approaches to Invariant Checking and Automatic Predicate Abstraction Randal E. Bryant.
Computing Over­Approximations with Bounded Model Checking Daniel Kroening ETH Zürich.
Efficient Software Model Checking of Data Structure Properties Paul T. Darga Chandrasekhar Boyapati The University of Michigan.
Word Level Predicate Abstraction and Refinement for Verifying RTL Verilog Himanshu Jain Daniel Kroening Natasha Sharygina Edmund Clarke Carnegie Mellon.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
Formal Verification of SpecC Programs using Predicate Abstraction Himanshu Jain Daniel Kroening Edmund Clarke Carnegie Mellon University.
Model Checking for Embedded Systems Edmund Clarke, CMU High-Confidence Embedded Systems Workshop, May 1 st.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
MCAI 2.0 Model Checking in Ten Minutes Edmund Clarke School of Computer Science Carnegie Mellon University.
Grand Challenge Problem: Model Check Concurrent Software Edmund M. Clarke Department of Computer Science Carnegie Mellon University.
Lecture 1: Model Checking
50.530: Software Engineering
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
Automatically Validating Temporal Safety Properties of Interfaces Thomas Ball, Sriram K. MSR Presented by Xin Li.
11 Counter-Example Based Predicate Discovery in Predicate Abstraction Satyaki Das and David L. Dill Computer Systems Lab Stanford University
Verification & Validation By: Amir Masoud Gharehbaghi
Reachability for Linear Hybrid Automata Using Iterative Relaxation Abstraction Sumit K. Jha, Bruce H. Krogh, James E. Weimer, Edmund M. Clarke Carnegie.
SAT-Based Model Checking Without Unrolling Aaron R. Bradley.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Variants of LTL Query Checking Hana ChocklerArie Gurfinkel Ofer Strichman IBM Research SEI Technion Technion - Israel Institute of Technology.
CHARME’03 Predicate abstraction with Minimum Predicates Sagar Chaki*, Ed Clarke*, Alex Groce*, Ofer Strichman** * Carnegie Mellon University ** Technion.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Verifying Component Substitutability Nishant Sinha Sagar Chaki Edmund Clarke Natasha Sharygina Carnegie Mellon University.
© Anvesh Komuravelli Spacer Model Checking with Proofs and Counterexamples Anvesh Komuravelli Carnegie Mellon University Joint work with Arie Gurfinkel,
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,
Having a BLAST with SLAM
CIS 842: Specification and Verification of Reactive Systems
Introduction to Software Verification
Property Directed Reachability with Word-Level Abstraction
Over-Approximating Boolean Programs with Unbounded Thread Creation
50.530: Software Engineering
Translating Linear Temporal Logic into Büchi Automata
Scalability in Model Checking
Abstraction, Verification & Refinement
Predicate Abstraction
Course: CS60030 Formal Systems
SAT Based Abstraction/Refinement in Model-Checking
Presentation transcript:

Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part 1 15-414 Bug Catching: Automated Program Verification and Testing Sagar Chaki November 28, 2011 Title Slide Title and Subtitle text blocks should not be moved from their position if at all possible. © 2006 Carnegie Mellon University

Outline Overview of Model Checking Creating Models from C Code: Predicate Abstraction Eliminating spurious behaviors from the model: Abstraction Refinement Concluding remarks : research directions, tools etc.

Model Checking Algorithm for answering queries about behaviors of state machines Given a state machine M and a query  does M ²  ? Standard formulation: M is a Kripke structure  is a temporal logic formula Computational Tree Logic (CTL) Linear Temporal Logic (LTL) Discovered independently by Clarke & Emerson and Queille & Sifakis in the early 1980’s

Scalability of Model Checking Explicit statespace exploration: early 1980s Tens of thousands of states Symbolic statespace exploration: millions of states Binary Decision Diagrams (BDD) : early 1990’s Bounded Model Checking: late 1990’s Based on propositional satisfiability (SAT) technology Abstraction and compositional reasoning 10120 to effectively infinite statespaces (particularly for software)

Models of C Code no yes … if (x) { y = x; } else { y = x + 1; } assert (y) x=1 y=0 x=1 y=1 x=0 y=0 x=0 y=1 … if (x) { y = x; } else { y = x + 1; } assert (y); Infinite State Program: Syntax Control Flow Graph Model: Semantics

Existential Abstraction Partition concrete statespace into abstract states Each abstract state S corresponds to a set of concrete states s We write (s) to mean the abstract state corresponding to s We define (S) = { s | S = (s) } Fix the transitions existentially S ! S’ , 9 s 2  (S) . 9 s’ 2  (S’) . s ! s’ S ! S’ ( 9 s 2  (S) . 9 s’ 2  (S’) . s ! s’ Existential Abstraction is conservative [ClarkeGrumbergLong94] If a ACTL* property holds on the abstraction, it also holds on the program LTL is a subset of ACTL* However, the converse is not true: a property that fails on the abstraction may still hold on the program Existential abstraction can be viewed as a form of abstract interpretation Strong & sometimes not computable Weak: computable

Example of Existential Abstraction Abstract Initial State Concrete Initial State Concrete State 6 2 Abstract Transition 8 Abstract State 1 5 9 Concrete Transition 3 Abstractly Reachable but Concretely Unreachable 4 10 7 Abstractly and Concretely Unreachable

Example of Existential Abstraction Concrete State Abstract Transition Abstract State Concrete Transition Abstractly Reachable but Concretely Unreachable p Abstractly and Concretely Unreachable G(: p)

Predicate Abstraction if (x) no yes Partition the statespace based on values of a finite set of predicates on program variables y = x + 1 y = x assert (y)

Predicate Abstraction  = G(: ERROR) :P States where y  0 P States where y = 0 if (x) no yes y = x + 1 y = x assert (y) ERROR P  ( y == 0 )

Predicate Abstraction if (x) Call SAT Checker no yes y = x + 1 y = x assert (y) ERROR :P P States where y  0 P  ( y == 0 ) States where y = 0

Predicate Abstraction SAT Checker Query: y  0  x = 0  x’ = x  y’ = y  y’  0 SAT Checker Answer: SAT and here’s a solution x=0, y=1, x’=0, y’=1 if (x) x=0 y=1 no yes y = x + 1 y = x x=0 y=1 assert (y) :P States where y  0 P  ( y == 0 )

Predicate Abstraction SAT Checker Query: y  0  x  0  x’ = x  y’ = y  y’  0 SAT Checker Answer: SAT and here’s a solution x=1, y=1, x’=1, y’=1 if (x) x=1 y=1 no yes y = x + 1 y = x x=1 y=1 assert (y) :P States where y  0 P  ( y == 0 )

Predicate Abstraction SAT Checker Query: y  0  x’ = x  y’ = x+1  y’  0 SAT Checker Answer: SAT and here’s a solution x=1, y=1, x’=1, y’=2 if (x) no yes y = x + 1 y = x x=1 y=1 assert (y) x=1 y=2 :P States where y  0 P  ( y == 0 )

Predicate Abstraction SAT Checker Query: y  0  x’ = x  y’ = x  y’  0 SAT Checker Answer: SAT and here’s a solution x=1, y=1, x’=1, y’=1 if (x) no yes y = x + 1 y = x x=1 y=1 assert (y) x=1 y=1 :P States where y  0 P  ( y == 0 )

Predicate Abstraction No predicates about x if (x) no yes y = x + 1 y = x assert (y) ERROR :P P States where y  0 P  ( y == 0 ) States where y = 0

Imprecision due to Predicate Abstraction Counterexamples generated by model checking the abstract model may be spurious, i.e., not concretely realizable Need to refine the abstraction iteratively by changing the set of predicates Can infer new set of predicates by analyzing the spurious counterexample Lot of research in doing this effectively Counterexample Guided Abstraction Refinement (CEGAR) A.K.A. Iterative Abstraction Refinement A.K.A. Iterative Refinement

Model Checking no yes : P P  = G(: ERROR) P  ( y == 0 ) if (x) y = x + 1 y = x assert (y) ERROR : P P  = G(: ERROR) P  ( y == 0 )

Model Checking no yes : P P  = G(: ERROR) P  ( y == 0 ) if (x) y = x + 1 y = x assert (y) ERROR : P P  = G(: ERROR) P  ( y == 0 )

Model Checking if (x) yes y = x assert (y) ERROR : P P P  ( y == 0 )

Counterexample Validation if (x) yes Simulate counterexample symbolically Call SAT Checker to determine if the post-condition is satisfiable In our case, Counterexample is spurious New set of predicates {x==0,y==0} y = x assert (y)

Counterexample Validation SAT Checker Query: x  0  y’ = x  y’ = 0 SAT Checker Answer: UNSAT and here’s an UNSAT core {x  0 , y’ = x , y’ = 0} if (x) yes y = x assert (y) Used to derive new predicate (x=0) Different heuristics used in practice

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Predicate Abstraction: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR :P :Q :P Q P :Q P Q x  0 y  0 P  ( x == 0 ) Q  ( y == 0 ) X = 0 y = 0

Model Checking: 2nd Iteration if (x) no yes y = x + 1 y = x assert (y) ERROR ERROR SUCCESS :P :Q :P Q P :Q P Q  = G(: ERROR) P  ( x == 0 ) Q  ( y == 0 )

Iterative Refinement: Summary Choose an initial set of predicate, and proceed iteratively as follows: Abstraction: Construct an abstract model M of the program using the predicate abstraction Verification: Model check M. If model checking succeeds, exit with success. Otherwise, get counterexample CE. Validation: Check CE for validity. If CE is valid, exit with failure. Refinement: Otherwise, update the set of predicates and repeat from Step 1.

Presentation (Full Color) Author, Date Iterative Refinement Presentation (Full Color) Author, Date 2/4/2018 Localization Reduction, Kurshan, Bell Labs Abstract Model Program Predicate Abstraction Model Checking Yes System OK Initial Predicates No Counterexample-guided Abstraction Refinement for Symbolic Model Checking, Clarke et al., CMU Better Predicates SAT Checker Candidate Counter-example Predicate Refinement No Counterexample Valid? Software Model Checking, SLAM Project, Microsoft, Ball & Rajamani Yes Problem Found

Predicate Abstraction: Optimizations Construct transitions on-the-fly Different set of predicates at different control locations Avoid exponential number of theorem-prover calls y = x + 1 if (x) y = x no yes assert (y) P  ( x == 0 ) P  ( x == 0 ) P  ( x == 0 ) Q  ( y == 0 )

Research Areas Finding “good” predicates Technically as hard as finding “good” loop invariants Complexity is linear in LOC but exponential in number of predicates Combining with static analysis Alias analysis, invariant detection, constant propagation Inexpensive, and may make subsequent model checking more efficient Bounded model checking

Software Model Checking Tools Iterative Refinement SLAM, BLAST, MAGIC, Copper, SATABS, … Bounded Model Checking CBMC, … Others Engines: MOPED, BEBOP, BOPPO, … Java: Java PathFiner, Bandera, BOGOR, … C: CMC, CPAChecker, … Next lecture Following lecture

Bibliography Existential Abstraction: Edmund M. Clarke, Orna Grumberg, David E. Long: Model Checking and Abstraction. ACM Trans. Program. Lang. Syst. 16(5): 1512-1542 (1994) Predicate Abstraction: Construction of abstract state graphs with PVS, S. Graf, H. Saidi, Proceedings of Computer Aided Verification (CAV), 1997 Abstraction Refinement for C: Automatically Validating Temporal Safety Properties of Interfaces, T. Ball, S. Rajamani, Proceedings of the SPIN Workshop, 2001 Software Model Checking Technology Transfer: SLAM and Static Driver Verifier: Technology Transfer of Formal Methods inside Microsoft, T. Ball, B. Cook, V. Levin, S. Rajamani, Proceedings of Intergrated Formal Methods, 2004

Presentation Title 2/4/2018 © 2006 Carnegie Mellon University