definitions and proofs structural induction three
play

Definitions and Proofs Structural Induction Three approaches to - PowerPoint PPT Presentation

Definitions and Proofs Structural Induction Three approaches to semantics compositional definitions Prove that the property holds for all the basis elements of the syntactic cat- natural semantics egory. structural operational


  1. Definitions and Proofs Structural Induction Three approaches to semantics • compositional definitions • Prove that the property holds for all the basis elements of the syntactic cat- • natural semantics egory. • structural operational semantics • Prove that the property holds for all Three proof principles the composite elements by assuming that the property holds for the imme- • structural induction diate constituents of the element (this • induction on the shape of derivation is called the induction hypothesis) and proving that it also holds for the ele- trees ment itself. • induction on the length of derivation sequences IV.1 IV.2

  2. Ind. on Shape of Derivation Trees Ind. on Length of Derivation Seq. • Prove that the property holds for all the simple derivation trees by showing • Prove that the property holds for all that it holds for all the axioms of the derivation sequences of length 0 transition system • Prove that the property holds for all • Prove that the property holds for all other derivation sequences: Assume the composite derivation trees: For that the property holds for derivation each rule assume that the property sequences of length at most k (this is holds for its premises (this is called called the induction hypothesis) and the induction hypothesis) and prove prove that it holds for derivation se- that it also holds for the conclusion of quences of length k + 1 the rule provided that the conditions of the rule are satisfied IV.3 IV.4

  3. Proof by Structural Induction A : Aexp → State → N Intuitively: The value of an arithmetic ex- pression only depends on the values of the variables that occur in it. Free variables in arithmetic expressions ∅ FV( n ) = A [ n ] s N [ n ] = FV( x ) = { x } A [ x ] s = s x FV( a 1 ) ∪ FV( a 2 ) FV( a 1 + a 2 ) = A [ a 1 + a 2 ] s = A [ a 1 ] s + A [ a 2 ] s FV( a 1 ∗ a 2 ) = FV( a 1 ) ∪ FV( a 2 ) A [ a 1 ∗ a 2 ] s = A [ a 1 ] s ∗ A [ a 2 ] s FV( a 1 − a 2 ) = FV( a 1 ) ∪ FV( a 2 ) A [ a 1 − a 2 ] s A [ a 1 ] s − A [ a 2 ] s = Lemma 1.11: Let s and s ′ be two states satisfying s x = s ′ x for all x ∈ FV( a ). Then A [ a ] s = A [ a ] s ′ IV.5 IV.6

  4. Proof by Ind. on Shape of Derivation Trees Natural Semantics ( x := a, s ) → s [ x �→ A [ a ] s ] ( skip , s ) → s ( S 1 , s ) → s ′ , ( S 2 , s ′ ) → s ′′ Theorem 2.9: ( S 1 ; S 2 , s ) → s ′′ The natural semantics of While is determin- ( S 1 , s ) → s ′ istic, that is for all statements S of While ( if b then S 1 else S 2 , s ) → s ′ and all states s , s ′ and s ′′ if ( S, s ) → s ′ and ( S, s ) → s ′′ if B [ b ] s = tt then s ′ = s ′′ . ( S 2 , s ) → s ′ ( if b then S 1 else S 2 , s ) → s ′ Proof: if B [ b ] s = ff We assume ( S, s ) → s ′ . We prove that if ( S, s ) → s ′′ then s ′ = s ′′ . ( S, s ) → s ′ , ( while b do S, s ′ ) → s ′′ ( while b do S, s ) → s ′′ We proceed by induction on the inference of ( S, s ) → s ′ . if B [ b ] s = tt ( while b do S, s ) → s if B [ b ] s = ff IV.7 IV.8

  5. Proof by Ind. on Length of Derivation Seq. Structural Operational Semantics ( x := a, s ) ⇒ s [ x �→ A [ a ] s ] ( skip , s ) ⇒ s ( S 1 , s ) ⇒ ( S ′ 1 , s ′ ) Lemma 2.19: ( S 1 ; S 2 , s ) ⇒ ( S ′ 1 ; S 2 , s ′ ) If ( S 1 ; S 2 , s ) ⇒ k s ′′ then ( S 1 , s ) ⇒ s ′ there exists s ′ , k 1 and k 2 such that ( S 1 ; S 2 , s ) ⇒ ( S 2 , s ′ ) ( S 1 , s ) ⇒ k 1 s ′ , ( S 2 , s ′ ) ⇒ k 2 s ′′ and ( if b then S 1 else S 2 , s ) ⇒ ( S 1 , s ) k = k 1 + k 2 if B [ b ] s = tt Proof: ( if b then S 1 else S 2 , s ) ⇒ ( S 2 , s ) We proceed by induction on the number k . if B [ b ] s = ff ( while b do S, s ) ⇒ ( if b then ( S ; while b do S ) else skip , s ) IV.9 IV.10

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend