natural deduction metalanguage, practical foundations
type theory (dependent, intensional, observational type theory, homotopy type theory)
computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory
hom-set, hom-object, internal hom, exponential object, derived hom-space
loop space object, free loop space object, derived loop space
In type theory a function type for two types is the type of functions from to .
In a model of the type theory in categorical semantics, this is an exponential object. In set theory, it is a function set. In dependent type theory, it is a special case of a dependent product type.
type theory | category theory | |
---|---|---|
syntax | semantics | |
natural deduction | universal construction | |
function type | internal hom | |
type formation | ||
term introduction | ||
term elimination | ||
computation rule |
Like any type constructor in type theory, a function type is specified by rules saying when we can introduce it as a type, how to construct terms of that type, how to use or “eliminate” terms of that type, and how to compute when we combine the constructors with the eliminators.
The type formation rule to build a function type is easy:
Function types are almost always defined as a negative type. In this presentation, primacy is given to the eliminators. The natural eliminator of a function type says that we can apply it to any input:
The constructor is then determined as usual for a negative type: to construct a term of , we have to specify how it behaves when applied to any input. In other words, we should have a term of type containing a free variable of type . This yields the usual “-abstraction” constructor:
The ∞-reduction rule is the obvious one (the ur-example of all -reductions), saying that when we evaluate a -abstraction, we do it by substituting for the bound variable.
If we want an ∞-conversion rule, the natural one says that every function is a -abstraction:
It is also possible to present function types as a positive type. However, this requires a stronger metatheory, such as a logical framework. We use the same constructor (-abstraction), but now the eliminator says that to define an operation using a function, it suffices to say what to do in the case that that function is a lambda abstraction.
This rule cannot be formulated in the usual presentation of type theory, since it involves a “higher-order judgment”: the context of the term involves a “term of type containing a free variable of type ”. However, it is possible to make sense of it. In dependent type theory, we need additionally to allow to depend on .
The natural -reduction rule for this eliminator is
and its -conversion rule looks something like
Here is a term containing a free variable of type . By substituting for , we obtain a term of type which depends on “a term containing a free variable ”. We then apply the positive eliminator at , and the -rule says that this can be computed by just substituting for in .
As usual, the positive and negative formulations are equivalent in a suitable sense. They have the same constructor, while we can formulate the eliminators in terms of each other:
The conversion rules also correspond.
In dependent type theory, this definition of only gives us a properly typed dependent eliminator if the negative function type satisfies -conversion. As usual, if it satisfies propositional eta-conversion then we can transport along that instead—and conversely, the dependent eliminator allows us to prove propositional -conversion. This is the content of Propositions 3.5, 3.6, and 3.7 in (Garner).
In dependent type theory a function type is the special case the dependent product over for the special case that is regarded as an -dependent type that actually happens to be -independent. The rules are given as follows:
In categorical semantics this is the statement that a section of a product projection is equivalently just a morphism .
In dependent type theory, in the same way that one could define equivalence types as types of one-to-one correspondences, one could also define function types as types of anafunctions. This requires both identity types and heterogeneous identity types being defined first, which we shall write as and respectively for , , , , and .
Rules for function types
By the rules for dependent sum types and dependent product types, one could derive that
which is precisely the statement that is an anafunction for all functions .
A function type is the special case of a dependent product type for the case where the dependent type does not actually depend.
See also at function monad.
In logic, functions types express implication. More precisely, for two propositions, under propositions as types the implication is the function type (or rather the bracket type of that if one wishes to force this to be of type again ).
A textbook account in the context of programming languages is in section III of
See also
Last revised on May 19, 2023 at 22:54:32. See the history of this page for a list of all contributions to it.