Algorithm W Created 2026-10-14 Updated 2026-11-05
Algorithm W infers data types for a pure lambda calculus with let polymorphism. Write , where is a type substitution and the inferred data type. Composition means applying first. The following presentation uses type schemes explicitly.[ref]
For a program identifier, take a fresh instance of its type scheme in the typing context. For , introduce fresh , infer , and return .
For an application , compute and . With fresh , let be the most general unifier of and . Return . An incompatible base data type or failed occurs check rejects the expression.
For let x = e1 in e2, first infer . Generalize exactly those type variables of not free in , producing a type scheme . Infer for under and return .
For example, let id = \x -> x in let a = id 3 in id True has a Boolean data type result. The identity function receives type scheme , then separate uses instantiate it at integer and Boolean data types. A parameter to a lambda abstraction instead has one shared monomorphic type; treating that parameter like a let-bound type scheme would accept programs outside this type system.
Church encoding 2026-10-14
Church encoding represents data and operations as terms of the lambda calculus. A Church numeral represents a natural number by repeated function application; a Church Boolean selects one of two arguments.
Combinatory logic 2026-10-14
Combinatory logic describes computation by application and fixed combinator constants, eliminating bound variables through bracket abstraction. Its intensional weak reduction does not identify every pair of terms that becomes beta-equivalent after translation into lambda calculus.
Jocelyn Quaintance 2026-11-05
The arithmetic chapter distinguishes the finite axioms of Robinson arithmetic from the mathematical induction schema used in Peano arithmetic. This matters computationally: a formal language can express arithmetic operations while different axiom systems prove different claims about them. The exposition connects symbolic rules with limits on what algorithms and formal proofs can establish.
K combinator 2026-10-31
In lambda calculus, the closed lambda term discards its second argument. In combinatory logic, its primitive constant satisfies . The corresponding principal type in the simply typed lambda calculus is .
Lambda calculus Created 2026-09-28 Updated 2026-11-05
A lambda term is a variable , a lambda application , or a lambda abstraction . The lambda abstraction binds in and represents a function whose argument will be substituted for . Computation uses beta reduction:
where the substitution is capture-avoiding substitution. For example, reduces to , while substituting a free into first requires renaming its bound variable, giving rather than .
The untyped lambda calculus allows self-application. If , then reduces to itself and has no terminating reduction. Conversely, Church numerals encode natural numbers as repeated application: represents two. This small syntax supports general computation while making binding, substitution and termination visible. The simply typed lambda calculus restricts the allowed lambda applications through types.
Model of computation 2026-11-05
A model of computation specifies how inputs are represented, which states and operations are available, how execution proceeds and what counts as its output and resource cost. Examples include Turing machines, random-access machines, Boolean circuits and the lambda calculus. A mathematical algorithmic claim is interpreted within such a model, even when the model is left implicit.
For example, adding two integers is one instruction in a unit-cost machine model. In a bit-cost model, operating on arbitrarily long integers requires time depending on their encoded lengths. A bound counting arithmetic operations therefore need not be a bound on bit complexity. Likewise, a circuit family can supply separate hardware for each input length, while a uniformity requirement asks one algorithm to generate those circuits. Stating the model makes efficiency comparisons meaningful and separates questions of computability from the cost of a chosen representation.
Normal-order reduction 2026-10-20
A reduction strategy that contracts the leftmost outermost reducible expression first. If a lambda calculus expression has a beta-normal form, this strategy reaches it, although the intermediate expressions can be large.
S combinator 2026-10-31
In lambda calculus, distributes its third argument to its first two arguments. In combinatory logic, its primitive constant satisfies and implements the application clause of bracket abstraction.