semantic functions natural semantics x a s s x a a s
play

Semantic functions Natural Semantics ( x := a, s ) s [ x A [ a ] s - PowerPoint PPT Presentation

Semantic functions Natural Semantics ( x := a, s ) s [ x A [ a ] s ] Natural Semantics: ( skip , s ) s s if ( S, s ) s S ns [ S ] s = undefined otherwise ( S 1 , s ) s , ( S 2 , s ) s


  1. Semantic functions Natural Semantics ( x := a, s ) → s [ x �→ A [ a ] s ] Natural Semantics: ( skip , s ) → s  s ′ if ( S, s ) → s ′  S ns [ S ] s = undefined otherwise ( S 1 , s ) → s ′ , ( S 2 , s ′ ) → s ′′  Structural Operational Semantics: ( S 1 ; S 2 , s ) → s ′′ if ( S, s ) ⇒ ∗ s ′  s ′  ( S 1 , s ) → s ′ S sos [ S ] s = undefined otherwise ( if b then S 1 else S 2 , s ) → s ′  Question if B [ b ] s = tt Does it hold that S ns = S sos ? ( S 2 , s ) → s ′ ( if b then S 1 else S 2 , s ) → s ′ Lemma 2.27 if B [ b ] s = ff For all S , s and s ′ ( S, s ) → s ′ , ( while b do S, s ′ ) → s ′′ ( S, s ) → s ′ implies ( S, s ) ⇒ ∗ s ′ ( while b do S, s ) → s ′′ Lemma 2.28 if B [ b ] s = tt For all S , s , s ′ and k ( while b do S, s ) → s ( S, s ) ⇒ k s ′ implies ( S, s ) → s ′ if B [ b ] s = ff V.1 V.2

  2. Structural Operational Semantics Proof of Lemma 2.27 ( x := a, s ) ⇒ s [ x �→ A [ a ] s ] ( S, s ) → s ′ implies ( S, s ) ⇒ ∗ s ′ ( skip , s ) ⇒ s Proof: Induction on the Shape of Deriva- tion Trees ( S 1 , s ) ⇒ ( S ′ 1 , s ′ ) ( S 1 ; S 2 , s ) ⇒ ( S ′ 1 ; S 2 , s ′ ) • Prove that the property holds for all the simple derivation trees by showing ( S 1 , s ) ⇒ s ′ ( S 1 ; S 2 , s ) ⇒ ( S 2 , s ′ ) that it holds for all the axioms of the transition system ( if b then S 1 else S 2 , s ) ⇒ ( S 1 , s ) • Prove that the property holds for all if B [ b ] s = tt the composite derivation trees: For each rule assume that the property ( if b then S 1 else S 2 , s ) ⇒ ( S 2 , s ) holds for its premises (this is called if B [ b ] s = ff the induction hypothesis) and prove that it also holds for the conclusion of ( while b do S, s ) ⇒ the rule provided that the conditions of the rule are satisfied ( if b then ( S ; while b do S ) else skip , s ) V.3 V.4

  3. Proof of Lemma 2.28 Auxiliary results In the proof of Lemma 2.27 we use Exercise 2.21: ( S, s ) ⇒ k s ′ implies ( S, s ) → s ′ If ( S 1 , s ) ⇒ k s ′ then ( S 1 ; S 2 , s ) ⇒ k ( S 2 , s ′ ) Proof: Induction on the Length of Deriva- In the proof of Lemma 2.28 we use tion Sequences • Prove that the property holds for all Lemma 2.19: s ′′ then there exists derivation sequences of length 0 ⇒ k If ( S 1 ; S 2 , s ) s ′ , k 1 and k 2 such that ( S 1 , s ) ⇒ k 1 s ′ , • Prove that the property holds for all ( S 2 , s ′ ) ⇒ k 2 s ′′ and k = k 1 + k 2 other derivation sequences: Assume that the property holds for derivation Lemma 2.5: sequences of length at most k (this is The statements called the induction hypothesis) and while b do S prove that it holds for derivation se- and quences of length k + 1 if b then (S; while b do S) else skip are semantically equivalent V.5 V.6

Recommend


More recommend