nLab definitional equality

Context

Type theory

natural deduction metalanguage, practical foundations

  1. type formation rule
  2. term introduction rule
  3. term elimination rule
  4. computation rule

type theory (dependent, intensional, observational type theory, homotopy type theory)

syntax object language

computational trinitarianism =
propositions as types +programs as proofs +relation type theory/category theory

logicset theory (internal logic of)category theorytype theory
propositionsetobjecttype
predicatefamily of setsdisplay morphismdependent type
proofelementgeneralized elementterm/program
cut rulecomposition of classifying morphisms / pullback of display mapssubstitution
introduction rule for implicationcounit for hom-tensor adjunctionlambda
elimination rule for implicationunit for hom-tensor adjunctionapplication
cut elimination for implicationone of the zigzag identities for hom-tensor adjunctionbeta reduction
identity elimination for implicationthe other zigzag identity for hom-tensor adjunctioneta conversion
truesingletonterminal object/(-2)-truncated objecth-level 0-type/unit type
falseempty setinitial objectempty type
proposition, truth valuesubsingletonsubterminal object/(-1)-truncated objecth-proposition, mere proposition
logical conjunctioncartesian productproductproduct type
disjunctiondisjoint union (support of)coproduct ((-1)-truncation of)sum type (bracket type of)
implicationfunction set (into subsingleton)internal hom (into subterminal object)function type (into h-proposition)
negationfunction set into empty setinternal hom into initial objectfunction type into empty type
universal quantificationindexed cartesian product (of family of subsingletons)dependent product (of family of subterminal objects)dependent product type (of family of h-propositions)
existential quantificationindexed disjoint union (support of)dependent sum ((-1)-truncation of)dependent sum type (bracket type of)
logical equivalencebijection setobject of isomorphismsequivalence type
support setsupport object/(-1)-truncationpropositional truncation/bracket type
n-image of morphism into terminal object/n-truncationn-truncation modality
equalitydiagonal function/diagonal subset/diagonal relationpath space objectidentity type/path type
completely presented setsetdiscrete object/0-truncated objecth-level 2-type/set/h-set
setset with equivalence relationinternal 0-groupoidBishop set/setoid with its pseudo-equivalence relation an actual equivalence relation
equivalence class/quotient setquotientquotient type
inductioncolimitinductive type, W-type, M-type
higher inductionhigher colimithigher inductive type
-0-truncated higher colimitquotient inductive type
coinductionlimitcoinductive type
presettype without identity types
set of truth valuessubobject classifiertype of propositions
domain of discourseuniverseobject classifiertype universe
modalityclosure operator, (idempotent) monadmodal type theory, monad (in computer science)
linear logic(symmetric, closed) monoidal categorylinear type theory/quantum computation
proof netstring diagramquantum circuit
(absence of) contraction rule(absence of) diagonalno-cloning theorem
synthetic mathematicsdomain specific embedded programming language

homotopy levels

semantics

Equality and Equivalence

Contents

 Idea

In logic and type theory, definitional equality is the metatheoretic equivalence relation on syntactic expressions (types, terms, propositions, contexts, whatever) which states that two syntactic expressions are equivalent if they have the same meaning. Thus, definitional equality encompasses both syntactic equality and alpha-equivalence, as well as equivalence of abbreviations and so forth.

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) …

Definitional equality is commonly written as \equiv, and is used to define certain symbols, abbreviations, and syntactical expressions as other syntactical expressions. For example, one might want to define the symbol 22 as the syntactical expression s(s(0))s(s(0)) representing the successor of the successor of zero in the natural numbers; definitional equality makes it so that in the metatheory, 2s(s(0))2 \equiv s(s(0)).

In addition, definitions are made using the single assignment operator \coloneqq in the metatheory, so one would write 2s(s(0))2 \coloneqq s(s(0)).

Internalizing definitional equality

Even though definitional equality is defined on general syntactic expressions in the metatheory, for specific syntactic expressions, such as those for types and terms, it is possible to internalize the notion of definitional equality inside of the object theory itself. This is formalized by the use of equality with another term or type.

More specifically, every definition of a symbol AA comes with a formation rule for the symbol which states that it is a type or an introduction rule for the symbol which states that it is a term of a type, and a definition rule that the term or type AA is equal to some existing term or type BB. The equality used in the definition rule is the internal definitional equality of the theory.

As documented in the article on equality, there are three notions of equality used in type theory: judgmental equality, propositional equality, and typal equality. All three notions of equality could be used as the internal definitional equality. In Martin-Löf type theory and cubical type theory, judgmental equality is used for the internal definitional equality. In ZFC and ETCS, propositional equality is used for the internal definitional equality, and in some objective type theories, typal equality is used for the internal definitional equality.

Returning back to the initial example given in the section above, one usually defines the symbol 22 to be the term s(s(0))s(s(0)) in the type of natural numbers. The symbol 22 is formally defined using the internal definitional equality as follows:

  • Introduction and judgmental definition rules for 22:
