an executable rewriting logic semantics for concurrent
play

An Executable Rewriting Logic Semantics for Concurrent Haskell - PowerPoint PPT Presentation

Introduction Rewriting Logic Semantics of Haskell Conclusion An Executable Rewriting Logic Semantics for Concurrent Haskell Patrick Bahr s0404888@inf.tu-dresden.de Technische Universitt Dresden January 11, 2008 Patrick Bahr An Executable


  1. Introduction Rewriting Logic Semantics of Haskell Conclusion An Executable Rewriting Logic Semantics for Concurrent Haskell Patrick Bahr s0404888@inf.tu-dresden.de Technische Universität Dresden January 11, 2008 Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  2. Introduction Rewriting Logic Semantics of Haskell Conclusion Outline Introduction 1 Motivation Preliminaries Rewriting Logic Semantics of Haskell 2 Pure Haskell Concurrent Haskell Properties of the Semantic Theory Conclusion 3 Summary Future Work Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  3. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Outline Introduction 1 Motivation Preliminaries Rewriting Logic Semantics of Haskell 2 Pure Haskell Concurrent Haskell Properties of the Semantic Theory Conclusion 3 Summary Future Work Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  4. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Why Haskell? declarative reading use as specification language program transformation to obtain efficient implementation Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  5. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Why Haskell? declarative reading use as specification language program transformation to obtain efficient implementation need for exact semantics to justify program transformations! yet: semantics of Haskell is well-studied Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  6. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Why yet another semantics? collect different aspects of the semantics in one semantic framework view the semantics from a different perspective use the semantics as input for tools to analyse the language Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  7. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Why Rewriting Logic? mature well-studied semantic framework there are rewrite semantics for many other languages implementation for rewriting logic is available remote goal: study relationship between Concurrent Haskell and Rewriting Logic Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  8. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Rewriting Logic where t , t ′ ∈ T Σ ( X ) → t ′ atomic formulae: t − in our context: t and t ′ encode program states → t ′ reads: “During the computation the program state t − changes from t to t ′ .” term are not taken as pure syntax: reasoning modulo an equational subtheory � Membership Equational Logic (MEL) : many-kinded term language atomic formulae: t = t ′ t : s “ t has sort s ” Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  9. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Membership Equational Signature Definition A membership equational signature (or MEL signature) is a triple Ω = (Σ , S , < ) , where S is a finite set of sorts, < is a strict order on S , Σ = { Σ w , k } ( w , k ) ∈ K ∗ × K is a K ∗ × K -indexed family of function symbols and K := S / ≡ < is the set of kinds induced by the equivalence closure of < . [ s ] will denote the equivalence class of s w.r.t ≡ < , i.e. its kind. Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  10. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Sorts and Kinds — Example Example S = { s 1 , s 2 , s 3 , s 4 , s 5 } — the set of sorts and < is s.t. s 2 < s 1 , s 3 < s 1 , s 5 < s 4 . s1 s1 s4 s5 s3 s2 Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  11. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Sorts and Kinds — Example Example S = { s 1 , s 2 , s 3 , s 4 , s 5 } — the set of sorts and < is s.t. s 2 < s 1 , s 3 < s 1 , s 5 < s 4 . s1 s1 s4 [s1] [s4] s5 s3 s2 � K = { [ s 1 ] , [ s 4 ] } , where [ s 1 ] = { s 1 , s 2 , s 3 } and [ s 4 ] = { s 4 , s 5 } . Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  12. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion MEL Sentences, MEL Theories Definition The following are membership equational sentences (or MEL sentences): ( ∀ X ) t = t ′ ⇐ � u i = v i ∧ � w j : s j (Equation) i ∈ I j ∈ J ( ∀ X ) t ′′ : s ⇐ � u i = v i ∧ � w j : s j (Membership) i ∈ I j ∈ J Definition A membership equational theory (or MEL theory) E is a pair (Ω , E ) where Ω is a MEL signature and E a is set of MEL sentences. Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  13. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion MEL Sentences, MEL Theories Definition The following are membership equational sentences (or MEL sentences): u i = v i w j : s j (Equation) t = t ′ ( ∀ X ) t ′′ : s ⇐ � u i = v i ∧ � w j : s j (Membership) i ∈ I j ∈ J Definition A membership equational theory (or MEL theory) E is a pair (Ω , E ) where Ω is a MEL signature and E a is set of MEL sentences. Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  14. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion MEL Sentences, MEL Theories Definition The following are membership equational sentences (or MEL sentences): u i = v i w j : s j (Equation) t = t ′ u i = v i w j : s j (Membership) t ′′ : s Definition A membership equational theory (or MEL theory) E is a pair (Ω , E ) where Ω is a MEL signature and E a is set of MEL sentences. Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  15. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion MEL Semantics in a Nutshell if t = t ′ ⇐ � i ∈ I u i = v i ∧ � j ∈ J w j : s j ∈ E and E ⊢ u i = v i and E ⊢ w j : s j hold then also E ⊢ t = t ′ . if t : s ⇐ � i ∈ I u i = v i ∧ � j ∈ J w j : s j ∈ E and E ⊢ u i = v i and E ⊢ w j : s j hold then also E ⊢ t : s . = is a congruence, sort membership is preserved by = , i.e if E ⊢ t = t ′ and E ⊢ t : s then also E ⊢ t ′ : s < means “sort” inclusion, i.e if s < s ′ and E ⊢ t : s then also E ⊢ t : s ′ Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  16. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion GRL Sentences, Generalised Rewrite Theories Definition The following is a generalised rewrite sentence (or GRL sentence): → t ′ ⇐ � → t ′ ( ∀ X ) t − u i = v i ∧ � w j : s j ∧ � t l − (Rewrite) l i ∈ I j ∈ J l ∈ L Definition A generalised rewrite theory (or GRT) is a triple R = (Ω , E , R ) where E = (Ω , E ) is a MEL theory and R is a set of GRT sentences of signature Ω . Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  17. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion GRL Sentences, Generalised Rewrite Theories Definition The following is a generalised rewrite sentence (or GRL sentence): → t ′ u i = v i w j : s j t l − l (Rewrite) → t ′ t − Definition A generalised rewrite theory (or GRT) is a triple R = (Ω , E , R ) where E = (Ω , E ) is a MEL theory and R is a set of GRT sentences of signature Ω . Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  18. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion GRL Semantics in a Nutshell → t ′ ⇐ � → t ′ if ( ∀ X ) t − u i = v i ∧ � w j : s j ∧ � t l − l ∈ R and i ∈ I j ∈ J l ∈ L → t ′ → t ′ E ⊢ u i = v i , E ⊢ w j : s j , R ⊢ t l − l then R ⊢ t − plus “nested replacement”! − → is reflexive, transitive and congruent, reasoning about − → is done modulo the MEL subtheory, i.e. if E ⊢ t = u and E ⊢ t ′ = u ′ then R ⊢ u − → u ′ implies → t ′ . R ⊢ t − Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

  19. Introduction Motivation Rewriting Logic Semantics of Haskell Preliminaries Conclusion Notation s 0 < s 1 < . . . < s n operator declaration: f : k 1 · · · k n → k or c : k f ∈ Σ k 1 ··· k n , k or c ∈ Σ ε, k � operator declaration on sorts: f : s 1 · · · s n → s or c : s as above plus membership sentence � mixfix operators: e.g. ( \ · -> · ) : Var Term → LambdaAbstraction implicit universal quantification of variables kind/sort of variables given when sort is introduced: e.g. Exp { e i } ∈ S : e i range over sort Exp ; [ e ] i range over kind [ Exp ] variables ranging over sort additional membership condition � where variable is used “otherwise” condition Patrick Bahr An Executable Rewriting Logic Semantics for Concurrent Haskell

Recommend


More recommend