nLab propositional equality (changes)

Showing changes from revision #19 to #20: | Removed | Chan

This article is about the notion of equality as a proposition or predicate. For equality as a judgment, see judgmental equality. For equality as a type, see typal equality. For other notions of equality, see 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 = \linebreak 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
propositional 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

\tableofcontents

Idea

The usual notion of equality in mathematics as a proposition or a predicate. This notion of equality can be formalized in predicate logic over type theory and in dependent type theory.

Propositional equality is most commonly used in set theories like ZFC and ETCS and dependently sorted set theories.

Propositional equality can be contrasted with judgmental equality, where equality is a judgment, and typal equality, where equality is a type.

Definition

Typed first-order logic

In any two-layer type theory with a layer of types and a layer of propositions, or equivalently a first order logic over type theory or a first-order theory, every type AA has a binary relation according to which two elements xx and yy of AA are related if and only if they are equal; in this case we write x= Ayx =_A y. Since relations are propositions in the context of a term variable judgment in the type layer, this is called propositional equality. The formation and introduction rules for propositional equality is as follows

ΓAtypeΓ,x:A,y:Ax= AypropΓAtypeΓ,x:Ax= Axtrue\frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, x:A, y:A \vdash x =_A y \; \mathrm{prop}} \quad \frac{\Gamma \vdash A \; \mathrm{type}}{\Gamma, x:A \vdash x =_A x \; \mathrm{true}}

Then we have the elimination rules for propositional equality:

ΓAtypeΓ,x:A,y:AP(x,y)propΓ(x:A.P(x,x))(x:A.y:A.x= AyP(x,y))true\frac{\Gamma \vdash A \; \mathrm{type} \quad \Gamma, x:A, y:A \vdash P(x, y) \; \mathrm{prop}}{\Gamma \vdash \left(\forall x:A.P(x, x)\right) \implies \left(\forall x:A.\forall y:A.x =_A y \implies P(x, y)\right) \; \mathrm{true}}

Untyped first-order logic

Something similar occurs in untyped first-order logic, where the domain of discourse has a binary relation according to which two elements xx and yy are related if and only if they are equal; in this case we write x=yx = y. Since relations are propositions in the context of a term variable judgment in the type layer, this is similarly called propositional equality. The formation and introduction rules for propositional equality is as follows

ΓxΓyΓx=ypropΓxΓx=xtrue\frac{\Gamma \vdash x \quad \Gamma \vdash y}{\Gamma \vdash x = y \; \mathrm{prop}} \quad \frac{\Gamma \vdash x}{\Gamma \vdash x = x \; \mathrm{true}}

Then we have the elimination rules for propositional equality:

Γ,x,yP(x,y)propΓ(x.P(x,x))(x.y.x=yP(x,y))true\frac{\Gamma, x, y \vdash P(x, y) \; \mathrm{prop}}{\Gamma \vdash \left(\forall x.P(x, x)\right) \implies \left(\forall x.\forall y.x = y \implies P(x, y)\right) \; \mathrm{true}}

Properties

Propositional equality is an equivalence relation

The introduction rule of propositional equality says that propositional equality is reflexive.

We can show that propositional equality is symmetric, that for all x:Ax:A and y:Ay:A such that x= Ayx =_A y, we have y= Axy =_A x. By the introduction rule, we have that for all x:Ax:A, we have that x= Axx =_A x, and because all propositions imply themselves, we have that x= Axx =_A x implies x= Axx =_A x. Thus, by the elimination rules for propositional equality, for all x:Ax:A and y:Ay:A such that x= Ayx =_A y, we have y= Axy =_A x.

We can also show that propositional equality is transitive, that for all x:Ax:A, y:Ay:A, and z:Az:A such that x= Ayx =_A y, y= Azy =_A z implies that x= Azx =_A z. By the introduction rule, we have that for all x:Ax:A and a:B(x)a:B(x), we have that x= Axx =_A x, and because all propositions imply themselves, we have that x= Azx =_A z implies y= Azy =_A z, and because true propositions imply true propositions, we have that x= Axx =_A x implies that x= Azx =_A z implies x= Azx =_A z. Thus, by the elimination rules for propositional equality, for all x:Ax:A, y:Ay:A, and z:Az:A such that x= Ayx =_A y, y= Azy =_A z implies that x= Azx =_A z.

Thus, propositional equality is an equivalence relation.

Functions are extensional

For all function f:ABf:A \to B and elements x:Ax:A and y:Ay:A such that x= Ayx =_A y, f(x)= Bf(y)f(x) =_{B} f(y):

f:AB.x:A.y:A.x= Ayf(x)= Bf(y)\forall f:A \to B.\forall x:A.\forall y:A.x =_A y \implies f(x) =_{B} f(y)

