a general framework for the semantics of type theory · referencesi j. ad amek and j. rosick y...

29
A General Framework for the Semantics of Type Theory Taichi Uemura ILLC, University of Amsterdam 16 August, 2019. HoTT 2019

Upload: others

Post on 30-Jan-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

  • A General Framework for the Semantics of TypeTheory

    Taichi Uemura

    ILLC, University of Amsterdam

    16 August, 2019. HoTT 2019

    https://hott.github.io/HoTT-2019/

  • CwF-semantics of Type Theory

    Semantics of type theories based on categories with families (CwF)(Dybjer 1996).

    Martin-Löf type theory

    Homotopy type theory

    Homotopy type system (Voevodsky 2013) and two-level typetheory (Annenkov, Capriotti, and Kraus 2017)

    Cubical type theory (Cohen et al. 2018)

    Goal

    To define a general notion of a “type theory” to unify theCwF-semantics of various type theories.

  • Outline

    1 Introduction

    2 Natural Models

    3 Type Theories

    4 Semantics of Type Theories

  • Outline

    1 Introduction

    2 Natural Models

    3 Type Theories

    4 Semantics of Type Theories

  • Natural Models

    An alternative definition of CwF.

    Definition (Awodey 2018)

    A natural model consists of...

    a category S (with a terminal object);

    a map p : E→ U of presheaves over Ssuch that p is representable: for any object Γ ∈ S and elementA ∈ U(Γ), the presheaf A∗E defined by the pullback

    A∗E E

    よΓ U

    yp

    A

    is representable, where よ is the Yoneda embedding.

  • Interpreting Type Theory

    Natural model Type theory

    Γ ∈ S Γ ` ctxA ∈ U(Γ) Γ ` A typea ∈ {x ∈ E(Γ) | p(x) = A} Γ ` a : Af : ∆→ Γ context morphismA · f ∈ U(∆) substitutiona · f ∈ E(∆) substitution

  • Representable Maps

    The representable map p : E→ U models context comprehension:

    よ{A} E

    よΓ U

    δA

    πAy

    p

    A

    よ{A} ∼= A∗E

    Natural model Type theory

    A :よΓ → U Γ ` A type{A} ∈ S Γ , x : A ` ctxπA : {A}→ Γ (Γ , x : A)→ ΓA · πA :よ{A}→ U Γ , x : A ` A typeδA :よ{A}→ E Γ , x : A ` x : A

  • Variable Binding

    Variable binding is modeled by the pushforwardp∗ : [S

    op,Set]/E→ [Sop, Set]/U, that is, the right adjoint to thepullback p∗.

    Example

    p∗(E×U) is the presheaf of type families: for Γ ∈ S andA :よΓ → U, we have

    p∗(E×U)

    よΓ UA

    ∼=

    {よ{A} U

    },

    so a section of p∗(E×U) over A is a type family Γ , x : A ` B type.

  • Modeling Type Constructors

    Consider dependent function types (Π-types).

    Γ ` A type Γ , x : A ` B type

    Γ `∏x:A

    B type

    It is modeled by an operation Π such that

    ΠΓ (A,B) ∈ U(Γ) for Γ ∈ S, A ∈ U(Γ) and B ∈ U({A});Π commutes with substitution.

    Thus Π is a map p∗(E×U)→ U of presheaves.

  • Cubical Type Theory

    To model (cartesian) cubical type theory, we need morerepresentable maps.

    Example

    Contexts can be extended by an interval:

    Γ ` ctxΓ , i : I ` ctx

    This is modeled by a presheaf I such that the map I→ 1 isrepresentable.

  • Summary on Natural Models

    An (extended) natural model consists of...

    a category S (with a terminal object);

    some presheaves U,E, . . . over S;

    some representable maps p : E→ U, . . .;some maps X→ Y of presheaves over S where X and Y arebuilt up from U,E, . . . ,p, . . . using finite limits andpushforwards along the representable maps p, . . ..

  • Outline

    1 Introduction

    2 Natural Models

    3 Type Theories

    4 Semantics of Type Theories

  • Representable Map Categories

    Definition

    A representable map category is a category A equipped with aclass of arrows called representable arrows satisfying the following:

    A has finite limits;

    identity arrows are representable and representable arrows areclosed under composition;

    representable arrows are stable under pullbacks;

    representable arrows are exponentiable: the pushforwardf∗ : A/X→ A/Y along a representable arrow f : X→ Y exists.

    Example

    [Sop,Set] with representable maps of presheaves.

  • Representable Map Categories

    Proposition (Weber 2015)

    Exponentiable arrows are stable under pullbacks.

    Example

    A category A with finite limits has structures of a representablemap category:

    Smallest one only isomorphisms are representable;

    Largest one all exponentiable arrows are representable.

    Also, given a class R of exponentiable arrows, we have the smalleststructure of a representable map category containing R.

  • Type Theories

    Definition

    A type theory is a (small) representable map category T.

    Definition

    A model of a type theory T consists of...a category S with a terminal object;

    a morphism (−)S : T→ [Sop,Set] of representable mapcategories, i.e. a functor preserving everything.

    Cf. Functorial semantics of algebraic theories (Lawvere 1963),first-order categorical logic (Makkai and Reyes 1977)

  • Generalised Algebraic Theories

    We give an example G of a type theory whose models are preciselythe natural models.

    Definition

    We denote by G the opposite of the category of finitely presentablegeneralised algebraic theories (GATs) (Cartmell 1978).

    From the general theory of locally presentable categories (Adámekand Rosický 1994), we get:

    Proposition

    G is essentially small and has finite limits, and Funfinlim(G,Set) isequivalent to the category of generalised algebraic theories.

  • An Exponentiable Map of GATs

    Definition

    U0 ∈ G is the GAT consisting of a type constant A0.E0 ∈ G is the GAT consisting of a type constant A0 and aterm constant a0 : A0.

    ∂0 : E0 → U0 is the arrow in G represented by the inclusionU0 → E0.

    Proposition

    ∂0 : E0 → U0 in G is exponentiable.

    So G has the smallest structure of a representable map categorycontaining ∂0.

  • An Exponentiable Map of GATs

    Example

    Let Σ denote the finite GAT

    ` B typex1 : B, x2 : B ` C(x1, x2) type

    x : B ` c(x) : C(x, x).

    Then (∂0)∗(E0 × Σ) is the finite GAT

    ` A0 typex0 : A0 ` B(x0) type

    x0 : A0, x1 : B(x0), x2 : B(x0) ` C(x0, x1, x2) typex0 : A0, x : B(x0) ` c(x0, x) : C(x0, x, x).

  • Representable Map Category of Finite GATs

    Theorem

    G is “freely generated by ∂0” as a representable map category: fora representable map category A and a representable arrowf : X→ Y in A, there exists a unique, up to isomorphism,morphism F : G→ A of representable map categories equippedwith an isomorphism F∂0 ∼= f.

    Corollary

    Models of G ' Natural models (' CwFs)

  • Outline

    1 Introduction

    2 Natural Models

    3 Type Theories

    4 Semantics of Type Theories

  • Bi-initial Models

    Let T be a type theory.

    Theorem

    The 2-category ModT of models of T has a bi-initial object.

  • Theory-model Correspondence

    Definition

    A T-theory is a functor T→ Set preserving finite limits. PutThT := Funfinlim(T,Set).

    Example

    A G-theory is a generalised algebraic theory.

  • Theory-model Correspondence

    Definition

    We define the internal language 2-functor LT : ModT → ThT as

    LT(S) =

    (T [Sop, Set] Set

    (−)S X 7→X(1))

    .

    Theorem

    LT has a left bi-adjoint with invertible unit.

    ModT

    aThT.

    LT

    MT

  • Theory-model Correspondence

    Example

    When T = G, we get a bi-adjunction

    CwFs

    a

    GATs

  • Conclusion

    Definition

    A type theory is a (small) representable map category T.

    Further results and future directions:

    Logical framework for representable map categories

    Application: canonicity by gluing representable map categories(instead of gluing models)?

    What can we say about the 2-categoty ModT?

    What can we say about the category ThT?

    Variations: internal type theories? (∞, 1)-type theories?

  • References I

    J. Adámek and J. Rosický (1994). Locally Presentable andAccessible Categories. Vol. 189. London Mathematical SocietyLecture Note Series. Cambridge University Press.

    D. Annenkov, P. Capriotti, and N. Kraus (2017). Two-Level TypeTheory and Applications. arXiv: 1705.03307v2.

    S. Awodey (2018). “Natural models of homotopy type theory”. In:Mathematical Structures in Computer Science 28.2,pp. 241–286. doi: 10.1017/S0960129516000268.

    J.W. Cartmell (1978). “Generalised algebraic theories andcontextual categories”. PhD thesis. Oxford University.

    https://arxiv.org/abs/1705.03307v2https://doi.org/10.1017/S0960129516000268

  • References II

    C. Cohen et al. (2018). “Cubical Type Theory: A ConstructiveInterpretation of the Univalence Axiom”. In: 21st InternationalConference on Types for Proofs and Programs (TYPES 2015).Ed. by T. Uustalu. Vol. 69. Leibniz International Proceedings inInformatics (LIPIcs). Dagstuhl, Germany: SchlossDagstuhl–Leibniz-Zentrum fuer Informatik, 5:1–5:34. doi:10.4230/LIPIcs.TYPES.2015.5.

    P. Dybjer (1996). “Internal Type Theory”. In: Types for Proofs andPrograms: International Workshop, TYPES ’95 Torino, Italy,June 5–8, 1995 Selected Papers. Ed. by S. Berardi andM. Coppo. Berlin, Heidelberg: Springer Berlin Heidelberg,pp. 120–134. doi: 10.1007/3-540-61780-9_66.

    F. W. Lawvere (1963). “Functorial Semantics of AlgebraicTheories”. PhD thesis. Columbia University.

    https://doi.org/10.4230/LIPIcs.TYPES.2015.5https://doi.org/10.1007/3-540-61780-9_66

  • References III

    M. Makkai and G. E. Reyes (1977). First Order Categorical Logic.Model-Theoretical Methods in the Theory of Topoi and RelatedCategories. Vol. 611. Lecture Notes in Mathematics.Springer-Verlag Berlin Heidelberg. doi: 10.1007/BFb0066201.

    V. Voevodsky (2013). A simple type system with two identitytypes. url: https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/HTS.pdf.

    M. Weber (2015). “Polynomials in categories with pullbacks”. In:Theory and Applications of Categories 30.16, pp. 533–598.

    https://doi.org/10.1007/BFb0066201https://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/HTS.pdfhttps://www.math.ias.edu/vladimir/sites/math.ias.edu.vladimir/files/HTS.pdf

  • The Bi-initial Model

    For a type theory T, we define a model I(T) of T:the base category is the full subcategory of T consisting ofthose Γ ∈ T such that the arrow Γ → 1 is representable;we define (−)I(T) to be the composite

    T よ−→ [Top,Set]→ [I(T)op,Set].

    Given a model S of T, we have a functor

    I(T) S

    T [Sop,Set]

    F

    よ∼=

    (−)S

    and F can be extended to a morphism of models of T.

    IntroductionNatural ModelsType TheoriesSemantics of Type TheoriesConclusionReferences