Definition
A function type is a binary type constructor whose elements are functions from one type to another. The function type from type to type is denoted .
An element is a function that maps each element of type to an element of type .
Type-Theoretic Rules
Function types have the following introduction and elimination rules:
- Introduction (lambda abstraction): Given an expression with free variable , we can form
- Elimination (application): Given and , we can form
The key property is the -reduction rule: where denotes substituting for in .
Properties
- Syntactically, function types associate right: means
- Function types form an exponential object in category theory: denotes the type of functions from to
Relationship to Product Types
Function types and product types are dual in a precise sense:
- Product introduction requires providing both components; elimination extracts one
- Function introduction abstracts over an input; elimination requires providing an input
This duality is formalized in the adjunction in category theory.
Related Concepts
- Product Type: The dual construction to function types
- Product Type: A generalization where the output type may depend on the input value
- Lambda Calculus: The foundational system for function types
- Currying: The correspondence between and