Presentation is loading. Please wait.

Presentation is loading. Please wait.

C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 C LAUS B RABRAND © 2005, University of Aarhus [ ] [

Similar presentations


Presentation on theme: "C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 C LAUS B RABRAND © 2005, University of Aarhus [ ] ["— Presentation transcript:

1 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 C LAUS B RABRAND © 2005, University of Aarhus [ brabrand@daimi.au.dk ] [ http://www.daimi.au.dk/~brabrand/ ] S EMANTICS (Q1,’05) W EEK 4: ”DEFINITIONS: STATIC AND DYNAMIC SEMANTICS”

2 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 2 ] S EP 22, 2005 Week 4 - Outline Issues from week 3; mini-project; competition Return of the Structural Induction Detailed Example: Determinism of SOS for L-exp’s Infinite vs. Finite Stores Simple Definitions (functional languages) Compound Definitions (fun) Type Checking Definitions (fun) Declarations (imperative langs) [  week 7]

3 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 3 ] S EP 22, 2005 “3x3 main issues” from week 3 Class X: 1x. course speed: easy; too slow (3 rd year, has had dOvs) ! 2x. step size: what step size should be used ? 3x. examples: some of the examples are too unrealistic/exotic !? Class Y: 1y. course speed: hard; too fast (2 nd year, hasn’t had dOvs) ! 2y. flip exercise: what was the point (if there was one) ?! 3y. which language?: 1) what’s the syntax; 2) what’s the sem. !!! Class Z: 1z. course speed: appropriate ! 2z. implementation: how much ML are we expected to know ? 3z. implementation: can you show ML examples at the lecture ?

4 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 4 ] S EP 22, 2005 Minor Project Minor project ( cf.: compulsory programme ): compulsory programme When?: 10 days: (Oct 3 -- Oct 13, 2005). What?: covering all topics (so far) Why?: chance to learn, measure, and get feedback Who?: everybody (individually) Amount?: roughly corresponds to an exercise class Form?: written, take-home Grading?: [0-4]-scale ~ [ Aims & Goals ]; (2+ to pass) Aims & Goals Correcting?: your teaching assistants Consequences?: project approved  attend exam Help?: TAs will answer un-applied understanding Q’s ”Good news”: less exercises for classes those 2 weeks

5 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 S TRUCTURAL I NDUCTION A Detailed Example: Determinism of SOS for L-Expressions

6 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 6 ] S EP 22, 2005 Structural Induction (for Exp) Given: Arithmetic Expressions ( e  Exp) e ::= n | v | e 0 +e 1  e  Exp : P(e) P(n)  composite (inductive) case base cases Principle of structural induction: P(e 0 )  P(e 1 )  P(e 0 +e 1 )  P(v) and

7 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 7 ] S EP 22, 2005 Intuition: Induction vs. Str’ Induction Induction: Holds for ? Structural Induction: Holds for ? P(0)P(0) => P(1)P(1) => P(2)P(2) => P(3)  P(3) P(7+(x+y)) P(7) P(x) P(y) P(x+y) P(7+(x+y))     

8 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 8 ] S EP 22, 2005 Structural Induction Examples Given: Arithmetic Expressions ( e  Exp) Determinism of SOS* for L-expressions : “One-step evaluation of expressions is deterministic” e ::= n | v | e 0 +e 1 P(e)  ,  ’: [ (  | _ e     | _ e   ’ ) =>  =  ’ ]  e: P(e) */ using the (side-effectless) small-step operational semantics Let  be given: Prove: (i.e., “prove property, P, holds for all expressions”)

9 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 9 ] S EP 22, 2005 Proof Structure (according to SI) Base cases: Case [ n ]; show : Case [ v ]; show : Inductive case: Case [ e 0 +e 1 ]; show : assume induction hypothesis [lhs]: P(e 0 )  P(e 1 ) show inductive step [rhs]: P(e 0 +e 1 ) P(n)  ,  ’: (  | _ n     | _ n   ’ ) =>  =  ’ P(v)  ,  ’: (  | _ v     | _ v   ’ ) =>  =  ’ P(e 0 )  ,  ’: (  | _ e 0     | _ e 0   ’ ) =>  =  ’ P(e 1 )  ,  ’: (  | _ e 1     | _ e 1   ’ ) =>  =  ’ P(e 0 +e 1 )  ,  ’: (  | _ e 0 +e 1     | _ e 0 +e 1   ’ ) =>  =  ’ P(n) P(v) P(e 0 )  P(e 1 ) => P(e 0 +e 1 )

