bi inductive structural semantics
play

Bi-inductive Structural Semantics Patrick Cousot Radhia Cousot - PowerPoint PPT Presentation

Bi-inductive Structural Semantics Patrick Cousot Radhia Cousot cole normale suprieure cole polytechnique & CNRS 45 rue dUlm Route de Saclay 75230 Paris cedex 05, France 91128 Palaiseau Cedex, France Patrick.Cousot@ens.fr


  1. « Bi-inductive Structural Semantics » Patrick Cousot Radhia Cousot École normale supérieure École polytechnique & CNRS 45 rue d’Ulm Route de Saclay 75230 Paris cedex 05, France 91128 Palaiseau Cedex, France Patrick.Cousot@ens.fr Radhia.Cousot@polytechnique.fr www.di.ens.fr/~cousot www.polytechnique.edu/Radhia.Cousot Fourth Workshop on Structural Operational Semantics SOS 2007 — Wroclaw, Poland July 9 th , 2007 SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 1 — ľ P. Cousot

  2. Contents Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Bi-inductive structural definitions . . . . . . . . . . . . . . . . . . . . . . . . . 5 Example: semantics of the eager – -calculus . . . . . . . . . . . . . . . . 8 Abstraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 2 — ľ P. Cousot

  3. 1. Motivation SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 3 — ľ P. Cousot

  4. Motivation – We look for a formalism to specify abstract program semantics from definitional semantics . . . to static program analysis algorithms - coping with termination & non-termination, - 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. SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 4 — ľ P. Cousot

  5. 2. Bi-inductive Structural Defini- tions Over-simplified for the presentation! SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 5 — ľ P. Cousot

  6. Inductive definitions Set-theoretic [Acz77] Order-theoretic universe h } ( U ) ; „i hD ; vi P P rules c 2 R ( P 2 } ( U ) ; c 2 U ) C 2 R ( P; C 2 D ) ˛ 9 P ˛ 9 P ˛ ˛ n o Gn o F ( X ) , F ( X ) , transformer c 2 R : P „ X c 2 R : P v X c C ˛ ˛ „ F 2 } ( U ) v F 2 D fixpoint def. lfp lfp equational def. „` least X : F ( X ) = X v` least X : F ( X ) = X constraint def. „` least X : F ( X ) „ X v` least X : F ( X ) v X n X X ˛ ˛ o n o rules ˛ X „ U ^ c 2 F ( X ) ˛ X 2 D ˛ ˛ c F ( X ) SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 6 — ľ P. Cousot

  7. Inductive definitions Set-theoretic [Acz77] Order-theoretic universe h } ( U ) ; „i hD ; vi P P rules c 2 R ( P 2 } ( U ) ; c 2 U ) C 2 R ( P; C 2 D ) ˛ 9 P ˛ 9 P ˛ ˛ n o Gn o F ( X ) , F ( X ) , transformer c 2 R : P „ X c 2 R : P v X c C ˛ ˛ „ F 2 } ( U ) v F 2 D fixpoint def. lfp lfp equational def. „` least X : F ( X ) = X v` least X : F ( X ) = X constraint def. „` least X : F ( X ) „ X v` least X : F ( X ) v X n X X ˛ ˛ o n o rules ˛ X „ U ^ c 2 F ( X ) ˛ X 2 D ˛ ˛ c F ( X ) SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 7 — ľ P. Cousot

  8. 3. Semantics of the Eager – -calculus SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 8 — ľ P. Cousot

  9. Syntax SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 9 — ľ P. Cousot

  10. Syntax of the Eager – -calculus variables x ; y ; z ; : : : 2 X constants ( X \ C = ? ) c 2 C c ::= 0 j 1 j : : : values v 2 V v ::= c j λ x . a errors e 2 E e ::= c a j e a a ; a 0 ; a 1 ; : : : ; b ; ; : : : 2 T terms a ::= x j v j a a 0 SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 10 — ľ P. Cousot

  11. Trace Semantics SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 11 — ľ P. Cousot

  12. Example I: Finite Computation function argument (( λ x . x x ) ( λ y . y )) (( λ z . z ) 0) ! evaluate function (( λ y . y ) ( λ y . y )) (( λ z . z ) 0) ! evaluate function, cont’d ( λ y . y ) (( λ z . z ) 0) ! evaluate argument ( λ y . y ) 0 ! apply function to argument 0 a value! SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 12 — ľ P. Cousot

  13. Example II: Infinite Computation function argument ( λ x . x x ) ( λ x . x x ) ! apply function to argument ( λ x . x x ) ( λ x . x x ) ! apply function to argument ( λ x . x x ) ( λ x . x x ) ! apply function to argument : : : non termination! SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 13 — ľ P. Cousot

  14. Example III: Erroneous Computation function argument (( λ x . x x ) (( λ z . z ) 0)) (( λ y . y ) 0) ! evaluate argument (( λ x . x x ) (( λ z . z ) 0)) 0 ! evaluate function (( λ x . x x ) 0) 0 ! evaluate function, cont’d (0 0) 0 a runtime error! SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 14 — ľ P. Cousot

  15. Finite, Infinite and Erroneous Trace Semantics s(t) Error 0 1 2 3 4 5 6 7 8 9 10 t SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 15 — ľ P. Cousot

  16. Traces – T ? (resp. T + , T ! , T / and T 1 ) be the set of finite (resp. nonempty finite, infinite, finite or infinite, and nonempty finite or infinite) sequences of terms – › is the empty sequence › › ff = ff › › = ff . – j ff j 2 N [ f ! g is the length of ff 2 T / . j › j = 0 . – If ff 2 T + then j ff j > 0 and ff = ff 0 › ff 1 › : : : › ff j ff j` 1 . – If ff 2 T ! then j ff j = ! and ff = ff 0 › : : : › ff n › : : : . SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 16 — ľ P. Cousot

  17. 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 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 = . . . . . . ② ② ② ② ② SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 17 — ľ P. Cousot

  18. Operations on Traces (Cont’d) – Similarly for a 2 T and ff 2 T 1 , ff @ a is ff 0 where 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 = . . . . . . ② ② ② ② ② SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 18 — ľ P. Cousot

  19. Finite and Infinite Trace Semantics s(t) 0 1 2 3 4 5 6 7 8 9 10 t SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 19 — ľ P. Cousot

  20. Bifinitary Trace Semantics ~ S of the Eager – -calculus 1 a [ x v ] › ff 2 ~ S v 2 ~ S ; v 2 V v ; v 2 V ( λ x . a ) v › a [ x v ] › ff 2 ~ S S + ; ( a v ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; a 2 V v ; v ; a 2 V ( a @ ff ) › ( a v ) › ff 0 2 ~ a @ ff 2 ~ S S S + ; ( v b ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; v 2 V v ( ff @ b ) › ( v b ) › ff 0 2 ~ ff @ b 2 ~ S S 1 Note: a [ x b ] is the capture-avoiding substitution of b for all free occurences of x within a . We let FV( a ) be the free variables of a . We define the call-by-value semantics of closed terms (without free variables) T , f a 2 T j FV( a ) = ? g . SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 20 — ľ P. Cousot

  21. Bifinitary Trace Semantics ~ S of the Eager – -calculus 1 a [ x v ] › ff 2 ~ S v 2 ~ S ; v 2 V v ; v 2 V ( λ x . a ) v › a [ x v ] › ff 2 ~ S S + ; ( a v ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; a 2 V v ; v ; a 2 V ( a @ ff ) › ( a v ) › ff 0 2 ~ a @ ff 2 ~ S S S + ; ( v b ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; v 2 V v ( ff @ b ) › ( v b ) › ff 0 2 ~ ff @ b 2 ~ S S 1 Note: a [ x b ] is the capture-avoiding substitution of b for all free occurences of x within a . We let FV( a ) be the free variables of a . We define the call-by-value semantics of closed terms (without free variables) T , f a 2 T j FV( a ) = ? g . SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 21 — ľ P. Cousot

  22. Bifinitary Trace Semantics ~ S of the Eager – -calculus 1 a [ x v ] › ff 2 ~ S v 2 ~ S ; v 2 V v ; v 2 V ( λ x . a ) v › a [ x v ] › ff 2 ~ S S + ; ( a v ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; a 2 V v ; v ; a 2 V ( a @ ff ) › ( a v ) › ff 0 2 ~ a @ ff 2 ~ S S S + ; ( v b ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; v 2 V v ( ff @ b ) › ( v b ) › ff 0 2 ~ ff @ b 2 ~ S S 1 Note: a [ x b ] is the capture-avoiding substitution of b for all free occurences of x within a . We let FV( a ) be the free variables of a . We define the call-by-value semantics of closed terms (without free variables) T , f a 2 T j FV( a ) = ? g . SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 22 — ľ P. Cousot

  23. Bifinitary Trace Semantics ~ S of the Eager – -calculus 1 a [ x v ] › ff 2 ~ S v 2 ~ S ; v 2 V v ; v 2 V ( λ x . a ) v › a [ x v ] › ff 2 ~ S S + ; ( a v ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; a 2 V v ; v ; a 2 V ( a @ ff ) › ( a v ) › ff 0 2 ~ a @ ff 2 ~ S S S + ; ( v b ) › ff 0 2 ~ S ! ff 2 ~ ff › v 2 ~ S v ; v 2 V v ( ff @ b ) › ( v b ) › ff 0 2 ~ ff @ b 2 ~ S S 1 Note: a [ x b ] is the capture-avoiding substitution of b for all free occurences of x within a . We let FV( a ) be the free variables of a . We define the call-by-value semantics of closed terms (without free variables) T , f a 2 T j FV( a ) = ? g . SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 23 — ľ P. Cousot

  24. The Computational Lattice Given S; T 2 } ( T 1 ) , we define – S + , S \ T + finite traces – S ! , S \ T ! infinite traces – S v T , S + „ T + ^ S ! « T ! computational order – h } ( T 1 ) ; v ; T ! ; T + ; t ; ui is a complete lattice SOS 2007, Wroclaw, Poland, July 9 th , 2007 — 24 — ľ P. Cousot

Recommend


More recommend