a cubical type theory
play

A Cubical Type Theory Simon Huber (j.w.w. Cyril Cohen, Thierry - PowerPoint PPT Presentation

A Cubical Type Theory Simon Huber (j.w.w. Cyril Cohen, Thierry Coquand, Anders M ortberg) University of Gothenburg HoTT/UF 2015 Warsaw, June 29, 2015 Cubical Type Theory: Overview Type theory where we can directly argue about n


  1. A Cubical Type Theory Simon Huber (j.w.w. Cyril Cohen, Thierry Coquand, Anders M¨ ortberg) University of Gothenburg HoTT/UF 2015 Warsaw, June 29, 2015

  2. Cubical Type Theory: Overview ◮ Type theory where we can directly argue about n -dimensional cubes (points, lines, squares, cubes, . . . .). ◮ Based on a constructive model of type theory in cubical sets with connections and diagonals. ◮ Id, Π, Σ, data types, U ◮ The Univalence Axiom and function extensionality are provable. ◮ But: usual definitional equality for J only propositional! Problem in our previous approach recently pointed out by Dan Licata.

  3. ◮ Not having definitional equalities for J does not seem to be a problem (N.A. Danielsson) ◮ Other definitional equalities, e.g., ap : ( f : A → B ) → Id A a b → Id B ( f a ) ( f b ) ap f (refl A a ) = refl B ( f a ) ap ( g ◦ f ) p = ap g ( ap f p ) ap id p = p ◮ Some higher inductive types with “good” definitional equalities

  4. Implementation: Cubicaltt Prototype proof-assistant implemented in Haskell. Based on: “A simple type-theoretic language: Mini-TT”, T. Coquand, Y. Kinoshita, B. Nordstr¨ om, M. Takeya (2008). Mini-TT is a variant of Martin-L¨ of type theory with data types. Cubicaltt extends Mini-TT with: ◮ name abstraction and application ◮ identity types ◮ composition ◮ equivalences can be transformed into equalities (glueing) ◮ some higher inductive types (experimental) Try it: https://github.com/mortberg/cubicaltt

  5. Basic Idea Expressions may depend on names i , j , k , . . . . E.g., x : A , i : I , y : B ( i , x ) ⊢ u ( x , i ) : C ( x , i , y ) is a line connecting the two points x : A , y : B (0 , x ) ⊢ u ( x , 0) : C ( x , 0 , y ) x : A , y : B (1 , x ) ⊢ u ( x , 1) : C ( x , 1 , y ) Each line i : I ⊢ t ( i ) : A gives an equality ⊢ � i � t ( i ) : Id A t (0) t (1)

  6. The Interval I ◮ Given by ϕ, ψ ::= 0 | 1 | i | 1 − i | ϕ ∧ ψ | ϕ ∨ ψ (formulas) ◮ i ranges over names or symbols ◮ Intuition: i an element of [0 , 1], ∧ is min, and ∨ is max. ◮ Equality is the equality in the free bounded distributive lattice with generators i , 1 − i . ◮ De Morgan algebra via 1 − 0 = 1 1 − ( ϕ ∧ ψ ) = (1 − ϕ ) ∨ (1 − ψ ) 1 − 1 = 0 1 − ( ϕ ∨ ψ ) = (1 − ϕ ) ∧ (1 − ψ ) 1 − (1 − i ) = i NB: i ∧ (1 − i ) � = 0 and i ∨ (1 − i ) � = 1!

  7. Overview of the Syntax (w/o Universe) A , B , P , t , u , v ::= x variables | ( x : A ) → B | λ x : A . t | t u Π-types | ( x : A ) × B | ( t , u ) | t . 1 | t . 2 Σ-types | ID A B | IdP P a b identity types | � i � t name abstraction | t ϕ formula application | comp P u � composition u u | ( a ,� | glue A � t ) | unGlue A � u v glueing | . . . data types

  8. Contexts and Substitutions Contexts Γ ⊢ A Γ ⊢ () ⊢ Γ , x : A ⊢ Γ , i : I ⊢ Substitutions are as usual but we also allow to assign a formula to a name: σ : ∆ → Γ ∆ ⊢ ϕ : I ( σ, i = ϕ ): ∆ → Γ , i : I

  9. Face Operations Certain substitutions correspond to face operations. E.g.: ( x = x , i = 0 , y = y ): ( x : A , y : B ( i = 0)) → ( x : A , i : I , y : B ) In general a face operation are α : Γ α → Γ setting some names to 0 or 1 and otherwise the identity. Faces are determined by all the assignments i = b , b ∈ { 0 , 1 } ; write α = ( i 1 b 1 ) . . . ( i n b n ) (Special case: α = id )

  10. Basic Typing Rules Γ ⊢ Γ ⊢ ( x : A in Γ) ( i : I in Γ) Γ ⊢ x : A Γ ⊢ i : I Γ , x : A ⊢ B Γ , x : A ⊢ t : B Γ ⊢ ( x : A ) → B Γ ⊢ λ x : A . t : ( x : A ) → B Γ ⊢ t : ( x : A ) → B Γ ⊢ u : A Γ ⊢ t u : B ( x = u ) Also: Sigma types and data types . . .

  11. Equality between types Γ ⊢ A Γ ⊢ B Γ , i : I ⊢ A Γ ⊢ ID A B Γ ⊢ � i � A : ID A ( i 0) A ( i 1) Γ ⊢ P : ID A B Γ ⊢ ϕ : I ( � i � A ) ϕ = A ( i ϕ ) � i � Pi = P Γ ⊢ P ϕ Γ ⊢ P : ID A B Γ ⊢ P : ID A B Γ ⊢ P 0 = A Γ ⊢ P 1 = B

  12. Heterogeneous Identity Types Γ ⊢ P : ID A B Γ ⊢ a : A Γ ⊢ b : B Γ ⊢ IdP P a b Γ , i : I ⊢ t : A Γ ⊢ � i � t : IdP( � i � A ) t ( i 0) t ( i 1) Γ ⊢ e : IdP P a b Γ ⊢ ϕ : I ( � i � t ) ϕ = t ( i ϕ ) � i � ei = e Γ ⊢ e ϕ : P ϕ Γ ⊢ e : IdP P a b Γ ⊢ e : IdP P a b Γ ⊢ e 0 = a : P 0 Γ ⊢ e 1 = b : P 1

  13. Identity Types We set Id A a b := IdP ( � i � A ) a b This is enough to justify reflexivity, symmetry, function extensionality, and that singletons are contractible! In the implementation: ◮ universe U with U : U ◮ ID A B is Id U A B

  14. Demo!

  15. Kan Operations Given i : I ⊢ A we want an equivalence between A ( i 0) and A ( i 1). Require additional composition operations. Refinement of Kan’s extension condition (1955) “Any open box can be filled”

  16. Systems A system � u = [ α �→ u α ] for Γ ⊢ A is given by a family of compatible terms Γ α ⊢ u α : A α ( α ranging over a set of faces L , L downwards closed)

  17. Systems For a system � u Γ α ⊢ u α : A α ( α ∈ L ) and substitution σ : ∆ → Γ we get a system ∆ β ⊢ ( � u σ ) β : A σβ ( β ∈ L σ ) Satisfying: ( � u α ) id = u α for α ∈ L

  18. Composition Γ ⊢ P : ID A B Γ ⊢ a : A Γ α ⊢ p α : IdP P α a α u α ( α ∈ L ) Γ ⊢ comp P a � p : B (comp P a � p ) σ = comp P σ a σ � p σ comp P a � p = p id 1 if id ∈ L So: (comp P a � p ) α = p α 1 if α ∈ L

  19. Kan Filling Γ ⊢ P : ID A B Γ ⊢ a : A Γ α ⊢ p α : IdP P α a α u α ( α ∈ L ) Γ ⊢ fill P a � p : IdP P a (comp P a � p ) Can be reduced to composition using connections: fill P a � p = � i � comp ( � j � P ( i ∧ j )) a [ α �→ � j � p α ( i ∧ j ) , ( i 0) �→ � j � a ] Special case: path lifting property ( � p = [ ])

  20. Demo!

  21. Composition comp ( � i � A ) a � p is defined by induction on the type A : ◮ Case i : I ⊢ A = Id B b 0 b 1 . comp ( � i � A ) a � p = � i � comp ( � i � B ) ( ai ) [ α �→ p α i , ( i 0) �→ b 0 , ( i 1) �→ b 1 ] ◮ Case i : I ⊢ A = ( x : B ) → C . For b 1 : B ( i 1) comp ( � i � A ) f � g b 1 = comp ( � i � C ( x = b )) ( f b 0 ) ( � g b ) with b = fill − ( � i � B ) b 1 [ ] and b 0 = b 0 : B ( i 0).

  22. Glue Given a system of equivalences on a type we introduce a new type: Γ ⊢ A Γ α ⊢ f α : Equiv T α A α ( α ∈ L ) Γ ⊢ glue A � f Γ ⊢ a : A Γ α ⊢ t α : T α Γ α ⊢ f α t α = a α : A α t ) : glue A � Γ ⊢ ( a ,� f (glue A � f ) σ = glue A σ � ( a ,� t ) σ = ( a σ,� f σ t σ ) glue A � ( a ,� f = T id t ) = t id if id ∈ L

  23. Composition in a Universe We also can define composition for glue A � f . If we have a universe U, we can reduce composition in U to glue. Any path P : Id U A B induces an equivalence P + : Equiv A B whose function part is given by: a : A ⊢ comp P a [ ] : B

  24. Univalence Axiom Using glue we can also prove the Univalence Axiom! Demo!

  25. Further Work ◮ Formal correctness proof of model and implementation ◮ Proof of canonicity for the type system ◮ Definitional equality for J? ◮ Related work: Brunerie/Licata, Polonsky, Altenkirch/Kaposi, Bernardy/Coquand/Moulin

  26. Thank you!

Recommend


More recommend