a general framework for the semantics of type...

32
A General Framework for the Semantics of Type Theory Taichi Uemura ILLC, University of Amsterdam 9 July, 2019. CT

Upload: others

Post on 31-Oct-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

A General Framework for the Semantics of TypeTheory

Taichi Uemura

ILLC, University of Amsterdam

9 July, 2019. CT

Page 2: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

CwF-semantics of Type Theory

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

Martin-Lof 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.

Page 3: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

CwF-semantics of Type Theory

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

Martin-Lof 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.

Page 4: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Outline

1 Introduction

2 Natural Models

3 Type Theories

4 Semantics of Type Theories

Page 5: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Outline

1 Introduction

2 Natural Models

3 Type Theories

4 Semantics of Type Theories

Page 6: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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 S

such 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.

Page 7: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

CwF vs Natural Model

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

よ{A} E

よΓ U

δA

πAy

p

A

よ{A} ∼= A∗E

Proposition (Awodey 2018)

CwFs ' natural models.

Page 8: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

CwF vs Natural Model

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

よ{A} E

よΓ U

δA

πAy

p

A

よ{A} ∼= A∗E

Proposition (Awodey 2018)

CwFs ' natural models.

Page 9: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Modeling Type Formers

Dependent function types (Π-types) are modeled by a pullback

PpE E

PpU U

λ

Pppy

p

Π

where Pp : [Sop, Set]→ [Sop, Set] is the functor

[Sop, Set] [Sop,Set]/E [Sop, Set]/U [Sop, Set](−×E) p∗ dom

and p∗ is the pushforward along p, i.e. the right adjoint of thepullback p∗.

Page 10: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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, . . ..

Page 11: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Outline

1 Introduction

2 Natural Models

3 Type Theories

4 Semantics of Type Theories

Page 12: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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;

the pushforward f∗ : A/X→ A/Y along a representable arrowf : X→ Y exists.

Definition

A representable map functor F : A→ B between representable mapcategories is a functor F : A→ B preserving all structures:representable arrows; finite limits; pushforwards along representablearrows.

Page 13: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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;

the pushforward f∗ : A/X→ A/Y along a representable arrowf : X→ Y exists.

Definition

A representable map functor F : A→ B between representable mapcategories is a functor F : A→ B preserving all structures:representable arrows; finite limits; pushforwards along representablearrows.

Page 14: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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 representable map functor (−)S : T→ [Sop, Set].

Page 15: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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 representable map functor (−)S : T→ [Sop, Set].

Page 16: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Examples of Type Theories

Proposition

Representable map categories have some “free” constructions (cf.LCCCs and Martin-Lof type theories (Seely 1984)).

Example

If T is freely generated by a single representable arrow p : E→ U,a model of T consists of...

a category S with a terminal object;

a representable map pS : ES → US of presheaves over S

i.e. a natural model.

Page 17: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Examples of Type Theories

Proposition

Representable map categories have some “free” constructions (cf.LCCCs and Martin-Lof type theories (Seely 1984)).

Example

If T is freely generated by a single representable arrow p : E→ U,a model of T consists of...

a category S with a terminal object;

a representable map pS : ES → US of presheaves over S

i.e. a natural model.

Page 18: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Outline

1 Introduction

2 Natural Models

3 Type Theories

4 Semantics of Type Theories

Page 19: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Main Results

Let T be a type theory.

Theorem

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

Theorem

There is a “theory-model correspondence”: we define a (locallydiscrete) 2-category ThT of T-theories and establish a bi-adjunction

ModT

a

ThT.

LT

MT

Page 20: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Main Results

Let T be a type theory.

Theorem

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

Theorem

There is a “theory-model correspondence”: we define a (locallydiscrete) 2-category ThT of T-theories and establish a bi-adjunction

ModT

a

ThT.

LT

MT

Page 21: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Main Results

Let T be a type theory.

Theorem

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

Theorem

There is a “theory-model correspondence”: we define a (locallydiscrete) 2-category ThT of T-theories and establish a bi-adjunction

ModT

a

ThT.

LT

MT

Page 22: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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.

Page 23: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

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.

Page 24: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Internal Languages

Definition

We define a 2-functor LT : ModT → Cart(T,Set) byLTS(A) = A

S(1), where Cart(T,Set) is the category of functorsT→ Set preserving finite limits.

Theorem

LT : ModT → Cart(T, Set) has a left bi-adjoint with invertible unit.

ThT := Cart(T,Set)

(Cf. algebraic approaches to dependent type theory (Isaev 2018;Garner 2015; Voevodsky 2014))

Page 25: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Internal Languages

Definition

We define a 2-functor LT : ModT → Cart(T,Set) byLTS(A) = A

S(1), where Cart(T,Set) is the category of functorsT→ Set preserving finite limits.

Theorem

LT : ModT → Cart(T, Set) has a left bi-adjoint with invertible unit.

ThT := Cart(T,Set)

(Cf. algebraic approaches to dependent type theory (Isaev 2018;Garner 2015; Voevodsky 2014))

Page 26: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Internal Languages

Definition

We define a 2-functor LT : ModT → Cart(T,Set) byLTS(A) = A

S(1), where Cart(T,Set) is the category of functorsT→ Set preserving finite limits.

Theorem

LT : ModT → Cart(T, Set) has a left bi-adjoint with invertible unit.

ThT := Cart(T,Set)

(Cf. algebraic approaches to dependent type theory (Isaev 2018;Garner 2015; Voevodsky 2014))

Page 27: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Conclusion

A type theory is a representable map category.

Every type theory has a bi-initial model.

There is a theory-model correspondence.

Future Directions:

Application: canonicity by gluing representable mapcategories?

What can we say about the 2-categoty ModT?

Better presentations of the category ThT?

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

Page 28: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

References I

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.

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.

Page 29: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

References II

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.

R. Garner (2015). “Combinatorial structure of type dependency”.In: Journal of Pure and Applied Algebra 219.6, pp. 1885–1914.doi: 10.1016/j.jpaa.2014.07.015.

V. Isaev (2018). Algebraic Presentations of Dependent TypeTheories. arXiv: 1602.08504v3.

R. A. G. Seely (1984). “Locally cartesian closed categories andtype theory”. In: Math. Proc. Cambridge Philos. Soc. 95.1,pp. 33–48. doi: 10.1017/S0305004100061284.

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.

Page 30: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

References III

V. Voevodsky (2014). B-systems. arXiv: 1410.5389v1.

Page 31: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Why is it a Theory?

In algebraic approaches to dependent type theory (Isaev 2018;Garner 2015; Voevodsky 2014), a theory is a diagram in Set whichlooks like

E0 E1 E2 . . .

U0 U1 U2 . . .

where

Un set of types with n variables;

En set of terms with n variables.

Page 32: A General Framework for the Semantics of Type Theoryconferences.inf.ed.ac.uk/ct2019/slides/7.pdfCwF-semantics of Type Theory Semantics of type theories based on categories with families

Why is it a Theory?

If T has a representable arrow p : E→ U, then T contains adiagram

P0pE P1

pE P2pE . . .

P0pU P1

pU P2pU . . .

P0pp P1

pp P2pp

where PpX = p∗(X× E).