(Optimal) Program Analysis of Sequential and Parallel Programs

Size: px
Start display at page:

Download "(Optimal) Program Analysis of Sequential and Parallel Programs"

Transcription

1 (Optimal) Program Analysis of Sequential and Parallel Programs Markus Müller-Olm Westfälische Wilhelms-Universität Münster, Germany 3rd Summer School on Verification Technology, Systems, and Applications Luxemburg, September 6-10, 2010

2 Dream of Automatic Analysis program analyzer result main() { x=17; if (x>63) { y=17;x=10;x=x+1;} else { x=42; while (y<99) { y=x+y;x=y+1;} y=11;} x=y+1; printf(x); } G( Φ FΨ) specification of property

3 Fundamental Problem Rice s Theorem (informal version): All non-trivial semantic properties of programs from a Turing-complete programming language are undecidable. Consequence: For Turing-complete programming languages: Automatic analyzers of semantic properties, which are both correct and complete are impossible. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

4 What can we do about it? Give up automatic : interactive approaches: proof calculi, theorem provers, Give up sound :??? Give up complete : approximative approaches: Approximate analyses: data flow analysis, abstract interpretation, type checking, Analyse weaker formalism: model checking, reachability analysis, equivalence- or preorderchecking,

5 What can we do about it? Give up automatic automatic : interactive approaches: proof calculi,, theorem provers,, Give up sound sound : :??? Give up complete : approximative approaches: Approximate analyses: data flow analysis, abstract interpretation, type checking, Analyse weaker formalism: model checking, reachability analysis, equivalence- or preorderchecking,

6 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Apology for not giving proper credit in these lectures! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

7 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Apology for not giving proper credit in these lectures! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

8 From Programs to Flow Graphs 0 main() { x=17; if (x>63) { y=17;x=10;x=x+1;} else { x=x+42; while (y<99) { y=x+y;x=y+1;} y=11;} x=y+1; } x=17 1 y>63 2 y:=17 (y>63) 5 x=x+42 y< x:=10 (y<99) x=y x:=x+1 10 y:=11 x:=y y=x+y Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

9 Dead Code Elimination Goal: find and eliminate assignments that compute values which are never used Fundamental problem: undecidability use approximate algorithm: e.g.: ignore that guards prohibit certain execution paths Technique: 1) perform live variables analyses: variable x is live at program point u iff there is a path from u on which x is used before it is modified 2) eliminate assignments to variables that are not live at the target point Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

10 Live Variables y>63 0 x=17 1 (y>63) y live 2 5 y:=17 x=x x:=10 (y<99) y<99 x=y+1 7 y=x+y 8 y live 4 9 x:=x+1 x dead y:=11 10 x:=y+1 11

11 Live Variables Analysis {y} {x,y} {y} y>63 0 x=17 1 (y>63) 2 y:=17 {x,y} {y} {x,y} {x,y} 5 x=x+42 {y} 3 {x,y} {y} 6 x:=10 (y<99) 4 9 x:=x+1 y:=11 10 x:=y+1 11 y<99 x=y+1 7 {x,y} y=x+y 8 {y}

12 Interpretation of Partial Orders in Approximate Program Analysis x y: x is more precise information than y. y is a correct approximation of x. X for X L, where (L, ) is the partial order: the most precise information consistent with all informations x X. Example: order for live variables analysis: (P(Var), ) with Var = set of variables in the program Remark: often dual interpretation in the literature!

13 Complete Lattice Complete lattice (L, ): a partial order (L, ) for which the least upper bound, X, exists for all X L. In a complete lattice (L, ): X exists for all X L: X = { x L x X } least element exists: = L = greatest element exists: = = L Example: for any set A let P(A) = {X X A } (power set of A). (P(A), ) is a complete lattice. (P(A), ) is a complete lattice.

14 Specifying Live Variables Analysis by a Constraint System Compute (smallest) solution over (L, ) = (P(Var), ) of: A[ fin] init, for fin, the termination node A[ u] f ( A[ v]), for each edge e = ( u, s, v) e where init = Var, f e :P(Var) P(Var), f e (x) = x\kill e gen e, with kill e = variables assigned at e gen e = variables used in an expression evaluated at e

15 Specifying Live Variables Analysis by a Constraint System Remarks: 1. Every solution is correct (whatever this means). 2. The smallest solution is called MFP-solution; it comprises a value MFP[u] L for each program point u. 3. MFP abbreviates maximal fixpoint for traditional reasons. 4. The MFP-solution is the most precise one.

16 Backwards vs. Forward Analyses Live Variables Analysis is a Backwards Analysis, i.e.: analysis info flows from target node to source node of an edge the initial inequality is for the termination node of the flow graph A[ te] init, for te, the termination point A[ u] f ( A[ v]), for each edge e = ( u, s, v) E Dually, there are Forward Analyses i.e..: e analysis info flows from source node to target node of an edge. the initial inequality is for the start node of the flow graph A[ st] init, for st,the start node A[ v] f ( A[ u]), for each edge e = ( u, s, v) E e Examples: reaching definitions, available expressions, constant propagation,... Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

17 Data-Flow Frameworks Correctness generic properties of frameworks can be studied and proved Implementation efficient, generic implementations can be constructed Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

18 Three Questions Do (smallest) solutions always exist? How to compute the (smallest) solution? How to justify that a solution is what we want? Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

19 Three Questions Do (smallest) solutions always exist? How to compute the (smallest smallest) solution? How to justify that a solution is what we want? Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

20 Knaster-Tarski Fixpoint Theorem Definitions: Let (L, ) be a partial order. f : L L is monotonic iff x,y L : x y f(x) f(y). x L is a fixpoint of f iff f(x)=x. Fixpoint Theorem of Knaster-Tarski: Every monotonic function f on a complete lattice L has a least fixpoint lfp(f) and a greatest fixpoint gfp(f). More precisely, lfp(f) = { x L f(x) x } least pre-fixpoint gfp(f) = { x L x f(x) } greatest post-fixpoint

21 Knaster-Tarski Fixpoint Theorem L: pre-fixpoints of f gfp(f) fixpoints of f lfp(f) post-fixpoints of f Picture from: Nielson/Nielson/Hankin, Principles of Program Analysis

22 Smallest Solutions Always Exist Define functional F : L n L n from right hand sides of constraints such that: σ solution of constraint system iff σ pre-fixpoint of F Functional F is monotonic. By Knaster-Tarski Fixpoint Theorem: F has a least fixpoint which equals its least pre-fixpoint. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

23 Three Questions Do (smallest smallest) solutions always exist? How to compute the (smallest) solution? How to justify that a solution is what we want? Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

24 Workset-Algorithm W = ; forall ( program points v) { A[ v] = ; W = W { v} ; } A[ fin] = init; while W { v = Extract( W ); forall ( u, s with e = ( u, s, v) edge) { t = fe( A[ v]); if ( t A[ u]) { A[ u] = A[ u] t; W = W { u} ; } } } Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

25 Invariants of the Main Loop a) A[ u] MFP[ u] f.a. prg. points u b1) A[ fin] init b2) v W A[ u] f ( A[ v]) f.a. edges e = ( u, s, v) e If and when workset algorithm terminates: A is a solution of the constraint system by b1)&b2) A[ u] MFP[ u] f.a. u Hence, with a): A[ u] = MFP[ u] f.a. u Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

26 How to Guarantee Termination Lattice (L, ) has finite heights algorithm terminates after at most #prg points (heights(l)+1) iterations of main loop Lattice (L, ) has no infinite ascending chains algorithm terminates Lattice (L, ) has infinite ascending chains: algorithm may not terminate; use widening operators in order to enforce termination Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

27 Widening Operator [Cousot] : L L L is called a widening operator iff 1) x,y L: x y x y 2) for all sequences (l n ) n, the (ascending) chain (w n ) n w 0 = l 0, w i+1 = w i l i+1 for i > 0 stabilizes eventually.

28 Workset-Algorithm with Widening W = ; forall ( program points v) { A[ v] = ; W = W { v} ; } A[ fin] = init; while W { v = Extract( W ); forall ( u, s with e = ( u, s, v) edge) { t = fe( A[ v]); if ( t A[ u]) { A[ u] = A[ u] t; W = W { u} ; } } } Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

29 Invariants of the Main Loop a) A[ u] MFP[ u] f.a. prg. points u b1) A[ fin] init b2) v W A[ u] f ( A[ v]) f.a. edges e = ( u, s, v) With a widening operator we enforce termination but we loose invariant a). e Upon termination, we have: A is a solution of the constraint system by b1)&b2) A[ u] MFP[ u] f.a. u Compute a sound upper approximation (only)! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

30 Example of a Widening Operator: Interval Analysis The goal Find save interval for the values of program variables, e.g. of i in: for (i=0; i<42; i++) if (0<=i and i<42) { } A1 = A+i; M[A1] = i;..., e.g., in order to remove the redundant array range check.

31 Example of a Widening Operator: Interval Analysis The lattice... ({ } { } ) ( ) Z { } Z { } L, = [ l, u] l, u +, l u,... has infinite ascending chains, e.g.: [0,0] [0,1] [0,2]... A widening operator: [ l, u ] [ l, u ] = [ l, u ], where l l if l l u if u u = and u = otherwise + otherwise A chain of maximal length arising with this widening operator: [3,7] [3, + ] [, + ]