ΓtypeΓ2:ΓtypeΓ2=s(s(0)):\frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash 2:\mathbb{N}} \qquad \frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash 2 = s(s(0)):\mathbb{N}}
  • Introduction and propositional definition rules for 22:
ΓtypeΓ2:ΓtypeΓ2= s(s(0))true\frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash 2:\mathbb{N}} \qquad \frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash 2 =_{\mathbb{N}} s(s(0)) \; \mathrm{true}}
  • Introduction and typal definition rules for 22:
ΓtypeΓ2:ΓtypeΓδ 2:2= s(s(0))\frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash 2:\mathbb{N}} \qquad \frac{\Gamma \vdash \mathbb{N} \; \mathrm{type}}{\Gamma \vdash \delta_2:2 =_{\mathbb{N}} s(s(0))}

Similarly, the symbol isProp(A)\mathrm{isProp}(A), which is usually defined as the type

x:A y:Ax= Ay\prod_{x:A} \prod_{y:A} x =_A y

This is formally defined using the internal definitional equality as follows:

  • Formation and judgmental definition rules for isProp(A)\mathrm{isProp}(A):
ΓAtypeΓisProp(A)typeΓAtypeΓisProp(A)= x:A y:Ax= Aytype\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{isProp}(A) \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{isProp}(A) = \prod_{x:A} \prod_{y:A} x =_A y \; \mathrm{type}}
  • Formation and propositional definition rules for isProp(A)\mathrm{isProp}(A):
ΓAtypeΓisProp(A)typeΓAtypeΓisProp(A)= x:A y:Ax= Aytrue\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{isProp}(A) \; \mathrm{type}} \qquad \frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{isProp}(A) = \prod_{x:A} \prod_{y:A} x =_A y\; \mathrm{true}}
  • Formation and typal definition rules for isProp(A)\mathrm{isProp}(A):
ΓAtypeΓisProp(A)typeΓisProp(A)typeΓδ isProp(A):isProp(A) x:A y:Ax= Ay\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma \vdash \mathrm{isProp}(A) \; \mathrm{type}} \qquad \frac{\Gamma \vdash \mathrm{isProp}(A) \; \mathrm{type}}{\Gamma \vdash \delta_{\mathrm{isProp}(A)}:\mathrm{isProp}(A) \simeq \prod_{x:A} \prod_{y:A} x =_A y}

 History

The notion of definitional equality was introduced first in AUTOMATH. The following paper presents a suggestive explanation of this notion and how proof-checking was designed in this system (especially section 10):

On the roles of types in mathematics

The notion of definitional equality was later introduced by Per Martin-Löf, first in the context of normalization proofs for higher-order logic in the paper Hauptsatz for Intuitionistic Simple Type Theory and generalized in Type Theory. He discusses this notion in the paper About Models for Intuitionistic Type Theory and The notion of Definitional Equality.

The extension from AUTOMATH is that one adds the notion of data type (natural number), of constructors (zero and successor) and primitive recursion as definitional equality. The motivation is that one can consider the schema of primitive recursion as a definition of a function.

This was also influenced by natural deduction, where constructors correspond to introduction rules and the work of Gödel on system T.

With this extension, one obtains a programming language with dependent types and where computations correspond to unfolding of definitions (that can be primitive recursive definitions). This programming language has the feature that all computations terminate. This has been also considered in functional programming, see e.g. the discussion in this paper.

A description of the evaluation algorithm using techniques from functional programming can be found in this work of Gregoire and Leroy.

Note on terminology

Historically in the dependent type theory community, the term definitional equality was used for judgmental equality. This was because in the most common model of dependent type theory, Martin-Löf type theory, judgmental equality was used for the internal definitional equality of the theory. However, we choose to make a distinction between definitional equality and judgmental equality, as not all type theories have judgmental equalities or internal definitional equalities: in particular, many objective type theories do not have judgmental equalities or an internal definitional equality, but nevertheless still have a metatheoretic definitional equality.

Even if we restrict to internal definitional equality, there is still a distinction between definitional equality and judgmental equality. First, the internal definitional equality is propositional equality in the most common foundations of mathematics, such as ZFC and ETCS, instead of judgmental equality. In addition, one could work in logic over dependent type theory and replace judgmental equality entirely by propositional equality throughout the type theory, resulting in a type theory which behaves almost identically to the original type theory, only that the internal definitional equality is a proposition instead of a judgment (see the second presentation of Martin-Löf type theory on that article). Finally, in the advent of objective type theory and other dependent type theories which lack judgmental equality entirely, it is typal equality which is used in the internal definitional equality.

See also

 References

The first paper to mention intensional equality (and the fact that it should be decidable) may be:

  • Kurt Gödel, Über eine bisher noch nicht benützte Erweiterung des finiten Standpunktes. Dialectica (1958), pp. 280–287,

The distinction between definitional equality and “book” equality:

The notion of definitional equality in the context of (dependent) type theory:

specifically in the Coq proof assistant:

Last revised on May 26, 2023 at 22:26:54. See the history of this page for a list of all contributions to it.