adventures in impredicative semantics
play

Adventures in Impredicative Semantics Programming and Proving in - PowerPoint PPT Presentation

Adventures in Impredicative Semantics Programming and Proving in Cedille Aaron Stump Computer Science The University of Iowa 1 / 23 ? Motivation and background for Cedille 2 / 23 A little history 3 / 23 System F (Girard, Reynolds, early


  1. Adventures in Impredicative Semantics Programming and Proving in Cedille Aaron Stump Computer Science The University of Iowa 1 / 23

  2. ? Motivation and background for Cedille 2 / 23

  3. A little history 3 / 23

  4. System F (Girard, Reynolds, early 1970s) 1969 Mercury Cyclone Spoiler II

  5. System F (Girard, Reynolds, early 1970s) ▷ ∀ X ∶ ⋆ . T ▷ Raw power (impredicativity!) ▷ A little crude (no Curry-Howard) 1969 Mercury Cyclone Spoiler II 4 / 23

  6. Calculus of Constructions (Coquand, Huet 1988) 1988 Chevrolet Camaro

  7. Calculus of Constructions (Coquand, Huet 1988) ▷ Add dependent types: Π x ∶ T . T ′ ▷ Imported from Automath/Martin-L¨ of type theory ▷ Curry-Howard! ▷ No induction. [Geuvers 2001] 1988 Chevrolet Camaro 5 / 23

  8. Calculus of Inductive Constructions (Werner 1994) 1992 Hoffman-Markley Streamliner

  9. Calculus of Inductive Constructions (Werner 1994) ▷ Add primitive inductive types ▷ Finally ready for constructive mathematics! ▷ Basis for Coq 1992 Hoffman-Markley Streamliner 6 / 23

  10. But Coq ≠ CIC ▷ Coinductive types ▷ Universe hierarchy (Extended CC, Luo 1990) ▷ Proof-irrelevant universe Prop ▷ And we might want more: ▸ definitional proof irrelevance ▸ inductive-inductive types ▸ inductive-recursive types Similarly, Agda ≠ MLTT. 7 / 23

  11. Issues and limitations, Coq and Agda ▷ No formal semantics/correctness proof ▸ Despite a lot of interest: TT in TT ▷ (Hence!) bugs and surprises ▷ incompatibilities with various axioms ▷ actual contradictions! ▷ type soundness broken in Coq ▷ Commitment to a set of datatypes ▷ theory of datatypes not finished... ▷ e.g., higher-order abstract syntax prohibited 8 / 23

  12. Have we created a monster? Schaufelradbagger 258 9 / 23

  13. If I could turn back time... Good-bye to: ▷ primitive datatypes ▷ (also universe hierarchy, my bias) Hello to ▷ lambda-encodings of data 10 / 23

  14. If I could turn back time... Good-bye to: ▷ primitive datatypes ▷ (also universe hierarchy, my bias) Hello to ▷ lambda-encodings of data 10 / 23

  15. Wanted : a new type theory where ▷ inductive datatypes are derived (lambda-encoded) ▷ impredicativity is central ▷ core theory is small and verifiable Tooling goals: ▷ see all typing/inference information ▷ predictable inference ▷ elaborate to core with independent checker 11 / 23

  16. Cedille CC ∀ x ∶ T . T ′ implicit products (Miquel) ι x ∶ T . T ′ dependent intersections (Kopylov) { t ≃ t ′ } untyped equality ▷ Small theory, formal syntax and semantics ▷ Core checker implemented in < 1000loc Haskell ▷ Logically sound ▷ Turing complete(!) ▷ Supports inductive lambda-encodings 12 / 23

  17. Back the truck up 13 / 23

  18. Back the truck up Did you say lambda encodings? 13 / 23

  19. Not your forebear’s lambda encodings ▷ Usual rap: inefficient accessors ▷ Corrected by Parigot 1988 for typed encoding ▷ Perfect untyped encoding B¨ ohm et al. 1994 ▸ linear space ▸ constant-time accessors ▸ intrinsic support for iteration ▷ Cedille: perfect inductive (typed) encodings 14 / 23

  20. How are inductive datatypes defined? ▷ Several variations (CPP ’18, ITP ’18), one theme: The type of d expresses an induction principle for d ▷ For Nat: n ∶ ∀ P ∶ Nat → ⋆ . (∀ x ∶ Nat . P x → P ( S x )) → P Z → P n ▷ Essentially due to Leivant 1983 ▷ With D. Firsov, generic derivations for classes of F ∶ ⋆ → ⋆ 15 / 23

  21. What do we get from this?

  22. What do we get from this? Freedom

  23. What do we get from this? Freedom ▷ No pre-set datatype class ▷ Explore semantics of advanced datatypes ▷ Power of impredicativity ▷ So far: Functorial, Monotone, IR, II 16 / 23

  24. So which car are we? 17 / 23

  25. So which car are we?

  26. So which car are we? High-altitude type-theory exploration 17 / 23

  27. Terrestrially: Cedille 1.1 ▷ Datatype notations convenient! ▷ Cedille 1.1 adds them ▷ With elaboration to Cedille Core ▷ Histomorphic recursion ▸ subsumes nested patterns ▸ can iteratively match on pattern variable x, ▸ and then make a recursive call ▸ division (iteratively take predecessor) 18 / 23

  28. Architecture of Cedille .ced files Emacs mode Backend Ok Cedille core .cdle files Error 19 / 23

  29. 20 / 23

  30. 21 / 23

  31. 22 / 23

  32. 23 / 23

Recommend


More recommend