32 Analyzing the Program with the Widening Operator Result is far too imprecise! Example taken from: H. Seidl, Vorlesung Programmoptimierung

33 Remedy 1: Loop Separators Apply the widening operator only at a loop separator (a set of program points that cuts each loop). We use the loop separator {1} here. Identify condition at edge from 2 to 3 as redundant!

34 Remedy 2: Narrowing Iterate again from the result obtained by widening --- Iteration from a prefix-point stays above the least fixpoint! --- We get the exact result in this example (but not guaranteed)!

35 Remarks Can use a work-list instead of a work-set Special iteration strategies in special situations Semi-naive iteration Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

36 Recall: Specifying Live Variables Analysis by a Constraint System Compute (smallest) solution over (L, ) = (P(Var), ) of: A[ fin] init, for fin, the termination node A[ u] f ( A[ v]), for each edge e = ( u, s, v) e where init = Var, f e :P(Var) P(Var), f e (x) = x\kill e gen e, with kill e = variables assigned at e gen e = variables used in an expression evaluated at e

37 Recall: Questions Do (smallest) solutions always exist? How to compute the (smallest) solution? How to justify that a solution is what we want? Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

38 Three Questions Do (smallest smallest) solutions always exist? How to compute the (smallest smallest) solution? How to justify that a solution is what we want? MOP vs MFP-solution Abstract interpretation Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

39 Three Questions Do (smallest smallest) solutions always exist? How to compute the (smallest smallest) solution? How to justify that a solution is what we want? MOP vs MFP-solution Abstract interpretation Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

40 Assessing Data Flow Frameworks Execution Semantics Abstraction MOP-solution sound? how precise? MFP-solution sound? precise? Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

41 Live Variables x := 17 {y} y := 17 x := 10 x := x+1 x := 42 y := 11 y := x+y x := y+1 x := y+1 out(x) infinitely many such paths MOP[ v] = { y} = { y}

42 Meet-Over-All-Paths Solution (MOP) Forward Analysis = p Paths[ entry, u] p MOP[ u] : F ( init) Backward Analysis = p Paths[ u, exit ] p MOP[ u] : F ( init) Here: Join-over-all-paths ; MOP traditional name Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

43 Coincidence Theorem Definition: A framework is positively-distributive if f( X)= { f(x) x X} for all X L, f F. Theorem: For any instance of a positively-distributive framework: MOP[u] = MFP[u] for all program points u (if all program points reachable). Remark: A framework is positively-distributive if a) and b) hold: (a) it is distributive: f(x y) = f(x) f(y) f.a. f F, x,y L. (b) it is effective: L does not have infinite ascending chains. Remark: All bitvector frameworks are distributive and effective. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

44 Lattice for Constant Propagation unknown value lattice L : { ρ ρ : Var ( Z { })} { } : ρ ρ ' : ρ = ( ρ, ρ ' x : ρ( x) ρ '( x))

45 x := 17 ( ρ( x), ρ( y), ρ( z)) x := 2 x := 3 y := 3 y := 2 z := x+y (2,3,5) out(x) (3,2,5) MOP[ v] = (,,5) Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

46 x := 17 ( ρ( x), ρ( y), ρ( z)) (,, ) x := 2 x := 3 (2,, ) (3,, ) y := 3 (2,3, ) (,, ) z := x+y (,, ) out(x) y := 2 (3,2, ) M FP[ v] = (,, ) MOP[ v] = (,,5) Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

47 Correctness Theorem Definition: A framework is monotone if for all f F, x,y L: x y f(x) f(y). Theorem: In any monotone framework: MOP[u] MFP[u] for all program points u. Remark: Any "reasonable" framework is monotone. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

48 Assessing Data Flow Frameworks Execution Semantics Abstraction MOP-solution sound MFP-solution sound precise, if distrib. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

49 Where Flow Analysis Looses Precision Execution semantics MOP MFP Widening Potential loss of precision Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

50 Three Questions Do (smallest smallest) solutions always exist? How to compute the (smallest smallest) solution? How to justify that a solution is what we want? MOP vs MFP-solution Abstract interpretation Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

51 Abstract Interpretation constraint system for Reference Semantics on concrete lattice (D, ) Replace concrete operators o by abstract operators o # constraint system for Analysis on abstract lattice (D #, # ) MFP MFP # Often used as reference semantics: sets of reaching runs: (D, ) = (P(Edges * ), ) or (D, ) = (P(Stmt * ), ) sets of reaching states ( collecting semantics ): (D, ) = (P(Σ * ), ) with Σ = Var Val Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

52 Abstract Interpretation constraint system for Reference Semantics on concrete lattice (D, ) Replace concrete operators o by abstract operators o # constraint system for Analysis on abstract lattice (D #, # ) MFP MFP # Assume a universally-disjunctive abstraction function α : D D #. Correct abstract interpretation: Show α(o(x 1,...,x k )) # o # (α(x 1 ),...,α(x k )) f.a. x 1,...,x k L, operators o Then α(mfp[u]) # MFP # [u] f.a. u Correct and precise abstract interpretation: Show α(o(x 1,...,x k )) = o # (α(x 1 ),...,α(x k )) f.a. x 1,...,x k L, operators o Then α(mfp[u]) = MFP # [u] f.a. u Use this as a guideline for designing correct (and precise) analyses! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

53 Abstract Interpretation Constraint system for reaching runs: Operational justification: Let R[u] be components of smallest solution over P(Edges *). Then Prove: { ε} R[ st], for st, the start node { } R[ v] R[ u] e, for each edge e = ( u, s, v) op R[ u] = R [ u] = { r Edges * st r u} for all u def a) R op [u] satisfies all constraints (direct) R[u] R op [u] f.a. u b) w R op [u] w R[u] (by induction on w ) R op [u] R[u] f.a. u

54 Abstract Interpretation Constraint system for reaching runs: { ε} R[ st], for st, the start node { } R[ v] R[ u] e, for each edge e = ( u, s, v) Derive the analysis: Replace {ε} by init ( ) { e } by f e Obtain abstracted constraint system: # R st init st [ ], for, the start node R [ v] f ( R [ u]), for each edge e = ( u, s, v) # # e

55 Abstract Interpretation MOP-Abstraction: Define α MOP : P(Edges *) L by { } α ( ) ( ) MOP R = f init r R where fε = Id, f = f f r s e e s Remark: For all transfer functions f e are monotone, the abstraction is correct: α ΜOP (R[u]) R # [u] f.a. prg. points u If all transfer function f e are universally-distributive, the abstraction is correct and precise: α ΜOP (R[u]) = R # [u] f.a. prg. points u Justifies MOP vs. MFP theorems (cum grano salis).

56 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

57 Challenges for Automatic Analysis Data aspects: infinite number domains dynamic data structures (e.g. lists of unbounded length) pointers... Control aspects: recursion concurrency creation of processes / threads synchronization primitives (locks, monitors, communication stmts...)... infinite/unbounded state spaces Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

58 Classifying Analysis Approaches control aspects data aspects analysis techniques Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

59 (My) Main Interests of Recent Years Data aspects: algebraic invariants over Q, Z, Z m (m = 2 n ) in sequential programs, partly with recursive procedures invariant generation relative to Herbrand interpretation Control aspects: recursion concurrency with process creation / threads synchronization primitives, in particular locks/monitors Technics: fixpoint-based automata-based (linear) algebra syntactic substitution-based techniques...

60 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

61 A Note on Karr s Algorithm Markus Müller-Olm FernUniversität Hagen (on leave from Universität Dortmund) Joint work with Helmut Seidl (TU München) ICALP 2004, Turku, July 12-16, 2004

62 What this Excursion is About x 1 :=1 x 2 :=1 x 3 :=1 x 1 :=x 1 +1 x 2 :=2x 2-2x 1 +5 x 3 :=x 3 +x 2 x 3 = x 1 2 x 2 = 2x 1-1

63 Affine Programs Basic Statements: affine assignments: x 1 := x 1-2x 3 +7 unknown assignments: x i :=? abstract too complex statements Affine Programs: control flow graph G=(N,E,st), where N E N Stmt N st N finite set of program points set of edges start node Note: non-deterministic instead of guarded branching

64 The Goal: Precise Analysis Given an affine program, determine for each program point all valid affine relations: a 0 + a i x i = 0 More ambitious goal: a i Q 5x 1 +7x 2-42=0 determine all valid polynomial relations (of degree d): p(x 1,,x k ) = 0 p Q[x 1,,x n ] 5x 1 x 22 +7x 33 =0

65 Applications of Affine (and Polynomial) Relations Data-flow analysis: definite equalities: x = y constant detection: x = 42 discovery of symbolic constants: x = 5yz+17 complex common subexpressions: xy+42 = y 2 +5 loop induction variables Program verification strongest valid affine (or polynomial) assertions (cf. Petri Net invariants)

66 Karr s Algorithm [Karr, 1976] Determines valid affine relations in programs. Idea: Perform a data-flow analysis maintaining for each program point a set of affine relations, i.e., a linear equation system. Fact: Set of valid affine relations forms a vector space of dimension at most k+1, where k = #program variables. can be represented by a basis. forms a complete lattice of height k+1.

