Predicate Abstraction and Canonical Abstraction for Singly - linked Lists Roman Manevich Mooly Sagiv Tel Aviv University Eran Yahav G. Ramalingam IBM T.J.

Slides:



Advertisements
Similar presentations
Partially Disjunctive Shape Analysis Josh Berdine Byron Cook MSR Cambridge Tal Lev-Ami Roman Manevich Mooly Sagiv Ran Shaham Tel Aviv University Ganesan.
Advertisements

Using Checkers for End-User Shape Analysis National Taiwan University – August 11, 2009 Bor-Yuh Evan Chang 張博聿 University of Colorado, Boulder If some.
Shape Analysis for Fine-Grained Concurrency using Thread Quantification Josh Berdine Microsoft Research Joint work with: Tal Lev-Ami, Roman Manevich, Mooly.
Abstract Interpretation Part II
Extensible Shape Analysis by Designing with the User in Mind Bor-Yuh Evan Chang Bor-Yuh Evan Chang, Xavier Rival, and George Necula University of California,
Gennaro Parlato (LIAFA, Paris, France) Joint work with P. Madhusudan Xiaokang Qie University of Illinois at Urbana-Champaign.
Gennaro Parlato (LIAFA, Paris, France) Joint work with P. Madhusudan Xiaokang Qie University of Illinois at Urbana-Champaign.
Shape Analysis by Graph Decomposition R. Manevich M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine B. Cook MSR Cambridge.
Interprocedural Shape Analysis for Recursive Programs Noam Rinetzky Mooly Sagiv.
Heap Decomposition for Concurrent Shape Analysis R. Manevich T. Lev-Ami M. Sagiv Tel Aviv University G. Ramalingam MSR India J. Berdine MSR Cambridge Dagstuhl.
3-Valued Logic Analyzer (TVP) Tal Lev-Ami and Mooly Sagiv.
Inferring Disjunctive Postconditions Corneliu Popeea and Wei-Ngan Chin School of Computing National University of Singapore - ASIAN
Bebop: A Symbolic Model Checker for Boolean Programs Thomas Ball Sriram K. Rajamani
1 Lecture 08(c) – Predicate Abstraction and SLAM Eran Yahav.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 13.
1 A Logic of Reachable Patterns in Linked Data-Structures Greta Yorsh joint work with Alexander Rabinovich, Mooly Sagiv Tel Aviv University Antoine Meyer,
SYMBOLIC MODEL CHECKING: STATES AND BEYOND J.R. Burch E.M. Clarke K.L. McMillan D. L. Dill L. J. Hwang Presented by Rehana Begam.
Relatively Complete Verification of Higher- Order Programs (via Automated Refinement Type Inference) Tachio Terauchi Nagoya University TexPoint fonts used.
Using Statically Computed Invariants Inside the Predicate Abstraction and Refinement Loop Himanshu Jain Franjo Ivančić Aarti Gupta Ilya Shlyakhter Chao.
1 Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications.
Local Heap Shape Analysis Noam Rinetzky Tel Aviv University Joint work with Jörg Bauer Universität des Saarlandes Thomas Reps University of Wisconsin Mooly.
Establishing Local Temporal Heap Safety Properties with Applications to Compile-Time Memory Management Ran Shaham Eran Yahav Elliot Kolodner Mooly Sagiv.
Solving Partial Order Constraints for LPO termination.
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Finding the Weakest Characterization of Erroneous Inputs Dzintars Avots and Benjamin Livshits.
Overview of program analysis Mooly Sagiv html://
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Invisible Invariants: Underapproximating to Overapproximate Ken McMillan Cadence Research Labs TexPoint fonts used in EMF: A A A A A.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
A Semantics for Procedure Local Heaps and its Abstractions Noam Rinetzky Tel Aviv University Jörg Bauer Universität des Saarlandes Thomas Reps University.
Overview of program analysis Mooly Sagiv html://
Static Program Analysis via Three-Valued Logic Thomas Reps University of Wisconsin Joint work with M. Sagiv (Tel Aviv) and R. Wilhelm (U. Saarlandes)
Dagstuhl Seminar "Applied Deductive Verification" November Symbolically Computing Most-Precise Abstract Operations for Shape.
Program Analysis and Verification Noam Rinetzky Lecture 10: Shape Analysis 1 Slides credit: Roman Manevich, Mooly Sagiv, Eran Yahav.
Thread Quantification for Concurrent Shape Analysis Josh BerdineMSR Cambridge Tal Lev-AmiTel Aviv University Roman ManevichTel Aviv University Mooly Sagiv.
By: Pashootan Vaezipoor Path Invariant Simon Fraser University – Spring 09.
1 Employing decision procedures for automatic analysis and verification of heap-manipulating programs Greta Yorsh under the supervision of Mooly Sagiv.
1 Automatic Refinement and Vacuity Detection for Symbolic Trajectory Evaluation Orna Grumberg Technion Haifa, Israel Joint work with Rachel Tzoref.
Shape Analysis Overview presented by Greta Yorsh.
Symbolically Computing Most-Precise Abstract Operations for Shape Analysis Greta Yorsh Thomas Reps Mooly Sagiv Tel Aviv University University of Wisconsin.
I-Neighbourhood Abstraction in Graph Transformation Arend Rensink University of Twente Based on work with: Jörg Bauer, Iovka Boneva, Dino Distefano, Marcus.
Generating Precise and Concise Procedure Summaries Greta Yorsh Eran Yahav Satish Chandra.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
1 Combining Abstract Interpreters Mooly Sagiv Tel Aviv University
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
Quantified Data Automata on Skinny Trees: an Abstract Domain for Lists Pranav Garg 1, P. Madhusudan 1 and Gennaro Parlato 2 1 University of Illinois at.
1 Iterative Program Analysis Abstract Interpretation Mooly Sagiv Tel Aviv University Textbook:
Roman Manevich Ben-Gurion University Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 16: Shape Analysis.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Shape & Alias Analyses Jaehwang Kim and Jaeho Shin Programming Research Laboratory Seoul National University
1 Simulating Reachability using First-Order Logic with Applications to Verification of Linked Data Structures Tal Lev-Ami 1, Neil Immerman 2, Tom Reps.
Interprocedural shape analysis for cutpoint-free programs Noam Rinetzky Tel Aviv University Joint work with Mooly Sagiv Tel Aviv University Eran Yahav.
Finding bugs with a constraint solver daniel jackson. mandana vaziri mit laboratory for computer science issta 2000.
Putting Static Analysis to Work for Verification A Case Study Tal Lev-Ami Thomas Reps Mooly Sagiv Reinhard Wilhelm.
Induction in CEGAR for Detecting Counterexamples
Interprocedural shape analysis for cutpoint-free programs
Shape Analysis Termination Analysis Linear Time
Partially Disjunctive Heap Abstraction
Compactly Representing First-Order Structures for Static Analysis
Spring 2016 Program Analysis and Verification
Symbolic Implementation of the Best Transformer
Parametric Shape Analysis via 3-Valued Logic
Program Analysis and Verification
Parametric Shape Analysis via 3-Valued Logic
Reduction in End-User Shape Analysis
Program Analysis and Verification
Symbolic Characterization of Heap Abstractions
A Semantics for Procedure Local Heaps and its Abstractions
Program Verification with Graph Types and Monadic Second-order Logic
Presentation transcript:

