How can a type express a specification that depends on its input?
Follow indexed data, dependent application, equality transport, and universe restrictions through explicit examples.
Girard's thesis and Reynolds's independent programming-language account develop polymorphic lambda calculi with explicit quantification over types. System F distinguishes one uniformly typed construction from a collection of unrelated implementations. Its impredicative polymorphism must be separated from dependent types and ML's restricted type inference.
Source: Girard, Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supérieur (1972 thesis)Simple types distinguish functions from their arguments and connect implication with abstraction. Mathematical specifications often need more information. A vector's type may depend on its length. A result may consist of an object together with evidence that the object satisfies a property.
Dependent type theory allows types to depend on terms. This makes the relationship between proofs and programs expressive enough to support substantial mathematics, while placing new demands on the rules for computation and equality.
A developing foundational program
Per Martin-Löf developed successive formulations of intuitionistic type theory from the early 1970s onward. The formulations changed in their treatment of universes, equality, and the relationship between mathematical judgments and internal propositions.
Sources and credit for Per Martin-Löf
Creator not identified in the source record. Via Wikimedia Commons. Image source · Public domain · Biographical dates
It is therefore misleading to attribute every feature of later dependent-type systems to a single presentation. The 1984 Intuitionistic Type Theory, based on lectures given in 1980, is one important reference point within a continuing development.
Other lines contributed to the emerging landscape. De Bruijn's Automath project investigated mechanically checked mathematical language. Jean-Yves Girard and John Reynolds independently developed second-order polymorphic lambda calculi, now associated with System F.
Polymorphism permits a term to be used uniformly across types. Dependence permits a type to refer to a term. These mechanisms can be combined, but they are distinct.
Judgments and contexts
A type theory does more than list propositions. It specifies judgments that say whether an expression is a type, whether a term has a type, and whether expressions are definitionally equal.
A context might contain
Later declarations depend on earlier ones. The expression for the type of uses both the type and the number .
Context formation therefore matters. A declaration cannot generally refer to a variable that has not yet been introduced. Substitution must preserve both the terms and the types that depend on them.
This disciplined treatment of context is one reason a compact mathematical phrase can require substantial elaboration before a checker sees its precise formal meaning.
Dependent products and sums
The dependent product
is a type of functions that, for each , produce a term of type . When does not depend on , it reduces to an ordinary function type.
Under propositions as types, it supplies the constructive interpretation of universal quantification: give a construction that works for an arbitrary input.
The dependent sum
contains pairs where and . The second component's type depends on the first component's value.
For example,
can contain the number paired with a proof that .
This is a data-bearing specification. Some assistants also provide an existential proposition in a separate logical universe with restricted elimination into data. One must not infer that every existential proof in every implementation permits unrestricted extraction of a computational witness.
Application now includes substitution in the result type. From and , we obtain . A proof checker cannot simply return the fixed type , because the output specification may change with the input. For a dependent pair , the second projection has type . Its correctness refers to the actual first component.
These rules also explain one constructive form of choice. A term
already supplies a selected witness and evidence for each input. Define , and prove using . This constructs
There is no search for an unspecified witness: the data-bearing hypothesis supplied one. This theorem of dependent products and sums should not be conflated with every set-theoretic or propositionally truncated formulation of choice. The distinction is developed in the first chapters of the Homotopy Type Theory book, before its specifically homotopical principles are introduced.
A length-indexed vector
Consider a family with constructors
and
For elements , the expression
has length two, with the length arguments left implicit here for readability.
A head operation can have type
Its input type excludes an empty vector. Pattern matching on the possible constructor supplies an element of .
The claim is stronger than “the function usually receives a nonempty list.” The length restriction is part of the expression that type checking must verify. Whether that expression accurately captures the application's needs remains a separate specification question.
A more informative operation is concatenation:
Write for successor, represented by the length notation above. Define addition recursively on its first argument, so computes to and computes to . In the empty-vector branch, returning the second vector has the required type because reduces to . In the constructor branch, recursively append the tail, then attach the first element. The new length is , definitionally the required .
The index is doing mathematical work in both branches. A program that accidentally drops the first element cannot satisfy the declared constructor-case type. More complicated equalities of indices, such as associativity of addition on variables, may require explicit proofs rather than just computation.
Computation inside type checking
Suppose a function expects a vector of length , and we supply one of length . In a theory whose natural-number computation rules reduce to , the types can be definitionally equal.
No separate proof of equality needs to be passed at this point. The checker uses the specified computation rules.
Now compare lengths and for a variable . Whether these are definitionally equal can depend on the chosen recursive definition of addition. If addition computes by recursion on its first argument, may not reduce when is a variable, even though a theorem proves the equality.
One then uses propositional equality to transport a vector between the corresponding types. A mathematically obvious equality may therefore require explicit evidence because it is not one of the equalities recognized by computation alone.
This distinction is essential to understanding proof assistants. Definitional equality governs conversion during checking; propositional equality is represented by an internal type whose inhabitants can be used in proofs.
Identity and elimination
An identity type expresses an equality between terms of type . Reflexivity supplies a canonical inhabitant when the endpoints agree.
Its elimination principle explains how a construction valid for reflexivity extends to general identity evidence. In a dependent setting, this supports transport: if is a family of types and , an inhabitant of can be moved to .
Different theories make different choices about how identity interacts with judgmental equality. Extensional equality reflection, for example, has substantial consequences for type checking.
Intensional identity also leaves room for the richer interpretations examined in Homotopy Type Theory. Those interpretations should not be assumed in advance merely because a system has dependent types.
In a common intensional formulation, the identity eliminator uses a family depending on two endpoints and an identity proof. If we construct for each , then supplies an inhabitant of for any . Its computation rule returns when and is reflexivity.
For transport, choose a family whose conclusion is . At reflexivity use the identity function on ; then produces the required map along any identity proof. The rule is an induction principle about equality evidence. It does not by itself say that all identity proofs are identical, nor that propositionally equal terms are interchangeable by the checker's definitional conversion rule.
This is one point at which successive systems in Martin-Löf's history differ. The 1984 lectures present an extensional treatment; many later proof assistants and homotopical developments use intensional identity. Treating that book as if it specified every later intensional implementation would conceal a foundational change.
Induction is part of the logical design
Inductive types provide constructors and principles for defining functions or proving properties by analyzing those constructors.
For natural numbers, the induction principle takes a proof of and a method taking to , and produces a proof of for every natural number.
A recursive function and an inductive proof can therefore share the same structural organization.
Unrestricted recursion would threaten the normalization properties needed for a direct proofs-as-terms foundation. Systems consequently impose conditions on recursive definitions. Likewise, restrictions such as strict positivity control which inductive definitions are admitted.
These restrictions are mathematical safeguards built into the formal theory. They are not merely inconveniences imposed by an implementation.
To see why positivity matters, imagine admitting a type with a constructor and a matching destructor satisfying the expected computation rule. Define
Then , and would have type . Its computation unfolds into itself. The negative occurrence of in the constructor's input has recreated self-application at the logical level. Ordinary strictly positive inductive definitions exclude precisely this pattern. The example does not prove that every more permissive system is inconsistent, but it identifies why unrestricted constructor formation cannot be accepted.
Universes and the limits of type formation
A universe lets a theory speak internally about a collection of types. Its formation rules determine how much self-reference and quantification the system permits.
Girard's paradox showed that powerful combinations of dependent type formation and an unrestricted type of all types can be inconsistent. Martin-Löf revised an early formulation in response.
Sources and credit for Jean-Yves Girard
UTLS. Via Wikimedia Commons. Image source · CC BY-SA 4.0 · Biographical dates
Sources and credit for John C. Reynolds
original picture taken by Andrej Bauer , cropped by romanm ( talk ). Via Wikimedia Commons. Image source · CC BY-SA 2.5 · Biographical dates
A common approach uses a hierarchy
A universe is then contained in a higher universe rather than being an unrestricted member of itself. Cumulativity, resizing, and impredicativity are further choices, each requiring a precise formulation.
The historical lesson resembles the response to set-theoretic paradoxes: expressive comprehension principles need careful limits. It does not follow that every impredicative type theory is inconsistent.
Constructions and inductive constructions
Thierry Coquand and Gérard Huet developed the Calculus of Constructions in the 1980s, combining dependent types with powerful forms of polymorphism. Their journal presentation appeared in 1988.
Work by Coquand, Christine Paulin-Mohring, and collaborators developed inductive types and the relationship between proofs and extracted programs. Paulin-Mohring's research is central to the account, including the rules and properties of inductive definitions in Coq. The project's publication bibliography records these developments.
Sources and credit for Thierry Coquand
Andrej Bauer. Via Wikimedia Commons. Image source · CC BY-SA 2.5 si · Biographical dates
Sources and credit for Gérard Huet
David MacQueen. Via Wikimedia Commons. Image source · CC0 · Biographical dates
Sources and credit for Christine Paulin-Mohring
David.Monniaux. Via Wikimedia Commons. Image source · CC BY-SA 4.0 · Biographical dates
This lineage became a basis for major proof-assistant implementations. Implementation choices concerning propositions, proof irrelevance, universes, elimination, and computation must still be described system by system.
A successful proof term is checked against a specific formal theory. The phrase “dependent type theory” identifies a family of foundations, not a single universal specification.
A type theory can also describe other logics
The Edinburgh Logical Framework, LF, developed by Robert Harper, Furio Honsell, and Gordon Plotkin and presented in 1987, uses dependent types for another purpose: representing the syntax, judgments, and inference rules of an object logic. A family can express the judgment that the object-language formula has a proof; a logical inference is represented by a constant whose type specifies its premises and conclusion.
This judgments-as-types use distinguishes the logic being represented from the framework doing the representation. LF is not simply one more proposal that every user's mathematics must adopt exactly the framework's internal logic as its object theory. Its original paper explains how dependency and binding can support reusable checking tools. This branch helps account for the diversity of later proof assistants and logical frameworks.
The encoding still needs an adequacy theorem. The relevant canonical LF terms must correspond to the intended object-language expressions and proofs, and encoding must respect substitution. Otherwise, a checker could correctly verify an LF term that encodes an unintended object-language derivation. The framework's type-checking theorem and the adequacy of a particular signature are separate obligations; declaring constants with plausible-looking types establishes neither their intended meaning nor that every encoded proof corresponds to an object proof. The original paper makes this correspondence part of what it means to present a logic correctly.
Toward structural semantics
Dependent types organize proofs through judgments, terms, and reduction rules. Another development asks how logical operations can be characterized through mathematical structure, independently of a particular symbolic presentation.
Check your understanding: why can equal lengths still need a proof?
Addition is defined by recursion on its first input. A function expects , but you have a vector of length , with a variable. Can type checking always identify the two types by evaluation alone?
Reasoning. No. The expression cannot unfold its first-argument recursion while is an unspecified variable. An induction proves , after which identity elimination transports the vector to the required type. For the numeral , evaluation can compute the equality directly. Mathematical equality and definitional computation are related but distinct judgments.
Sources and further reading
- Per Martin-Löf, Intuitionistic Type Theory (1984), based on the Padua lectures of 1980.
- Jean-Yves Girard, Interprétation fonctionnelle et élimination des coupures de l'arithmétique d'ordre supérieur (1972).
- John C. Reynolds, “Towards a Theory of Type Structure” (1974).
- Thierry Coquand and Gérard Huet, “The Calculus of Constructions” (1988).
- Thierry Coquand and Christine Paulin-Mohring, “Inductively Defined Types” (1988); Christine Paulin-Mohring, “Inductive Definitions in the System Coq: Rules and Properties” (1993).
- Rocq research bibliography, containing the historical Coq papers; Paulin-Mohring's publication list.
- Robert Harper, Furio Honsell, and Gordon Plotkin, “A Framework for Defining Logics”, conference presentation (1987), expanded journal version (1993).
- The Univalent Foundations Program, Homotopy Type Theory: Univalent Foundations of Mathematics (2013), chapters 1–2 for dependent pairs, identity, and transport; the later foundational program is treated separately in Part 26.