67 Deficiencies of Karr s Algorithm Basic operations are complex non-invertible assignments union of affine spaces O(n k 4 ) arithmetic operations n size of the program k number of variables Numbers may have exponential length

68 Our Contribution Reformulation of Karr s algorithm: basic operations are simple O(n k 3 ) arithmetic operations numbers stay of polynomial length: O(n k 2 ) Moreover: generalization to polynomial relations of bounded degree show, algorithm finds all affine relations in affine programs Ideas: represent affine spaces by affine bases instead of lin. eq. syst. use semi-naive fixpoint iteration keep a reduced affine basis for each program point during fixpoint iteration

69 Affine Basis

70 Concrete Collecting Semantics Smallest solution over subsets of Q k of: where V[ st] Q k V[ v] f ( V[ u]), for each edge ( u, s, v) x : = t i x : =? s { } f ( X ) = x[ x t( x)] x X i { Q} f ( X ) = x[ x c] x X, c i i First goal: compute affine hull of V[u] for each u.

71 Abstraction Affine hull: { λ λ Q λ } aff ( X ) = x x X,, = 1 i i i i i The affine hull operator is a closure operator: aff ( X ) X, aff ( aff ( X )) = X, X Y aff ( X ) aff ( Y ) Affine subspaces of Q k ordered by set inclusion form a complete lattice: ({ Q k } ) ( D, ) = X aff ( X ) = X,. Affine hull is even a precise abstraction: Lemma : f ( aff ( X )) = aff ( f ( X )). s s

72 Abstract Semantics Smallest solution over (D, ) of: V # [ st] Q V [ v] f ( V [ u]), for each edge ( u, s, v) # # s k # Lemma: V [ u] = aff ( V[ u]) for all program points u.

73 Basic Semi-naive Fixpoint Algorithm forall ( v N) G[ v] = ; G[ st] = {0, e1,..., ek }; W = {( st,0),( st, e1),...,( st, ek )}; while W { ( u, x) = Extract( W ); forall ( s, v with ( u, s, v) E) { t = s x; if ( t aff ( G[ v])) { G[ v] = G[ v] { t} ; W = W { ( v, t) }; } } }

74 Example 0 1 x 1 :=1 x 2 :=1 x 3 :=1 x 1 :=x 1 +1 x 2 :=2x 2-2x , 0, 1, aff 1, 3, x 3 :=x 3 +x

75 Correctness Theorem: a) Algorithm terminates after at most nk + n iterations of the loop, where n = N and k is the number of variables. # b) For all, we have ( fin[ ]) = [ v N aff G v V v]. Invariants for b) I1: v N : G[ v] V[ v] and ( u, x) W : x V[ u]. { } ( ) I2: (u,s,v) E: aff G[ v] s x ( u, x) W f ( aff ( G[ u]). s

76 Complexity Theorem: # a) The affine hulls V [ u] = aff ( V[ u]) can be computed in time 3 O( n k ), where n = N + E. b) In this computation only arithmetic operations on numbers 2 with O( n k ) bits are u sed. Store diagonal basis for membership tests. Propagate original vectors.

77 Point + Linear Basis

78 Example 0 1 x 1 :=1 x 2 :=1 x 3 :=1 x 1 :=x 1 +1 x 2 :=2x 2-2x , 0, 1, , x 3 :=x 3 +x , 0 0 2

79 Determining Affine Relations Lemma: a is valid for X a is valid for aff ( X ). suffices to determine the affine relations valid for affine bases; can be done with a linear equation system! Theorem: a) The vector spaces of all affine relations valid at the program 3 points of an affine program can be computed in time O( n k ). b) This computation performs arithmetic operations on integers 2 with O( n k ) bits only.

80 Example a + a x + a x + a x = 0 is valid at x 1 :=1 x 2 :=1 x 3 :=1 x 1 :=x 1 +1 x 2 :=2x 2-2x 1 +5 a + 2a + 3a + 4a = a + 2a = a = 0 a = a, a = 2 a, a = x x 1 is valid at x 3 :=x 3 +x , 0 0 2

81 Also in the Paper Non-deterministic assignments Bit length estimation Polynomial relations Affine programs + affine equality guards validity of affine relations undecidable Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

82 End of Excursion 1

83 (Optimal) Program Analysis of Sequential and Parallel Programs Markus Müller-Olm Westfälische Wilhelms-Universität Münster, Germany 3rd Summer School on Verification Technology, Systems, and Applications Luxemburg, September 6-10, 2010

84 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

85 Interprocedural Analysis Main: c:=a+b procedures P: c:=a+b P() Q() call edges R() Q: a:=7 c:=a+b R: a:=7 c:=a+b P() recursion R()

86 Running Example: (Definite) Availability of the single expression a+b The lattice: false a+b not available false true a+b available Initial value: false c:=c+3 true false true c:=a+b true a:=7 false c:=a+b a:=42 false

87 Intra-Procedural-Like Analysis Conservative assumption: procedure destroys all information; information flows from call node to entry point of procedure Main: false true false st M u 1 u 2 c:=a+b P() λ x. false a:=7 P: st P r P true false c:=a+b true The lattice: false true false u 3 false r M P() λ x. false

88 Context-Insensitive Analysis Conservative assumption: Information flows from each call node to entry of procedure and from exit of procedure back to return point Main: false true true st M u 1 u 2 c:=a+b P() a:=7 P: st P r P true false c:=a+b true The lattice: false true false u 3 true r M P()

89 Context-Insensitive Analysis Conservative assumption: Information flows from each call node to entry of procedure and from exit of procedure bac to return point Main: false true st M u 1 c:=a+b P() P: st P true false The lattice: false true false true u 2 a:=7 r P true false false u 3 false r M P()

90 Recall: Abstract Interpretation Recipe constraint system for Reference Semantics on concrete lattice (D, ) Replace concrete operators o by abstract operators o # constraint system for Analysis on abstract lattice (D #, # ) MFP MFP # Assume a universally-disjunctive abstraction function α : D D #. Correct abstract interpretation: Show α(o(x 1,...,x k )) # o # (α(x 1 ),...,α(x k )) f.a. x 1,...,x k L, operators o Then α(mfp[u]) # MFP # [u] f.a. u Correct and precise abstract interpretation: Show α(o(x 1,...,x k )) = o # (α(x 1 ),...,α(x k )) f.a. x 1,...,x k L, operators o Then α(mfp[u]) = MFP # [u] f.a. u Use this as a guideline for designing correct (and precise) analyses! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

91 Example Flow Graph Main: e 0 : e 1 : st M u 1 u 2 c:=a+b P() P: e 4 : st P c:=a+b The lattice: false true e 2 : a:=7 r P e 3 : u 3 P() r M

92 Let s Apply Our Abstract Interpretation Recipe: Constraint System for Feasible Paths Operational justification: Same-level runs: S( p) S( r ) r return point of p { ε} p S( st ) st entry point of p p r { stp } r { stp ε } S( u) = r Edges u for all u in procedure p S( p) = r Edges for all procedures p r { w Nodes stmain } R( u) = r Edges : uw for all u { } S( v ) S( u) e e = ( u, s, v ) base edge S(v) S( u) S( p) e = ( u, p, v) call edge p p Reaching runs: Main { ε} R( st ) st entry point of Main { } R( v ) R( u) e e = ( u, s, v ) basic edge R( v ) R( u) S( p) e = ( u, p, v ) call edge R( st ) R( u) e = ( u, p, v ) call edge, st entry point of p Main p p

93 Context-Sensitive Analysis Idea: Phase 1: Compute summary information for each procedure as an abstraction of same-level runs Phase 2: Use summary information as transfer functions for procedure calls in an abstraction of reaching runs Classic approaches for summary informations: 1) Functional approach: [Sharir/Pnueli 81, Knoop/Steffen: CC 92] Use (monotonic) functions on data flow informations! 2) Relational approach: [Cousot/Cousot: POPL 77] Use relations (of a representable class) on data flow informations! 3) Call string approach: [Sharir/Pnueli 81], [Khedker/Karkare: CC 08] Analyse relative to finite portion of call stack!

94 Formalization of Functional Approach Abstractions: Abstract same-level runs with α : Edges ( L L) : α Funct { fr r R } Funct ( R) = for R Edges Abstract reaching runs with α : Edges L : α MOP 1. Phase: Compute summary informations, i.e., functions: # # S ( p) S ( rp ) rp return point of p # S ( stp ) id stp entry point of p # # # S ( v) f S ( u) e = ( u, s, v) base edge e MOP { fr init r R } ( R) = ( ) for R Edges # # # S (v) S ( p) S ( u) e = ( u, p, v) call edge 2. Phase: Use summary informations; compute on data flow informations: # R ( stmain ) init stmain entry point of Main # # # R ( v ) f ( R ( u) ) e = ( u, s, v ) basic edge e # # # R ( v ) S ( p) ( R ( u) ) e = ( u, p, v ) call edge # # R ( st ) R ( u) e = ( u, p, v ) call edge, st entry point of p p p

