Definition
A dependent product (or dependent function type) is a generalization of Function Type where the output type may depend on the input value.
The dependent product type is written or , where is a type and is a type family indexed by .
An element of is a function such that for each , we have .
Type Rules
- Introduction rule: Given an expression with free variable , we can form .
- Elimination rule: Given and , we have .
- Computation rule (β-rule):
Examples
- Polymorphic Identity Function: takes a type and returns the identity function on that type
- vectors: might prepend an element to vectors of any length
- Universal quantification: The proposition corresponds to
Special Cases
When is a constant type family (does not depend on ), the dependent product reduces to the ordinary Function Type: .
Related Concepts
- Function Type: The non-dependent special case
- Dependent Sum: The dual construction where pairs have dependent components
- Product Type: The non-dependent product
- Lambda Calculus: The foundation for function abstraction