A delightful question that bridges the realms of mathematics and computer science!
To a mathematician, I'd explain that presheaves are effective in modeling dependent type theory because they provide a natural framework for capturing the notion of "contextual" or "dependent" data. In essence, presheaves allow us to model mathematical structures that vary over a base space, which is precisely what dependent type theory is all about.
Dependent type theory in a nutshell
Dependent type theory is a branch of type theory that generalizes the notion of types to depend on terms. In other words, the type of an expression can depend on the value of another expression. This is in contrast to traditional type theory, where types are fixed and independent of terms. Dependent type theory is useful for modeling mathematical structures that involve dependencies between objects, such as bundles, fibrations, and homotopy types.
Presheaves to the rescue
Presheaves, which are contravariant functors from a category to the category of sets, provide a natural way to model dependent data. Given a category C, a presheaf F on C assigns to each object c of C a set F(c) of "sections" over c. The key insight is that these sections can be thought of as "dependent" on the object c, in the sense that they vary as c varies.
In the context of dependent type theory, we can think of the category C as a "context" or "base space" of types, and the presheaf F as assigning to each type c in C a set F(c) of "terms" or "expressions" that depend on c. The presheaf condition, which states that F is contravariant, ensures that these terms can be "transported" or "restricted" along morphisms in C, much like how dependent types can be substituted along equalities.
The categorical structure of dependent type theory
The connection between presheaves and dependent type theory becomes even more apparent when we consider the categorical structure of dependent type theory. The category of contexts, which is typically a category of types, can be equipped with a Grothendieck topology, which encodes the notion of "covering" or "locality" in the context. The presheaf category on this site, which consists of presheaves on the category of contexts, provides a natural model for dependent type theory.
In particular, the presheaf category satisfies the following properties, which are essential for modeling dependent type theory:
- Dependent products: The presheaf category has dependent products, which allow us to model the formation of dependent types.
- Dependent sums: The presheaf category has dependent sums, which allow us to model the formation of dependent types with disjoint sum types.
- Contextual weakening: The presheaf category satisfies contextual weakening, which allows us to model the substitution of terms along equalities.
Conclusion
In summary, presheaves provide a natural framework for modeling dependent type theory because they capture the notion of contextual or dependent data. The categorical structure of dependent type theory, which involves a category of contexts equipped with a Grothendieck topology, can be modeled using presheaves on this site. The presheaf category provides a natural model for dependent type theory, satisfying the essential properties of dependent products, dependent sums, and contextual weakening. This connection has far-reaching implications for the study of dependent type theory, homotopy type theory, and the foundations of mathematics.