Definition
A product type is a Type Constructor that combines two types and into a composite type. Given types and , their product consists of pairs where and .
More generally, the product of types is written and contains -tuples where for each .
Type Rules
Product types are characterized by their introduction and elimination rules:
Introduction Rule
If we have and , we can construct the pair .
Elimination Rules
From a pair , we can project out its components using and .
Computation Rules
Eta Rule
For any , we have .
Category-Theoretic View
In category theory, the product type corresponds to the categorical product. The type is the product of and with projection morphisms and .
The product satisfies a universal property: for any type with morphisms and , there exists a unique morphism such that and .
Related Concepts
- Ordered Tuple: Elements of product types
- Sum Type: The dual construction for type theory
- Dependent Pair: A generalization where the second type depends on the first value
- Record Type: Product types with named fields
- Function Type: Related by currying via the isomorphism
- Cartesian Product: The set-theoretic analogue