In http://planetmath.org/node/87533Chapter 1, we presented the two basic judgments of type theory. The first, , asserts that a term has type . The second, , states that the two terms and are judgmentally equal at type . These judgments are inductively defined by a set of inference rules described in \autorefsec:syntax-more-formally.
To construct an element of a type is to derive ; in the book, we give informal arguments which describe the construction of , but formally, one must specify a precise term and a full derivation that .
However, the main difference between the presentation of type theory in the book and in this appendix is that here judgments are explicitly formulated in an ambient context, or list of assumptions, of the form
An element of the context expresses the assumption that the variable has type . The variables appearing in the context must be distinct. We abbreviate contexts with the letters and .
The judgment in context is written
and means that under the assumptions listed in . When the list of assumptions is empty, we write simply
where denotes the empty context. The same applies to the equality judgment
However, such judgments are sensible only for well-formed contexts, a notion captured by our third and final judgment
expressing that each is a type in the context . In particular, therefore, if and , then we know that each contains only the variables , and that and contain only the variables .
In informal mathematical presentations, the context is implicit. At each point in a proof, the mathematician knows which variables are available and what types they have, either by historical convention ( is usually a number, is a function, etc.) or because variables are explicitly introduced with sentences such as “let be a real number”. We discuss some benefits of using explicit contexts in \autorefsec:more-formal-pi,\autorefsec:more-formal-sigma.
We write for the substitution of a term for free occurrences of the variable in the term , with possible capture-avoiding renaming of bound variables, as discussed in §1.2 (http://planetmath.org/12functiontypes). The general form of substitution
substitutes expressions for the variables simultaneously.
To bind a variable in an expression means to incorporate both of them into a larger expression, called an abstraction, whose purpose is to express the fact that is “local” to , i.e., it is not to be confused with other occurrences of appearing elsewhere. Bound variables are familiar to programmers, but less so to mathematicians. Various notations are used for binding, such as , , and , depending on the situation. We may write for the substitution of a term for the variable in the abstracted expression, i.e., we may define to be . As discussed in §1.2 (http://planetmath.org/12functiontypes), changing the name of a bound variable everywhere within an expression (“-conversion”) does not change the expression. Thus, to be very precise, an expression is an equivalence class of syntactic forms which differ in names of bound variables.
One may also regard each variable of a judgment
to be bound in its scope, consisting of the expressions , , and .