the groupoid interpretation of type theory a personal
play

The Groupoid Interpretation of Type Theory, a Personal Retrospective - PowerPoint PPT Presentation

The Groupoid Interpretation of Type Theory, a Personal Retrospective Martin Hofmann LMU Munich TLCA, Warsaw, 3rd July 2015 mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 1 / 38 Prehistory Got to know type theory through the proof


  1. The Groupoid Interpretation of Type Theory, a Personal Retrospective Martin Hofmann LMU Munich TLCA, Warsaw, 3rd July 2015 mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 1 / 38

  2. Prehistory Got to know type theory through the proof assistant LEGO in ∼ 1990 in a workshop organized by Terry Stroup in Hetzelsdorf, .de. Among the attendants: Randy Pollack, Benjamin Pierce, Thorsten Altenkirch, . . . hetz.jpg beer.jpeg Became fascinated by machine-checked proof, but also annoyed by lack of “extensional concepts” and intrigued by type dependency and intensionality. mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 2 / 38

  3. Dependent types Propositions as types for predicate logic. Curry-Howard: a proof of ϕ ∧ ψ is a pair comprising a proof of ϕ and a proof of ψ . A proof of ϕ → ψ is a function mapping proofs of ϕ to proofs of ψ . A proposition is (induces, corresponds to,. . . ) the type (set) of its proofs Generalising to predicates: a proof of ∀ x : A .ϕ ( x ) is a dependent function mapping an element v ∈ A to an element (=proof) of ϕ ( v ). We write the type of such dependent functions as Π x : A .ϕ ( x ). a proof of ∃ x : A .ϕ ( x ) is a dependent pair ( v , p ) consisting of an element v ∈ A and an element (=proof) p of ϕ ( v ). We write the type of such dependent functions as Σ x : A .ϕ ( x ). mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 3 / 38

  4. To formalise this, we need families of types depending on values: dependent types. Other examples of dependent types: vectors, matrices, arrays, universes, . . . . So far (a formal system of dependent types including Π , Σ) this existed before Martin-L¨ of: de Bruijn’s Automath. mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 4 / 38

  5. Martin-L¨ of type theory Martin-L¨ of augments basic system of dependent types with inductively defined types : natural numbers, lists, trees, well-orderings, . . . . . . and an inductive definition of equality: the identity type: For each type A a dependent type Id A ( x , y ) where x , y ∈ A representing equality of x and y mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 5 / 38

  6. Reflexivity: a dependent function refl A : Π x : A . Id A ( x , x ) An induction principle asserting that this is the only inhabitant: ◮ Given a dependent type C ( x , y , p ) where x , y : A and p : Id A ( x , y ) ◮ Given a dependent function h : Π x : A . C ( x , x , refl A ( x )) obtain a dependent function J ( h ) : Π x , y : A . C ( x , y , p ) ◮ β -reduction: J ( h )( x , x , refl A ( x )) � h ( x ) Compare with natural numbers 0 : N and Suc : N → N . Given a dependent type C ( x ) where x : N and h 0 : C (0) and h Suc : Π x : N . C ( x ) → C ( Suc ( x )) you get I ( h 0 , h Suc ) : Π x : N . C ( x ). One has I ( h 0 , h Suc )(0) � h 0 and I ( h 0 , h Suc )( Suc ( n )) � h Suc ( n , I ( h 0 , h Suc )( n )). Can use that both for primitive recursion (e.g. C ( x ) = N ) and induction (e.g. C ( x ) = Id N ( x , Suc x (0))). mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 6 / 38

  7. Properties of propositional equality Leibniz principle: if P : A → Set then can define subst : Π x , y : A . Id ( x , y ) → P ( x ) → P ( y ) with β -rule subst ( x , x , refl ( x ) , p ) � p . Symmetry, transitivity of Id : sym : Π x , y : A . Id ( x , y ) → Id ( y , x ) trans : Π x , y , z : A . Id ( x , y ) → Id ( y , z ) → Id ( y , x ) Congruence rules with respect to almost all term formers. In particular resp : Π f : A → B . Π x , y : A . Id A ( x , y ) → Id B ( f ( x ) , f ( y )). Can define elements of Id by induction (recursion), thus e.g. find an inhabitant (“proof”) of Π A : Set . Π l : List ( A ) . Id ( rev ( rev ( l )) , l ) mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 7 / 38

  8. Definitional equality Definitional equality is the congruence induced by β -reduction. Definitionally equal terms and types are identified (“syntactic congruence”) Definitional equality is decidable (inhabitance of Id ( x , y ) a.k.a. propositional equality is not). ? mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 8 / 38

  9. Extensional type theory Definitional and propositional equality identified. If Id ( u , v ) is inhabited then u = v may be concluded. Definitional equality and thus type checking becomes undecidable. Valid typing judgements should be accompanied by a (sufficiently verbose digest of a) derivation. Underlying theory of Nuprl and PVS mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 9 / 38

  10. Id is great Coming from the Calculus of Constructions (LEGO) where equality is encoded by Leibniz formula, the identity type was quite an innovation for us. The following type is inhabited, proof using J . Π x , y : N . Π u : Vec ( x ) . Π p : Id N ( x , y ) . Id N ( length ( u ) , length ( subst Vec ( p , u )) For the first time we could not only define but also reason about dependent functions and data types. Fortunately, LEGO had support for arbitrary rewrite rules so we could easily put in the identity type even before the Calculus of Inductive Constructions became available. mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 10 / 38

  11. Extensional concepts It was known for a long time that propositional equality suffered from some unnecessary (?) defects: From Π x : A . Id B ( f ( x ) , g ( x )) cannot conclude Id A → B ( f , g ) Cannot redefine propositional equality by quotienting (real numbers, streams, modular arithmetic, . . . ) Cannot conclude Id Prop ( ϕ, ψ ) from ϕ ↔ ψ Cure: book equality, setoids, OTT, axioms for extensional concepts, setoid interpretation mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 11 / 38

  12. Uniqueness of identity The extensional concepts somehow are orthogonal or even in conflict with the view of propositional equality as an inductive definition. But the following are not! ◮ Uniqueness of identity proofs (UIP): Π x , y : A . Π p , q : Id A ( x , y ) . Id Id A ( x , y ) ( p , q ) ◮ Streicher’s K : Π C : Π x : A . Id A ( x , x ) → Set . (Π x : A . C ( x , refl ( x ))) → (Π x : A . Π p : Id ( x , x ) . C ( x , p )) ◮ Congruence for the second projection: Π a : A . Π b , b ′ : B ( a ) . Id Σ x : A . B ( x ) (( a , b ) , ( a , b ′ )) → Id B ( a ) ( b , b ′ ) None of these are inhabited (as we now know), but they are interdefinable and inhabited in an extension of Martin-L¨ of type theory with pattern matching (Coquand). mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 12 / 38

  13. “Identity equations” While not all equality proofs are equal (at least we didn’t know how to prove it) some identities are provable: Π x , y : A . Π p : Id ( x , y ) . Id Id ( x , y ) ( p , trans ( refl ( x ) , p )) We use C ( x , y , p ) := Id Id ( x , y ) ( p , trans ( refl ( x ) , p )) and have h := λ x : A . refl ( refl ( x )) : Π x : A . C ( x , x , refl ( x )) This is because by β -reduction trans ( refl ( x ) , refl ( x )) � refl ( x ). Recall the definition of trans in terms of J . mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 13 / 38

  14. Notation and more identity equations Let us abbreviate: trans ( p , q ) by qp and refl ( x ) by id x . Let us also write p ∼ q when Id Id ( x , y ) ( p , q ) is inhabited. We have just proved: p id x ∼ p In a similar way, we can also prove: id p ∼ p p ( qr ) ∼ ( pq ) r i.e. Id ( trans ( trans ( r , q ) , p ) , trans ( r , trans ( q , p ))) is inhabited. Thus, intuitively, each type forms a category with its members as objects, and Id -proofs as morphisms. mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 14 / 38

  15. Symmetry as an inverse Recall sym : Π x , y : A . Id ( x , y ) → Id ( y , x ). Writing p − 1 := sym ( p ) we can prove: p p − 1 ∼ 1 p − 1 p ∼ 1 So, the category of identity proofs is in fact a groupoid (a category where all morphisms are isomorphisms). Up to ∼ , that is. mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 15 / 38

  16. Functions are functors Recall that resp :Π f : A → B . Π x , y : A . Id A ( x , y ) → Id B ( f ( x ) , f ( y )) Abbreviating resp ( f )( p ) by f ( p ) we can prove: f ( id ) ∼ id f ( p q ) ∼ f ( p ) f ( q ) and, as a consequence: f ( p − 1 ) ∼ f ( p ) − 1 . So, each type-theoretic function f : A → B is actually a functor from the groupoid induced by A to the groupoid induced by B . mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 16 / 38

  17. Leibniz principle Recall subst : Π x , y : A . Id ( x , y ) → P ( x ) → P ( y ) If b : P ( x ) and p : Id ( x , y ) let us write P ( p )( b ) : P ( y ) for subst ( p , b ). Each type P ( x ) for x : A is a groupoid (by being a type and by the above). The Leibniz principle P ( p )( − ) is a functor from the groupoid P ( x ) to P ( y ) when p ∈ Id ( x , y ). That’s just because P ( p ) : P ( x ) → P ( y ). But more than that: we can show that the functor P ( id ) : P ( x ) → P ( x ) is naturally isomorphic to the identity functor and that the composition P ( q ) ◦ P ( p ) is naturally isomorphic to P ( qp ). mh (lmumun) Groupoid Interpretation TLCA 03.07.2015 17 / 38

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