This is because for all functions f:ABf:A \to B, by the introduction rule for propositional equality, for all elements x:Ax:A, f(x)= Bf(x)f(x) =_{B} f(x), and the elimination rule for propositional equality states that if for all elements x:Ax:A, f(x)= Bf(x)f(x) =_{B} f(x), then for all elements x:Ax:A and y:Ay:A such that x= Ayx =_A y, f(x)= Bf(y)f(x) =_{B} f(y).

Function extensionality

The extensionality principle for function types (function extensionality) states that for all functions f:ABf:A \to B and g:ABg:A \to B, f= ABgf =_{A \to B} g if and only if for all a:Aa:A and b:Ab:A such that a= Aba =_A b, f(a)= Bg(b)f(a) =_{B} g(b)

f:AB.g:AB.f= ABga:A.b:A.a= Ab(f(a)= Bg(b))\forall f:A \to B.\forall g:A \to B.f =_{A \to B} g \iff \forall a:A. \forall b:A.a =_A b \implies (f(a) =_{B} g(b))

Transport and heterogeneous propositional equality

Given a set AA and elements xAx \in A and yAy \in A and a family of sets (B(x)) xA(B(x))_{x \in A}, aB(x)a \in B(x) and bB(y)b \in B(y), if x= Ayx =_A y, then we can define transport functions tr A,B(x,y):B(x)B(y)\mathrm{tr}_{A, B}(x, y):B(x) \to B(y) whose inverse function is tr A,B(y,x)\mathrm{tr}_{A, B}(y, x) by symmetry of propositional equality.

The heterogeneous propositional equality is given by the logically equivalent relations

tr A,B(x,y,a)= B(y)bora= B(x)tr A,B(y,x,b)\mathrm{tr}_{A, B}(x, y, a) =_{B(y)} b \quad \mathrm{or} \quad a =_{B(x)} \mathrm{tr}_{A, B}(y, x, b)

Transport and heterogeneous propositional equality are important in some set theories which do not have equality between sets themselves, and the only way to compare sets for equality is through isomorphisms. The same is true of logic over dependent type theory which do not have definitional equality between types, and one has to use definitional isomorphisms instead. In the presence of equality between sets, transport is simply the identity function on the equal set.

In computation and uniqueness rules

In logic over dependent type theory, propositional equality can be used in the computation rules and uniqueness rules of types:

  • Computation rules for dependent product types:
Γ,x:Ab(x):B(x)Γa:AΓλ(x:A).b(x)(a)= B(a)b(a)true\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \lambda(x:A).b(x)(a) =_{B(a)} b(a) \; \mathrm{true}}
  • Uniqueness rules for dependent product types:
Γf: x:AB(x)Γf= x:AB(x)λ(x).f(x)true\frac{\Gamma \vdash f:\prod_{x:A} B(x)}{\Gamma \vdash f =_{\prod_{x:A} B(x)} \lambda(x).f(x) \; \mathrm{true}}
  • Computation rules for negative dependent sum types:
Γ,x:Ab(x):B(x)Γa:AΓπ 1(a,b)= AatrueΓ,x:Ab:BΓa:AΓπ 2(a,b)= B(π 1(a,b))btrue\frac{\Gamma, x:A \vdash b(x):B(x) \quad \Gamma \vdash a:A}{\Gamma \vdash \pi_1(a, b) =_A a \; \mathrm{true}} \qquad \frac{\Gamma, x:A \vdash b:B \quad \Gamma \vdash a:A}{\Gamma \vdash \pi_2(a, b) =_{B(\pi_1(a, b))} b \; \mathrm{true}}
  • Uniqueness rules for negative dependent sum types:
Γz: x:AB(x)Γz= x:AB(x)(π 1(z),π 2(z))true\frac{\Gamma \vdash z:\sum_{x:A} B(x)}{\Gamma \vdash z =_{\sum_{x:A} B(x)} (\pi_1(z), \pi_2(z)) \; \mathrm{true}}
  • Computation rules for identity types:
Γ,a:A,b:A,p:a= AbCtypeΓt: x:AC(x,x,refl A(x))Γc:AΓJ(t,c,c,refl(c))= C(c,c,refl A(c))t(c)true\frac{\Gamma, a:A, b:A, p:a =_A b \vdash C \; \mathrm{type} \quad \Gamma \vdash t:\prod_{x:A} C(x, x, \mathrm{refl}_A(x)) \quad \Gamma \vdash c:A}{\Gamma \vdash J(t, c, c, \mathrm{refl}(c)) =_{C(c, c, \mathrm{refl}_A(c))} t(c) \; \mathrm{true}}

In constructive and classical mathematics

Constructive mathematics is mathematics in which the law of excluded middle does not necessarily hold for propositions, subsingletons, or h-propositions. Classical mathematics is mathematics in which the law of excluded middle does hold for propositions, subsingletons, or h-propositions.

