meyer and wand property for damas and milner s
play

Meyer and Wand property for Damas and Milners polymorphic type - PowerPoint PPT Presentation

Meyer and Wand property for Damas and Milners polymorphic type assignment system Presentation Type Theory and Coq Jelte J. Zwetsloot Radboud University Nijmegen May 15th, 2018 Jelte J. Zwetsloot (Radboud University) Meyer and Wand property


  1. Meyer and Wand property for Damas and Milner’s polymorphic type assignment system Presentation Type Theory and Coq Jelte J. Zwetsloot Radboud University Nijmegen May 15th, 2018 Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 1 / 17

  2. Contents Damas and Milner’s polymorphic type assignment system (DM) 1 Types and contexts Typing rules DM+cont Call-by-Name Type Transform for DM 2 Meyer-Wand typing property for DM 3 Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 2 / 17

  3. Terms and values for call-by-name untyped terms e ::= x | λ x . e | e 1 e 2 | let x be e 1 in e 2 callcc | throw n ::= λ x . e | callcc | throw untyped values Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 3 / 17

  4. Call-by-Name CPS Transform | n | cbn = λ k . k || n || cbn | x | cbn = x λ k . | e 1 | cbn ( λ k ′ . k ′ | e 2 | cbn k ) | e 1 e 2 | cbn = | let x be e 1 in e 2 | cbn = λ k . let x be | e 1 | cbn in ( | e 2 | cbn k ) || λ x . e || cbn = λ x . | e | cbn λ f .λ k . f ( λ f ′ . f ′ ( λ l . lk ) k ) || callcc || cbn = λ c .λ k . k ( λ x .λ l . c ( λ c ′ . x ( λ x ′ . c ′ x ′ ))) || throw || cbn = Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 4 / 17

  5. Damas and Milner’s polymorphic type assignment system (DM) Types and contexts DM types and contexts mono-types τ ::= t | b | τ 1 → τ 2 poly-types σ ::= τ | ∀ t .σ contexts Γ ::= • | Γ , x : σ Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 5 / 17

  6. Damas and Milner’s polymorphic type assignment system (DM) Typing rules λ → typing rules Γ , x : τ 1 ⊢ e : τ 2 Γ ⊢ x : Γ( x ) (VAR) (ABS) Γ ⊢ λ x . e : τ 1 → τ 2 Γ ⊢ e 1 : τ 1 → τ 2 Γ ⊢ e 2 : τ 1 (APP) Γ ⊢ e 1 e 2 : τ 2 Γ ⊢ e 1 : τ 1 Γ , x : τ 1 ⊢ e 2 : τ 2 (MONO-LET) Γ ⊢ let x be e 1 in e 2 : τ 2 Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 6 / 17

  7. Damas and Milner’s polymorphic type assignment system (DM) Typing rules Additional DM typing rules Γ ⊢ e : ∀ t .σ Γ ⊢ e : σ (INST) (t / ∈ FTV (Γ)) , ( GEN ) Γ ⊢ e : [ τ/ t ] σ Γ ⊢ e : ∀ t .σ Γ ⊢ e 1 : σ Γ , x : σ ⊢ e 2 : τ (x / ∈ dom(Γ)) , ( POLY − LET ) Γ ⊢ let x be e 1 in e 2 : τ Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 7 / 17

  8. Damas and Milner’s polymorphic type assignment system (DM) DM+cont DM+ cont typing rules DM is extended to DM + cont by adding the type expression τ cont, and by adding the following typing rules: Γ ⊢ callcc : σ callcc (CALLCC’) Γ ⊢ throw : σ throw (THROW’) where σ callcc = ∀ t . ( t cont → t ) → t and σ throw = ∀ s . ∀ t . s cont → s → t . Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 8 / 17

  9. Call-by-Name Type Transform for DM Call-by-Name Type Transform for DM | τ | cbn = ( || τ || cbn → α ) → α |∀ t .σ | cbn = ∀ t . | σ | cbn || t || cbn = t || b || cbn = b || τ 1 → τ 2 || cbn = | τ 1 | cbn → | τ 2 | cbn ||∀ t .σ || cbn = ∀ t . || σ || cbn Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 9 / 17

  10. Call-by-Name Type Transform for DM Call-by-Name Type Transform for contexts | Γ | cbn ( x ) = | Γ( x ) | cbn for each x ∈ dom(Γ) Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 10 / 17

  11. Call-by-Name Type Transform for DM Clarity | − | cbn = | − | || − || cbn = || − || Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 11 / 17

  12. Call-by-Name Type Transform for DM Substitution rules Lemma: || [ τ/ t ] σ || = [ || τ || / t ] || σ || | [ τ/ t ] σ | = [ || τ || / t ] | σ | Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 12 / 17

  13. Call-by-Name Type Transform for DM Substitution rules: proof Lemma: || [ τ/ t ] σ || = [ || τ || / t ] || σ || | [ τ/ t ] σ | = [ || τ || / t ] | σ | Proof: by induction on structure of σ . Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 13 / 17

  14. Meyer-Wand typing property for DM Meyer-Wand property for DM Theorem: 1. If Γ ⊢ n : σ holds in DM , then | Γ | ⊢ || n || : || σ || holds in DM 2. If Γ ⊢ e : σ holds in DM , then | Γ | ⊢ | e | : | σ | holds in DM Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 14 / 17

  15. Meyer-Wand typing property for DM Meyer-Wand property for DM: proof Theorem: 1. If Γ ⊢ n : σ holds in DM , then | Γ | ⊢ || n || : || σ || holds in DM 2. If Γ ⊢ e : σ holds in DM , then | Γ | ⊢ | e | : | σ | holds in DM Proof by induction on the structure of typing derivations Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 15 / 17

  16. Meyer-Wand typing property for DM Extension to DM+ cont Extend DM to DM + cont by defining || τ cont || = || τ || → α Then verify || callcc || : || σ callcc || || throw || : || σ throw || Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 16 / 17

  17. Meyer-Wand typing property for DM Thank you for your attention Jelte J. Zwetsloot (Radboud University) Meyer and Wand property for DM May 15th, 2018 17 / 17

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