A dependent type upon X is interpreted as an object of the slice category C/X.
A dependent type of the form x: A |- B(x) is a type corresponds to morphisms f: B -> A, whose fiber over x: A is the type f^{-1}(x) = B(x).
The dependent sum Σx:AB(x) is given by an object in Set/A, the set ∪a∈ABa. The morphism is the morphism from Ba→A which sends an elements of Ba1 to a1, ,Ba2 to a2 and so forth. The fibers of the map give us the disjoint union decomposition.
The dependent product Πx:AA(x) is given by an object in Set/A.
We can describe both dependent sum and product as arising as adjoints to the functor Set→Set/A given by X↦(X×A→A).
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.
If instead we think of a subset as a function PY:Y→Ω where Ω is the subobject classifier, we then get that PX is the composite PX≡PY∘f.
Similarly, if we have a "regular function" f:X→Y, and we want to substitute s(a) ( s:A→X for substitution) into f(x) to get f(s(a)), then this is just computing f∘s.
To to dependent types in a category, we can use display maps .
The display map of a morphism p:B→A represents x:A∣−B(x):Type. The intuition is that B(x)is the fiber of the map p over x:A.
For any category C, a class of morphisms D are called display maps iff all pullbacks of D exist and belong to D. Often, D is also closed under composition.
Said differently, D is closed under all pullbacks, as well as composition.
A category with displays is well rooted if the category has a terminal object 1, and all maps into 1are display maps (ie, they can always be pulled back along any morphism).
This then implies that binary products exist (?? HOW?)