In classical mathematics, propositional equality of sets is a stable equivalence relation, and denial inequality of sets is a tight apartness relation. However, in constructive mathematics, propositional equality cannot be proven to be stable for all sets, and denial inequality cannot be proven to be a tight apartness relation for all sets. Instead, one could distinguish between 4 different notions of propositional equality and inequality:

The sets in which propositional equality and inequality behaves as it does in classical mathematics are the classical sets, the sets with an apartness relation such that every pair of elements are either equal or apart from each other.

As a result, in constructive mathematics, sometimes one takes sets with tight apartness relations instead of general sets to be the foundational primitive concept. In classical mathematics, this is unnecessary, because every set has a tight apartness relation.

In dependent type theory

In dependent type theory, the term propositional equality is used to describe a notion of equality type different from that of judgmental equality.

More specifically, there are two interpretations of propositions and logic in dependent type theory:

Instead, in propositions as some types , two elementsxx andyy of a typeAA are propositionally equal if xx and yy are uniquely identified; the identity type Id A(x,y)\mathrm{Id}_A(x, y) is a contractible type.

x=yisContr(Id A(x,y))x = y \coloneqq \mathrm{isContr}(\mathrm{Id}_A(x, y))

Expanding out the definition of a contractible type , a witness of propositional equality consists of anidentification and a contraction showing that the identification is thecenter of contraction of the identity type .

By this definition of equality, propositional equality is always a binary relation, because isContr is always a proposition in dependent type theory. In fact, if all identifications in an identity type are unique (i.e. there is a function Id A(x,y)x=y\mathrm{Id}_A(x, y) \to x = y), then the identity type is an h-proposition, and if the identity type is an h-proposition, then all identifications in the identity type are unique; hence the name propositional equality for unique identifications and the relation x=yx = y for the type isContr(Id A(x,y))\mathrm{isContr}(\mathrm{Id}_A(x, y)).

An h-set is then precisely a type where all identifications are unique, and the uniqueness of identity proofs can then be represented by a propositional analogue of equality reflection for extensional type theory:

Γp:Id A(x,y)ΓUIP(p):x=y\frac{\Gamma \vdash p:\mathrm{Id}_A(x, y)}{\Gamma \vdash \mathrm{UIP}(p):x = y}

making typal equality and propositional equality synonyms of each other again, because then all identity types are propositions and all identifications are unique.

Propositional equality defined in this manner is similar to the preset and setoid approaches to foundations of mathematics.

Propositional equality satisfies the principle of substitution by transport of the unique identification across predicates, and satisifes the identity of indiscernibles because propositional equality is always a proposition, and so we have:

x:A y:AisContr(Id A(x,y)) x:APropP(x)P(y)\prod_{x:A} \prod_{y:A} \mathrm{isContr}(\mathrm{Id}_A(x, y)) \simeq \prod_{x:A \to \mathrm{Prop}} P(x) \simeq P(y)

The identity of indiscernibles doesn’t work for arbitrary identity types of a type AA because the type x:APropP(x)P(y)\prod_{x:A \to \mathrm{Prop}} P(x) \simeq P(y) on the right hand side of the equivalence of types is always a proposition, and so if it were true, it would imply that AA is an h-set; hence the necessity to restrict to identity types with a unique identification.

However, propositional equality defined in this manner is not an equivalence relation because it is not a reflexive relation: for any loop space type which is not a contractible type, the proposition isContr(Id A(x,x))\mathrm{isContr}(\mathrm{Id}_A(x, x)) is an empty type. The only such types with a reflexive propositional equality are thus those that satisfy axiom K: the h-sets, thus making non-set types presets .

Furthermore, the type-theoretic functions are prefunctions with respect to propositional equality. While functions do preserve identifications, they do not preserve propositional equality in the sense of the uniqueness of identifications. Any identification is given by a function out of the interval type 𝕀\mathbb{I}, and the inductively generated identification p:Id 𝕀(0,1)p:\mathrm{Id}_\mathbb{I}(0, 1) in the interval type is unique in Id 𝕀(0,1)\mathrm{Id}_\mathbb{I}(0, 1), but not all identifications are unique in the absence of uniqueness of identity proofs. One can define an extensional function as one that does preserve the uniqueness of identifications, and prove that functions between h-sets preserve the uniqueness of identifications, and that h-sets are precisely the types between which all functions preserve uniqueness of identifications. To say that all functions are extensional along the lines of the preset approach to set theory is equivalent to the uniqueness of identity proofs that implies that all types are h-sets.

Most homotopy type theorists use the propositions as types interpretation of propositional equality as a synonym of typal equality, even by those who use the propositions as some types interpretation for everything else. Kevin Buzzard in Buzzard 2024 has used this fact and how that contradicts the interpretation of propositional equality elsewhere in mathematics as an argument for adopting a set-level type theory instead of homotopy type theory.

