Abstract Interpretation with Alien Expressions and Heap Structures Bor-Yuh Evan ChangK. Rustan M. Leino UC BerkeleyMicrosoft Research November 11, 2004.

Slides:



Advertisements
Similar presentations
Assertion Checking over Combined Abstraction of Linear Arithmetic and Uninterpreted Functions Sumit Gulwani Microsoft Research, Redmond Ashish Tiwari SRI.
Advertisements

Join Algorithms for the Theory of Uninterpreted Functions Sumit Gulwani Ashish Tiwari George Necula UC-Berkeley SRI UC-Berkeley.
Combining Abstract Interpreters Sumit Gulwani Microsoft Research Redmond, Group Ashish Tiwari SRI RADRAD.
A Randomized Satisfiability Procedure for Arithmetic and Uninterpreted Function Symbols Sumit Gulwani George Necula EECS Department University of California,
Precise Interprocedural Analysis using Random Interpretation Sumit Gulwani George Necula UC-Berkeley.
TVLA for System Code Jörg KreikerHelmut SeidlVesal Vojdani TU Munich Dagstuhl, July 2009.
Continuing Abstract Interpretation We have seen: 1.How to compile abstract syntax trees into control-flow graphs 2.Lattices, as structures that describe.
1 Programming Languages (CS 550) Mini Language Interpreter Jeremy R. Johnson.
Predicate Abstraction and Canonical Abstraction for Singly - linked Lists Roman Manevich Mooly Sagiv Tel Aviv University Eran Yahav G. Ramalingam IBM T.J.
3-Valued Logic Analyzer (TVP) Tal Lev-Ami and Mooly Sagiv.
Domain: 1) f(0) = 8 2) f(3) = 3) g(-2) = -2 4) g(2) = 0 5) f(g(0)) = f(2) =0 6) f(g(-2)) = f(-2) =undefined 7) f(g(2)) = f(0) =8 8) f(g(-1)) = f(1) =3.
Abstract Interpretation with Alien Expressions and Heap Structures Bor-Yuh Evan ChangK. Rustan M. Leino University of California, BerkeleyMicrosoft Research.
Program Representations. Representing programs Goals.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
A survey of techniques for precise program slicing Komondoor V. Raghavan Indian Institute of Science, Bangalore.
Type-Based Verification of Assembly Language for Compiler Debugging Bor-Yuh Evan ChangAdam Chlipala George C. NeculaRobert R. Schneck University of California,
Inferring Object Invariants Bor-Yuh Evan ChangK. Rustan M. Leino University of California, BerkeleyMicrosoft Research January 21, 2005 AIOOL 2005 Paris,
Discovering Affine Equalities Using Random Interpretation Sumit Gulwani George Necula EECS Department University of California, Berkeley.
Assertion Checking Unified Sumit Gulwani Microsoft Research, Redmond Ashish Tiwari SRI.
Precise Inter-procedural Analysis Sumit Gulwani George C. Necula using Random Interpretation presented by Kian Win Ong UC Berkeley.
Common Sub-expression Elim Want to compute when an expression is available in a var Domain:
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Automated Theorem Proving Lecture 4.   Formula := A |  |    A  Atom := b | t = 0 | t < 0 | t  0 t  Term := c | x | t + t | t – t | ct | Select(m,t)
Prof. Necula CS Lecture 121 Decision-Procedure Based Theorem Provers Tactic-Based Theorem Proving Inferring Loop Invariants CS Lecture 12.
Program Analysis Using Randomization Sumit Gulwani, George Necula (U.C. Berkeley)
A Numerical Abstract Domain based on Expression Abstraction + Max Operator with Application in Timing Analysis Sumit Gulwani (MSR Redmond) Bhargav Gulavani.
Randomized Analysis with Repeated Conditionals for Affine Equalities Bor-Yuh Evan Chang CS263 Final Project December 4, 2002.
Recap from last time: live variables x := 5 y := x + 2 x := x + 1 y := x y...
Using and Building an Automatic Program Verifier K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond Lecture 5 LASER.
A Polynomial-Time Algorithm for Global Value Numbering SAS 2004 Sumit Gulwani George C. Necula.
The Composite Pattern.. Composite Pattern Intent –Compose objects into tree structures to represent part-whole hierarchies. –Composite lets clients treat.
Relations and Functions
Introduction to Logic for Artificial Intelligence Lecture 2 Erik Sandewall 2010.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
0.1 Functions and Their Graphs. Real Numbers A set is a collection of objects. The real numbers represent the set of numbers that can be represented as.
SECTION 1.1 FUNCTIONS FUNCTIONS. DEFINITION OF A RELATION A relation is a correspondence between two sets. If x and y are two elements in these sets and.
6.001 SICP 1/ : Structure and Interpretation of Computer Programs Symbols Example of using symbols Differentiation.
A Parametric Segmentation Functor for Fully Automatic and Scalable Array Content Analysis Patrick Cousot, NYU & ENS Radhia Cousot, CNRS & ENS & MSR Francesco.
SECTION 4.2 ONE-TO-ONE FUNCTIONS ONE-TO-ONE FUNCTIONS INVERSE FUNCTIONS INVERSE FUNCTIONS.
SWBAT… define and evaluate functions Agenda 1. Warm-Up (5 min) 2. Quiz – piecewise functions (6 min) 3. Notes on functions (25 min) 4. OYO problems (10.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 14: Numerical Abstractions Roman Manevich Ben-Gurion University.
Program Analysis and Verification Spring 2014 Program Analysis and Verification Lecture 14: Numerical Abstractions Roman Manevich Ben-Gurion University.
Symbolic Implementation of the Best Transformer Thomas Reps University of Wisconsin Joint work with M. Sagiv and G. Yorsh (Tel-Aviv) [TR-1468, Comp. Sci.
Formal Specification of Intrusion Signatures and Detection Rules By Jean-Philippe Pouzol and Mireille Ducassé 15 th IEEE Computer Security Foundations.
Program analysis with dynamic change of precision. Philippe Giabbanelli CMPT 894 – Spring 2008.
Section 3-2: Solving Systems Algebraically (Pg.125) By Ms. Beydoun.
Simplify. Assume that all expressions are defined.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 12: Abstract Interpretation IV Roman Manevich Ben-Gurion University.
Random Interpretation Sumit Gulwani UC-Berkeley. 1 Program Analysis Applications in all aspects of software development, e.g. Program correctness Compiler.
K. Rustan M. Leino Research in Software Engineering (RiSE) Microsoft Research, Redmond, WA part 2 International Summer School Marktoberdorf Marktoberdorf,
Ch 9 – Properties and Attributes of Functions 9.4 – Operations with Functions.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
1 An infrastructure for context-awareness based on first order logic 송지수 ISI LAB.
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.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
2.1 Functions and their Graphs Standard: Students will understand that when a element in the domain is mapped to a unique element in the range, the relation.
Daniel Kroening and Ofer Strichman 1 Decision Procedures in First Order Logic Decision Procedures for Equality Logic.
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 8: Static Analysis II Roman Manevich Ben-Gurion University.
Satisfiability Modulo Theories and DPLL(T) Andrew Reynolds March 18, 2015.
Decision Procedures in First Order Logic
Ch. 1 – Functions and Their Graphs
Spring 2016 Program Analysis and Verification
Programming Languages Dan Grossman 2013
Symbolic Implementation of the Best Transformer
2.1 – Represent Relations and Functions.
Program Analysis and Verification
Aim: What is the function notation?
Symbolic Characterization of Heap Abstractions
Warm Up 12/3/2018 Solve by substitution.
Presentation transcript:

Abstract Interpretation with Alien Expressions and Heap Structures Bor-Yuh Evan ChangK. Rustan M. Leino UC BerkeleyMicrosoft Research November 11, 2004 OSQ Meeting

2 11/12/2004 Standard Abstract Interpretation y := 8; x := 0; while (*) { y := y + x; x++; } y ¸ 8 Can do this inference with the polyhedra abstract domain [CH79]

3 11/12/2004 Standard Abstract Interpretation this.y := 8; this.x := 0; while (*) { this.y := this.y + this.x; this.x++; } this.y ¸ 8? Goal: Given a base domain that can infer certain kind of predicates on variables, use it to infer predicates on fields

4 11/12/2004 Achieving the Goal 1.Handling Alien Expressions / Uninterpreted Functions 2.Handling Heap Updates

5 11/12/2004 Abstract Domains interface AbstractDomain { type Elt Constrain : Elt £ Expr ! Elt Eliminate : Elt £ Var ! Elt Rename : Elt £ Var £ Var ! Elt ToPredicate : Elt ! Expr Join : Elt £ Elt ! Elt AtMost : Elt £ Elt ! bool }

6 11/12/2004 Fooling the Base Domains Congruence-Closure Domain / “Name Service” Polyhedra Constrain( sel(H,o,f) ¸ 8 ) assume o.f ¸ 8 Constrain(  ¸ 8 ) sel(H,o,f)   Base Domains SymbolicValue

7 11/12/2004 Understandable to the Base Domain ¸ + sel Hof ² | 2 ¢ x + sel(H,o,f) · |y - z| 2xyz Understands : FunSymbol £ Expr[] ! bool

8 11/12/2004 Understandable to the Base Domain ¸ + sel Hof ² | 2 ¢ x + sel(H,o,f) · |y - z| 2xyz Understands : FunSymbol £ Expr[] ! bool Yes No

9 11/12/2004 Understandable to the Base Domain ¸ +  ² | 2 ¢ x +  · |y - z| 2xyz Understands : FunSymbol £ Expr[] ! bool No No

10 11/12/2004 Understandable to the Base Domain ¸ +  ²  2 ¢ x +  ·  2xyz Understands : FunSymbol £ Expr[] ! bool No Yes   = y - z

11 11/12/2004 Congruence-Closure Domain Could always choose new names, but … –Should use the same name for syntactically equivalent expressions –Even Better: same name for known equalities Tracks equalities of uninterpreted functions –an E-Graph with abstract domain operations –symbolic values “name” equivalence classes of expressions –implements congruence closure

12 11/12/2004 E-Graph w = f(x) Æ g(x,y) = f(y) Æ w = h(w) A set of mappings: w   x   f(  )   y   g( ,  )   f(  )   h(  )   Always congruence-closed    w xy g h  ff

13 11/12/2004 Join Join the e-graphs, then join the base domains Think of the lattice over conjunctions of equalities (including infinite ones) Let G = Join(G 0,G 1 ) x  G h  ’,  ’ i if x  G 0  ’ and x  G 1  ’ f( h ,  i )  G h  ’,  ’ i if f(  )  G 0  ’ and f(  )  G 1  ’ Rename distinct pairs to fresh symbolic values

14 11/12/2004 Join Complexity: O(n ¢ m) Complete? As precise as possible? –No, e-graphs do not form a lattice! x = y t g(x) = g(y) Æ x = f(x) Æ y = f(y) = Æ i : i ¸ 0 g(f i (x)) = g(f i (y)) –Only relatively complete [Gulwani et al.] Tell base domains about renaming h ,  i à  Constrain B 0 (  =  ), Constrain B 1 (  =  )

15 11/12/2004 So Far We Have … Reasoning for uninterpreted functions Base domains that work with alien expressions transparently What we need for field reads –sel is alien to all base domains

16 11/12/2004 Achieving the Goal 1.Handling Alien Expressions / Uninterpreted Functions 2.Handling Heap Updates

17 11/12/2004 Heap Updates Java/C#if (p.g == 8) { o.f = x; } Abstractassume H[p,g] == 8; InterpreterH := upd(H,o,f,x); sel(upd(H,o,f,e),o’,f’) = e if o = o’ and f = f’ sel(upd(H,o,f,e),o’,f’) = sel(H,o’,f’) if o  o’ or f  f’

18 11/12/2004 Heap Updates Java/C#if (p.g == 8) { o.f = x; } Abstractassume H[p,g] == 8; InterpreterH := H’ where H’ ´ o,f H and sel(H’,o,f) = x

19 11/12/2004 Heap Updates Abstractassume H[p,g] == 8; InterpreterH := H’ where H’ ´ o,f H and sel(H’,o,f) = x AbstractConstrain( sel(H,p,g) = 8 ) DomainConstrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate() Tracked by a new base domain: Heap Succession

20 11/12/2004 Heap Update Example Heap Succession H’ ´ o,f H E-Graph sel(H,p,g)   8   sel(H’,o,f)   x   H  Hp  p H’  H’ g  g o  of  f Constrain( sel(H,p,g) = 8 ) Constrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate()

21 11/12/2004 Heap Update Example Heap Succession H’ ´ o,f H E-Graph sel(H,p,g)   8   sel(H’,o,f)   x   H  Hp  p H’  H’ g  g o  of  f Constrain( sel(H,p,g) = 8 ) Constrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate()

22 11/12/2004 Heap Update Example Heap Succession H’ ´ o,f H E-Graph sel(H,p,g)   8   sel(H’,o,f)   x   H  Hp  p H  H’ g  g o  of  f Constrain( sel(H,p,g) = 8 ) Constrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate()

23 11/12/2004 Heap Update Example Heap Succession H’ ´ o,f H E-Graph sel(H,p,g)   8   sel(H’,o,f)   x   H  Hp  p H  H’ g  g o  of  f Constrain( sel(H,p,g) = 8 ) Constrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate() 1.“Collect Garbage” (H) EquivalentExpr : Queryable £ Expr £ Var ! Expr Can you give me an equivalent expression without H?

24 11/12/2004 Heap Update Example Heap Succession H’ ´ o,f H E-Graph sel(H’,p,g)   8   sel(H’,o,f)   x   H  Hp  p H  H’ g  g o  of  f Constrain( sel(H,p,g) = 8 ) Constrain( H’ ´ o,f H ) Constrain( sel(H’,o,f) = x ) Eliminate( H ) Rename( H’, H ) ToPredicate() 1.“Collect Garbage” (H) EquivalentExpr : Queryable £ Expr £ Var ! Expr option Eliminate(H) on Base 2.ToPredicate() on Base and Convert Expr for Client 3.Add Equalities Yes, use H’

25 11/12/2004 Related Work Join for Uninterpreted Functions [Gulwani, Tiwari, Necula] Shape Analysis [many] and TVLA [Sagiv, Reps, Wilhelm, …]

26 11/12/2004 Conclusion Extended the power of abstract domains to work with alien expressions using the congruence-closure domain Added reasoning about heap updates with the heap succession domain Close to having “cooperating abstract interpreters”? –missing propagating back equalities inferred by base domains

Thank you! Questions? Comments?