Type inference
Builds on Type systemSimply typed lambda calculusSubstitutionUnification
Definition
Let a type system be given by a typing relation between contexts, terms and types. Type inference, also called type reconstruction, is the following computational problem. The input is a context and a term , possibly without type annotations. The task is to decide whether some type satisfies , and if so to output one such .
Suppose that types may contain type variables. A type of in is principal if every type of in is a substitution instance of . That is, it arises from by putting types in place of its type variables.
Remarks
Example: in the Curry-style simply typed lambda calculus with type variables, take and the empty context. Give the type and the type ; the application forces . So has the principal type , and each other type, such as , is a substitution instance of it. For this calculus the constraints are equations between types, and first-order unification solves them, so inference is decidable.
Non-example: the term has no type in the simply typed calculus. Inference reaches the equation , which fails the occurs check of unification, and the algorithm reports that there is no type.
Type inference differs from type checking, which is the problem of deciding for a given . For the Curry-style System F, J. B. Wells proved that both problems are undecidable.
Reading path
To understand this page from the ground up, read these 27 pages in order. The foundations come first.
Show the path as a graph
- no evidence level
- Element definition
- Intuitionistic logic concept
- Lambda calculus concept
- Proposition concept
- Set concept
- Substitution concept
- Type system concept
- Unification concept
- Set definition
- Conjunction definition
- Disjunction definition
- Implication definition
- Negation definition
- Biconditional definition
- Truth table concept
- Modus ponens concept
- Mathematical proof concept
- Propositional logic concept
- Tautology definition
- Logical equivalence definition
- Double negation law statement
- Proof by contradiction concept
- Russell's paradox statement
- Type theory concept
- Curry–Howard correspondence concept
- Simply typed lambda calculus concept
- Type inference definition
Further reading
About this page
| Tag | E7YW37TGAY |
|---|---|
| URI | m2://E7YW37TGAY |
| Kind | definition |
| Writing | W0 stub |
| MSC | 68N15, 68N18, 03B40 |
| Defines | Type inference |
| Uses | Type system, Simply typed lambda calculus, Substitution, Unification |
| Changed | 3 November 2026 |
Markdown · JSON · Edit on GitHub
What this page needs for W1
- an inventory row: the row of the inventory that the node accounts for (0 of 1)
- a source with a locator (0 of 1)
The writing levels say how complete the text of a page is. They do not measure its truth.
What links here
No page links to this page yet.