In constructive mathematics, a set has decidable equality if any two elements of are either equal or not equal. Equivalently, has decidable equality if its equality relation is a decidable subset of . Sometimes one says that such a set is discrete, although of course this term has many meanings. Of course, in classical mathematics, every set has decidable equality. But the concept generalises in topos theory to the notion of decidable object.
More generally, has stable equality if any two elements of are equal if (hence iff) they are not not equal. Every set with decidable equality must also have stable equality, but not conversely.
Working with decidable subsets of sets with decidable equality makes constructive mathematics very much like classical mathematics. This is why constructivism has few consequences for basic combinatorics and algebra (although it does have important consequences for more advanced topics in those fields). In analysis, in contrast, constructivism matters right away, because the set of real numbers may not have decidable equality. (However, the set of located real numbers does have stable equality.)
In type-theoretic foundations, the notion of decidable equality is slightly different depending on whether “or” is interpreted using propositions as types or propositions as some types. That is, decidable equality for could be either of the two types
where denotes a bracket type. Since every type maps to its bracket, implies .
On the other hand, if holds and is an h-set, i.e. it satisfies uniqueness of identity proofs, then and represent disjoint subobjects of . Thus is already a subobject of , so it is equivalent to its bracket, and also holds.
The converse of this is also true: if holds, then not only does also hold, but in fact is an h-set. This was first proven by Michael Hedberg; a proof can be found at h-set and in the references below. This fact is useful in homotopy type theory to show that many familiar types, such as the natural numbers, are h-sets.
For non-h-sets, the difference between and can be dramatic. For instance, if we model homotopy type theory in a Boolean -topos (such as constructed classically), then every type satisfies (which is what it means for the logic to be boolean), but only the h-sets satisfy (in accordance with Hedberg's theorem).
Michael Hedberg, A coherence theorem for Martin-Löf’s type theory, J. Functional Programming, 1998
Nicolai Kraus, A direct proof of Hedberg’s theorem, blog post