Predicate Abstraction and Canonical Abstraction for Singly - linked Lists Roman Manevich Mooly Sagiv Tel Aviv University Eran Yahav G. Ramalingam IBM T.J. Watson

2 Motivating Example 1: CEGAR curr = head; while (curr != tail) { assert (curr != null); curr = curr.n; } curr n nnn tail … Counterexample-guided abstraction refinement generates following predicates: curr.n ≠ null, curr.n.n ≠ null, … after i refinement steps: curr(.n) i ≠ null head

3 Motivating Example 1: CEGAR curr = head; while (curr != tail) { assert (curr != null); curr = curr.n; } n nnn tail … In general, problem is undecidable: V. Chakaravathy [POPL 2003] State-of-the-art canonical abstractions can prove assertion curr head

4 Motivating Example 2 cyclic(x) t = null; y = x; while (t != x && y.data < low) { t = y.n; y = t; } z = y; while (z != x && z.data < high) { t = z.n; z = t; } t = null; if (y != z) { y.n = null; y.n = z; } cyclic(x)

5 Motivating Example 2 x n n n n n nn y z x n n n nn y cyclic(x)

6 Existing Canonical Abstraction x,cn rx,ry,rz n n y,cn rx,ry,rz z,cn rx,ry,rz n n n n n x n n n n n nn y z cn rx,ry,rz concreteabstract order between variables lost! cannot cyclic(x)

7 Overview and Main Results Current predicate abstraction refinement methods not adequate for analyzing heaps Predicate abstraction can simulate arbitrary finite abstract domains Often requires too many predicates New family of abstractions for lists Bounded number of sharing patterns Handles cycles more precisely than existing canonical abstractions Encode abstraction with two methods: Canonical abstraction Polynomial predicate abstraction

8 Outline New abstractions for lists Observations on concrete shapes Static naming scheme Encoding via predicate abstraction Encoding via canonical abstraction Controlling the number of predicates via heap-sharing depth parameter Experimental results Related work Conclusion

9 Concrete Shapes Assume the following class of (list-) heaps Heap contains only singly-linked lists No garbage (easy to handle) A heap can be decomposed into Basic shape (sharing pattern) List lengths

10 Concrete Shapes x y class SLL { Object value; SLL n; } n nnnnnnnnn nnn n

11 Interrupting Nodes x y Interruption: node pointed-to by a variable or shared by n fields #interruptions ≤ 2 · #variables (bounded number of sharing patterns) n nnnnnnnnn nnn n

12 Maximal Uninterrupted Lists x y Maximal uninterrupted list: maximal list segment between two interruptions not containing interruptions in-between n nnnnnnnnn nnn n

13 Maximal Uninterrupted Lists x y max. uninterrupted 2max. uninterrupted 1 max. uninterrupted 3 max. uninterrupted 4 n nnnnnnnnn nnn n

