<<

Theories and models

Example Categorical models of The theory of a asserts an identity e, products x · y and inverses x−1 for any x, y, and equalities x · (y · z) = (x · y) · z and x · e = x = e · x and x · x−1 = e. Michael Shulman I A model of this theory (in sets) is a particularparticular group, like Z or S3. February 28, 2012 I A model in spaces is a .

I A model in is a .

I ...

1 / 43 3 / 43

Group objects in categories Categorical

Definition A group object in a with finite products is an object G with e : 1 → G, m : G × G → G, and i : G → G, such that the following diagrams commute. Categorical semantics is a general procedure to go from 1. the theory of a group to m×1 (e,1) (1,e) G × G × G / G × G / G × G o 2. the notion of group object in a category. G F G FF xx 1×m m FF m xx A group object in a category is a model of the theory of a group. 1 FF xx1   FF#  { xx G × G / x m G G Then, anything we can prove formally in the theory of a group will be valid for group objects in any category. ! / e / G 1 GO ∆ m  G × G / G × G 1×i

4 / 43 5 / 43 Doctrines Theores and models

For each kind of type theory there is a corresponding kind of structured category in which we consider models.

Once we have fixed a doctrine D, then Algebraic theory ←→ Category with finite products I A D-theory specifies “generating” or “axiomatic” types and Simply typed λ-calculus ←→ Cartesian closed category terms.

Dependent type theory ←→ Locally c.c. category I A D-category is one possessing the specified structure. . . I A model of a D-theory T in a D-category C realizes the types and terms in T as objects and morphisms of C. A doctrine specifies

I A collection of type constructors (e.g. ×), and

I A categorical structure realizing those constructors as operations (e.g. cartesian products).

6 / 43 7 / 43

The doctrine of finite products Models of finite-product theories

T a finite-product theory, C a category with finite products. Definition Definition A finite-product theory is a type theory with unit and × as the A model of T in C assigns only type constructors, plus any number of axioms. 1. To each type A in T, an object A in C J K Example 2. To each judgment derivable in T: The theory of magmas has one axiomatic type M, and x : A ,..., xn : An ` b : B axiomatic terms 1 1 a in C: ` e : M and x : M, y : M ` (x · y): M b A1 × · · · × An −−→J K B . For or groups, we need equality axioms (later). J K J K J K 3. Such that A × B = A × B , etc. J K J K J K

8 / 43 9 / 43 Models of finite-product theories Complete theories To define a model of T in C, it suffices to interpret the axioms.

Example Definition A model of the theory of magmas in C consists of The complete theory Th(C) of a D-category C has

I An object M . I As axiomatic types, all the objects of C. J K e I A morphism 1 −−→J K M . I As axiomatic terms, all the morphisms of C. J K · I A morphism M × M −→J K M . J K J K J K Remarks Given this, any other term like I The theory Th(C) has a tautological model in C. A model of T in C is equivalently a translation of T into x : M, y : M, z : M ` x · (y · z): M I Th(C).

is automatically interpreted by the composite I Reasoning in Th(C), or a subtheory of it, is a way to prove things specifically about C. 1× · · M × M × M −−−→J K M × M −→J K M J K J K J K J K J K J K

10 / 43 11 / 43

Syntactic categories The syntax–semantics adjunction

There are bijections between: Definition The syntactic category Syn(T) of a D-theory T has 1. Models of a theory T in a category C 2. Structure-preserving Syn(T) → C I As objects, exactly the types of T. 3. Translations T → Th(C) I As morphisms, exactly the terms of T. Hence Syn is left adjoint to Th. Remarks syntactic category I The theory T has a tautological model in Syn(T). A model of T in C is equivalently a structure-preserving I Type theories Categories Syn(T) → C.

I That is, Syn(T) → C is the free D-category generated by a model of T. complete theory

I Studying Syn(T) categorically can yield meta-theoretic information about T. Depending on how you things up, you can make this adjunction an equivalence.

12 / 43 13 / 43 Why categorical semantics A list of doctrines

unit ←→ terminal object I When we prove something in a particular type theory, like ∅ ←→ initial object the theory of a group, it is then automatically valid for product A × B ←→ categorical product models of that theory in all different categories. disjoint union A + B ←→ categorical I We can use type theory to prove things about a particular type A → B ←→ exponentials (cartesian closure) category by working in its complete theory. I We can use to prove things about a type To include a type constructor in a doctrine, we have to specify theory by working with its syntactic category. meanings for 1. the type constructor (an operation on objects) 2. its constructors, and 3. its eliminators.

14 / 43 16 / 43

