- Motivation for variants of categorical models of dependent types
- Seminal paper: Locally cartesian closed categories and type theory
- A closed type is interpreted as an object.
- A term is interpreted as a morphism.
- A dependent type upon is interpreted as an object of the slice category .
- A dependent type of the form
x: A |- B(x) is a typecorresponds to morphismsf: B -> A, whose fiber overx: Ais the typef^{-1}(x) = B(x). - The dependent sum is given by an object in , the set . The morphism is the morphism from which sends an elements of to , to and so forth. The fibers of the map give us the disjoint union decomposition.
- The dependent product is given by an object in .
- We can describe both dependent sum and product as arising as adjoints to the functor given by .
- Recalling that dependent types are interpreted by display maps, substitution of a term tt into a dependent type BB is interpreted by pullback of the display map interpreting BB along the morphism interpreting tt.
- Reference
§ Key ideas
- Intro to categorical logic
- Contexts are objects of the category
C - Context morphisms are morphisms
f: Γ → Δ - Types are morphisms
σ: X → Γfor arbitraryX - Terms are sections of
σ: X → Γ, so they are functionss: Γ → Xsuch thatσ . s = id(Γ) - Substitution is pullback
§ Why is substitution pullback?
- Suppose we have a function , and we have a predicate .
- The predicate can be seen as a mono , which maps the subset where is true into .
- now, the subset , ie, the subset is another subset .
- See that is a pullback of along :
P_X -univ-> P_Y| |px py| |v vX -----f---> Y- This is true because we can think of .
- If we imagine a bundle, at each point , there is the presence/absence of a fiber since is monic.
- When pulling back the bundle, each point either inherits this fiber or not depending on whether has a fiber above it.
- Thus, the pullback is also monic, as each fiber of either has a strand or it does not, depending on whether has a strand or not.
- This means that has a unique element precisely when does.
- This means that is monic, and represents the subset that is given by .
§ Isn't substitution composition?
- If instead we think of a subset as a function where is the subobject classifier, we then get that is the composite .
- Similarly, if we have a "regular function" , and we want to substitute ( for substitution) into to get , then this is just computing .
§ Using this to do simply typed lambda calculus
- Introduction to categories and categorical logic
- Judgement of the form
A1, A2, A3 |- Abecomes a morphismA1xA2xA3 → A. - Stuff above the inference line will be arguments, stuff below the line will be the return value.
- Eg, the identity judgement:
Γ,A |- Abecomes the function snd: ΓxA → A.
§ Display maps
- Reference: Substitution on nlah
- To to dependent types in a category, we can use display maps .
- The display map of a morphism represents . The intuition is that is the fiber of the map over .
- For any category , a class of morphisms are called display maps iff all pullbacks of exist and belong to . Often, is also closed under composition.
- Said differently, is closed under all pullbacks, as well as composition.
- A category with displays is well rooted if the category has a terminal object , and all maps into are display maps (ie, they can always be pulled back along any morphism).
- This then implies that binary products exist (?? HOW?)