95 Functional Approach Theorem: Correctness: For any monotone framework: α MOP (R[u]) R # [u] f.a. u Completeness: For any universally-distributive framework: α MOP (R[u]) = R # [u] f.a. u Remark: Alternative condition: framework positively-distributive & all prog. point dyn. reachable a) Functional approach is effective, if L is finite... b)... but may lead to chains of length up to L height(l) at each program point (in general). Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

96 Functional Approach for Availability of Single Expression Problem Observations: Just three montone functions on lattice L: λ x. false k (ill) false true λ x. x λ x. true i (gnore) g (enerate) Functional composition of two such functions f,g : L L: h f f = h if if h = i h { g, k} Analogous: precise interprocedural analysis for all (separable) bitvector problems in time linear in program size.

97 Context-Sensitive Analysis, 1. Phase Main: P() g c:=a+b Q() i P: i i g c:=a+b g the lattice: k i g R() g i k Q: k a:=7 k i g c:=a+b g k R: k a:=7 g i g c:=a+b g P() g k R() g

98 Context-Sensitive Analysis, 2. Phase Main: g false P: i true g false the lattice: false P() true Q() false true true true true false true false R() true Q: k k true g R: k g false g false true false true P() true false R() true

99 Functional Approach Theorem: Correctness: For any monotone framework: α MOP (R[u]) R # [u] f.a. u Completeness: For any universally-distributive framework: Remark: α MOP (R[u]) = R # [u] f.a. u Alternative condition: framework positively-distributive & all prog. point dyn. reachable a) Functional approach is effective, if L is finite... b)... but may lead to chains of length up to L height(l) at each program point. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

100 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

101 Precise Interprocedural Analysis through Linear Algebra Markus Müller-Olm FernUniversität Hagen (on leave from Universität Dortmund) Joint work with Helmut Seidl (TU München) POPL 2004, Venice, January 14-16, 2004

102 Finding Invariants... x 1 -x 2 -x 3 -x 2 x 3 = 0 Main: 0 P: 5 x 1 :=x 2 x 3 :=x x 3 :=0 x 1 -x 2 -x 3 = x 1 :=x 1 +x P() x 1 -x 2 -x 3 = 0 8 P() x 1 :=x 1 -x 2 -x 3 x 1 :=x 1 -x 2 4 x 1 = 0 9

103 through Linear Algebra Linear Algebra vectors vector spaces, sub-spaces, bases linear maps, matrices vector spaces of matrices Gaussian elimination... Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

104 Applications definite equalities: x = y constant propagation: x = 42 discovery of symbolic constants: x = 5yz+17 complex common subexpressions: xy+42 = y 2 +5 loop induction variables program verification... Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

105 A Program Abstraction Affine programs: affine assignments: x 1 := x 1-2x 3 +7 unknown assignments: x i :=? abstract too complex statements! non-deterministic instead of guarded branching Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

106 The Challenge Given an affine program (with procedures, parameters, local and global variables,...) over R : (R the field Q or Z p, a modular ring Z m, the ring of integers Z, an effective PIR,...) determine all valid affine relations: a 0 + a i x i = 0 a i R 5x+7y-42=0 determine all valid polynomial relations (of degree d): p(x 1,,x k ) = 0 p R [x 1,,x n ] 5xy 2 +7z 3-42=0 and all this in polynomial time (unit cost measure)!!!

107 Infinity Dimensions push-down arithmetic Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

108 Use a Standard Approach for Interprocedural Generalization of Karr? Functional approach [Sharir/Pnueli, 1981], [Knoop/Steffen, 1992] Idea: summarize each procedure by function on data flow facts Problem: not applicable Call-string approach [Sharir/Pnueli, 1981], [Khedker/Karkare: CC 08] Idea: take just a finite piece of run-time stack into account Problem: not exact Relational approach [Cousot/Cousot, 1977] Idea: summarize each procedure by approximation of I/O relation Problem: not exact Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

109 Towards the Algorithm...

110 Concrete Semantics of an Execution Path Every execution path π induces an affine transformation of the program state: x : = x + x + 1; x : = x + 1 ( v) x3 : x3 1 ( x1 : x1 x2 1 ( v) ) = = + = v1 1 = x3 : = x v v v1 1 = v v3 1

111 Affine Relations An affine relation can be viewed as a vector: 5 = = 1 x 1-3 x corresponds to a 3 0 Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

112 Affine Assignments induce linear wp- Transformations on Affine Relations { x + x + 5 = 0 } x : = 4x + x + 3 { x 3x + 2 = 0} weakest precondition! A linear transformation: = Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

113 WP of Affine Relations Every execution path π induces a linear transformation of affine post-conditions into their weakest pre-conditions: T x : = x + x + 1; x : = x + 1 ( a) ( T ) = x : = x + x + 1 x : = x + 1 ( a) = x : = x + x a a a a 3 T 1 T = a 0 a1 a 2 a 3 Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

114 Observations Only the zero relation is valid at program start: 0 : 0+0x x k = 0 Thus, relation a 0 +a 1 x 1 + +a k x k =0 is valid at program point v iff M a = 0 for all M { π T π reaches v} iff M a = 0 for all M Span { π T π reaches v} iff M a = 0 for all M in a basis of Span { π T π reaches v} Matrices M form a vector space of dimension (k+1) x (k+1) Sub-spaces form a complete lattice of height O(k 2 ).

115 Let s Apply Our Abstract Interpretation Recipe: Constraint System for Feasible Paths Operational justification: Same-level runs: S( p) S( r ) r return point of p { ε} p S( st ) st entry point of p p r { stp } r { stp ε } S( u) = r Edges u for all u in procedure p S( p) = r Edges for all procedures p r { ω Nodes stmain ω } R( u) = r Edges : u for all u { } S( v ) S( u) e e = ( u, s, v ) base edge S(v) S( u) S( p) e = ( u, p, v) call edge p p Reaching runs: Main { ε} R( st ) st entry point of Main { } R( v ) R( u) e e = ( u, s, v ) basic edge R( v ) R( u) S( p) e = ( u, p, v ) call edge R( st ) R( u) e = ( u, p, v ) call edge, st entry point of p Main p p

116 Algorithm for Computing Affine Relations 1) Compute a basis B with: Span B = Span { π T π reaches v} for each program point by a precise abstract interpretation: Lattice: Subspaces of IF (k+1) x (k+1) Replace: { ε} { } concatenation { } e by A for affine assignment edge e = ( u, s, v ) 2) Solve the linear equation system: M a = 0 for all M B by I ( I identity matrix) by matrix product (lifted to subspaces) e Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

117 Theorem In an affine program: The following vector spaces of matrices can be computed precisely: α(r(v)) = Span { π T π R(v) } for each prg. point v. The vector spaces { a F k+1 affine relation a is valid at v } can be computed precisely for all prg. points v. The time complexity is linear in the program size and polynomial in the number of variables: O(n k 8 ) (n size of the program, k number of variables) Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

118 An Example Main: 0 P: 0 x 1 :=x x 3 :=0 2 2 P() 3 3 x 1 :=x 1 -x 2 -x 3 x 3 :=x 3 +1 x 1 :=x 1 +x 2 +1 P() x 1 :=x 1 -x stable! =

119 An Example a + a x + a x + a x = 0 is valid at Main: 0 1 x 1 :=x 2 x 3 := a a a1 = a1 0 and = a a a a3 a = 0 a = a = a x 1 :=x 1 -x 2 -x 3 4 P() Span are valid at , Just the affine relations of the form a x a x a x = 0 (a F)

120 Extensions Also in the paper: Local variables, value parameters, return values Computing polynomial relations of bounded degree Affine pre-conditions Formalization as an abstract interpretation In follow-up papers (see webpage): Computing over modular rings (e.g. modulo 2 w ) or PIRs Forward algorithm Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

121 End of Excursion 2 Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

122 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

123 Interprocedural Analysis of Parallel Programs Main: c:=a+b P: c:=a+b P() Q() P() parallel call edge R() Q: a:=7 c:=a+b R: a:=7 c:=a+b P() R() Q()

124 Interleaving- Operator (Shuffle-Operator) Example: a, b, x, y a, b x, y = a, x, b, y, a, x, y, b x, a, b, y, x, a, y, b, x, y, a, b Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

125 Constraint System for Same-Level Runs Operational justification: r { stp } r { stp ε } S( u) = r Edges u for all u in procedure p S( p) = r Edges for all procedures p Same-level runs: [Seidl/Steffen: ESOP 2000] S( p) S( r ) r return point of p { ε} p S( st ) st entry point of p p { } S( v ) S( u) e e = ( u, s, v) base edge S(v) S( u) S( p) e = ( u, p, v ) call edge S(v) S( u) ( S( p ) S( p )) e = ( u, p p, v) parallel call edge p p Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

126 Constraint System for a Variant of Reaching Runs Operational justification: r { c Config stq u } R( u, q) = r Edges : c, At ( c) for progam point u and procedure r { c Config stq } P( q) = r Edges : c q Reaching runs: [Seidl/Steffen: ESOP 2000] R( u, q) S( u) u program point in procedure q R( u, q) S( v ) R( u, p) e = ( v, p,_) call edge in proc. q R( u, q) S( v ) ( R( u, p ) P( p )) e = ( v, p p, _) parallel call edge in proc. q, i = 0, 1 i 1 i 0 1 Interleaving potential: P( p) R( u, p) u program point and p procedure Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

