Dependent Type Theory: Proofs, Data, and Universes

How types came to express specifications that depend on values, and why equality, induction, and universe rules became foundational decisions.

Modern logic · Part 16Historical questions · mathematical ideas

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.

Selected landmarksSeries timeline ↗

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.

Portrait of Per Martin-Löf
Per Martin-Löf (b. 1942)
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

A:U,n:N,v:Vec⁡(A,n).A:\mathcal U,\quad n:\mathbb N,\quad v:\operatorname{Vec}(A,n).

Later declarations depend on earlier ones. The expression for the type of vv uses both the type AA and the number nn.

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

∏x:AB(x)\prod_{x:A}B(x)

is a type of functions that, for each x:Ax:A, produce a term of type B(x)B(x). When BB does not depend on xx, 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

∑x:AB(x)\sum_{x:A}B(x)

contains pairs (a,b)(a,b) where a:Aa:A and b:B(a)b:B(a). The second component's type depends on the first component's value.

For example,

∑n:N(n>10)\sum_{n:\mathbb N}(n>10)

can contain the number 1111 paired with a proof that 11>1011>10.

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 f:∏x:AB(x)f:\prod_{x:A}B(x) and a:Aa:A, we obtain f(a):B(a)f(a):B(a). A proof checker cannot simply return the fixed type BB, because the output specification may change with the input. For a dependent pair p:∑x:AB(x)p:\sum_{x:A}B(x), the second projection has type B(π1p)B(\pi_1p). Its correctness refers to the actual first component.

These rules also explain one constructive form of choice. A term

h:∏x:A∑y:BR(x,y)h:\prod_{x:A}\sum_{y:B}R(x,y)

already supplies a selected witness and evidence for each input. Define f(x)=π1(h(x))f(x)=\pi_1(h(x)), and prove R(x,f(x))R(x,f(x)) using π2(h(x))\pi_2(h(x)). This constructs

∑f:A→B∏x:AR(x,f(x)).\sum_{f:A\to B}\prod_{x:A}R(x,f(x)).

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 Vec⁡(A,n)\operatorname{Vec}(A,n) with constructors

nil⁡:Vec⁡(A,0)\operatorname{nil}:\operatorname{Vec}(A,0)

and

cons⁡:∏n:NA→Vec⁡(A,n)→Vec⁡(A,n+1).\operatorname{cons}: \prod_{n:\mathbb N} A\to\operatorname{Vec}(A,n)\to \operatorname{Vec}(A,n+1).

For elements a,b:Aa,b:A, the expression

cons⁡(a,cons⁡(b,nil⁡))\operatorname{cons}\bigl(a,\operatorname{cons}(b,\operatorname{nil})\bigr)

has length two, with the length arguments left implicit here for readability.

A head operation can have type

∏n:NVec⁡(A,n+1)→A.\prod_{n:\mathbb N} \operatorname{Vec}(A,n+1)\to A.

Its input type excludes an empty vector. Pattern matching on the possible constructor supplies an element of AA.

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:

append⁡:∏m,n:NVec⁡(A,m)→Vec⁡(A,n)→Vec⁡(A,m+n).\operatorname{append}:\prod_{m,n:\mathbb N} \operatorname{Vec}(A,m)\to\operatorname{Vec}(A,n) \to\operatorname{Vec}(A,m+n).

Write S(m)S(m) for successor, represented by the length notation m+1m+1 above. Define addition recursively on its first argument, so 0+n0+n computes to nn and S(m)+nS(m)+n computes to S(m+n)S(m+n). In the empty-vector branch, returning the second vector has the required type because 0+n0+n reduces to nn. In the constructor branch, recursively append the tail, then attach the first element. The new length is S(m+n)S(m+n), definitionally the required S(m)+nS(m)+n.

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 1+11+1, and we supply one of length 22. In a theory whose natural-number computation rules reduce 1+11+1 to 22, 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 n+0n+0 and nn for a variable nn. Whether these are definitionally equal can depend on the chosen recursive definition of addition. If addition computes by recursion on its first argument, n+0n+0 may not reduce when nn 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 Id⁡A(a,b)\operatorname{Id}_A(a,b) expresses an equality between terms of type AA. 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 PP is a family of types and a=ba=b, an inhabitant of P(a)P(a) can be moved to P(b)P(b).

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 JJ uses a family C(x,y,p)C(x,y,p) depending on two endpoints and an identity proof. If we construct d(x):C(x,x,refl⁡x)d(x):C(x,x,\operatorname{refl}_x) for each x:Ax:A, then JJ supplies an inhabitant of C(a,b,p)C(a,b,p) for any p:Id⁡A(a,b)p:\operatorname{Id}_A(a,b). Its computation rule returns d(a)d(a) when b=ab=a and pp is reflexivity.

For transport, choose a family whose conclusion is P(a)→P(b)P(a)\to P(b). At reflexivity use the identity function on P(a)P(a); JJ 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 P(0)P(0) and a method taking P(n)P(n) to P(n+1)P(n+1), and produces a proof of P(n)P(n) 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 DD with a constructor roll⁡:(D→⊥)→D\operatorname{roll}:(D\to\bot)\to D and a matching destructor unroll⁡:D→(D→⊥)\operatorname{unroll}:D\to(D\to\bot) satisfying the expected computation rule. Define

δ(x)=unroll⁡(x)(x).\delta(x)=\operatorname{unroll}(x)(x).

Then δ:D→⊥\delta:D\to\bot, and δ(roll⁡(δ))\delta(\operatorname{roll}(\delta)) would have type ⊥\bot. Its computation unfolds into itself. The negative occurrence of DD 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.

Portrait of Jean-Yves Girard
Jean-Yves Girard (b. 1947)
Sources and credit for Jean-Yves Girard

UTLS. Via Wikimedia Commons. Image source · CC BY-SA 4.0 · Biographical dates

Portrait of John C. Reynolds
John C. Reynolds (1935–2013)
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

U0:U1:U2:⋯ .\mathcal U_0:\mathcal U_1:\mathcal U_2:\cdots.

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.

Portrait of Thierry Coquand
Thierry Coquand (b. 1961)
Sources and credit for Thierry Coquand

Andrej Bauer. Via Wikimedia Commons. Image source · CC BY-SA 2.5 si · Biographical dates

Portrait of Gérard Huet
Gérard Huet (b. 1947)
Sources and credit for Gérard Huet

David MacQueen. Via Wikimedia Commons. Image source · CC0 · Biographical dates

Portrait of Christine Paulin-Mohring
Christine Paulin-Mohring (b. 1962)
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 proof⁡(A)\operatorname{proof}(A) can express the judgment that the object-language formula AA 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 Vec⁡(A,n)\operatorname{Vec}(A,n), but you have a vector of length n+0n+0, with nn a variable. Can type checking always identify the two types by evaluation alone?

Reasoning. No. The expression n+0n+0 cannot unfold its first-argument recursion while nn is an unspecified variable. An induction proves n+0=nn+0=n, after which identity elimination transports the vector to the required type. For the numeral 2+02+0, 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.