Universal properties Uniqueness of universal properties The categorical versions of type constructors are generally characterized by universal properties. Definition Theorem A left universal property for an object X of a category is a way If X and X 0 have the same universal property, then X =∼ X 0. of describing hom(X, Z ) up to isomorphism for every object Z , which is “natural in Z”. Example ∼ 0 ∼ Examples Suppose hom(∅, Z ) = ∗ and hom(∅ , Z) = ∗ for all Z . 0 0 I Then hom(∅, ∅ ) =∼ ∗ and hom(∅ , ∅) =∼ ∗, so we have ∼ I hom(∅, Z ) = ∗. morphisms ∅ → ∅0 and ∅0 → ∅. hom(A + B, Z) ∼ hom(A, Z ) × hom(B, Z ). 0 0 I = I Also hom(∅, ∅) =∼ ∗ and hom(∅ , ∅ ) =∼ ∗, so the composites ∅ → ∅0 → ∅ and ∅0 → ∅ → ∅0 must be identities. Definition A right universal property for an object X of a category is a way of describing hom(Z, X) up to isomorphism for every object Z , which is “natural in Z”.

17 / 43 18 / 43 Interpreting positive types Interpreting positive types Positive type constructors are generally interpreted by objects Positive type constructors are generally interpreted by objects with left universal properties. with left universal properties.

I The constructors are given as data along with the objects. I The constructors are given as data along with the objects.

I The eliminators are obtained from the universal property. I The eliminators are obtained from the universal property. Example Example An initial object has hom(∅, Z) =∼ ∗. A coproduct of A, B has morphisms inl: A → A + B and

I No extra data (no constructors). inr: B → A + B, such that composition with inl and inr: I For every Z, we have a unique morphism ∅ → Z (the hom(A + B, Z ) → hom(A, Z) × hom(B, Z) eliminator “abort” or “match with end”). is a bijection.

I Two data inl and inr (type constructors of a disjoint union).

I Given A → Z and B → Z, we have a unique morphism A + B → Z (the eliminator, definition by cases).

19 / 43 19 / 43

Interpreting negative types Cartesian products are special

Negative type constructors are generally interpreted by objects with right universal properties.

I The eliminators are given as data along with the objects. Definition

I The constructors are obtained from the universal property. A product of A, B has morphisms pr1 : A × B → A and pr2 : A × B → B, such that composition with pr1 and pr2: Example An exponential of A, B has a morphism ev: BA × A → B, such hom(Z , A × B) → hom(Z , A) × hom(Z , B) that composition with ev: is a bijection. hom(Z, BA) → hom(Z × A, B) I This is a right universal property. . . but we said products were a positive type! is a bijection. I Also: we already used products × in other places! I One datum ev (eliminator of function types, application). A I Given a morphism A → B, we have a unique element of B (the constructor, λ-abstraction).

20 / 43 21 / 43 How to deal with products Display object categories

Backing up: how do we interpret terms Definition A display object category is a category with

x : A, y : B ` c : C I A terminal object. if we don’t have the type constructor ×? I A subclass of its objects called the display objects. (i.e. if our category of types doesn’t have products?) I The product of any object by a display object exists.

1. Work in a cartesian multicategory: in addition to Idea

morphisms A → C we have “multimorphisms” A, B → C. I The objects represent contexts.

2. OR: associate objects to contexts rather than types. I The display objects represent contexts x : A, which are equivalent to types. These are basically equivalent. The first is arguably better; the I Think of non-display objects as “formal products” of display second is simpler to describe and generalize. objects.

22 / 43 23 / 43

Examples of d.o. categories Contexts in d.o. categories

Now we interpret types by display objects, and a term Example Any category having products and a terminal object (e.g. sets), x : A, y : B ` c : C with all objects being display. by a morphism Example A × B → C To define Syn(T) when the doctrine lacks products: J K J K J K where A × B interprets the x : A, y : B, and need not I objects = contexts be a displayJ K objectJ K itself. I morphisms = tuples of terms Similarly, a term ` c : C in the empty context gives a morphism I display objects = singleton contexts 1 → C out of the terminal object 1, which may not be display. J K

24 / 43 25 / 43 Products in d.o. categories Other types in d.o. categories

The left universal property for the positive product type:

x : A, y : B ` z : Z p : A × B ` match(... ): Z I Products: Display objects are closed under products. I Disjoint unions: any two display objects have a coproduct which is also a display object, and products distribute over Definition . Given display objects A and B, a display product is a display I ∅: there is an initial object that is a display object. object P with a morphism A × B → P, such that composition with it: I unit: The terminal object is a display object. hom(P, Z ) → hom(A × B, Z) I Function types: any two display objects have an exponential which is also a display object. is a bijection.

It follows that A × B → P is an isomorphism, so we are really just saying that display objects are closed under products.

26 / 43 27 / 43

Dependent contexts Display map categories

Question Definition If B : A → Type, how do we interpret a judgment A display map category is a category with I A terminal object. x : A, y : B(x) ` c : C ? I A subclass of its morphisms called the display maps, denoted B  A or B A. _ Partial Answer I Any pullback of a display map exists and is a display map. If we associate objects to contexts as in a display object category, this will just be a morphism Remarks The objects represent contexts. x : A, y : B(x) → C I J K J K I A display map represents a projection Γ, y : B  Γ but what is the object on the left, and how is it related to A (the type B may depend on Γ). J K J K J K and B : A → Type? I The fiber of this projection over x :Γ is the type B(x). Well: there should be a projection x : A, y : B(x) → A . I The display objects are those with A  1 a display map. J K J K