By Buzzard’s argument, homotopy type theorists should not be using the term “equality” to refer to arbitrary identifications or identity types, whether in its bare form or as propositional equality ortypal equality”, instead restricting the use of equality / propositional equality for only the unique identifications, and using a suitable alternative for “typal equality”, such as “identification” and “identified” and “identity type”. On the other hand, the fact that propositional equality defined as having a unique identification is not a reflexive relation for non-set types means that perhaps it is not suitable for the bare term “equality”, and perhaps the bare term “equality” and even the term “propositional equality” should refer to typal equality which is always reflexive.

Either way, in the absence of uniqueness of identity proofs, one has to give up either the notion of propositional equality as unique identification satisfying the identity of indiscernibles or the notion of propositional equality satisfying the first law of thought.

Propositional equality internal to a set theory

Relations and propositional equality could be internalized in any set theory: the internal propositional equality in set theory is the smallest internal reflexive relation on SS, and it is in fact an internal equivalence relation; it is the only internal equivalence relation on SS that is also a partial order (although that fact is somewhat circular). This relation is often called the identity relation on SS, either because ‘identity’ can mean ‘equality’ or because it is the identity for composition of relations.

In the category of reflexive relations on SS, the equality relation on SS is an initial reflexive relation; when the equality relation is a type family instead of a family of propositions, then the equality relation is the initial type generated by reflexivity or the first law of thought.

As a subset of S×SS \times S, the equality relation is often called the diagonal and written Δ S\Delta_S or similarly. As an abstract set, this subset is isomorphic to SS itself, so one also sees the diagonal as a map, the diagonal function SΔ SS×SS \overset{\Delta_S}\to S \times S, which maps xx to (x,x)(x,x); note that x=xx = x. This is in Set; analogous diagonal morphisms exist in any cartesian monoidal category.

 See also

\phantom{-}symbol\phantom{-}\phantom{-}in logic\phantom{-}
A\phantom{A}\inA\phantom{A}element relation
A\phantom{A}:\,:A\phantom{A}typing relation
A\phantom{A}==A\phantom{A}propositional equality
A\phantom{A}\vdashA\phantom{A}A\phantom{A}entailment / sequentA\phantom{A}
A\phantom{A}\topA\phantom{A}A\phantom{A}true / topA\phantom{A}
A\phantom{A}\botA\phantom{A}A\phantom{A}false / bottomA\phantom{A}
A\phantom{A}\RightarrowA\phantom{A}implication
A\phantom{A}\LeftrightarrowA\phantom{A}logical equivalence
A\phantom{A}¬\notA\phantom{A}negation
A\phantom{A}\neqA\phantom{A}inequality / apartnessA\phantom{A}
A\phantom{A}\notinA\phantom{A}negation of element relation A\phantom{A}
A\phantom{A}¬¬\not \notA\phantom{A}negation of negationA\phantom{A}
A\phantom{A}\existsA\phantom{A}existential quantificationA\phantom{A}
A\phantom{A}\forallA\phantom{A}universal quantificationA\phantom{A}
A\phantom{A}\wedgeA\phantom{A}logical conjunction
A\phantom{A}\veeA\phantom{A}logical disjunction
symbolin type theory (propositions as types)
A\phantom{A}\toA\phantom{A}function type (implication)
A\phantom{A}×\timesA\phantom{A}product type (conjunction)
A\phantom{A}++A\phantom{A}sum type (disjunction)
A\phantom{A}00A\phantom{A}empty type (false)
A\phantom{A}11A\phantom{A}unit type (true)
A\phantom{A}==A\phantom{A}identity type (propositional equality)
A\phantom{A}\simeqA\phantom{A}equivalence of types (logical equivalence)
A\phantom{A}\sumA\phantom{A}dependent sum type (existential quantifier)
A\phantom{A}\prodA\phantom{A}dependent product type (universal quantifier)
symbolin linear logic
A\phantom{A}\multimapA\phantom{A}A\phantom{A}linear implicationA\phantom{A}
A\phantom{A}\otimesA\phantom{A}A\phantom{A}multiplicative conjunctionA\phantom{A}
A\phantom{A}\oplusA\phantom{A}A\phantom{A}additive disjunctionA\phantom{A}
A\phantom{A}&\&A\phantom{A}A\phantom{A}additive conjunctionA\phantom{A}
A\phantom{A}\invampA\phantom{A}A\phantom{A}multiplicative disjunctionA\phantom{A}
A\phantom{A}!\;!A\phantom{A}A\phantom{A}exponential conjunctionA\phantom{A}
A\phantom{A}?\;?A\phantom{A}A\phantom{A}exponential disjunctionA\phantom{A}

References

The usual notion of equality as a proposition is discussed in

Last revised on June 16, 2025 at 12:40:21. See the history of this page for a list of all contributions to it.