127 Interleaving- Operator (Shuffle-Operator) Example: a, b, x, y a, b x, y = a, x, b, y, a, x, y, b x, a, b, y, x, a, y, b, x, y, a, b The only new ingredient: interleaving operator must be abstracted! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

128 Case: Availability of Single Expression [Seidl/Steffen: ESOP 2000] Abstract shuffle operator: # i g k i i g k g g g k k k k k f f : = f f f f # The lattice: k (ill) i (gnore) g (enerate) Main lemma: { i} fj { g, k, i} : fn... fj + 1 fj... f1 = f { g k}, j = 1 Treat other (separable) bitvector problems analogously... j precise interprocedural analyses for all bitvector problems!

129 Overview Introduction Fundamentals of Program Analysis Excursion 1 Interprocedural Analysis Excursion 2 Analysis of Parallel Programs Excursion 3 Appendix Conclusion Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

130 Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures Markus Müller-Olm Westfälische Wilhelms-Universität Münster Joint work with: Peter Lammich [same place] CONCUR 2007

131 (My) Main Interests of Recent Years Data aspects algebraic invariants over Q, Z, Z m (m = 2 n ) in sequential programs, partly with recursive procedures invariant generation relative to Herbrand interpretation Control aspects recursion concurrency with process creation / threads synchronization primitives, in particular locks/monitors Technics used fixpoint-based automata-based (linear) algebra syntactic substitution-based techniques...

132 Another Program Model Procedures Entry point, e q, of Q P: 0 Q: 4 Recursive procedure calls A 1 call P spawn Q 5 C call Q 2 6 Basic actions B 3 7 D Spawn commands Return point, x q, of Q

