Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University Simplifying Loop Invariant Generation Using Splitter Predicates.

Slides:



Advertisements
Similar presentations
Demand-driven inference of loop invariants in a theorem prover
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Constraint-based Invariant Inference over Predicate Abstraction Sumit Gulwani Ramarathnam Venkatesan Microsoft Research, Redmond Saurabh Srivastava University.
De necessariis pre condiciones consequentia sine machina P. Consobrinus, R. Consobrinus M. Aquilifer, F. Oratio.
Termination Proofs from Tests
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
Semantics Static semantics Dynamic semantics attribute grammars
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } P1() Challenge: Correct and Efficient Synchronization { ……………………………
Greta YorshEran YahavMartin Vechev IBM Research. { ……………… …… …………………. ……………………. ………………………… } T1() Challenge: Correct and Efficient Synchronization { ……………………………
A Program Transformation For Faster Goal-Directed Search Akash Lal, Shaz Qadeer Microsoft Research.
Verification of Evolving Software Natasha Sharygina Joint work with Sagar Chaki and Nishant Sinha Carnegie Mellon University.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
1 PROPERTIES OF A TYPE ABSTRACT INTERPRETATER. 2 MOTIVATION OF THE EXPERIMENT § a well understood case l type inference in functional programming à la.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Inferring Disjunctive Postconditions Corneliu Popeea and Wei-Ngan Chin School of Computing National University of Singapore - ASIAN
1 Eran Yahav Technion Joint work with Martin Vechev (ETH), Greta Yorsh (ARM), Michael Kuperstein (Technion), Veselin Raychev (ETH)
Logic as the lingua franca of software verification Ken McMillan Microsoft Research TexPoint fonts used in EMF: A A A A A Joint work with Andrey Rybalchenko.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
Rahul Sharma, Saurabh Gupta, Bharath Hariharan, Alex Aiken, and Aditya Nori (Stanford, UC Berkeley, Microsoft Research India) Verification as Learning.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
Program Analysis as Constraint Solving Sumit Gulwani (MSR Redmond) Ramarathnam Venkatesan (MSR Redmond) Saurabh Srivastava (Univ. of Maryland) TexPoint.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
CS 355 – Programming Languages
An Integration of Program Analysis and Automated Theorem Proving Bill J. Ellis & Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt.
The Software Model Checker BLAST by Dirk Beyer, Thomas A. Henzinger, Ranjit Jhala and Rupak Majumdar Presented by Yunho Kim Provable Software Lab, KAIST.
Revisiting Generalizations Ken McMillan Microsoft Research Aws Albarghouthi University of Toronto.
Discovering Affine Equalities Using Random Interpretation Sumit Gulwani George Necula EECS Department University of California, Berkeley.
Termination Proofs for Systems Code Andrey Rybalchenko, EPFL/MPI joint work with Byron Cook, MSR and Andreas Podelski, MPI PLDI’2006, Ottawa.
Using Statically Computed Invariants Inside the Predicate Abstraction and Refinement Loop Himanshu Jain Franjo Ivančić Aarti Gupta Ilya Shlyakhter Chao.
Counterexample-Guided Focus TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA A A A AA A A Thomas Wies Institute of.
Synergy: A New Algorithm for Property Checking
CS 267: Automated Verification Lectures 14: Predicate Abstraction, Counter- Example Guided Abstraction Refinement, Abstract Interpretation Instructor:
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
VS 3 : Verification and Synthesis using SMT Solvers SMT Solvers for Program Verification Saurabh Srivastava * Sumit Gulwani ** Jeffrey S. Foster * * University.
Overview of program analysis Mooly Sagiv html://
Program Verification using Templates over Predicate Abstraction Saurabh Srivastava University of Maryland, College Park Sumit Gulwani Microsoft Research,
Describing Syntax and Semantics
DySy: Dynamic Symbolic Execution for Invariant Inference.
Constraint-based Invariant Inference. Invariants Dictionary Meaning: A function, quantity, or property which remains unchanged Property (in our context):
By: Pashootan Vaezipoor Path Invariant Simon Fraser University – Spring 09.
A Parametric Segmentation Functor for Fully Automatic and Scalable Array Content Analysis Patrick Cousot, NYU & ENS Radhia Cousot, CNRS & ENS & MSR Francesco.
Verification of Java Programs using Symbolic Execution and Loop Invariant Generation Corina Pasareanu (Kestrel Technology LLC) Willem Visser (RIACS/USRA)
Rahul Sharma Joint work with Aditya Nori (MSR India) and Alex Aiken (Stanford)
Surinder Jain The University of Sydney 4th SAPLING meeting Sydney, Australia.
Inferring Specifications to Detect Errors in Code Mana Taghdiri Presented by: Robert Seater MIT Computer Science & AI Lab.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Variance Analyses from Invariance Analyses Josh Berdine Microsoft Research, Cambridge Joint work with Aziem Chawdhary, Byron Cook, Dino.
Formal verification of skiplist algorithms Student: Trinh Cong Quy Supervisor: Bengt Jonsson Reviewer: Parosh Abdulla.
Semantics In Text: Chapter 3.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 12: Abstract Interpretation IV Roman Manevich Ben-Gurion University.
Proving Non-Termination Gupta, Henzinger, Majumdar, Rybalchenko, Ru-Gang Xu presentation by erkan.
Learning Symbolic Interfaces of Software Components Zvonimir Rakamarić.
Localization and Register Sharing for Predicate Abstraction Himanshu Jain Franjo Ivančić Aarti Gupta Malay Ganai.
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
Model Checking for Simple Java Programs Taehoon Lee, Gihwon Kwon Department of Computer Science Kyonggi University, Korea IWFST, Shanghai, China,
Random Interpretation Sumit Gulwani UC-Berkeley. 1 Program Analysis Applications in all aspects of software development, e.g. Program correctness Compiler.
1 Combining Abstract Interpreters Mooly Sagiv Tel Aviv University
Automated Debugging with Error Invariants TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA A A A AA A A Chanseok Oh.
/ PSWLAB Evidence-Based Analysis and Inferring Preconditions for Bug Detection By D. Brand, M. Buss, V. C. Sreedhar published in ICSM 2007.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
Abstraction and Abstract Interpretation. Abstraction (a simplified view) Abstraction is an effective tool in verification Given a transition system, we.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 8: Static Analysis II Roman Manevich Ben-Gurion University.
11/22/2016IT 3271 A formal system:Axioms and Rules, for inferring valid specification x := m; y := n; while ¬(x=y) do if x>y then x := x-y else y := y-x.
Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part Bug Catching: Automated Program Verification.
Beyond Strong vs. Weak Updates Isil Dillig, Thomas Dillig, Alex Aiken
Symbolic Implementation of the Best Transformer
Over-Approximating Boolean Programs with Unbounded Thread Creation
Presentation transcript:

Rahul Sharma Işil Dillig, Thomas Dillig, and Alex Aiken Stanford University Simplifying Loop Invariant Generation Using Splitter Predicates

Loops and Loop Invariants Invariant evaluates to true after every iteration Key problem software verification Is undecidable Loop Head Loop Body x = 0; while( x <= 49 ) { x = x + 1; }

Conjunctive Invariants Mature techniques for discovering these Cousot and Halbwachs, 1978 Abstract interpretation-based technique (Interproc) Keep estimate of reachable states StInG and InvGen Assume an invariant template (a.x + b.y <= c) Solve (non-linear) constraints to instantiate template x = 0; y = 50; while( x <= 49 ) { x = x + 1; } x <= 50 && y = 50 && x >= 0

Disjunctive Invariants Some loops require disjunctive invariants Some very involved techniques: Probabilistic inference, predicate abstraction, … Difficult to characterize their behavior Most are not fully automatic Can we reduce disjunctive to conjunctive?

Loops Requiring Disjunctive Invariants OpenSSH for(int i=0; i< size; i++) { if( i == size-1 ) a[i] = NULL; else a[i] = malloc(...); } Digikam for(int i = 0; i <num_widgets; i++) { if( i == 0 ) { delete w[i]; continue; } w[i-1] = w[i]; }

A Small Study About 10% of loops require disjunctive invariants (OpenSSH 9/95) Of these about 90% are multi-phase (OpenSSH 8/9)

Multi-phase Loops x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); (x<=50 && y=50) ||(50<=x<=100 && y=x) x = 0, x = 1, …, x = 49 x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); x = 50, x = 51, …, x = 99

