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
In combinatory logic, in the -calculus, or more generally in type theory, a fixed-point combinator is a term which, when applied to a term , yields a term that is a fixed-point of :
This equality is usually a directed beta-reduction as follows:
When “programming” in any of these systems, a fixed-point combinator serves as a mechanism for implementing general recursion. When writing a recursive function in a standard programming language, such as the factorial
def fact(n:nat) : nat = {
if (n == 0) {
return 1
} else {
return n * fact(n-1)
}
}
one generally calls the function being defined inside of its own body. This is not possible for a combinator or a lambda-term to do directly, but it can be implemented using a fixed-point combinator. One first defines a “generator” which takes “the function to call recursively” as an additional argument:
def genfact(f : nat -> nat)(n:nat) : nat = {
if (n == 0) {
return 1
} else {
return n * f(n-1)
}
}
and then “closes the loop” by applying the fixed-point combinator. That is, we curry genfact
to view it as an endofunction of nat -> nat
(an operator) and then construct its fixed point,
The directed -reduction version of the fixed-point property of then implements the process of calling a function recursively:
In particular, observe that because general recursion allows the definition of nonterminating functions, so does a fixed-point combinator. An obvious example is the fixed point of the identity function , which reduces as follows:
There are many ways of constructing or otherwise obtaining a fixed-point combinator, varying with the formal system in which one works.
In the unityped -calculus, a traditional construction (due to Curry) is
For a given term , put . We then have , and we also have
so that is a fixed point of . Compare Lawvere's proof of Cantor's theorem.
Another construction is due to (Klop 07):
where
Note that is repeated 26 times, and the string contains 27 characters. Thus
In combinatory logic (based on the combinators , , and ), one construction is
following the standard formulas , and , and where bracketings left unspecified are by convention to the left. For a derivation of this, see the article on combinatory algebra.
In many forms of (multi-) typed -calculus (and more general type theory), a fixed-point combinator cannot be constructed, because there is no type whose terms can be applied to themselves. This is usually intentional, because it avoids the nontermination inherent in the existence of a fixed-point combinator.
However, it is possible to add a fixed-point combinator to typed -calculus by fiat, obtaining a typed system which includes general recursion and hence nontermination. This is appropriate for some forms of domain semantics, and for modeling some real-world programming languages (Haskell is a notable example).
In type theory:
Last revised on January 28, 2023 at 15:45:00. See the history of this page for a list of all contributions to it.