133 Spawns are Fundamentally Different P: 0 Q: 4 A C 1 5 call P spawn Q call Q 2 6 B D 3 7 P induces trace language: L = { A n ( B m (C i D j ) n m 0, i j 0 } Cannot characterize L by constraint system with and. [Bouajjani, MO, Touili: CONCUR 2005]

134 Gen/Kill-Problems Class of simple but important DFA problems Assumptions: Lattice (L, ) is distributive Transfer functions have form f e (l)= (l kill e ) gen e with kill,gen L Examples: bitvector problems, e.g. available expressions, live variables, very busy expressions,... Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

135 Data Flow Analysis Goal: Compute, for each program point u: Forward analysis: MOP F [u] = α F (Reach[u]), where α F (X) = { f w (x 0 ) w X } Backward analysis: MOP B [u] = α B (Leave[u]), where α B (X) = { f w ( ) w R X } w { w c emain c atu c } * w { w c emain c atu c } Reach[u] = :{[ ]} ( ) Leave[u] = :{[ ]} _ ( ) at ( c) w : ( uw) c u f = f f, for w = e e w e e 1 n n 1 Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

136 Data Flow Analysis Goal: Compute, for each program point u: Forward analysis: MOP F [u] = α F (Reach[u]), where α F (X) = { f w (x 0 ) w X } Backward analysis: MOP B [u] = α B (Leave[u]), where α B (X) = { f w ( ) w R X } Problem for programs with threads and procedures: We cannot characterize Reach[u] and Leave[u] by a constraint system with operators concatenation and interleaving. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

137 One Way Out [Lammich/MO: CONCUR 2007] Derive alternative characterization of MOP-solution: reason on level of execution paths exploit properties of gen/kill-problems Characterize the path sets occuring as least solutions of constraint systems Perform analysis by abstract interpretation of these constraint systems Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

138 Forward Analysis Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

139 Directly Reaching Paths and Potential Interleaving at u e Main Reaching path: Directly reaching path: Potential interference: a suitable interleaving of the red and blue paths the red path set of edges in the blue paths (note: no order information!) Formalization by augmented operational semantics with markers (see paper)

140 Forward MOP-solution Theorem: For gen/kill problems: MOP F [u] = α F (DReach[u]) α PI (PI[u]), where α PI (X) = { gen e e X }. Remark DReach[u] and PI[u] can be characterized by constraint systems (see paper) α F (DReach[u]) and α PI (PI[u]) can be computed by an abstract interpretation of these constraint systems Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

141 Characterizing Directly Reaching Paths Same level paths: Directly reaching paths: Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

142 Backwards Analysis Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

143 Directly Leaving Paths and Potential Interleaving at u e Main Leaving path: Directly leaving path: Potential interference: a suitable interleaving of orange, black and parts of blue paths a suitable interleaving of orange and black paths the edges in the blue paths Formalization by augmented operational semantics with markers (see paper)

144 Interleaving from Threads created in the Past Theorem: For gen/kill problems: MOP B [u] = α B (DLeave[u]) α PI (PI[u]), where α PI (E) = { gen e e E }. Remark We know no simple characterization of DLeave[u] by a constraint system. Main problem: Threads generated in a procedure instance survive that instance. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

145 Representative Directly Leaving Paths at u 3 5 A representative directly leaving path: Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

146 Interleaving from Threads created in the Future Lemma α B (DLeave[u]) = α B (RDLeave[u]) (for gen/kill problems). Corollary MOP B [u] = α B (RDLeave[u]) α PI (PI[u]) (for gen/kill problems). Remark RDLeave[u] and PI[u] can be characterized by constraint systems (see paper) α B (RDLeave[u]) and α PI (PI[u]) can be computed by an abstract interpretation of these constraint systems Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

147 Also in the Paper Formalization of these ideas constraint systems for path sets validation with respect to operational semantics Parallel calls in combination with threads threads become trees instead of stacks... Analysis of running time: global information in time linear in the program size Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

148 Summary Forward- and backward gen/kill-analysis for programs with threads and procedures More efficient than automata-based approach More general than known fixpoint-based approach Current work: Precise analysis in presence of locks/monitors (see papers at SAS 2008, CAV 2009 for first results) Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

149 End of Excursion 3

150 Appendix Regular Symbolic Analysis of Dynamic Networks of Pushdown Systems

151 DPNs: Dynamic Pushdown-Networks A dynamic pushdown-network (over a finite set of actions Act) consists of: P, a finite set of control symbols Γ, a finite set of stack symbols, a finite set of rules of the following form a pγ p w 1 1 a pγ p w p w (with p,p 1,p 2 P, γ Γ, w 1,w 2 Γ *, a Act). Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

152 DPNs: Dynamic Pushdown-Networks A State of a DPN is a word in (PΓ*) + : p w p w p w p P w k * k k (with i, i Γ, > 0)... an infinite state space The transition relation of a DPN: ( γ a ) p p w : u pγ v u p w v a ( a γ ) p p w p w : u pγ v u p w p w v a Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

153 Example Consider the following DPN with a single rule a pγ pγγ qγ Transitions: pγ qγ pγγ qγ qγ pγγγ qγ qγ qγ pγγγγ qγ qγ qγ qγ pγγγγγ Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

154 Reachability Analysis Given: Model of a system: M Set of system states: Bad Reachability analysis: Can a state from Bad be reached from an initial states of the system? σ,..., σ : Init σ σ Bad? 0 k 0 k Applications: Check safety properties: Bad is a set of states to be avoided More applications by iterated computation of reachability sets for submodels of the system model, e.g. data-flow analysis...

155 Given: Model of a system: M Set of system states: Bad Reachability Analysis Reachability analysis: Can a state from Bad be reached from an initial state of the system? σ,..., σ : Init σ σ Bad? 0 k 0 Def.: - pre*(x) = df { σ σ X: σ * σ } - post*(x) = df { σ σ X: σ * σ} k Equivalent formulations of reachability analysis: pre*(bad) Init post*(init) Bad Computation of pre* or post* is key to reachability analysis

156 Reachability Analysis of Finite State Systems ϕ n ϕ 0 =Init ϕ 1 ϕ 2 ϕ 3 ϕ n-1 Bad ϕ0 = df Init ϕi + 1 = df ϕi post( ϕi ) post( X) = ' X : ' Bad reachable from initial state df { σ σ σ σ } Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

157 Reachability Analysis of Finite State Systems ϕ n-1 =ϕ n ϕ 0 =Init ϕ 1 ϕ 2 ϕ 3 Bad ϕ0 = df Init ϕi + 1 = df ϕi post( ϕi ) post( X) = ' X : ' Bad not reachable from initial state df { σ σ σ σ } Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

158 Problems with Infinite-State Systems State setsφ i can be infinite symbolic representation of (certain) infinite state sets Here: by finite automata Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

159 Example: Representation of an Infinite State Set of a DPN by a Word Automaton An automaton A: p q γ p q γ p q γ γ The regular set of states represented by A: L( A) = * ( qγ qγ pγ ) *... an infinite set of states. Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

160 Problems with Infinite-State Systems State setsφ i can be infinite symbolic representation of (certain) infinite state sets Here: by finite (word) automata Iterated computation of reachability sets does not terminate in general Methods for acceleration of the computation Here: by computing with finite automata

161 Computing pre* for DPNs with Finite Automata Theorem [Bouajjani, MO, Touili, 2005] For every DPN and every regular state set R, pre*(r) is regular and can be computed in polynomial time. Proof: [Bouajjani/Esparza/Maler, 1997] Generalization of a known technique for single pushdown systems: saturation of an automaton for R. Reachability analysis is effective for regular sets Bad of states! Markus Müller-Olm, WWU Münster VTSA 2010, Luxembourg, September 6-10,

Fundamentals of Program Analysis + Generation of Linear Prg. Invariants

Fundamentals of Program Analysis + Generation of Linear Prg. Invariants Fundamentals of Program Analysis + Generation of Linear Prg. Invariants Markus Müller-Olm Westfälische Wilhelms-Universität Münster, Germany 2nd Tutorial of SPP RS3: Reliably Secure Software Systems Schloss

More information

A Tutorial on Program Analysis

A Tutorial on Program Analysis A Tutorial on Program Analysis Markus Müller-Olm Dortmund University Thanks! Helmut Seidl (TU München) and Bernhard Steffen (Universität Dortmund) for discussions, inspiration, joint work,... 1 Dream of

More information

Precise Program Analysis through (Linear) Algebra

Precise Program Analysis through (Linear) Algebra Precise Program Analysis through (Linear) Algebra Markus Müller-Olm FernUniversität Hagen (on leave from Universität Dortmund) Joint work with Helmut Seidl (TU München) CP+CV 4, Barcelona, March 8, 4 Overview

More information

Model Checking & Program Analysis

Model Checking & Program Analysis Model Checking & Program Analysis Markus Müller-Olm Dortmund University Overview Introduction Model Checking Flow Analysis Some Links between MC and FA Conclusion Apology for not giving proper credit to

More information

Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures

Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures Precise Fixpoint-Based Analysis of Programs with Thread-Creation and Procedures Peter Lammich and Markus Müller-Olm Institut für Informatik, Fachbereich Mathematik und Informatik Westfälische Wilhelms-Universität

More information

Dataflow Analysis - 2. Monotone Dataflow Frameworks

Dataflow Analysis - 2. Monotone Dataflow Frameworks Dataflow Analysis - 2 Monotone dataflow frameworks Definition Convergence Safety Relation of MOP to MFP Constant propagation Categorization of dataflow problems DataflowAnalysis 2, Sp06 BGRyder 1 Monotone

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic MARKUS MÜLLER-OLM Westfälische Wilhelms-Universität Münster and HELMUT SEIDL TU München We consider integer arithmetic modulo a power of 2 as provided by mainstream programming

More information

Precise Interprocedural Analysis through Linear Algebra

Precise Interprocedural Analysis through Linear Algebra Precise Interprocedural Analysis through Linear Algebra Markus Müller-Olm FernUniversität Hagen, LG Praktische Informatik 5 58084 Hagen, Germany mmo@ls5csuni-dortmundde Helmut Seidl TU München, Lehrstuhl

More information

Interprocedurally Analyzing Polynomial Identities

Interprocedurally Analyzing Polynomial Identities Interprocedurally Analyzing Polynomial Identities Markus Müller-Olm 1, Michael Petter 2, and Helmut Seidl 2 1 Westfälische Wilhelms-Universität Münster, Institut für Informatik Einsteinstr. 62, 48149 Münster,

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic MARKUS MÜLLER-OLM Westfälische Wilhelms-Universität Münster and HELMUT SEIDL TU München We consider integer arithmetic modulo a power of 2 as provided by mainstream programming

More information

Software Verification

Software Verification Software Verification Grégoire Sutre LaBRI, University of Bordeaux, CNRS, France Summer School on Verification Technology, Systems & Applications September 2008 Grégoire Sutre Software Verification VTSA

More information

Generation of. Polynomial Equality Invariants. by Abstract Interpretation

Generation of. Polynomial Equality Invariants. by Abstract Interpretation Generation of Polynomial Equality Invariants by Abstract Interpretation Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya (UPC) Barcelona Joint work with Deepak Kapur (UNM) 1 Introduction

More information

Reading: Chapter 9.3. Carnegie Mellon

Reading: Chapter 9.3. Carnegie Mellon I II Lecture 3 Foundation of Data Flow Analysis Semi-lattice (set of values, meet operator) Transfer functions III Correctness, precision and convergence IV Meaning of Data Flow Solution Reading: Chapter

More information

Program verification

Program verification Program verification Data-flow analyses, numerical domains Laure Gonnord and David Monniaux University of Lyon / LIP September 29, 2015 1 / 75 Context Program Verification / Code generation: Variables

More information

CMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis

CMSC 631 Program Analysis and Understanding. Spring Data Flow Analysis CMSC 631 Program Analysis and Understanding Spring 2013 Data Flow Analysis Data Flow Analysis A framework for proving facts about programs Reasons about lots of little facts Little or no interaction between

More information

MIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology

MIT Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology MIT 6.035 Foundations of Dataflow Analysis Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Dataflow Analysis Compile-Time Reasoning About Run-Time Values of Variables

More information

Dataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4

Dataflow Analysis. Chapter 9, Section 9.2, 9.3, 9.4 Dataflow Analysis Chapter 9, Section 9.2, 9.3, 9.4 2 Dataflow Analysis Dataflow analysis is a sub area of static program analysis Used in the compiler back end for optimizations of three address code and

More information

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants

An Abstract Interpretation Approach. for Automatic Generation of. Polynomial Invariants An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants Enric Rodríguez-Carbonell Universitat Politècnica de Catalunya Barcelona Deepak Kapur University of New Mexico Albuquerque

More information

Data Flow Analysis. Lecture 6 ECS 240. ECS 240 Data Flow Analysis 1

Data Flow Analysis. Lecture 6 ECS 240. ECS 240 Data Flow Analysis 1 Data Flow Analysis Lecture 6 ECS 240 ECS 240 Data Flow Analysis 1 The Plan Introduce a few example analyses Generalize to see the underlying theory Discuss some more advanced issues ECS 240 Data Flow Analysis

More information

Automatic Generation of Polynomial Invariants for System Verification

Automatic Generation of Polynomial Invariants for System Verification Automatic Generation of Polynomial Invariants for System Verification Enric Rodríguez-Carbonell Technical University of Catalonia Talk at EPFL Nov. 2006 p.1/60 Plan of the Talk Introduction Need for program

More information

On the coinductive nature of centralizers

On the coinductive nature of centralizers On the coinductive nature of centralizers Charles Grellois INRIA & University of Bologna Séminaire du LIFO Jan 16, 2017 Charles Grellois (INRIA & Bologna) On the coinductive nature of centralizers Jan

More information

Reachability analysis of multithreaded software with asynchronous communication

Reachability analysis of multithreaded software with asynchronous communication Reachability analysis of multithreaded software with asynchronous communication Ahmed Bouajjani 1, Javier Esparza 2, Stefan Schwoon 2, and Jan Strejček 2 1 LIAFA, University of Paris 7, abou@liafa.jussieu.fr

More information

Design of Distributed Systems Melinda Tóth, Zoltán Horváth

Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Design of Distributed Systems Melinda Tóth, Zoltán Horváth Publication date 2014 Copyright 2014 Melinda Tóth, Zoltán Horváth Supported by TÁMOP-412A/1-11/1-2011-0052

More information

Static Program Analysis using Abstract Interpretation

Static Program Analysis using Abstract Interpretation Static Program Analysis using Abstract Interpretation Introduction Static Program Analysis Static program analysis consists of automatically discovering properties of a program that hold for all possible

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-18/spa/ Recap: Interprocedural Dataflow Analysis Outline of

More information

Precise Relational Invariants Through Strategy Iteration

Precise Relational Invariants Through Strategy Iteration Precise Relational Invariants Through Strategy Iteration Thomas Gawlitza and Helmut Seidl TU München, Institut für Informatik, I2 85748 München, Germany {gawlitza, seidl}@in.tum.de Abstract. We present

More information

The State Explosion Problem

The State Explosion Problem The State Explosion Problem Martin Kot August 16, 2003 1 Introduction One from main approaches to checking correctness of a concurrent system are state space methods. They are suitable for automatic analysis

More information

Formal Methods in Software Engineering

Formal Methods in Software Engineering Formal Methods in Software Engineering An Introduction to Model-Based Analyis and Testing Vesal Vojdani Department of Computer Science University of Tartu Fall 2014 Vesal Vojdani (University of Tartu)

More information

Generalizing Data-flow Analysis

Generalizing Data-flow Analysis Generalizing Data-flow Analysis Announcements PA1 grades have been posted Today Other types of data-flow analysis Reaching definitions, available expressions, reaching constants Abstracting data-flow analysis

More information

A Certified Denotational Abstract Interpreter (Proof Pearl)

A Certified Denotational Abstract Interpreter (Proof Pearl) A Certified Denotational Abstract Interpreter (Proof Pearl) David Pichardie INRIA Rennes David Cachera IRISA / ENS Cachan (Bretagne) Static Analysis Static Analysis Static analysis by abstract interpretation

More information

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège

Temporal logics and explicit-state model checking. Pierre Wolper Université de Liège Temporal logics and explicit-state model checking Pierre Wolper Université de Liège 1 Topics to be covered Introducing explicit-state model checking Finite automata on infinite words Temporal Logics and

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Analysis of Modular Arithmetic

Analysis of Modular Arithmetic Analysis of Modular Arithmetic Markus Müller-Olm 1 and Helmut Seidl 2 1 Universität Dortmund, Fachbereich Informatik, LS 5 Baroper Str. 301, 44221 Dortmund, Germany markus.mueller-olm@cs.uni-dortmund.de

More information

Discrete Fixpoint Approximation Methods in Program Static Analysis

Discrete Fixpoint Approximation Methods in Program Static Analysis Discrete Fixpoint Approximation Methods in Program Static Analysis P. Cousot Département de Mathématiques et Informatique École Normale Supérieure Paris

More information

Mechanics of Static Analysis

Mechanics of Static Analysis Escuela 03 III / 1 Mechanics of Static Analysis David Schmidt Kansas State University www.cis.ksu.edu/~schmidt Escuela 03 III / 2 Outline 1. Small-step semantics: trace generation 2. State generation and

More information

Data flow analysis. DataFlow analysis

Data flow analysis. DataFlow analysis Data flow analysis DataFlow analysis compile time reasoning about the runtime flow of values in the program represent facts about runtime behavior represent effect of executing each basic block propagate

More information

Causal Dataflow Analysis for Concurrent Programs

Causal Dataflow Analysis for Concurrent Programs Causal Dataflow Analysis for Concurrent Programs Azadeh Farzan P. Madhusudan Department of Computer Science, University of Illinois at Urbana-Champaign. {afarzan,madhu}@cs.uiuc.edu Abstract. We define

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness and Completeness of Axiomatic Semantics. Announcements Axiomatic Semantics: Verification Conditions Meeting 12, CSCI 5535, Spring 2009 Announcements Homework 4 is due tonight Wed forum: papers on automated testing using symbolic execution 2 Questions? Review

More information

Introduction to Abstract Interpretation. ECE 584 Sayan Mitra Lecture 18

Introduction to Abstract Interpretation. ECE 584 Sayan Mitra Lecture 18 Introduction to Abstract Interpretation ECE 584 Sayan Mitra Lecture 18 References Patrick Cousot,RadhiaCousot:Abstract Interpretation: A Unified Lattice Model for Static Analysis of Programs by Construction

More information

Unifying Theories of Programming

Unifying Theories of Programming 1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May

More information

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University

Trace semantics: towards a unification of parallel paradigms Stephen Brookes. Department of Computer Science Carnegie Mellon University Trace semantics: towards a unification of parallel paradigms Stephen Brookes Department of Computer Science Carnegie Mellon University MFCSIT 2002 1 PARALLEL PARADIGMS State-based Shared-memory global

More information

CMSC 631 Program Analysis and Understanding Fall Abstract Interpretation

CMSC 631 Program Analysis and Understanding Fall Abstract Interpretation Program Analysis and Understanding Fall 2017 Abstract Interpretation Based on lectures by David Schmidt, Alex Aiken, Tom Ball, and Cousot & Cousot What is an Abstraction? A property from some domain Blue

More information

Precise Interprocedural Analysis using Random Interpretation

Precise Interprocedural Analysis using Random Interpretation Precise Interprocedural Analysis using Random Interpretation Sumit Gulwani gulwani@cs.berkeley.edu George C. Necula necula@cs.berkeley.edu Department of Electrical Engineering and Computer Science University

More information

Compilation and Program Analysis (#8) : Abstract Interpretation

Compilation and Program Analysis (#8) : Abstract Interpretation Compilation and Program Analysis (#8) : Abstract Interpretation Laure Gonnord http://laure.gonnord.org/pro/teaching/capm.html Laure.Gonnord@ens-lyon.fr Master, ENS de Lyon Nov 7 Objective Compilation vs

More information

Principles of Program Analysis: Control Flow Analysis

Principles of Program Analysis: Control Flow Analysis Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Polynomial Constants are Decidable

Polynomial Constants are Decidable Polynomial Constants are Decidable Markus Müller-Olm 1 and Helmut Seidl 2 1 University of Dortmund, FB 4, LS5, 44221 Dortmund, Germany mmo@ls5.cs.uni-dortmund.de 2 Trier University, FB 4-Informatik, 54286

More information

Logical Abstract Domains and Interpretations

Logical Abstract Domains and Interpretations Logical Abstract Domains and Interpretations Patrick Cousot 2,3, Radhia Cousot 3,1, and Laurent Mauborgne 3,4 1 Centre National de la Recherche Scientifique, Paris 2 Courant Institute of Mathematical Sciences,

More information

Abstractions and Decision Procedures for Effective Software Model Checking

Abstractions and Decision Procedures for Effective Software Model Checking Abstractions and Decision Procedures for Effective Software Model Checking Prof. Natasha Sharygina The University of Lugano, Carnegie Mellon University Microsoft Summer School, Moscow, July 2011 Lecture

More information

Principles of Program Analysis: A Sampler of Approaches

Principles of Program Analysis: A Sampler of Approaches Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag

More information

Probabilistic Model Checking and [Program] Analysis (CO469)

Probabilistic Model Checking and [Program] Analysis (CO469) Probabilistic Model Checking and [Program] Analysis (CO469) Program Analysis Herbert Wiklicky herbert@doc.ic.ac.uk Spring 208 / 64 Overview Topics we will cover in this part will include:. Language WHILE

More information

Semantics and Verification of Software

Semantics and Verification of Software Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational

More information

Introduction to Kleene Algebras

Introduction to Kleene Algebras Introduction to Kleene Algebras Riccardo Pucella Basic Notions Seminar December 1, 2005 Introduction to Kleene Algebras p.1 Idempotent Semirings An idempotent semiring is a structure S = (S, +,, 1, 0)

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Dataflow analysis. Theory and Applications. cs6463 1

Dataflow analysis. Theory and Applications. cs6463 1 Dataflow analysis Theory and Applications cs6463 1 Control-flow graph Graphical representation of runtime control-flow paths Nodes of graph: basic blocks (straight-line computations) Edges of graph: flows

More information

Hoare Calculus and Predicate Transformers

Hoare Calculus and Predicate Transformers Hoare Calculus and Predicate Transformers Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

An Alternative Construction in Symbolic Reachability Analysis of Second Order Pushdown Systems

An Alternative Construction in Symbolic Reachability Analysis of Second Order Pushdown Systems An Alternative Construction in Symbolic Reachability Analysis of Second Order Pushdown Systems Anil Seth CSE Department, I.I.T. Kanpur, Kanpur 208016, INDIA. seth@cse.iitk.ac.in Abstract. Recently, it

More information

Analysing All Polynomial Equations in Z 2

Analysing All Polynomial Equations in Z 2 Analysing All Polynomial Equations in Z 2 w Helmut Seidl, Andrea Flexeder and Michael Petter Technische Universität München, Boltzmannstrasse 3, 85748 Garching, Germany, {seidl, flexeder, petter}@cs.tum.edu,

More information

Conflict Analysis of Programs with Procedures, Dynamic Thread Creation, and Monitors

Conflict Analysis of Programs with Procedures, Dynamic Thread Creation, and Monitors Conflict Analysis of Programs with Procedures, Dynamic Thread Creation, and Monitors Peter Lammich and Markus Müller-Olm Institut für Informatik, Fachbereich Mathematik und Informatik Westfälische Wilhelms-Universität

More information

Computing Procedure Summaries for Interprocedural Analysis

Computing Procedure Summaries for Interprocedural Analysis Computing Procedure Summaries for Interprocedural Analysis Sumit Gulwani 1 and Ashish Tiwari 2 1 Microsoft Research, Redmond, WA 98052, sumitg@microsoft.com 2 SRI International, Menlo Park, CA 94025, tiwari@csl.sri.com

More information

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007

Dynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007 Dynamic Noninterference Analysis Using Context Sensitive Static Analyses Gurvan Le Guernic July 14, 2007 1 Abstract This report proposes a dynamic noninterference analysis for sequential programs. This

More information

CSC D70: Compiler Optimization Dataflow-2 and Loops

CSC D70: Compiler Optimization Dataflow-2 and Loops CSC D70: Compiler Optimization Dataflow-2 and Loops Prof. Gennady Pekhimenko University of Toronto Winter 2018 The content of this lecture is adapted from the lectures of Todd Mowry and Phillip Gibbons

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

Dense-Timed Pushdown Automata

Dense-Timed Pushdown Automata Dense-Timed Pushdown Automata Parosh Aziz Abdulla Uppsala University Sweden Mohamed Faouzi Atig Uppsala University Sweden Jari Stenman Uppsala University Sweden Abstract We propose a model that captures

More information

Abstract Interpretation from a Topological Perspective

Abstract Interpretation from a Topological Perspective (-: / 1 Abstract Interpretation from a Topological Perspective David Schmidt Kansas State University www.cis.ksu.edu/ schmidt Motivation and overview of results (-: / 2 (-: / 3 Topology studies convergent

More information

Automata-Theoretic Model Checking of Reactive Systems

Automata-Theoretic Model Checking of Reactive Systems Automata-Theoretic Model Checking of Reactive Systems Radu Iosif Verimag/CNRS (Grenoble, France) Thanks to Tom Henzinger (IST, Austria), Barbara Jobstmann (CNRS, Grenoble) and Doron Peled (Bar-Ilan University,

More information

Interprocedural Analysis: Sharir-Pnueli s Call-strings Approach

Interprocedural Analysis: Sharir-Pnueli s Call-strings Approach Interprocedural Analysis: Sharir-Pnueli s Call-strings Approach Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 04 September 2013 Outline 1 Motivation

More information

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either

Introduction to Temporal Logic. The purpose of temporal logics is to specify properties of dynamic systems. These can be either Introduction to Temporal Logic The purpose of temporal logics is to specify properties of dynamic systems. These can be either Desired properites. Often liveness properties like In every infinite run action

More information

Reachability Analysis of Conditional Pushdown Systems with Patterns

Reachability Analysis of Conditional Pushdown Systems with Patterns . RESEARCH PAPER. SCIENCE CHINA Information Sciences Reachability Analysis of Conditional Pushdown Systems with Patterns Xin Li 1 1 East China Normal University, Shanghai, 200062, China Received XXX; accepted

More information

Axiomatic Semantics. Lecture 9 CS 565 2/12/08

Axiomatic Semantics. Lecture 9 CS 565 2/12/08 Axiomatic Semantics Lecture 9 CS 565 2/12/08 Axiomatic Semantics Operational semantics describes the meaning of programs in terms of the execution steps taken by an abstract machine Denotational semantics

More information

Accelerated Data-Flow Analysis

Accelerated Data-Flow Analysis Accelerated Data-Flow Analysis Jérôme Leroux, Grégoire Sutre To cite this version: Jérôme Leroux, Grégoire Sutre. Accelerated Data-Flow Analysis. Springer Berlin. Static Analysis, 2007, Kongens Lyngby,

More information

Proof Calculus for Partial Correctness

Proof Calculus for Partial Correctness Proof Calculus for Partial Correctness Bow-Yaw Wang Institute of Information Science Academia Sinica, Taiwan September 7, 2016 Bow-Yaw Wang (Academia Sinica) Proof Calculus for Partial Correctness September

More information

The algorithmic analysis of hybrid system

The algorithmic analysis of hybrid system The algorithmic analysis of hybrid system Authors: R.Alur, C. Courcoubetis etc. Course teacher: Prof. Ugo Buy Xin Li, Huiyong Xiao Nov. 13, 2002 Summary What s a hybrid system? Definition of Hybrid Automaton

More information

Regular Symbolic Analysis of Dynamic Networks of Pushdown Systems

Regular Symbolic Analysis of Dynamic Networks of Pushdown Systems Regular Symbolic Analysis of Dynamic Networks of Pushdown Systems Ahmed Bouajjani 1, Markus Müller-Olm 2, and Tayssir Touili 1 1 LIAFA, University of Paris 7, 2 place Jussieu, 75251 Paris cedex 5, France

More information

CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers. 1 Complete partial orders (CPOs) 2 Least fixed points of functions

CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers. 1 Complete partial orders (CPOs) 2 Least fixed points of functions CS 6110 Lecture 21 The Fixed-Point Theorem 8 March 2013 Lecturer: Andrew Myers We saw that the semantics of the while command are a fixed point. We also saw that intuitively, the semantics are the limit

More information

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples

Hoare Logic I. Introduction to Deductive Program Verification. Simple Imperative Programming Language. Hoare Logic. Meaning of Hoare Triples Hoare Logic I Introduction to Deductive Program Verification Işıl Dillig Program Spec Deductive verifier FOL formula Theorem prover valid contingent Example specs: safety (no crashes), absence of arithmetic

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

More information

Axioms of Kleene Algebra

Axioms of Kleene Algebra Introduction to Kleene Algebra Lecture 2 CS786 Spring 2004 January 28, 2004 Axioms of Kleene Algebra In this lecture we give the formal definition of a Kleene algebra and derive some basic consequences.

More information

Probabilistic Aspects of Computer Science: Probabilistic Automata

Probabilistic Aspects of Computer Science: Probabilistic Automata Probabilistic Aspects of Computer Science: Probabilistic Automata Serge Haddad LSV, ENS Paris-Saclay & CNRS & Inria M Jacques Herbrand Presentation 2 Properties of Stochastic Languages 3 Decidability Results

More information

Size-Change Termination and Transition Invariants

Size-Change Termination and Transition Invariants Size-Change Termination and Transition Invariants Matthias Heizmann 1, Neil D. Jones 2, and Andreas Podelski 1 1 University of Freiburg, Germany 2 University of Copenhagen, Denmark Abstract. Two directions

More information

EE249 - Fall 2012 Lecture 18: Overview of Concrete Contract Theories. Alberto Sangiovanni-Vincentelli Pierluigi Nuzzo

EE249 - Fall 2012 Lecture 18: Overview of Concrete Contract Theories. Alberto Sangiovanni-Vincentelli Pierluigi Nuzzo EE249 - Fall 2012 Lecture 18: Overview of Concrete Contract Theories 1 Alberto Sangiovanni-Vincentelli Pierluigi Nuzzo Outline: Contracts and compositional methods for system design Where and why using

More information

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

The Downward-Closure of Petri Net Languages

The Downward-Closure of Petri Net Languages The Downward-Closure of Petri Net Languages Peter Habermehl 1, Roland Meyer 1, and Harro Wimmel 2 1 LIAFA, Paris Diderot University & CNRS e-mail: {peter.habermehl,roland.meyer}@liafa.jussieu.fr 2 Department

More information

Verification of Real-Time Systems Numerical Abstractions

Verification of Real-Time Systems Numerical Abstractions Verification of Real-Time Systems Numerical Abstractions Jan Reineke Advanced Lecture, Summer 2015 Recap: From Local to Global Correctness: Kleene Iteration Abstract Domain F # F #... F # γ a γ a γ a Concrete

More information

Automata-based Verification - III

Automata-based Verification - III COMP30172: Advanced Algorithms Automata-based Verification - III Howard Barringer Room KB2.20: email: howard.barringer@manchester.ac.uk March 2009 Third Topic Infinite Word Automata Motivation Büchi Automata

More information

A Canonical Contraction for Safe Petri Nets

A Canonical Contraction for Safe Petri Nets A Canonical Contraction for Safe Petri Nets Thomas Chatain and Stefan Haar INRIA & LSV (CNRS & ENS Cachan) 6, avenue du Président Wilson 935 CACHAN Cedex, France {chatain, haar}@lsvens-cachanfr Abstract

More information

CP405 Theory of Computation

CP405 Theory of Computation CP405 Theory of Computation BB(3) q 0 q 1 q 2 0 q 1 1R q 2 0R q 2 1L 1 H1R q 1 1R q 0 1L Growing Fast BB(3) = 6 BB(4) = 13 BB(5) = 4098 BB(6) = 3.515 x 10 18267 (known) (known) (possible) (possible) Language:

More information

CS357: CTL Model Checking (two lectures worth) David Dill

CS357: CTL Model Checking (two lectures worth) David Dill CS357: CTL Model Checking (two lectures worth) David Dill 1 CTL CTL = Computation Tree Logic It is a propositional temporal logic temporal logic extended to properties of events over time. CTL is a branching

More information

Verification of String Manipulating Programs Using Multi-Track Automata

Verification of String Manipulating Programs Using Multi-Track Automata Verification of String Manipulating Programs Using Multi-Track Automata Fang Yu University of California, Santa Barbara yuf@cs.ucsb.edu Tevfik Bultan University of California, Santa Barbara bultan@cs.ucsb.edu

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Logic and Automata I. Wolfgang Thomas. EATCS School, Telc, July 2014

Logic and Automata I. Wolfgang Thomas. EATCS School, Telc, July 2014 Logic and Automata I EATCS School, Telc, July 2014 The Plan We present automata theory as a tool to make logic effective. Four parts: 1. Some history 2. Automata on infinite words First step: MSO-logic

More information

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements

Axiomatic Semantics: Verification Conditions. Review of Soundness of Axiomatic Semantics. Questions? Announcements Axiomatic Semantics: Verification Conditions Meeting 18, CSCI 5535, Spring 2010 Announcements Homework 6 is due tonight Today s forum: papers on automated testing using symbolic execution Anyone looking

More information

Space-aware data flow analysis

Space-aware data flow analysis Space-aware data flow analysis C. Bernardeschi, G. Lettieri, L. Martini, P. Masci Dip. di Ingegneria dell Informazione, Università di Pisa, Via Diotisalvi 2, 56126 Pisa, Italy {cinzia,g.lettieri,luca.martini,paolo.masci}@iet.unipi.it

More information

An Abstract Domain to Infer Ordinal-Valued Ranking Functions

An Abstract Domain to Infer Ordinal-Valued Ranking Functions An Abstract Domain to Infer Ordinal-Valued Ranking Functions Caterina Urban and Antoine Miné ÉNS & CNRS & INRIA, Paris, France urban@di.ens.fr, mine@di.ens.fr Abstract. The traditional method for proving

More information

Automatic determination of numerical properties of software and systems

Automatic determination of numerical properties of software and systems Automatic determination of numerical properties of software and systems Eric Goubault and Sylvie Putot Modelling and Analysis of Interacting Systems, CEA LIST MASCOT-NUM 2012 Meeting, March 21-23, 2012

More information