Multi-phase Loops Continued… Phase transition C : predicate of if inside loop Phase: contiguous iterations with C constant Transition: C changes value Restrict to 2-phase loops C transitions from false to true

Basic Idea Disjunctive Invariant Conjunctive Invariants! x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); x = 0; y = 50; while( x <= 49 ) { x = x + 1; } while( x 49) { x = x + 1; y = y + 1; } assert( y == 100); x<=50 && y=50 50<=x<=100 && y=x (x<=50 && y=50) || (50<=x<=100 && y=x)

Our Goal Reduce the problem of inferring disjunctive invariants for a multi-phase loop to inferring conjunctive invariants for a sequence of loops

Our Approach Identify multi-phase loops Split the multi-phase loops. Use standard invariant generation technique infer conjunctive invariants

Example Before Splitting After Splitting x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); x = 0; y = 50; while( x<100 && x <= 49 ) { x = x + 1; if( false ) y = y + 1; } while( x 49 ) { x = x + 1; if( true ) y = y + 1; } assert( y == 100);

Splitter Predicate (Q) while P { B [C] } } while P && !Q { B [false] } while P && Q { B [true] }

Last Notational Hurdle x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100);

Properties of Splitter Predicates Theorem: For a loop while P { B[C] }, if Q satisfies these three properties then it is a splitter predicate.

