Here is a list of distinctions between different notions of equality, in different contexts, where possibly all the following pairs of notions are, in turn, “the same”, just expressed in terms of different terminologies:
In a formal language such as type theory, one distinguishes various different notions of equality or equivalence of the terms of the language.
Note that both intensional and extensional type theories may distinguish between intensional and extensional equality (and whether the type theory satisfies function extensionality is yet a separate issue).
The most basic one is definitional equality or intensional equality.
According to PML (1980), p. 31:
Definitional equality is intensional equality, or equality of meaning (synonymy). … It is a relation between linguistic expressions … Definitional equality is the equivalence relation generated by abbreviatory definitions, changes of bound variables and the principle of substituting equals for equals. … Definitional equality can be used to rewrite expressions ….
on p. 60:
… intensional (sameness of meaning) …
For instance the symbols “” and “” (meaning the successor of the successor of ) are definitionally/intensionally equal terms (of type the natural numbers): the first is merely an abbreviation for the second.
Another sort of equality which is very important in type theory is computational, conversional, or reductional equality. This is the congruence on terms generated by various conversion or reduction rules, such as β-reduction or η-conversion (the choice of rules depends on the type theory).
The paradigmatic example of computational equality is a pair of terms like ”” and ””, where the second is obtained by -reduction from the first. In a type theory that includes definitions by recursion, expansion of a recursor is also computational equality. For instance, if addition is defined by recursion, then ”” (that is, ) reduces via this rule to ”” (that is, ).
For better or for worse, however, it is common in type theory to use the phrase “definitional equality” to include computational equality, even though it involves more than mere expansion of definitional abbreviations. There is even a phrase ”-reduction” for the substitution of definitions regarded as a conversion rule analogous to -reduction and -expansion. Thus, even though ”” and ”” are not literally equal by definition but only by performing some computation (even if the computation is fairly trivial in this case), the type of equality they do enjoy is generally called definitional.
Perhaps this is because in type theory, computational equality plays the same role as true definitional equality. In particular, typing judgments respect it: if , while and are computationally equal to and , then also . For and , this fact is sometimes called type preservation? and is an important provable aspect of a type theory. For and , the statement is generally only contentful in a dependent type theory, in which case it is often included explicitly as one of the typing rules.
Another apt word for computational equality is judgmental equality, since it is often expressed in type theory by a separate judgment: in addition to typing judgments , we have equality judgments . The rules for manipulating such judgments then include reflexivity, symmetry, transitivity, and the generating computations such as -reduction.
By contrast with ”” and ””, it is pretty much impossible to write down rules of computational equality such that the symbols “” and “” (in a context with free variables and for, say, natural numbers) become equal. They are (only) extensionally equal, in the sense that they become computationally equal when any particular natural numbers (such as and , say) are substituted for and . An actual proof is necessary to demonstrate this equality in general: it is not a definition but a theorem that for all natural numbers . With addition defined recursively on (say) its first argument, this theorem must be proven by induction on and is surprisingly nontrivial to formalize.
In type theory, this extensional equality is a judgement, not itself yet a proposition (an item in the formal system itself). It can be internalized, however, into a notion of equality called propositional equality, by introducing identity types (or identity propositions). Thus, is the type/proposition that is propositionally equal to , while is the proposition that addition is commutative. Exhibiting a term belonging to such a type is exhibiting (i.e. proving) such a propositonal equality.
The fact that typing judgments respect computational/judgmental equality means that if two terms , are computationally/judgmentally equal, then they are also propositionally equal. This is because the type is always inhabited by the reflexivity term , but then this term also inhabits the type .
The converse, however, is not true in general. It is possible to add a rule to type theory saying that “if is inhabited, then judgmentally”. (In this case, the adjectives “computational” and “definitional” sometimes used for judgmental equality truly lose their applicability.) This is a very strong way to make the type theory extensional type theory, but is often eschewed by type theorists (even those who don’t care about homotopy type theory) because it makes type checking undecidable — because type checking has to respect judgmental equality, such a rule means that it also has to respect propositional equality, which in turn means that it has to be able to evaluate arbitrary functions defined inside of type theory.
Every set has an equality relation, a binary relation according to which two elements and of are related if and only if they are equal; in this case we write . This is the smallest reflexive relation on , and it is in fact an equivalence relation; it is the only equivalence relation on that is also a partial order (although that fact is somewhat circular). This relation is often called the identity relation on , either because ‘identity’ can mean ‘equality’ or because it is the identity for composition of relations.
As a subset of , the equality relation is often called the diagonal and written or similarly. As an abstract set, this subset is isomorphic to itself, so one also sees the diagonal as a map, the diagonal function , which maps to ; note that . This is in Set; analogous diagonal morphisms exist in any cartesian monoidal category.
In an axiomatic set theory? such as ZFC or ETCS, the presence of the equality relation is part of the axiomatization, although this is usually swept under the rug by including an equality relation by default in all first-order theories. (It has to be made more explicit in a structural set theory such as SEAR, where there is no equality relation on sets themselves, only on elements of a particular set.)
equality is the subject of volume 1, book 2 “Die Lehre vom Wesen” (The doctrine of essence). As discussed at Science of Logic, one can roughly identify in Hegel’s text there the notion of intensional identity and of the reflector term in identity types.
Texts on type theory typically deal with the subtleties of the notion of equality. For instance
which might be the first paper to mention intensional equality (and the fact that it should be decidable), another reference is
which makes a distinction between definitional equality and “book” equality.