2 Natural Models
In this chapter we describe the categorical semantics of our syntax via natural models. It follows previous work on natural models [ Awo17 ] , with the following additional features
A more compact description of identity types exploiting the technology of polynomial endofunctors.
A collection of N Russell-style nested universes.
universe-variable \(\Pi \)-types and \(\Sigma \)-types, i.e. with possibly different universe level inputs, and landing in the largest universe (imitating the type theory of Lean4).
2.1 Interpretation of syntax
A very brief overview of the interpretation of syntax follows. We will work in a presheaf category \(\mathbf{Psh}(\mathbb {C})\). A context \(\Gamma \) will be interpreted as an object \([\! [\Gamma ]\! ] \in \mathbb {C}\). We will often take the image of the context under the Yoneda embedding \(\mathsf{y}[\! [\Gamma ]\! ] \in \mathbf{Psh}(\mathbb {C})\). If \(i \le N\) is a universe level, then a typing judgment \(\Gamma \vdash _i a : A\) will be interpreted as a commuting triangle of the following form
2.2 Natural model
Fix a small category \(\mathbb {C}\).
Following Awodey [ Awo17 ] , we say that a map \(\mathsf{tp}: \mathsf{Tm}\to \mathsf{Ty}\) in \(\mathbf{Psh}(\mathbb {C})\) is fiberwise representable or a natural model when any fiber of a representable is representable. In other words, given any \(\Gamma \in \mathbb {C}\) and a map \(A : \mathsf{y}(\Gamma ) \to \mathsf{Ty}\), there is some representable \(\Gamma \cdot A \in \mathbb {C}\) and maps \(\mathsf{disp}_{A} : \Gamma \cdot A \to \Gamma \) and \(\mathsf{var}_{A} : \mathsf{y}(\Gamma \cdot A) \to \mathsf{Tm}\) forming a pullback
A collection of \(N+1\) natural models with \(N\) Russell style universes and lifts consists of
For each \(i \leq N\) a natural model \(\mathsf{tp}_i : \mathsf{Tm}_i \to \mathsf{Ty}_i\)
For each \(i {\lt} N\) a lift \(\mathsf{L}_{i}^{i+1} : \mathsf{Ty}_i \to \mathsf{Ty}_{i+1}\)
For each \(i {\lt} N\) a point \(\mathsf{U}_i : 1 \to \mathsf{Ty}_{i+1}\) such that
2.3 Pi types
We will use \(P_{\mathsf{tp}_i}\) to denote the polynomial endofunctor 5.0.1 associated with a natural model \(\mathsf{tp}_i\). Then additional structure of \(\Pi \) types on our \(N\) universes consists of, for each \(i, j \le N\), a pullback square
2.4 Sigma types
We will use the polynomial composition of two maps 5.0.6, \(\mathsf{tp}_i \lhd \mathsf{tp}_j : Q \to P_{\mathsf{tp}_i}(\mathsf{Ty}_j)\). Then additional structure of \(\Sigma \) types on our \(N\) universes consists of, for each \(i, j \le N\), a pullback square
2.5 Identity types
Suppose \(\mathsf{tp}: \mathsf{Tm}\to \mathsf{Ty}\) is a natural model and we have a commutative square (this need not be a pullback)
where \(\delta \) is the diagonal:
Then let \(I\) be the pullback. We get a comparison map \(\rho \)
Then view \(\rho : \mathsf{tp}\to q\) as a map in the slice over \(\mathsf{Ty}\).
Now (by 5.0.8) applying \(P_{-} : (\mathbf{Psh}(\mathbb {C})/ \mathsf{Ty}) ^{\mathrm{op}} \to [\mathbf{Psh}(\mathbb {C}), \mathbf{Psh}(\mathbb {C})]\) to \(\rho : \mathsf{tp}\to q\) gives us a naturality square (this also need not be a pullback).
Taking the pullback \(T\) and the comparison map \(\varepsilon \) we have
Then a natural model \(\mathsf{tp}\) with identity types consists of a commutative square 3, with a section \(\mathsf{J}: T \to P_{q}{\mathsf{Tm}}\) of \(\varepsilon \).
2.6 Binary products and Exponentials
It is convenient to specialize \(\Sigma \) and \(\Pi \) types to their non-dependent counterparts \(\times \) and \(\mathsf{Exp}\).
In the natural model we can construct these by considering first the map
defined using the characterising property of polynomials 5.0.2, which we can visualize in
Then, respectively, the pullback of the diagrams 1 and 2 for interpreting \(\Pi \) and \(\Sigma \) rules along this map give us pullback diagrams for interpreting function types and product types. (We simplify the situation to where \(i = j\).)
By the universal property of pullbacks and 5.0.2 we can write a map \(\Gamma \to F\) as a triple \((A,B,f)\) such that \(A, B: \Gamma \to \mathsf{Ty}\) and
This gives us four equivalent ways we can view a function. Namely, as \(f : \Gamma \cdot A \to \mathsf{Tm}\) in the above diagram, \(\lambda \circ f : \Gamma \to \mathsf{Tm}\), as \((A,B,f) : \Gamma \to F\), or as a map between the displays \(\mathsf{disp}_{A} \to \mathsf{disp}_{B}\)
For the formalization, we need not prove that the pullback of \(\mathsf{tp}\lhd \mathsf{tp}\) is \(\mathsf{tp}\times \mathsf{tp}\). Rather, we can also use the universal property of pullbacks and 5.0.2 to classify a map into the pullback (whatever it may be) as a pair \((\alpha , \beta )\), where \(\alpha , \beta : \Gamma \to \mathsf{Tm}\). This could then be adapted to a proof that the pullback is what the diagram claims it to be.
The identity function \(\mathsf{id}_{A} : \Gamma \to \mathsf{Tm}\) of type \(\mathsf{Exp}\circ (A,A) : \Gamma \to \mathsf{Ty}\) can be defined by the following
Viewed as a map between the display maps, this is simply the identity \(\Gamma \cdot A \to \Gamma \cdot A\).
Composition is also simplest when viewed as an operation on maps between fibers. Given \(f : \mathsf{disp}_{A} \to \mathsf{disp}_{B}\) and \(g : \mathsf{disp}_{B} \to \mathsf{disp}_{C}\), the composition is \(g \circ f : \mathsf{disp}_{A} \to \mathsf{disp}_{C}\).
2.7 Univalence
For two types \(A, B : \Gamma \to \mathsf{Ty}\) and two functions \(f, g : A \to B\) we can define internally a homotopy from \(f\) to \(g\) as
We define the types of left and right inverses of \(f : A \to B\) as
and the property of being an equivalence
We could do the same for two small types \(A, B : \Gamma \to \mathsf{U}\)
Again, internally we can define a function
which uses \(J\) to transport along the proof of equality to produce an equivalence.
Univalence for universe \(\mathsf{U}\) states that IdToEquiv itself is an equivalence
Note that this statement is large, i.e. not a type in the universe \(\mathsf{U}\).
2.8 Extensional identity types and UIP
In this section we outline variations on the identity type in the natural model. We will describe these as additional structure on \(\mathsf{Id}\), as opposed to introducing different identity types.
The first option is fully extensional identity types, i.e. those satisfying equality reflection and uniqueness of identity proofs (UIP). Equality reflection says that if one can construct a term satisfying \(\mathsf{Id}(a,b)\) then we have that definitionally \(a \equiv b\), i.e. they are equal morphisms in the natural model. This amounts to just requiring that 3 is a pullback, i.e. \(\rho \) is an isomorphism
Note that this means \({\rho }^{\star }\) is an isomorphism, from which it follows that 4 is also a pullback, i.e. \(\varepsilon \) is an isomorphism.
We could only require UIP:
Say an identity type in a natural model satisfies UIP if \(I \to \mathsf{tp}\times _{\mathsf{Ty}} \mathsf{tp}\) is a strict proposition, meaning for any \((a,b) : \Gamma \to \mathsf{tp}\times _{\mathsf{Ty}} \mathsf{tp}\) there it at most one lift
One might wonder what other variations we could come up with by tweaking the pullback conditions. In fact, only requiring that \(\rho \) has a section is equivalent to requiring that \(\rho \) is an isomorphism. So this just the extensional case again.
If we require instead that \(\varepsilon \) is an isomorphism then this is giving an \(\eta \)-rule for \(J\), from which we can prove equality reflection and UIP [ Hof95 ] . So this just the extensional case again.