14 Maximal Uninterrupted Lists x y n nnnnnnnnn nnn n number of links

15 Maximal Uninterrupted Lists x y n nnnnnnnnn nnn n 2>2 Abstract lengths: {1,2,>2}

16 Using Static Names Goal: name all sharing patterns Prepare static names for interruptions Derive predicates for canonical abstraction Prepare static names for max. uninterrupted lists Derive predicates for predicate abstraction All names expressed by FO TC formulae

17 Naming Interruptions x y x1 y1 x2 y2 We name interruptions by adding auxiliary variables For every variable x : x1, …,xk (k=#variables) x y n nnnnnnnnn nnnn

18 Naming Max. Uninterrupted Lists x y x1 y1 x2 y2 x y [x1,x2] [x1,y2] [y1,x2] [y1,y2] [x,x1] [x,y1] [x2,x2] [x2,y2] [y2,x2] [y2,y2] [y,x1] [y,y1] n nnnnnnnnn nnnn

19 A Predicate Abstraction For every pair of variables x,y (regular and auxiliary) Aliased[x,y] = x and y point to same node UList1[x,y] = max. uninterrupted list of length 1 UList2[x,y] = max. uninterrupted list of length 2 UList[x,y] = max. uninterrupted list of any length For every variable x (regular and auxiliary) UList1[x,null] = max. uninterrupted list of length 1 UList2[x,null] = max. uninterrupted list of length 2 UList[x,null] = max. uninterrupted list of any length Predicates expressed by FO TC formulae

20 Predicate Abstraction Example x y x1 y1 x2 y2 x y n nnnnnnnnn nnnn Aliased[x2,x2]Aliased[x1,x1]Aliased[y,y]Aliased[x,x] Aliased[y1,x1]Aliased[x1,y1]Aliased[y2,y2]Aliased[y1,y1] UList[x,y1]UList[x,x1]Aliased[y2,x2]Aliased[x2,y2] UList2[y1,y2]UList2[y1,x2]UList2[x1,y2]UList2[x1,x2] UList[y1,y2]UList[y1,x2]UList[x1,y2]UList[x1,x2] UList[x2,y2]UList[x2,x2]UList[y,y1]UList[y,x1] UList[y2,y2]UList[y2,x2] concrete abstract

21 A Canonical Abstraction For every variable x (regular and auxiliary) x(v) = v is pointed-to by x cul[x](v) = uninterrupted list from node pointed-to by x to v Predicates expressed by FO TC formulae

22 Canonical Abstraction Example x y x1 y1 x2 y2 x y cul[x] cul[y] cul[x1] cul[y1] cul[x2] cul[y2] n nnnnnnnnn nnnn concrete

23 Canonical Abstraction Example x y x1 y1 x2 y2 x y cul[x] cul[y] cul[x1] cul[y1] cul[x2] cul[y2] n nnnnn n n n nn abstract

24 Canonical Abstraction of Cyclic List x n n n n n nn y z concreteabstract x n n n nn y z cul[x] cul[y] cul[z] n n

25 Canonical Abstraction of Cyclic List abstract preabstract post x n n n nn y z cul[x] cul[y] cul[z] n n x n n n nn y z cul[x] cul[y] cul[z]

26 Heap-sharing Depth x y x1 y1 x2 y2 x y In this example the heap-sharing depth is 2 In practice depth expected to be low (≤ 1) n nnnnnnnnn nnnn

27 Setting the Heap-sharing Depth x y x1 y1 x y Setting the heap-sharing depth parameter to 1 results in lost information about shape n nnnnnnnnn nnnn Heap-sharing depth parameter d determines number of static names : control over number of predicates

28 Experimental Results

29 Related Work Dor, Rode and Sagiv [SAS ’00] Checking cleanness in lists Sagiv, Reps and Wilhelm [TOPLAS ‘02] General framework + abstractions for lists Dams and Namjoshi [VMCAI ’03] Semi-automatic predicate abstraction for shape analysis Balaban, Pnueli and Zuck [VMCAI ’05] Predicate abstraction for shapes via small models Deutsch [PLDI ’94] Symbolic access paths with lengths

30 Conclusion New abstractions for lists Observations about concrete shapes Precise for programs containing heaps with sharing and cycles, ignoring list lengths Parametric in sharing-depth d:[1…k] Encoded new abstractions via Canonical abstraction O(d·k) Polynomial predicate abstraction O(d 2 ·k 2 ) d=1 sufficient for all examples

31 Missing from Talk Simulating abstract domains by pred. abs. Formal definition of abstractions Abstract transformers Decidable logic  can be automatically derived Abstraction equivalence: for every two concrete heaps H1,H2 β PA (H1)=β PA (H2) iff β C (H1)=β C (H2) Abstractions with less predicates Cycle breaking Linear static naming scheme

32 Merci

33 Simulating Finite Domains by Predicate Abstraction Assume finite abstract domain of numbered elements {1,…,n} Naïve simulation Predicates {P i } i=1…n P i Holds when abstract program state is i Simulation using logarithmic number of predicates Use binary representation of numbers Predicates {P j } j=1…log n P j Holds when j-th bit of abstract program state is 1