10 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 10 ] S EP 22, 2005 Proof: Base Case [n] Case [ n ]; show : Show implication “ => ” (assume [lhs], show [rhs]): However, since [lhs] is trivially false (no rules for constants), the whole thing is trivially true (aka. “vacuously true”) Recall that: [explanation]explanation P(n)  ,  ’: (  | _ n     | _ n   ’ ) =>  =  ’ P(n)   b : (false => b)  true

11 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 11 ] S EP 22, 2005 Proof: Base Case [v] Case [ v ]; show : Show implication “ => ” (assume [lhs], show [rhs]): assume [lhs]: and for some ,  ’ show [rhs]: could only be because ; thus,  =  (v) …and similarly: could only be because ; thus,  ’ =  (v) Thus, we have that:  =  (v) =  ’ (as required)  P(v)  ,  ’: (  | _ v     | _ v   ’ ) =>  =  ’ P(v)  |_ v   |_ v    =  ’  |_ v  ’ |_ v  ’  |_ v   |_ v    | _ v   (v)  |_ v  ’ |_ v  ’

12 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 12 ] S EP 22, 2005 Proof: Inductive Case [e 0 +e 1 ] Case [ e 0 +e 1 ]; show : assume induction hypothesis: P(e 0 )  P(e 1 ) show inductive step: P(e 0 +e 1 ) Show implication “ => ” (assume [lhs], show [rhs]): Assume [lhs]: and for some ,  ’ Show [rhs]: When could we have that: (?) Case Analysis (on e 0 +e 1 ) Three possibilities ( [SUM 1 ], [SUM 2 ], and [SUM 3 ] )… P(e 0 )  ,  ’: (  | _ e 0     | _ e 0   ’ ) =>  =  ’ P(e 1 )  ,  ’: (  | _ e 1     | _ e 1   ’ ) =>  =  ’ P(e 0 +e 1 )  ,  ’: (  | _ e 0 +e 1     | _ e 0 +e 1   ’ ) =>  =  ’ P(e 0 )  P(e 1 ) => P(e 0 +e 1 )  | _ e 0 +e 1    | _ e 0 +e 1   ’  =  ’  | _ e 0 +e 1  

13 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 13 ] S EP 22, 2005 Proof: Case Analysis (on e 0 +e 1 ) Case Analysis (on e 0 +e 1 ): Case [SUM 1 (e 0  Z)]: could only be because But from our induction hypothesis, P(e 0 ) ; i.e. … : … we get that: and implies that: e 0 ’ = e 0 ” Thus we have that:  = e 0 ’+e 1 = e 0 ”+e 1 =  ’ (as required)  | _ e 0 +e 1    |_ e0  e0’ |_ e0  e0’  | _ e 0 +e 1  e 0 ’+e 1 =   |_ e0  e0” |_ e0  e0”  | _ e 0 +e 1  e 0 ”+e 1 =  ’  | _ e 0 +e 1   ’   |_ e0  e0’ |_ e0  e0’  |_ e0  e0” |_ e0  e0” P(e 0 )  ,  ’: (  | _ e 0     | _ e 0   ’ ) =>  =  ’

14 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 14 ] S EP 22, 2005 Proof: Case Analysis (on e 0 +e 1 ) Case [SUM 2 (e 0  Z, e 1  Z)]: (analoguous) Case [SUM 3 (e 0  Z, e 1  Z)]: could only be because Thus, we have that:  = m = n 0 +n 1 = m’ =  ’ (as required)  | _ n 0 +n 1    | _ n 0 +n 1   ’  | _ e 0 +e 1  m =   | _ e 0 +e 1  m’ =  ’ m = n 0 +n 1 m’ = n 0 +n 1   

