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
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Semantic functions Natural Semantics: Sns[S] s =

  

s′ if (S, s) → s′ undefined otherwise Structural Operational Semantics: Ssos[S] s =

  

s′ if (S, s) ⇒∗ s′ undefined otherwise Question Does it hold that Sns = Ssos? Lemma 2.27 For all S, s and s′ (S, s) → s′ implies (S, s) ⇒∗ s′ Lemma 2.28 For all S, s, s′ and k (S, s) ⇒k s′ implies (S, s) → s′

V.1

Natural Semantics (x := a, s) → s[x → A[a]s] (skip, s) → s (S1, s) → s′, (S2, s′) → s′′ (S1; S2, s) → s′′ (S1, s) → s′ (if b then S1 else S2, s) → s′ if B[b]s = tt (S2, s) → s′ (if b then S1 else S2, s) → s′ if B[b]s = ff (S, s) → s′, (while b do S, s′) → s′′ (while b do S, s) → s′′ if B[b]s = tt (while b do S, s) → s if B[b]s = ff

V.2

slide-2
SLIDE 2

Structural Operational Semantics (x := a, s) ⇒ s[x → A[a]s] (skip, s) ⇒ s (S1, s) ⇒ (S′

1, s′)

(S1; S2, s) ⇒ (S′

1; S2, s′)

(S1, s) ⇒ s′ (S1; S2, s) ⇒ (S2, s′) (if b then S1 else S2, s) ⇒ (S1, s) if B[b]s = tt (if b then S1 else S2, s) ⇒ (S2, s) if B[b]s = ff (while b do S, s) ⇒ (if b then (S; while b do S) else skip, s)

V.3

Proof of Lemma 2.27 (S, s) → s′ implies (S, s) ⇒∗ s′ Proof: Induction on the Shape of Deriva- tion Trees

  • Prove that the property holds for all

the simple derivation trees by showing that it holds for all the axioms of the transition system

  • Prove that the property holds for all

the composite derivation trees: For each rule assume that the property holds for its premises (this is called the induction hypothesis) and prove that it also holds for the conclusion of the rule provided that the conditions

  • f the rule are satisfied

V.4

slide-3
SLIDE 3

Proof of Lemma 2.28 (S, s) ⇒k s′ implies (S, s) → s′ Proof: Induction on the Length of Deriva- tion Sequences

  • Prove that the property holds for all

derivation sequences of length 0

  • Prove that the property holds for all
  • ther derivation sequences:

Assume that the property holds for derivation sequences of length at most k (this is called the induction hypothesis) and prove that it holds for derivation se- quences of length k + 1

V.5

Auxiliary results In the proof of Lemma 2.27 we use Exercise 2.21: If (S1, s) ⇒k s′ then (S1; S2, s) ⇒k (S2, s′) In the proof of Lemma 2.28 we use Lemma 2.19: If (S1; S2, s) ⇒k s′′ then there exists s′, k1 and k2 such that (S1, s) ⇒k1 s′, (S2, s′) ⇒k2 s′′ and k = k1 + k2 Lemma 2.5: The statements while b do S and if b then (S; while b do S) else skip are semantically equivalent

V.6