Dependent types I › Rules of inference [01CZ]
- August 11, 2025
- Jon Sterling
In § [01CV] we have outlined the “parts of speech” of dependent type theory in terms of forms of judgement governing types and elements, but we have not yet actually described what the types and elements actually “are”—in other words, we lack vocabulary. Instead of giving a definition of what the types and elements are, type theorists instead describe them indirectly by means of rules of inference—which specify valid processes by which one may describe types and terms. For the programmers in the room, these rules of inference constitute an abstract Application Programming Interface or API against which type theorists agree to work. This API is organised into two main classes of rules: structural rules and rules governing type formers; the former are required to make the judgemental structure behave correctly, whereas the latter give us actual concrete types to work with.
Structural rules [01D0]
- August 11, 2025
- Jon Sterling
In type theory, the structural rules mainly ensure that judgemental equality behaves correctly. From a certain point of view, these rules are redundant (because without them, judgemental “equality” it wouldn’t be equality, etc.!), but we include them for the sake of explicitness. Recalling our warning, note and do not fear the fact that different presentations of type theory will organise these rules differently or may even choose different sets of rules. There are many roads to Rome.
Judgemental equality is an equivalence relation [01D1]
- August 11, 2025
- Jon Sterling
We have the following rules of inference witnessing that judgemental equality is an equivalence relation:
- Reflexivity.
- Given A~\mathit {type} we may assert A\equiv A~\mathit {type}.
- Given A~\mathit {type} and u:A, we may assert u\equiv u:A.
- Transitivity.
- Given A,B,C~\mathit {type} such that A\equiv B~\mathit {type} and B\equiv C~\mathit {type}, we may assert A\equiv C~\mathit {type}.
- Given A~\mathit {type} and u,v,w:A such that u\equiv v:A and v\equiv w:A, we may assert u\equiv w:A.
- Symmetry.
- Given A,B~\mathit {type} such that A\equiv B~\mathit {type}, we may assert B\equiv A~\mathit {type}.
- Given A~\mathit {type} and u,v:A such that u\equiv v:A, we may assert v\equiv u:A.
Typing respects equality [01D2]
- August 11, 2025
- Jon Sterling
Another important rule of equality is that equal types have the same elements; this is sometimes called the “conversion rule”. In particular:
- Given A,B~\mathit {type} and u:A such that A\equiv B~\mathit {type}, we may assert u:B.
- Given A,B~\mathit {type} and u,v:A such that A\equiv B~\mathit {type} and u\equiv v:A, we may assert u\equiv v:B.
This is rendered like so in short-hand:
\frac { A\equiv B~\mathit {type} \quad u:A }{ u:B } \qquad \frac { A\equiv B~\mathit {type} \quad u\equiv v:A }{ u\equiv v:B }Substitutivity of judgemental equality [01D6]
- August 11, 2025
- Jon Sterling
The following rules express the sense in which hypothetical judgments respect judgemental equality.
- Given A~\mathit {type} and x:A\vdash B[x]~\mathit {type} and u,v:A such that u\equiv v:A, we may assert B[u]\equiv B[v]~\mathit {type}.
- Given A~\mathit {type} and x:A\vdash B[x]~\mathit {type} and x:A\vdash w[x]:B[x] and u,v:A such that u\equiv v:A, we may assert w[u]\equiv w[v]:B[u].
We have written the rules “long-hand”, but a theoretician may write these in the following short-hand notation:
\frac { x:A\vdash B[x]~\mathit {type} \quad u\equiv v:A }{ B[u]\equiv B[v]~\mathit {type} } \frac { x:A\vdash B[x]~\mathit {type} \quad x:A\vdash w[x]:B[x] \quad u\equiv v:A }{ w[u]\equiv w[v]:B[u] }As you can see, it is common when in a hurry to leave out all some of the obvious premises (for example, the premises A~\mathit {type} and u,v:A in the first rule). From the perspective of this course, these premises are “actually” secretly present; when someone writes a rule like this, they are relying on a shared expectation of good faith—that they would never intentionally write down a judgement that is meaningless, and so if the necessary presuppositions are omitted, these are intended to be filled in by the reader.
Note: we could have added a rule coverning hypothetical judgements of the form X~\mathit {type}\vdash B[x]~\mathit {type}, etc., such judgements do not usually arise in dependent type theory, so we ignore it.
Exercise Rule golf [01D7]
- August 11, 2025
- Jon Sterling
Imagine that we had omitted the transitivity and symmetry rules for judgemental equality. Devise a single rule that handles both transitivity and symmetry simultaneously.
The usual schema for type formers [01D8]
- August 11, 2025
- Jon Sterling
A type former is something like “the booleans” or “the function space”; type formers are described by rules of inference that govern how they and their elements can be formed and used.
The rules of a type former \mathbf {T} to be arranged into a few groups:
- The formation rules specify how to describe an instance of the type former \mathbf {T}.
- The introduction rules specify how to describe elements of instances of \mathbf {T}.
- The elimination rules specify how to describe elements of other types that depend on elements of instances of \mathbf {T}.
- The large elimination rule specifies how to define a type that depends on an element of an instance of \mathbf {T}.
- The computation rules describe what happens when an elimination rule is applied to the result of an introduction rule.
- The uniqueness rules describe either a strategy to equate the result of the introduction rule to other elements, or (more rarely) a strategy to equate the result of the elimination rule to other elements.
Large elimination rules are often omitted (or redundant). We won’t take a position either way, but some examples might involve them.
Not all type formers come with uniqueness rules; there are both practical and semantic reasons to omit them at times, but we will not get into that. We will not consider any types that have uniqueness rules on the elimination side, but many of the type formers that we look at will have uniqueness rules on the introduction side.