15 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 15 ] S EP 22, 2005 What did we do: Proof Structure Base cases: Case [ n ]; showed : Case [ v ]; showed : Inductive case: Case [ e 0 +e 1 ]; showed : assumed induction hypothesis [lhs]: P(e 0 )  P(e 1 ) showed inductive step [rhs] via case analysis: P(e 0 +e 1 ) P(n)  ,  ’: (  | _ n     | _ n   ’ ) =>  =  ’ P(v)  ,  ’: (  | _ v     | _ v   ’ ) =>  =  ’ P(e 0 )  ,  ’: (  | _ e 0     | _ e 0   ’ ) =>  =  ’ P(e 1 )  ,  ’: (  | _ e 1     | _ e 1   ’ ) =>  =  ’ P(e 0 +e 1 )  ,  ’: (  | _ e 0 +e 1     | _ e 0 +e 1   ’ ) =>  =  ’ P(n) P(v) P(e 0 )  P(e 1 ) => P(e 0 +e 1 )

16 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 I NFINITE vs. F INITE S TORES

17 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 17 ] S EP 22, 2005 Problem: Infinite Stores Problem: (Var infinite) Solution: (for V  FIN Var) Now define finite configurations:   Store = Var  Z  v  Store V = V  Z  V := { | Var( e )  V    Store V } appropriate store all vars in “V”

18 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 18 ] S EP 22, 2005 Finite Typeable Configurations Configurations (Exp): Transitions (using “  V,E ”): Configurations (Com): Transitions (using “  V,C ”):  V.C := { | | _ wfc c  Var C ( c )  V    Store V }  V,E := { |  : | _ e:   Var E ( e )  V    Store V }  V,E [ SUM 1 ]  V,C [ SEQ 1 ]  {  |   Store V }

19 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 19 ] S EP 22, 2005 Variable Extraction Functions Var E : Exp  P(Var) Var E ( n ) = Ø Var E ( t ) = Ø Var E ( v ) = { v } Var E ( ~ e ) = Var E ( e ) Var E ( e  e’ ) = Var E ( e )  Var E ( e’ ) Var C : Com  P(Var) Var C ( nil ) = Ø Var C ( x := e ) = { x }  Var E ( e ) Var C ( c ; c’ ) = Var C ( c )  Var C ( c’ ) Var C ( if e then c else c’ ) = Var E ( e )  Var C ( c )  Var C ( c’ ) Var C ( while e do c ) = Var E ( e )  Var C ( c )

20 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 D EFINITIONS (FUNCTIONAL LANGs)

21 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 21 ] S EP 22, 2005 Introducing Binding Constructs Consider the language ”Let”: Expressions ( e  Exp): Example Let program: Note: the actual identifier names are irrellevant (only the use-def links are significant) e ::= n | x | e  e’ | let x = e in e’   { +, -, * } …where: x + let x = 5 in x + let x = 1 + x in x * x Definition (def) Usage (use): Free use Bound use use-def link Terminology definition scope

22 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 22 ] S EP 22, 2005 Free Variables Determine the free variables? FV: Exp  P(Var) FV( n ) = Ø FV( x ) = { x } FV( e  e’ ) = FV( e )  FV( e’ ) FV( let x=e in e’ ) = FV( e )  ( FV( e’ ) \ { x } ) Note: error in [Plotkin, p. 56]; all intersections in figure should be unions.

23 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 23 ] S EP 22, 2005 Dynamic Semantics (Trans. Sys.) Define (family of) environments: recall terminology (no side-effects) Configurations: i.e., numbers Transition relation: ; writing for  V = { |   Env V  FV( e )  V } T V = { |   Env V  z  Z }  v  Env V = V  Z Note: this is done slightly differently in [Plotkin, p. 57-…]: through “relative transition systems” that are (implicitly) relative to an environment. V  V  VV  V  V  |- e  V e (, )  ‘  V ’