Splitter Predicate while (P) { B [C] } } while (P && !Q) { B [C] } while (P && Q) { B [C] } while (P && !Q) { B [false] } while (P && Q) { B [true] }

Algorithm

Example Revisited Before Splitting After Splitting x = 0; y = 50; while( x < 100 ) { x = x + 1; if( x > 50 ) y = y + 1; } assert( y == 100); x = 0; y = 50; while( x<100 && x <= 49 ) { x = x + 1; if( false ) y = y + 1; } while( x 49 ) { x = x + 1; if( true ) y = y + 1; } assert( y == 100); Q = WP ( x = x + 1, x > 50 ) Q = x > 49

Optimizations Splitting preserves splitter predicates Simplify precondition computation Process if top down For nested loops, process inside out

Experimental Framework Interproc abstract interpretation-based InvGen constraint solving-based Our implementation in C++ MISTRAL for precondition and constraint solving

Experiments : verification succeeded; : verification failed + : better invariants; | : incomparable; = : exactly same

Conclusion Static analysis to identify phase transitions Decompose multi-phase loops Preserve semantics Benefit standard invariant generation tools Better invariants Handle more loops Simple, easy to implement, and can be integrated with any invariant generation tool

References Balakrishnan, G., Sankaranarayanan, S., Ivancic, F., Gupta, A.: Refining the control structure of loops using static analysis. In: EMSOFT (2009), pp Gulwani, S., Jain, S., Koskinen, E.: Control-flow refinement and progress invariants for bound analysis. In: PLDI (2009), pp Mauborgne, L., Rival, X.: Trace partitioning in abstract interpretation based static analyzers. In: ESOP (2005), pp Gopan, D., Reps, T.: Guided static analysis. In: SAS (2007), pp