29 / 43 30 / 43 Pullbacks and substitution Dependent terms The pullback of a display map represents substitution into a dependent type. Given f : A → B and a dependent type y : B ` C : Type, we have x : A ` C[f (x)/y]: Type. Given Γ ` C : Type represented by q : Γ, C  Γ , a term J K J K C[f (x)/y] / C Γ ` c : C J K J K is represented by a section   A / B f Γ, C J K J K J @ K In particular, for two types A and B in the empty context: c q  A × B / B Γ J K J K J K J K   (i.e. qc = 1 Γ ) A / / 1 J K J K represents the context x : A, y : B, as in a d.o. category.

31 / 43 32 / 43

Non-dependent terms Dependent sums in d.m. categories

Definition If C is independent of Γ, then q : Γ, C  Γ is the pullback Given a display object A  1 and a display map B  A, a J K J K dependent sum is a display object P  1 with a map B → P, Γ, C C such that composition with it J K J K

q hom(P, Z ) → hom(B, Z )

is a bijection. Γ 1 J K Note: if B  A is the pullback of some C  1, then B = A × C and this is just a product. and sections of it are the same as maps Γ → C , as before. J K J K As there, it follows that B → P is an isomorphism, so we are really saying that display maps are closed under composition.

33 / 43 34 / 43 Dependent products in d.m. categories Universes and dependent types

Definition But if types are just terms of type Type . . . Given A  1 and B  A, a dependent product is a display type of types “Type” ←→ universe object U object P  1 with a map P × A → B over A, such that composition with it Examples

hom(Z , P) → homA(Z × A, B) I In sets, U = a Grothendieck universe of “small sets” In ∞-groupoids, U = the ∞-groupoid of small ∞-groupoids is a bijection. I Then. . . (Really, we replace 1 by an arbitrary context Γ everywhere.) dependent type A → Type ←→ morphism A → U ? If the category is locally cartesian closed, this means ←→ display map B  A display maps are closed under Π-functors.

35 / 43 36 / 43

The universal dependent context Coherence

A universe object U has to come with a display map There are issues with coherence. Ue  U g∗(f ∗B) / ∗ / (fg)∗B / f B B B representing the universal dependent context _ _ _ 6=      A: Type, x : A.   A3 / A2 / A1 A3 / A1 g f fg A display map B  A represents a context extension by a type in U (a “small type”) just when it is a pullback: but substitutions in type theory

/ B(z) 7→ B(f (y)) 7→ B(f (g(x))) B Ue _ B(z) 7→ B((f ◦ g)(x)) = B(f (g(x)))

  A / U are the same.

37 / 43 38 / 43 Coherence via universes Display maps in homotopy theory

Question Which maps can be display maps? One solution (Voevodsky) Interpret dependent types B : A → Type by morphisms Recall: given B : A → Type, x, y : A, and p :(x = y), we have A → U, obtaining the corresponding display map by pullback the operation of transporting along p: whenJ K necessary. Then substitution is by composition: B(x) B(y) g f B A3 −→ (A2 −→ A1 −→ U) g f B (A3 −→ A2 −→ A1) −→ U B u J K transport(p, u) and thus strictly associative.

There are other solutions too. p A J K x y

39 / 43 41 / 43

Fibrations Transport in fibrations

If B  A is a fibration, then paths in A act on its fibers by Definition transporting along lifted paths. A map B → A of spaces (or ∞-groupoids) is a fibration if for Example any any path p : x y in A and any point u in the fiber over x, 1 The infinite helix R → S . there is a path u v lying over p.. . . and such a path can be chosen to vary continuously in its inputs. I Each fiber is Z. I Transporting around a loop acts on Z by “+1”. u X / B : Example 0 The inclusion of a point ∗ → S1 is not a fibration.   × [ , ] / X 0 1 p A I No way to transport the point ∗ in one fiber any other (empty) fiber. In homotopy type theory, display maps must be fibrations. I Note: R is homotopy equivalent to ∗, as a space!

42 / 43 43 / 43