24 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 24 ] S EP 22, 2005 Dynamic Semantics [n] | [x] | [e  e] Structural Operational Semantics: [ BOP 1 ] [ BOP 2 ] [ BOP 3 ] [ VAR ]  |- e 0  e 1  V e 0 ’ + e 1  |- e 0  V e 0 ’  |- z 0  z 1  V z z = z 0  z 1  |- z 0  e 1  V z 0 + e 1 ’  |- e 1  V e 1 ’  |- x  V z z =  (x)   Env V = V  Z

25 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 25 ] S EP 22, 2005 Dynamic Semantics [ let-in ] Structural Operational Semantics: Note: the premisis works in the extended environment Live: derive in environment: [ LET 2 ] [ LET 3 ] [ LET 1 ]   Env V = V  Z  |- let x = e 0 in e 1  V let x = e 0 ’ in e 1  |- e 0  V e 0 ’  |- let x = z in n  V n  |- let x = z in e 1  V let x = z in e 1 ’  [x  z] |- e 1  V  {x} e 1 ’ let x=y in x [y7][y7]

26 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 C OMPOUND D EFINITIONS

27 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 27 ] S EP 22, 2005 Compound Definitions Consider language Let++: Expressions ( e  Exp): Definitions (d  Def): e ::= n | x | e  e’ | let d in e d ::= nil | x = e | d ; d’ | d and d’ | d in d’ x + 3y = x+7 Graphically: value env {x} env {y} [x1][x1] env {x} [x1][x1][y8][y8] 4   { +, -, * } …where:

28 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 28 ] S EP 22, 2005 Graphically: [x = e] | [d ; d’] Definition block: E.g.: Sequential definition: E.g.: let d in e d ; d’ let x=a ; y=b in b * c + y > a b c x y b c

29 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 29 ] S EP 22, 2005 Graphically: [d and d’] | [d in d’] Simultaneous definition: E.g.: Private definition: E.g.: d and d’ d in d’ >

30 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 30 ] S EP 22, 2005 Static Semantics: Let++ Problem: I.e. non-disjoint simultaneous definitions! Solution: static semantics exp / def “well-formedness relations”: ‘|- wfe ’ / ‘|- wfd ’: let x = 1 and x = 2 in x | _ wfe e | _ wfe e’ | _ wfe e  e’ Exp well-formedness:Definition well-formedness: | _ wfe n | _ wfe x | _ wfd d | _ wfe e | _ wfe let d in e | _ wfd nil  | _ wfe e | _ wfd x = e | _ wfd d | _ wfd d’ | _ wfd d ; d’ | _ wfd d | _ wfd d’ | _ wfd d and d’ | _ wfd d | _ wfd d’ | _ wfd d in d’ DV( d )  DV( d’ ) = Ø

31 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 31 ] S EP 22, 2005 Recall: Free Variables for Let Let: FV( n ) = Ø FV( x ) = { x } FV( e  e’ ) = FV( e )  FV( e’ ) FV( let x=e in e’ ) = FV( e )  ( FV( e’ ) \ { x } ) Let++: FV( let d in e’ ) = FV( d )  ( FV( e’ ) \ DV( d ) ) So we need FV( d ) and DV( d ) …

32 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 32 ] S EP 22, 2005 Defining Variables and Free Variables DV: Def  P(Var)defining variables DV( nil ) = Ø DV( x = e )= { x } DV( d ; d’ ) = DV( d )  DV( d’ ) DV( d and d’ )= DV( d )  DV( d’ ) DV( d in d’ )= DV( d’ ) FV: Def  P(Var)free variables FV( nil ) = Ø FV( x = e )= FV( e ) FV( d ; d’ ) = FV( d )  ( FV( d’ ) \ DV( d ) ) FV( d and d’ )= FV( d )  FV( d’ ) FV( d in d’ )= FV( d )  ( FV( d’ ) \ DV( d ) ) + should be disjoint union

33 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 33 ] S EP 22, 2005 Dynamic Semantics (Trans. Sys.) Expression Configurations: Problem: what should definitions evaluate to? Environments (like expressions evaluate to numbers) Solution: add “environments results” as intermediate syntax: Definition Configurations:  V,E = { |   Env V  FV( e )  V  |- wfe e } T V,E = { |   Env V  z  Z } only well-formed exps d ::= nil | x = e | d ; d’ | d and d’ | d in d’ |  0  V,D = { |   Env V  FV( d )  V  |- wfd d } T V,D = { |   Env V } only well-formed defs

