bi inductive structural semantics and its abstraction
play

Bi-inductive Structural Semantics and its Abstraction Patrick - PowerPoint PPT Presentation

Bi-inductive Structural Semantics and its Abstraction Patrick Cousot cole normale suprieure 1. Motivation 45 rue dUlm, 75230 Paris cedex 05, France Patrick.Cousot@ens.fr www.di.ens.fr/~cousot (joint work with Radhia Cousot)


  1. « Bi-inductive Structural Semantics and its Abstraction » Patrick Cousot École normale supérieure 1. Motivation 45 rue d’Ulm, 75230 Paris cedex 05, France Patrick.Cousot@ens.fr www.di.ens.fr/~cousot (joint work with Radhia Cousot) Departmental Seminar — Department of Computing, Imperial College London Wednesday July 4 th , 2007 J ✁ – ? [ ✄ I J ✁ – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 1 ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 3 ✄ ľ P. Cousot Contents Motivation Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 3 – We look for a formalism to specify abstract program Example: semantics of the eager – -calculus . . . . . . . . . . . . . . . . 7 semantics Bi-inductive structural definitions . . . . . . . . . . . . . . . . . . . . . . . . 47 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 from definitional semantics . . . Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 to static program analysis algorithms handling the many different styles of presentations found in the literature (rules, fixpoint, equations, constraints, . . . ) in a uniform way – A simple generalization of inductive definitions from sets to posets seems adequate. J ✁ – ? [ ✄ I J ✁ – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 2 ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 4 ✄ ľ P. Cousot

  2. On the importance of defining both finite and infinite behaviors 2. Semantics of the Eager – -calculus – Example of the choice operator E 1 j E 2 where: termination E 1 = ) a E 2 = ) b or non-termination E 1 = ) ? E 2 = ) ? – The finite behavior of E 1 j E 2 is: a j b = ) a a j b = ) b : [1] P. Cousot & R. Cousot. Bi-inductive Structural Semantics. SOS 2007, July 9, 2007, Wroclaw, Poland. J ✁ – ? [ ✄ I J ✁ – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 5 ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 7 ✄ ľ P. Cousot – But for the case ? j ? = ) ? , the infinite behaviors of E 1 j E 2 depend on the choice method: Non-deter- Parallel Eager Mixed left- Mixed right- ministic to-right to-left ? j b = ) b ? j b = ) b ? j b = ) b Syntax ? j b = ) ? ? j b = ) ? ? j b = ) ? ? j b = ) ? a j ? = ) a a j ? = ) a a j ? = ) a a j ? = ) ? a j ? = ) ? a j ? = ) ? a j ? = ) ? – Nondeterministic: an internal choice is made initially to evaluate E 1 or to evaluate E 2 ; – Parallel: evaluate E 1 and E 2 concurrently, with an unspecified scheduling, and return the first available result a or b ; – Mixed left-to-right: evaluate E 1 and then either return its result a or evaluate E 2 and return its result b ; – Mixed right-to-left: evaluate E 2 and then either return its result b or evaluate E 1 and return its result a ; – Eager: evaluate both E 1 and E 2 and return either results if both terminate. J ✁ – ? [ ✄ I J ✁ – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 6 ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 8 ✄ ľ P. Cousot

  3. Syntax of the Eager – -calculus Example I: Finite Computation function argument variables x ; y ; z ; : : : 2 X (( λ x . x x ) ( λ y . y )) (( λ z . z ) 0) constants ( X \ C = ? ) c 2 C ! evaluate function c ::= 0 j 1 j : : : (( λ y . y ) ( λ y . y )) (( λ z . z ) 0) values v 2 V v ::= c j λ x . a ! evaluate function, cont’d ( λ y . y ) (( λ z . z ) 0) errors e 2 E e ::= c a j e a ! evaluate argument a ; a 0 ; a 1 ; : : : ; b ; ; : : : 2 T terms ( λ y . y ) 0 a ::= x j v j a a 0 ! apply function to argument 0 a value! J ✁ – ? [ ✄ I J ✁ ✁ – 11 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✁ – 9 ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Example II: Infinite Computation function argument ( λ x . x x ) ( λ x . x x ) ! apply function to argument ( λ x . x x ) ( λ x . x x ) Trace Semantics ! apply function to argument ( λ x . x x ) ( λ x . x x ) ! apply function to argument : : : non termination! J ✁ ✁ – 10 – ? [ ✄ I J ✁ ✁ – 12 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot

  4. Example III: Erroneous Computation Traces – T ? (resp. T + , T ! , T / and T 1 ) be the set of finite function argument (resp. nonempty finite, infinite, finite or infinite, and (( λ x . x x ) (( λ z . z ) 0)) (( λ y . y ) 0) nonempty finite or infinite) sequences of terms ! evaluate argument (( λ x . x x ) (( λ z . z ) 0)) 0 – › is the empty sequence › › ff = ff › › = ff . – j ff j 2 N [ f ! g is the length of ff 2 T / . j › j = 0 . ! evaluate function (( λ x . x x ) 0) 0 – If ff 2 T + then j ff j > 0 and ff = ff 0 › ff 1 › : : : › ff j ff j` 1 . ! evaluate function, cont’d – If ff 2 T ! then j ff j = ! and ff = ff 0 › : : : › ff n › : : : . (0 0) 0 a runtime error! J ✁ ✁ – 13 – ? [ ✄ I J ✁ ✁ – 15 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Finite, Infinite and Erroneous Trace Semantics Operations on Traces (Cont’d) – For a 2 T and ff 2 T 1 , we define a @ ff to be ff 0 2 T 1 s(t) such that 8 i < j ff j : ff 0 i = a ff i ff 0 ff 1 ff 2 ff 3 ff i ff = . . . . . . ② ② ② ② ② a ff 0 a ff 1 a ff 2 a ff 3 a ff i a @ ff = . . . . . . ② ② ② ② ② Error 0 1 2 3 4 5 6 7 8 9 10 t J ✁ ✁ – 14 – ? [ ✄ I J ✁ ✁ – 16 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot

  5. Example Example – a = ( λ y . y ) – ff = (( λ x . x x ) ( λ y . y )) › (( λ y . y ) ( λ y . y )) › ( λ y . y ) – ff = (( λ z . z ) 0) › 0 – b = (( λ z . z ) 0) – a @ ff = – ( ff @ b ) ( λ y . y )@(( λ z . z ) 0) › 0 = = (( λ y . y ) (( λ z . z ) 0)) › (( λ y . y ) 0) ((( λ x . x x ) ( λ y . y )) › (( λ y . y ) ( λ y . y )) › ( λ y . y )@(( λ z . z ) 0)) = ((( λ x . x x ) ( λ y . y )) (( λ z . z ) 0)) › ((( λ y . y ) ( λ y . y )) (( λ z . z ) 0)) › (( λ y . y ) (( λ z . z ) 0)) J ✁ ✁ – 17 – ? [ ✄ I J ✁ ✁ – 19 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Finite and Infinite Trace Semantics Operations on Traces (Cont’d) – Similarly for a 2 T and ff 2 T 1 , ff @ a is ff 0 where s(t) 8 i < j ff j : ff 0 i = ff i a ff 0 ff 1 ff 2 ff 3 ff i ff = . . . . . . ② ② ② ② ② ff 0 a ff 1 a ff 2 a ff 3 a ff i a ff @ a = . . . . . . ② ② ② ② ② 0 1 2 3 4 5 6 7 8 9 10 t J ✁ ✁ – 18 – ? [ ✄ I J ✁ ✁ – 20 – ? [ ✄ I ] ¨ – ✄ ] ¨ – ✄ Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot Departmental Seminar, Imperial College, July 4 th , 2007 ✁ ✄ ľ P. Cousot

Recommend


More recommend