Type Theory – Does the Dependent Product Functor Relate to Type Theory?

category-theoryslice-categorytype-theory

I'm confused by the naming of the dependent product functor. As far as I understand, in the category of sets, given $f:X\to Y$ and $u:A\to X$, the dependent product functor $\Pi_f:\mathsf{Set}_{/X}\to\mathsf{Set}_{/Y}$ takes $(A,u)$ to the set of maps from $f^{-1}(x)$ to $A$ respecting the fiber w.r.t. $u$.

In the context of type theory, I assumed the dependent product functor to somehow associate a family of types with the dependent product type. But I don't really understand the role of $Y$ here. It would make more sense if $Y=\{*\}$, then you could say $a\in A$ are members of the type $u(a)$ and $\Pi_f(A,u)$ is the set of fiber-preserving maps. But what about non-trivial $Y$, how does it fit into the type theory picture?

Best Answer

Contexts and types are conflated in the locally Cartesian closed categorical semantics of dependent type theory in a confusing way: a context is just a type is just an object of the category, and similarly a dependent type is the same thing as a term of a function type, namely, a morphism in the category. That means there can be a nondeterminism in how to interpret categorical constructions in terms of type theory.

That said, in the situation you describe, we think of $X$ as a type in context $Y$, and $A$ as a type in context $Y,x:X.$ Categorically, this context is just…$X$ again.

Thus what the dependent product functor is doing is implementing the rule that from premises $Y \vdash X\texttt{ type}, Y,x:X\vdash A(x)\texttt{ type},$ we can conclude $Y\vdash \Pi_{x:X} A(x)\texttt{ type}.$

As an aside, if you also find this mashup of contexts, types, dependencies, substitutions and terms confusing, you might find it pedagogically useful to look into a framework like categories with families that gives categorical semantics much closer to the type theory.

Related Question