Equivalence Relations & Partial Orders
How equivalence relations collapse interchangeable representations into quotient objects, while partial orders preserve distinction and expose dependency, bounds, lattices, and linear extensions.
An equivalence relation says that several representations should count as the same abstract object. A partial order says that distinct objects can be no greater than one another without requiring every pair to be comparable. Quotients, dependency graphs, version constraints, inheritance, dataflow, and state-space reduction all depend on knowing which of those two structures is actually present.
Property names are quantified contracts #
Let . The variables below range over all of ; they are not assumed distinct.
| Property | Contract |
|---|---|
| reflexive | |
| irreflexive | |
| symmetric | |
| asymmetric | |
| antisymmetric | |
| transitive | |
| total / connected | , often required only for when is strict |
These words are not interchangeable:
- “not reflexive” means ; irreflexive means no element relates to itself.
- Antisymmetric does not mean “not symmetric.” Equality is both symmetric and antisymmetric. The subset relation is antisymmetric but not symmetric.
- An asymmetric relation is automatically irreflexive. A strict order such as is asymmetric; a non-strict order such as is reflexive and antisymmetric.
- Transitivity never requires to be different. Adding that restriction produces a weaker, nonstandard property.
Equivalence relations turn representations into classes #
Reflexivity puts in its own class. Symmetry makes class membership direction-independent. Transitivity makes overlap collapse into equality:
For the forward direction, if , then and , so and ; reverse the roles for the other inclusion. For the reverse direction, , so .
The equivalence–partition theorem #
Every equivalence relation produces the partition
The proof has three invariants:
- is nonempty because .
- The classes cover because every lies in .
- If and overlap at , then , so and the classes are equal. Thus unequal classes are disjoint.
Conversely, a partition defines
Coverage and disjointness give each element a unique block. “Same block” is immediately reflexive, symmetric, and transitive. The two constructions undo each other, which is why formal libraries can move between setoids and partitions; Mathlib exposes this correspondence through its setoid/partition API.
flowchart TD A["representations in A"] E["equivalence test x ~ y"] C1["class [a]"] C2["class [b]"] Q["quotient A / ~<br/>one point per class"] A --> E E -->|"collect all equivalents"| C1 E -->|"different class or same class"| C2 C1 --> Q C2 --> Q
The quotient forgets which representative was used but retains the class. That is useful only if later operations cannot observe the discarded difference.
Kernels, fibers, and canonical abstraction #
Every function induces an equivalence relation
Reflexivity, symmetry, and transitivity come directly from equality. Its classes are exactly the nonempty fibers . The map factors as
where and . The second map is bijective:
- it is well-defined because all representatives in have the same -value;
- it is injective because equal outputs mean equal classes;
- it is surjective by the definition of the range.
Well-defined functions on quotients #
Suppose is an equivalence relation on , one on , and we want
The formula mentions a representative , so it defines a function only if changing representatives cannot change the output class:
This is the compatibility or well-definedness condition. Proving it is mandatory; writing brackets around a formula does not make it true.
The same test governs quotient automata, normalized paths, case-insensitive identifiers, and values modulo a representation invariant.
Orders keep identity but constrain direction #
- Preorder
- A reflexive, transitive relation. Distinct elements may satisfy both directions.
- Partial order
- A preorder that is antisymmetric.
- Linear or total order
- A partial order in which every pair is comparable.
- Strict partial order
- An irreflexive, transitive relation. It is automatically asymmetric.
For a partial order , define
Conversely, from a strict partial order define iff or . Under the stated axioms these translations recover the corresponding strict/non-strict views. Formal order libraries make the same distinction: a preorder supplies reflexivity and transitivity, while a partial order adds antisymmetry; see Mathlib's partial-order definitions.
Examples clarify what each axiom does:
| Carrier and relation | Structure | Why |
|---|---|---|
| subsets of under | partial order | two inclusions force equality; many subsets are incomparable |
| positive integers under divisibility | partial order | and force for positive integers |
| integers under | linear order | every pair is comparable |
| tasks under “can reach by zero or more dependency steps” | preorder | cycles create distinct tasks reachable in both directions |
| strict ancestry in a tree | strict partial order | no node is its own strict ancestor; ancestry composes |
Hasse diagrams show only covers #
In a finite poset, is covered by when and there is no with . A Hasse diagram draws cover edges upward and omits reflexive loops, arrowheads, and edges implied by transitivity.
flowchart BT n1["1"] --- n2["2"] n1 --- n3["3"] n2 --- n4["4"] n2 --- n6["6"] n3 --- n6 n4 --- n12["12"] n6 --- n12
This is the divisibility order on the divisors of . The missing edge is not a missing relation: transitivity recovers . Nodes and are incomparable because neither divides the other. A Hasse diagram is therefore a transitive reduction of the order, not the complete adjacency relation.
Least, minimal, bounds, meet, and join #
Let be a subset of a poset .
| Concept | Quantifier pattern | Uniqueness |
|---|---|---|
| least element | for every | unique if it exists |
| minimal element | no satisfies | may be many |
| greatest element | dual of least | unique if it exists |
| maximal element | dual of minimal | may be many |
| lower bound | for every | may lie outside |
| greatest lower bound | greatest among lower bounds | unique if it exists |
| least upper bound | least among upper bounds | unique if it exists |
In the divisibility poset above:
- for , both elements are minimal and maximal within , but has no least or greatest element;
- the lower bounds of are , so the greatest lower bound is ;
- the only upper bound of within the displayed carrier is , so its least upper bound is .
The distinction is not vocabulary trivia. “Pick any minimal dependency” may admit several safe choices; “the least dependency” asserts a unique element below every other one.
Two canonical examples fix the notation:
- is a lattice with and .
- Positive divisors of , ordered by divisibility, form a lattice with meet and join .
Not every poset is a lattice. The subposet under divisibility has no meet for and , because their natural greatest common divisor is outside the carrier.
From dependency graphs to orders #
A directed dependency graph is not automatically a partial order.
- Start with a direct-edge relation .
- Its reflexive-transitive closure means “reachable in zero or more steps” and is always a preorder.
- If the graph is acyclic, mutual reachability implies equality, so is antisymmetric and therefore a partial order.
- If cycles exist, distinct vertices in one cycle are mutually reachable; antisymmetry fails.
The repair is principled: define
These are the strongly connected components (SCCs). Quotienting by collapses every cycle, and reachability between SCCs is a partial order. The resulting condensation graph is a DAG.
flowchart LR
a["a"] --> b["b"]
b --> a
b --> c["c"]
c --> d["d"]
d --> c
subgraph quotient["SCC quotient"]
ab["[a,b]"] --> cd["[c,d]"]
end
The four-state graph contains two cycles. The boxed SCC quotient has two abstract nodes and one directed order relation. This equivalence-then-order pattern is fundamental in module dependency analysis, automata minimization, build scheduling, and fixed-point computation.
Every preorder has a partial-order quotient #
The SCC construction is a special case. For any preorder , define
This is an equivalence relation:
- reflexivity follows from ;
- symmetry is built into the conjunction;
- transitivity follows by composing both directions.
Define iff . This is well-defined: if and , then
The quotient relation is reflexive and transitive, and if both and , then , hence . Antisymmetry has been recovered precisely by identifying the pairs that violated it.
Linear extensions and scheduling #
A linear extension of a finite poset is a total order that preserves every original comparison. Orient each Hasse edge from prerequisite to dependent; any topological ordering of that DAG is a linear extension.
The algorithmic invariant is simple: a node with indegree zero has no unplaced predecessor, so choosing it next cannot violate the partial order. Remove it and repeat. Different choices among currently minimal nodes produce different valid schedules.
Equivalence closure versus transitive closure #
Given an arbitrary relation :
- reflexive closure adds all ;
- symmetric closure adds reversed pairs;
- transitive closure adds positive-length consequences;
- equivalence closure is the least relation containing that is reflexive, symmetric, and transitive.
For a finite undirected edge list, equivalence closure is exactly “belongs to the same connected component,” which disjoint-set union (union–find) maintains efficiently. For a directed relation, ordinary connected components are not enough: direction matters, so use SCCs for mutual reachability or transitive closure for one-way reachability. Mathlib treats these as distinct formal constructions (ReflGen, SymmGen, TransGen, ReflTransGen, and EqvGen) rather than overloading one word “closure.”
Diagnostic checklist #
Before using a relation as an equivalence or order, test the intended meaning:
- Are the carrier and relation type fixed? Congruence modulo on produces ; silently switching the carrier to changes the quotient.
- Does “same” really satisfy transitivity? “Shares a tag with” is symmetric but need not be transitive.
- Are partition blocks nonempty, covering, and pairwise disjoint?
- Is every quotient operation independent of representatives?
- Does two-way comparability force equality? If not, the structure is a preorder; quotient the mutual pairs.
- Are incomparable elements allowed? If yes, do not apply linear-order intuitions.
- Is an element least/greatest, merely minimal/maximal, or only a bound outside the subset?
- Does a Hasse diagram show cover edges only, with crossings that do not imply junctions?
The decisive habit is to translate each word back into its quantifiers and then search for a smallest counterexample.
Sources
- bookSets, Functions, and Relations: Part I — Naïve Set Theorypdfnotes
- bookSpecial Sections of Mathematics 1: Discrete Mathematics, Section 1, Topic 1pdfnotes
- docsMathlib — Setoids and Partitions
- docsMathlib — Partial Orders
- docsMathlib — Bounds
- docsMathlib — Relations and Relation Closures