autosubst 2 towards reasoning with multi sorted de bruijn
play

Autosubst 2: Towards Reasoning with Multi-Sorted de Bruijn Terms - PowerPoint PPT Presentation

Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Autosubst 2: Towards Reasoning with Multi-Sorted de Bruijn Terms and Vector Substitutions Jonas Kaiser, Steven Schfer, Kathrin Stark saarland


  1. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Autosubst 2: Towards Reasoning with Multi-Sorted de Bruijn Terms and Vector Substitutions Jonas Kaiser, Steven Schäfer, Kathrin Stark saarland university computer science September 08, 2017 K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 1 / 21

  2. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Our Motivation ◮ Formalising the metatheory of programming languages and logical systems with binders, ◮ e.g. call-by-value System F (F CBV ): A , B ∈ ty ::= X | A → B | ∀ X . A Types s , t ∈ tm ::= s t | s A | v Terms u , v ∈ vl ::= x | λ ( x : A ) . s | Λ X . s Values ◮ Formalising proofs as weak normalisation ◮ progress and preservation of type systems ◮ K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 2 / 21

  3. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Goal: Weak Normalisation via Logical Relations Theorem ( Weak Normalisation) ⊢ s : A → ∃ v . s ⇓ v ◮ Substitution and substitution lemmas of the form s [ σ ] = t [ τ ] arise everywhere! ◮ In the definition of ⊢ s : A and s ⇓ v ◮ In the definition of term / value interpretations ◮ In the proofs that syntactic typing implies semantic typing ◮ This requires most lines of code: Weak Normalisation Goal: Automate this! Typing/Eval Substitution Substitution lemmas K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 3 / 21

  4. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Related Work ◮ Benchmarks: POPLMARK challenge [Aydemir et al. 2005] , POPLMark Reloaded [Abel/Momigliano/Pientka 2017] . . . ◮ Representation techniques: de Bruijn [de Bruijn 1972] , locally nameless [Aydemir et al. 2008] , nominal logic [Pitts 2001] , higher order abstract syntax (HOAS) [Pfenning/Elliot 1988] , . . . ◮ Proof assistants: Abella [Baelde et al. 2014] , Beluga [Pienta/Cave 2015] , . . . K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 4 / 21

  5. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Binders in Coq ◮ Large user base, mature system ◮ Dependent types ◮ No native support for nominal binders/HOAS [Pfenning/Elliot ’88] e g n e l l a h c r n e e K 1 t m G o R B t a n T s A K D b M u & a , s d n L a b e o y b e t i l P t d o e L m G u O r M B e e N A a e P L D G N L L 2005 2010 2015 � locally nameless � single-point de Bruijn � parallel de Bruijn σ = x �→ v σ = 0 �→ v 0 , 1 �→ v 1 , . . . K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 5 / 21

  6. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Autosubst 1 [Schäfer/Smolka/Tebbi ’15] – A Library à la de Bruijn [de Bruijn ’72] ◮ Goal: Given an annotated inductive type, automates the generation of substitution and substitution lemmas ◮ Variable representation à la [de Bruijn ’72] A , B ∈ ty ::= X ∈ N | A → B | ∀ . A ◮ Parallel substitutions s [ σ ] à la [de Bruijn ’72] ◮ Equational theory à la σ -calculus [Abadi et al ’91] ◮ Substitution is broken down into primitives, e.g. A · σ, ↑ , σ ◦ τ . . . ◮ Decidable, sound, complete rewriting system for UTLC [Schäfer/Smolka/Tebbi ’15] Weak Normalisation Autosubst 1? Typing/Eval Substitution Substitution lemmas K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 6 / 21

  7. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Autosubst 1 [Schäfer/Smolka/Tebbi ’15] – A Library à la de Bruijn [de Bruijn ’72] Autosubst 1 was used for: ◮ Several case studies: Strong normalisation to the metatheory of Martin-Löf type theory [Schäfer/Smolka/Tebbi ’15] ◮ Interactive proofs in higher-order concurrent separation logic [Krebbers et al. ’17] ◮ Equivalence proofs of alternative syntactic presentations of System F [Kaiser et al. ’17] ◮ Formalisations of logical relations for F µ [Timany et al. ’17] ◮ Formalisation of CPS translations for UTLC [Pottier ’17] Weak Normalisation Autosubst 1? Typing/Eval Substitution Substitution lemmas K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 6 / 21

  8. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Autosubst 1 Cannot Handle F CBV A , B ∈ ty ::= X | A → B | ∀ X . A Types s , t ∈ tm ::= s t | s A | v Terms u , v ∈ vl ::= x | λ ( x : A ) . s | Λ X . s Values ◮ Enforces variables for each sort with substitutions ◮ Ad-hoc handling of heterogeneous substitutions ◮ Values require type and value variables ◮ AS1: One instantiation operation per sort ◮ Problem: How do they interfere? s [ τ ] vl [ σ ] ty = s [ σ ] ty [ λ x . ( σ x )[ τ ] ty ] vl K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 7 / 21

  9. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Contributions of Autosubst 2 second order HOAS specification ◮ Handle mutually inductive sorts 1. Extend the input language Autosubst 2 to second order HOAS 2. More uniform handling of heterogeneous substitutions Parallelise! ◮ parallel vector substitution + substitution lemmas s [ σ ty , σ vl ] + decision procedure K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 8 / 21

  10. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work From HOAS to de Bruijn for F CBV ty, tm, vl : Type Inductive ty : Type := | var_ty : index → ty arr : ty → ty → ty | arr : ty → ty → ty all : (ty → ty) → ty | all : ty → ty. Inductive tm : Type := app : tm → tm → tm | app : tm → tm → tm tapp: tm → ty → tm | tapp : tm → ty → tm : vl → tm | vt : vl → tm vt with vl : Type := | var_vl : index → vl lam : ty → (vl → tm) → vl | lam : ty → tm → vl tlam: (ty → tm) → vl | tlam : tm → vl. 1. Which sorts depend on each other? 2. Which sorts require variable constructors? 3. What are the components of the substitution vectors? K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 9 / 21

  11. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Dependency Graph for F CBV ty, tm, vl : Type arr : ty → ty → ty 1. Which sorts depend on each other? all : (ty → ty) → ty 2. Which sorts require variable constructors (*)? app : tm → tm → tm 3. What are the components of the tapp: tm → ty → tm substitution vectors? : vl → tm vt lam : ty → (vl → tm) → vl tlam: (ty → tm) → vl ty ∗ [ty] vl ∗ [ty,vl] tm[ty,vl] K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 10 / 21

  12. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Contributions of Autosubst 2 second order HOAS specification ◮ Handle mutually inductive sorts 1. Extend the input language Autosubst 2 to second order HOAS 2. More uniform handling of heterogeneous substitutions Parallelise! ◮ parallel vector substitution + substitution lemmas s [ σ ty , σ vl ] + decision procedure K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 11 / 21

  13. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Towards Vector Substitutions ty ∗ [ty] tm[ty,vl] vl ∗ [ty,vl] x [ σ, τ ] = τ x ◮ Traverses values ( λ A . s )[ σ, τ ] = λ A [ σ ] . s [ ⇑ vl tm ( σ, τ )] ◮ homomorphically (Λ . s )[ σ, τ ] = Λ . s [ ⇑ ty tm ( σ, τ )] ◮ mutually recursive ◮ with the inferred vector ◮ Take care of: ⇑ vl tm ( σ, τ ) = ( σ, 0 vl · τ ◦ ( id ty , ↑ )) ◮ Projections ⇑ ty tm ( σ, τ ) = ( 0 ty · σ ◦ ↑ , τ ◦ ( ↑ , id vl )) ◮ Castings ◮ Traversals of binders K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 12 / 21

  14. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Towards an Equational Theory of Vector Substitutions Given Extended (vector) primitives A · σ , σ ◦ ( σ ′ , τ ′ ) , . . . Goal Extend the σ -calculus to multi-sorted syntax K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 13 / 21

  15. Introduction Towards Autosubst 2 Interpreting HOAS Vector Substitutions Case Study Future Work Example: Adapt the Equations From Single-sorted to Multi-sorted 1. Defining equations of instantiation 2. Interaction between lift and cons, e.g. ↑ ◦ ( s · σ ) ≡ σ 3. Monoid action laws, e.g. A [ id ty ] = A s [ id ty , id vl ] = s id ty ◦ σ ≡ σ id ty ◦ ( σ, τ ) ≡ σ id vl ◦ ( σ, τ ) ≡ τ A [ σ ][ σ ′ ] = A [ σ ◦ σ ′ ] s [ σ, τ ][ σ ′ , τ ′ ] = s [ σ ◦ σ ′ , τ ◦ ( σ ′ , τ ′ )] K. Stark, Saarland University Towards Autosubst 2: Vector Substitutions 14 / 21

Recommend


More recommend