34 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 34 ] S EP 22, 2005 Dynamic Semantics: Exp Structural Operational Semantics: Note: the premisis works in the  0 - extended environment [ LET 2 ] [ LET 3 ] [ LET 1 ]   Env V = V  Z  |- let d in e  V let d’ in e  |- d  V d’  |- let  0 in n  V n  |- let  0 in e  V let  0 in e’  [  0 ] |- e  V  DV(  0) e’

35 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 35 ] S EP 22, 2005 Dynamic Sem.: Def [nil] | [x=e] Structural Operational Semantics:   Env V = V  Z [ NIL ]  |- nil  V [] the empty environment,  [] [ DEF 1 ]  |- x = e  V x = e’  |- e  V e’ [ DEF 2 ]  |- x = n  V [x  n] the environment,  [x  n]

36 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 36 ] S EP 22, 2005 Dynamic Sem.: Def [d;d’] Structural Operational Semantics: Note: the premisis works in the  0 - extended environment Note: the result is the combined environment,  0 [  1 ] [ SEQ 2 ] [ SEQ 3 ] [ SEQ 1 ]   Env V = V  Z  |- d 0 ; d 1  V d 0 ’ ; d 1  |- d 0  V d 0 ’  |-  0 ;  1  V  0 [  1 ]  |-  0 ; d 1  V  0 ; d 1 ’  [  0 ] |- d 1  V  DV(  0) d 1 ’

37 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 37 ] S EP 22, 2005 Dynamic Sem.: Def [d and d’] Structural Operational Semantics: Notice the independence of the two operands (d and d’) Note: the result is the disj. combined environment,  0  1 [ AND 2 ] [ AND 3 ] [ AND 1 ]   Env V = V  Z  |- d 0 and d 1  V d 0 ’ and d 1  |- d 0  V d 0 ’  |-  0 and  1  V  0  1  |-  0 and d 1  V  0 and d 1 ’  |- d 1  V d 1 ’

38 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 38 ] S EP 22, 2005 Dynamic Sem.: Def [d in d’] Structural Operational Semantics: Note: the premisis works in the  0 - extended environment Note: the result is only the last environment,  1 [ IN 2 ] [ IN 3 ] [ IN 1 ]   Env V = V  Z  |- d 0 in d 1  V d 0 ’ in d 1  |- d 0  V d 0 ’  |-  0 in  1  V  1  |-  0 in d 1  V  0 in d 1 ’  [  0 ] |- d 1  V  DV(  0) d 1 ’

39 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 T YPE C HECKING D EFINITIONS

40 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 40 ] S EP 22, 2005 Adding Boolean Variables: Let B ++ Consider language Let B ++: Mixed Expressions ( e  Exp): Definitions (d  Def): Note: The type of a var is now context dependent I.e. a context-free (grammar) approach will not suffice Examples: ? ? … e ::= n | t | x | ~ e | e  e’ | e ? e’ : e” | let d in e d ::= nil |  x = e | d ; d’ | d and d’ | d in d’   { +, -, *, =, or } …where: x or tt x * x type definition (annotation)   { bool, int } …where:

41 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 41 ] S EP 22, 2005 Static Semantics: Let B ++ DV and FV as before …adding: We now need type environments: Type = { bool, int } Define static semantics (type checking rel’s): “ e has type  (given type environment  )” provided “ d yields type env.  (given type env.  )” provided FV( e ? e’ : e” ) = FV( e )  FV( e’ )  FV( e” ) TEnv V = V  Type  |- V e :   |- V d :  FV( e )  V FV( d )  V

