basic concepts of abstract interpretation
play

Basic Concepts of Abstract Interpretation Patrick Cousot cole - PowerPoint PPT Presentation

Basic Concepts of Abstract Interpretation Patrick Cousot cole normale suprieure 45 rue dUlm 75230 Paris cedex 05, France Patrick.Cousot@ens.fr www.di.ens.fr/~cousot IFIP WCC Topical day on Abstract Interpretation P.


  1. Undecidability – The concrete mathematical semantics of a program is an “tinfinite” mathematical object, not computable ; – All non trivial questions on the concrete program se- mantics are undecidable . Example: termination – Assume termination(P) would always terminates and returns true iff P always terminates on all input data; – The following program yields a contradiction P ” while termination(P) do skip od . ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 22 —

  2. Graphic example: Safety properties The safety properties of a program express that no possi- ble execution in any possible execution environment can reach an erroneous state. ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 23 —

  3. Graphic example: Safety property x ( t ) �������������� ��������� ������������ t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 24 —

  4. Safety proofs – A safety proof consists in proving that the intersection of the program concrete semantics and the forbidden zone is empty; – Undecidable problem (the concrete semantics is not computable); – Impossible to provide completely automatic answers with finite computer resources and neither human in- teraction nor uncertainty on the answer 2 . 2 e.g. probabilistic answer. ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 25 —

  5. Test/debugging – consists in considering a subset of the possible execu- tions; – not a correctness proof; – absence of coverage is the main problem. ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 26 —

  6. Graphic example: Property test/simulation x ( t ) �������������� ��������� ��������� ������������ �������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 27 —

  7. Abstract interpretation – consists in considering an abstract semantics , that is to say a superset of the concrete semantics of the pro- gram; – hence the abstract semantics covers all possible con- crete cases; – correct: if the abstract semantics is safe (does not in- tersect the forbidden zone) then so is the concrete se- mantics ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 28 —

  8. Graphic example: Abstract interpretation x ( t ) �������������� ��������� ������������ ������������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 29 —

  9. Formal methods Formal methods are abstract interpretations, which dif- fer in the way to obtain the abstract semantics: – “ model checking ”: - the abstract semantics is given manually by the user; - in the form of a finitary model of the program exe- cution; - can be computed automatically, by techniques rele- vant to static analysis. ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 30 —

  10. – “ deductive methods ”: - the abstract semantics is specified by verification con- ditions; - the user must provide the abstract semantics in the form of inductive arguments (e.g. invariants); - can be computed automatically by methods relevant to static analysis. – “ static analysis ”: the abstract semantics is computed automatically from the program text according to pre- defined abstractions (that can sometimes be tailored automatically/manually by the user). ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 31 —

  11. Required properties of the abstract semantics – sound so that no possible error can be forgotten; – precise enough (to avoid false alarms); – as simple/abstract as possible (to avoid combinatorial explosion phenomena). ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 32 —

  12. Graphic example: The most abstract correct and precise semantics x ( t ) �������������� ��������� ������������ t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 33 —

  13. Graphic example: Erroneous abstraction — I x ( t ) �������������� ��������� ��������� ������������ �������������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 34 —

  14. Graphic example: Erroneous abstraction — II x ( t ) �������������� ��������� ��������� ������������ �������������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 35 —

  15. Graphic example: Imprecision ) false alarms x ( t ) �������������� ����������� ��������� ������������ �������������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 36 —

  16. Abstract domains Standard abstractions – that serve as a basis for the design of static analyzers: - abstract program data, - abstract program basic operations; - abstract program control (iteration, procedure, con- currency, . . . ); – can be parametrized to allow for manual adaptation to the application domains. ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 37 —

  17. Graphic example: Standard abstraction by intervals x ( t ) �������������� ������������ ��������� ������������ ��������������������������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 38 —

  18. Graphic example: A more refined abstraction x ( t ) �������������� ��������� ������������ ����������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 39 —

  19. A very informal introduction to static analysis algorithms ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 40 —

  20. Standard operational semantics ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 41 —

  21. Standard semantics – Start from a standard operational semantics that de- scribes formally: - states that is data values of program variables, - transitions that is elementary computation steps; – Consider traces that is successions of states correspond- ing to executions described by transitions (possibly in- finite). ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 42 —

  22. Graphic example: Small-steps transition semantics x ( t ) ��������� ��������� ������������ t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 43 —

  23. Example: Small-steps transition semantics of an assignment int x; ... l: x := x + 1; l’: f l : x = v ! l 0 : x = v + 1 j v 2 [ min _ int ; max _ int ` 1] g [ f l : x = max _ int ! l 0 : x = ˙ g (runtime error) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 44 —

  24. Example: Small-steps transition semantics of a loop 3 l1 : : : : 7 7 7 7 l1 : x = ` 1 & 7 7 7 7 7 7 l1: l1 : x = 0 ! l2 : x = 1 7 7 7 7 x := 1; 7 7 % l1 : x = 1 7 7 l2: 7 7 7 7 l1 : : : : 7 while x < 10 do 7 5 l3: l2 : x = 1 ! l3 : x = 1 x := x + 1 l3 : x = 1 ! l4 : x = 2 l4: od l4 : x = 2 ! l3 : x = 2 l5: l3 : x = 2 ! l4 : x = 3 : : : l4 : x = 10 ! l5 : x = 10 ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 45 —

  25. Example: Trace semantics of loop l1: x := 1; l2: while x < 10 do l3: x := x + 1 l4: od 3 l5: l1 : : : : 7 7 7 7 l1 : x = ` 1 & 7 7 7 7 7 7 ! l2 : x = 1 ! l3 : x = 1 ! l4 : x = 2 ! l1 : x = 0 7 7 7 7 7 7 l1 : x = 1 % 7 7 7 7 7 7 l1 : : : : 7 7 5 l3 : x = 2 ! l4 : x = 3 : : : ! l4 : x = 10 ! l5 : x = 10 ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 46 —

  26. Transition systems – h S; t !i where: - S is a set of states/vertices/. . . t - ! 2 } ( S ˆ S ) is a transition relation/set of arcs/. . . t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 47 —

  27. Collecting semantics in fixpoint form ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 48 —

  28. Collecting semantics – consider all traces simultaneously; – collecting semantics: - sets of states that describe data values of program variables on all possible trajectories; - set of states transitions that is simultaneous elemen- tary computation steps on all possible trajectories; ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 49 —

  29. Graphic example: sets of states x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 50 —

  30. Graphic example: set of states transitions x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 51 —

  31. � Example: Reachable states of a transition system I ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 52 —

  32. Reachable states in fixpoint form F ( X ) = I [ f s 0 j 9 s 2 X : s t ! s 0 g „ R = lfp ; F = + 1 n =0 F n ( ; ) f 0 ( x ) = x where [ f n +1 ( x ) = f ( f n ( x )) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 53 —

  33. Example of fixpoint iteration „ ; –X . I [ f s 0 j 9 s 2 X : s t for reachable states lfp ! s 0 g I � � � � � � � � � � � � � � � �� � � ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 54 —

  34. Example of fixpoint iteration „ ; –X . I [ f s 0 j 9 s 2 X : s t for reachable states lfp ! s 0 g � � � � � F � � � � � � � � � � �� � � ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 54 —

  35. Example of fixpoint iteration „ ; –X . I [ f s 0 j 9 s 2 X : s t for reachable states lfp ! s 0 g � � � � � F � � F � � � � � � � �� � � ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 54 —

  36. Example of fixpoint iteration „ ; –X . I [ f s 0 j 9 s 2 X : s t for reachable states lfp ! s 0 g � � � � � F � � F � � F � � � � �� � � ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 54 —

  37. Example of fixpoint iteration „ ; –X . I [ f s 0 j 9 s 2 X : s t for reachable states lfp ! s 0 g � � � � � F � � F � � F � � F � �� � � ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 54 —

  38. Abstraction by Galois connections ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 55 —

  39. Abstracting sets (i.e. properties) – Choose an abstract domain, replacing sets of objects (states, traces, . . . ) S by their abstraction ¸ ( S ) – The abstraction function ¸ maps a set of concrete ob- jects to its abstract interpretation; – The inverse concretization function ‚ maps an abstract set of objects to concrete ones; – Forget no concrete objects: (abstraction from above) S „ ‚ ( ¸ ( S )) . ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 56 —

  40. Interval abstraction ¸ � �� f x : [1 ; 99] ; y : [2 ; 77] g � � � �� ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 57 —

  41. Interval concretization ‚ � �� f x : [1 ; 99] ; y : [2 ; 77] g � � � �� ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 58 —

  42. The abstraction ¸ is monotone � �� �� f x : [33 ; 89] ; y : [48 ; 61] g v �� f x : [1 ; 99] ; y : [2 ; 90] g � � � �� �� �� X „ Y ) ¸ ( X ) v ¸ ( Y ) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 59 —

  43. The concretization ‚ is monotone f x : [33 ; 89] ; y : [48 ; 61] g v f x : [1 ; 99] ; y : [2 ; 90] g X v Y ) ‚ ( X ) „ ‚ ( Y ) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 60 —

  44. The ‚ ‹ ¸ composition is extensive � �� f x : [1 ; 99] ; y : [2 ; 77] g � � �� � X „ ‚ ‹ ¸ ( X ) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 61 —

  45. The ¸ ‹ ‚ composition is reductive � �� f x : [1 ; 99] ; y : [2 ; 77] g = = v f x : [1 ; 99] ; y : [2 ; 77] g � � � �� ¸ ‹ ‚ ( Y ) = = v Y ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 62 —

  46. Correspondance between concrete and abstract properties – The pair h ¸; ‚ i is a Galois connection: ‚ ` ` ` h } ( S ) ; „i ` hD ; vi ` ` ! ¸ ‚ ` ` ` ` – h } ( S ) ; „i ` hD ; vi when ¸ is onto (equivalently ` `! ` ! ¸ ¸ ‹ ‚ = 1 or ‚ is one-to-one). ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 63 —

  47. Galois connection ‚ ` ` ` hD ; „i ` hD ; vi ` ` ! ¸ iff 8 x; y 2 D : x „ y = ) ¸ ( x ) v ¸ ( y ) ^ 8 x; y 2 D : x v y = ) ‚ ( x ) „ ‚ ( y ) ^ 8 x 2 D : x „ ‚ ( ¸ ( x )) ^ 8 y 2 D : ¸ ( ‚ ( y )) v x iff 8 x 2 D ; y 2 D : ¸ ( x ) v y ( ) x „ ‚ ( y ) ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 64 —

  48. Graphic example: Interval abstraction x ( t ) ����������������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 65 —

  49. Graphic example: Abstract transitions x ( t ) ������������������� t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 66 —

  50. Example: Interval transition semantics of assignments int x; ... l: x := x + 1; l’: f l : x 2 [ ‘; h ] ! l 0 : x 2 [ l + 1 ; min( h + 1 ; max _ int )] [ f ˙ j h = max _ int g j ‘ » h g where [ ‘; h ] = ; when h < ‘ . ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 67 —

  51. �������� ������ Function abstraction � � F ] = ¸ ‹ F ‹ ‚ i : e : F ] =  ‹ F � �������� ������ ‚ ` ` ` h P; „i ` h Q; vi ) ` ` ! ¸ –F ] . ‚ ‹ F ] ‹ ¸ ! P; _ ` ` ` ` ` ` ` ` ` ` ! Q; _ mon h Q mon h P 7` „i ` 7` vi ` ` ` ` ` ` ` ` ` ! –F . ¸ ‹ F ‹ ‚ ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 68 —

  52. Example: Set of traces to trace of intervals abstraction Set of traces: ¸ 1 # Trace of sets: ¸ 2 # Trace of intervals ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 69 —

  53. Example: Set of traces to reachable states abstraction Set of traces: ¸ 1 # Trace of sets: ¸ 3 # Reachable states ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 70 —

  54. Composition of Galois Connections The composition of Galois connections: ‚ 1 ` ` ` h L; »i ` h M; vi ` ` ! ¸ 1 and: ‚ 2 ` ` ` h M; vi ` h N; —i ` ` ! ¸ 2 is a Galois connection: ‚ 1 ‹ ‚ 2 ` ` ` ` ` ` h L; »i ` h N; —i ` ` ` ` ` ! ¸ 2 ‹ ¸ 1 ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 71 —

  55. Abstract semantics in fixpoint form ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 72 —

  56. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  57. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  58. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  59. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  60. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  61. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  62. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  63. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  64. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  65. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  66. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  67. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  68. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  69. Graphic example: traces of sets of states in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 73 —

  70. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

  71. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

  72. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

  73. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

  74. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

  75. Graphic example: traces of intervals in fixpoint form x ( t ) t ľ P. Cousot IFIP WCC — Topical day on Abstract Interpretation, Toulouse, 24 August 2004 — 74 —

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend