identity types and type setups
play

Identity Types and Type Setups Uppsala, February 18th, 2009 - PowerPoint PPT Presentation

Identity Types and Type Setups Uppsala, February 18th, 2009 Stockholm-Uppsala Logic Seminar and Gothenberg, February 19th, 2009 . Peter Aczel petera@cs.man.ac.uk SCAS and Manchester University Part I: Identity Types Part II: Type Setups


  1. Identity Types and Type Setups Uppsala, February 18th, 2009 Stockholm-Uppsala Logic Seminar and Gothenberg, February 19th, 2009 . Peter Aczel petera@cs.man.ac.uk SCAS and Manchester University Part I: Identity Types Part II: Type Setups Identity Types and Type Setups – p.1/42

  2. Some References: [1] Homotopy Theoretic Models of Identity Types , Steve Awodey and Michael A. Warren [2] The Identity Type Weak Factorisation System , Nicola Gambino and Richard Garner [3] Two-dimensional Models of Type Theory , Richard Garner [1] Nice categories with weak factorisation systems can be used to model type theories with identity types. [2] The category C ( T ) of contexts of a type theory T with identity types has a natural weak factorisation system. [3] A type theory with identity types has identity contexts. The result in [3] is exploited in [2]. Identity Types and Type Setups – p.2/42

  3. Weak Factorisation Systems A map g : C → D has the right lifting property with respect to f : A → B , written f ∩ | g if, whenever given maps A → C and B → D such that A → C → D = A → B → D then there is a diagonal filler B → C ; i.e. A → B → C = A → C and B → C → D = B → D. Given a set M of maps let M ∩ | = { g | ∀ f ∈ M f ∩ | g } ∩ | M = { f | ∀ g ∈ M f ∩ | g } ( A , B ) is a weak factorisation system if 1. every map A → B has a factorisation A → Y → B with A → Y in A and Y → B in B , and | = B and A = ∩ 2. A ∩ | B . Identity Types and Type Setups – p.3/42

  4. Theorem of Gambino and Garner Let T be the set of context projections Γ , ∆ → Γ in the category of contexts of a type theory T . | . Let A = ∩ | T and B = A ∩ Assume that T has identity types. Theorem: ( A , B ) is a weak factorization system. Main Lemma: Every context map Γ ′ → Γ has a factorization Γ ′ → (Γ , ∆) → Γ where Γ ′ → (Γ , ∆) is in ∩ | T and (Γ , ∆) → Γ is in T . Identity Types and Type Setups – p.4/42

  5. Part I: Identity Types Identity Propositions Identity types with Π and Σ types Avoiding Π types Also avoiding Σ types Identity Types and Type Setups – p.5/42

  6. Identity Propositions Identity Types and Type Setups – p.6/42

  7. [ a = b ] ⇐ ⇒ ∀ P [ P ( a ) ⇔ P ( b )] Liebnitz Identity: It suffices to assume: [ a = b ] ⇐ ⇒ ∀ P [ P ( a ) ⇒ P ( b )] . ∀ P [ P ( a ) ⇒ P ( b )] P ′ ( x ) ≡ [ P ( x ) ⇒ P ( a )] P ′ ( a ) ⇒ P ′ ( b ) P ′ ( a ) P ′ ( b ) P ( b ) ⇒ P ( a ) P ( a ) ⇔ P ( b ) ∀ P [ P ( a ) ⇔ P ( b )] Identity Types and Type Setups – p.7/42

  8. Singleton Class Definition Impredicative: b ∈ I a , [ a = b ] ⇐ ⇒ where � I a = { X | a ∈ X } . Inductive: I a is the smallest class X such that a ∈ X. Identity Types and Type Setups – p.8/42

  9. Reflexive Relations Definition ∀ R [ R reflexive ⇒ ( a, b ) ∈ R ] . [ a = A b ] ⇐ ⇒ Impredicative: The identity relation I A = { ( x, x ) | x ∈ A } on a class A is the intersection of all reflexive relations on A . Inductive: I A is the smallest reflexive relation on A ; i.e. the smallest relation R on A such that ∀ x ∈ A ( x, x ) ∈ R. Identity Types and Type Setups – p.9/42

  10. Adjoint characterisations of = A Reflexive Relations: [ x = A y ] ⊢ x,y Q ( x, y ) ⊢ x Q ( x, x ) Singleton Class: [ a = A y ] ⊢ y P ( y ) ( a ∈ A ) ⊢ P ( a ) Identity Types and Type Setups – p.10/42

  11. Type Theoretical Logical Rules,1 Singleton Class: For a : A [ a = A y ] prop ( y : A ) [ a = A a ] true D ( y ) prop ( y : A, [ a = A y ] true ) D ( a ) true D ( y ) true ( y : A, [ a = A y ] true ) Identity Types and Type Setups – p.11/42

  12. Type Theoretical Logical Rules,2 Reflexive Relations: [ x = A y ] prop ( x, y : A ) [ x = A x ] true ( x : A ) C ( x, y ) prop ( x, y : A, [ x = A y ] true ) C ( x, x ) true ( x : A ) C ( x, y ) true ( x, y : A, [ x = A y ] true ) Identity Types and Type Setups – p.12/42

  13. Identity Types with Π and Σ types Identity Types and Type Setups – p.13/42

  14. Identity Types,1: Given A type : Formation: I A ( x, y ) type ( x, y : A ) Introduction: r A ( x ) : I A ( x, x ) ( x : A ) Elimination/Computation C ( x, y, z ) type ( x, y : A, z : I A ( x, y )) d ( x ) : C ( x, x, r A ( x )) ( x : A ) J d ( x, y, z ) : C ( x, y, z ) ( x, y : A, z : I A ( x, y )) J d ( x, x, r A ( x )) = d ( x ) : C ( x, x, r A ( x )) ( x : A ) These are the standard rules for Identity types. Identity Types and Type Setups – p.14/42

  15. Identity Types,2: Given a : A : Formation: I a ( y ) type ( y : A ) Introduction: r a : I a ( a ) Elimination/Computation D ( y, z ) type ( y : A, z : I a ( y )) e : D ( a, r a ) J ′ a,e ( y, z ) : D ( y, z ) ( y : A, z : I a ( y )) J ′ a,e ( a, r a ) = e : D ( a, r a ) These rules are due to Christine Paulin-Mohring. Identity Types and Type Setups – p.15/42

  16. J versus J ′ It is easy to define J using J ′ . But it is not so easy to define J ′ using J . Martin Hoffman showed that this could be done. A construction is presented as an appendum in Thomas Streicher’s Habilitation Thesis. But it is almost unreadable because of the awful syntax used. The construction uses Π -types and Σ -types. But by using a parametric strengthening of the J -rule, due to Richard Garner, Π -types can be avoided and, by using ideas also due to Garner, and more work Σ -types can also be avoided. The following is essentially Hofmann’s construction. Identity Types and Type Setups – p.16/42

  17. Definition of J ′ using J , 1: Given I A and a : A : Step 1: Define, for x, y : A, z : I A ( x, y ) , I a ( y ) ≡ I A ( a, y ) r a ≡ r A ( a ) ≡ (Σ x ′ : A ) I A ( x, x ′ ) A 0 ( x ) C ( x, y, z ) ≡ I A 0 ( x ) ( < x, r A ( x ) >, < y, z > ) d ( x ) ≡ r A 0 ( x ) ( < x, r A ( x ) > ) : C ( x, x, r A ( x )) Use the J rule with C, d to define f ( x, y, z ) ≡ J d ( x, y, z ) : C ( x, y, z ) such that f ( x, x, r A ( x )) = d ( x ) : C ( x, x, r A ( x )) . Identity Types and Type Setups – p.17/42

  18. Definition of J ′ using J , 2: Given also D ( y, z ) type ( y : A, z : I a ( y )) : Step 2: Define A 1 ≡ A 0 ( a ) and, for x 1 , y 1 : A 1 , z 1 : I A 1 ( x 1 , y 1 ) , B 1 ( x 1 ) ≡ D ( π 1 ( x 1 ) , π 2 ( x 1 )) C 1 ( x 1 , y 1 , z 1 ) ≡ B 1 ( x 1 ) → B 1 ( y 1 ) d 1 ( x 1 ) ≡ ( λu : B 1 ( x 1 )) u : C 1 ( x 1 , x 1 , r A 1 ( x 1 ) Use the J rule with C 1 , d 1 to define g ( x 1 , y 1 , z 1 ) ≡ J d ( x 1 , y 1 , z 1 ) : C 1 ( x, y, z ) such that g ( x 1 , x 1 , r A 1 ( x 1 )) = d 1 ( x 1 ) : C 1 ( x 1 , x 1 , r A 1 ) . Identity Types and Type Setups – p.18/42

  19. Definition of J ′ using J , 3: Given a, D as before and e : D ( a, r a ) : Step 3: Define, for y : A, z : I a ( y ) , a 1 ≡ < a, r a > : A 1 J ′ a,e ( y, z ) ≡ app ( g ( a 1 , < y, z >, f ( a, y, z )) , e ) : D ( y, z ) Then J ′ a,e ( a, r a ) = app ( g ( a 1 , a 1 , f ( a, a, r a )) , e ) = app ( g ( a 1 , a 1 , r A 1 ( a 1 )) , e ) = app (( λu : B 1 ( a )) u, e ) = e : D ( a, r a ) . Identity Types and Type Setups – p.19/42

  20. Avoiding Π types Identity Types and Type Setups – p.20/42

  21. The parametric J -rule: For x, y : A, z : I A ( x, y ) , u : � C ( x, y, z,� u ) type ( � E ( x, y, z ))) u : � d ( x,� u ) : C ( x, x, r A ( x ) ,� u ) ( � E ( x, x, r A ( x ))) u : � J d ( x, y, z,� u ) : C ( x, y, z,� u ) ( � E ( x, y, z )) u : � J d ( x, x, r A ( x ) ,� u ) = d ( x,� u ) : C ( x, x, r A ( x ) ,� u )) ( � E ( x, x, r A ( x ))) u : � E ( x, y, z ) is the context of parameters relative to the � declarations of x, y, z . u : � � E ( x, x, r A ( x )) is the resulting context of parameters rela- tive to the declaration of x after substituting x for y and r A ( x ) for z . Identity Types and Type Setups – p.21/42

  22. The parametric substitution rule: u : � For x, y : A, z : I A ( x, y ) ,� E ( x ) , B ( x,� u ) type u, v ) : B ( y, � sub ( x, y, z,� sub ( x, y, z,� u )) ( v : B ( x,� u )) sub ( x, x, r A ( x ) ,� u, v ) = v : B ( x,� u ) ( v : B ( x,� u )) u ≡ u 1 , . . . , u n then � u ) ≡ u ′ 1 , . . . , u ′ where, if � sub ( x, y, z,� n with u ′ i ≡ sub ( x, y, z, u ′ 1 , . . . , u ′ i − 1 , u i ) ( i = 1 , . . . , n ) . This can be derived using the parametric J -rule with u, v ) ≡ B ( y, � u )) and d ( x,� u, v ) ≡ v . C ( x, y, z,� sub ( x, y, z,� Identity Types and Type Setups – p.22/42

  23. Definition of J ′ using the parametric J -rule The aim here is to avoid Π -types by using the parametric J -rule. As in the earlier Step 1, we can use the J -rule to define, for x, y : A, z : I A ( x, y ) , f ( x, y, z ) : I A 0 ( x ) ( x 1 , < y, z > ) , where A 0 ( x ) ≡ (Σ x ′ : A ) I A ( x, x ′ ) and x 1 ≡ < x, r A ( x ) > , such that f ( x, x, r A ( x )) = r A 0 ( x ) ( x 1 ) . Given a, D, e we can now use substitution (without parameters) to define, for y : A, x : I A ( a, y ) , J ′ a,e ( y, z ) ≡ sub ( < a, r A ( a ) >, < y, z >, f ( a, y, z ) , e ) : D ( y, z ) . We have still used Σ -types, which we want to avoid. Identity Types and Type Setups – p.23/42

  24. Also avoiding Σ types Identity Types and Type Setups – p.24/42

Recommend


More recommend