42 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 42 ] S EP 22, 2005 Static Semantics (expressions) Expressions: [ NUM ]  |- V n : int  |- V t : bool [ TVL ] [ VAR ]  |- V x :  (x) [ VAR ]  |- V ~ e : bool  |- V e : bool [ LET ]  |- V let d in e :   |- V d :   [  ] |- V  DV{  } e :  [ IFE ]  |- V e 0 ? e 1 : e 2 :   |- V e 0 : bool  |- V e 1 :  1  |- V e 2 :  2  = 1 =2 = 1 =2 [ BOP ]  |- V e 0  e 1 : type  (  0,  1 )  |- V e 0 :  0  |- V e 1 :  1

43 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 43 ] S EP 22, 2005 Static Semantics (definitions) Definitions: [ NIL ]  |- V nil : [] [ DEF ]  |- V  x = e : [x  ]  |- V e :  ’  = ’ = ’ [ SEQ ]  |- V d 0 ; d 1 :  0 [  1 ]  |- V d 0 :  0  [  0 ] |- V  DV{  0} d 1 :  1 [ AND ]  |- V d 0 and d 1 :  0  1  |- V d 0 :  0  |- V d 1 :  1 [ IN ]  |- V d 0 in d 1 :  1  |- V d 0 :  0  [  0 ] |- V  DV{  0} d 1 :  1 DV( d 0 )  DV( d 1 ) = Ø Note: combined environment Note: only last environment Note: disjoint environment Note: type check

44 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 44 ] S EP 22, 2005 Dynamic Semantics: Let B ++ Type Environment (Compile-time): Type = { bool, int } Environment (Runtime): B = { tt, ff } Define type correspondence relation ‘~’: Note:  v  TEnv V = V  Type  v  Env V = V  B  Z  v ~  v   x  V:  v ( x ) = bool   v ( x )  B  v ( x ) = int   v ( x )  Z (  0 ~  0   1 ~  1 )   0 [  1 ] ~  0 [  1 ]

45 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 45 ] S EP 22, 2005 Exp. Transition System for Let B ++ Let++ Expression Configurations: Let B ++ Expression Configurations:   V  Type: Env  := i.e., “only type corresponding runtime environments”  V = { |   Env V  FV( e )  V  |- wfe e } T V = { |   Env V  z  Z } only well-formed exps   = { |   Env   FV( e )  V   :  |- V e :  } T  = { |   Env   r  B  Z } {   ( V  B  Z ) |  ~  }

46 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 46 ] S EP 22, 2005 Def. Transition System for Let B ++ Let++ Definition Configurations: Let B ++ Definition Configurations:   V  Type: Env  := i.e., “only type corresponding runtime environments”  V = { |   Env V  FV( d )  V  |- wfd d } only well-formed defs T V = { |   Env V }   = { |   Env   FV( d )  V   :  |- V d :  } T  = { |   Env  } {   ( V  B  Z ) |  ~  }

47 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 47 ] S EP 22, 2005 Exp. Dynamic Semantics: Let B ++ SOS of Expressions for Let B ++: E.g. [LET]: - Basically substituting  for V (from dyn. sem. of Let++) [ LET 2 ] [ LET 3 ] [ LET 1 ]   Env   |- let d in e   let d’ in e  |- d   d’  |- let  0 in r   r  |- let  0 in e   let  0 in e’  [  0 ] |- e   [  0] e’ 0 ~ 00 ~ 0

48 C LAUS B RABRAND © S EMANTICS (Q1,’05) [ 48 ] S EP 22, 2005 Def. Dynamic Semantics: Let B ++ SOS of Definitions for Let B ++: E.g [SEQ]: - Again, basically substituting  for V (from dyn. sem. of Let++) [ SEQ 2 ] [ SEQ 3 ] [ SEQ 1 ]  |- d 0 ; d 1   d 0 ’ ; d 1  |- d 0   d 0 ’  |-  0 ;  1    0 [  1 ]  |-  0 ; d 1    0 ; d 1 ’  [  0 ] |- d 1   [  0] d 1 ’   Env  0 ~ 00 ~ 0

49 C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 Next week (CCS): Concurrency and Communication Any Questions?


Download ppt "C LAUS B RABRAND S EMANTICS (Q1,’05) S EP 22, 2005 C LAUS B RABRAND © 2005, University of Aarhus [ ] ["

Similar presentations


Ads by Google