Equivalence relations #
This file defines the complete lattice of equivalence relations on a type, results about the inductively defined equivalence closure of a binary relation, and the analogues of some isomorphism theorems for quotients of arbitrary types.
Implementation notes #
The function Rel
and lemmas ending in ' make it easier to talk about different
equivalence relations on the same type.
The complete lattice instance for equivalence relations could have been defined by lifting
the Galois insertion of equivalence relations on α into binary relations on α, and then using
CompleteLattice.copy
to define a complete lattice instance with more appropriate
definitional equalities (a similar example is Filter.CompleteLattice
in
Order/Filter/Basic.lean
). This does not save space, however, and is less clear.
Partitions are not defined as a separate structure here; users are encouraged to
reason about them using the existing Setoid
and its infrastructure.
Tags #
setoid, equivalence, iseqv, relation, equivalence relation
A version of Setoid.r
that takes the equivalence relation as an explicit argument.
Equations
- Setoid.Rel r = Setoid.r
Instances For
Equations
- Setoid.decidableRel r = h
A version of Quotient.eq'
compatible with Setoid.Rel
, to make rewriting possible.
Two equivalence relations are equal iff their underlying binary operations are equal.
Defining ≤
for equivalence relations.
Equations
- Setoid.instLESetoid = { le := fun r s => ∀ ⦃x y : α⦄, Setoid.Rel r x y → Setoid.Rel s x y }
The kernel of a function is an equivalence relation.
Equations
- Setoid.ker f = { r := (fun x x_1 => x = x_1) on f, iseqv := (_ : Equivalence (Eq on f)) }
Instances For
The kernel of the quotient map induced by an equivalence relation r equals r.
Given types α
, β
, the product of two equivalence relations r
on α
and s
on β
:
(x₁, x₂), (y₁, y₂) ∈ α × β
are related by r.prod s
iff x₁
is related to y₁
by r
and x₂
is related to y₂
by s
.
Equations
- Setoid.prod r s = { r := fun x y => Setoid.Rel r x.fst y.fst ∧ Setoid.Rel s x.snd y.snd, iseqv := (_ : Equivalence fun x y => Setoid.Rel r x.fst y.fst ∧ Setoid.Rel s x.snd y.snd) }
Instances For
The infimum of two equivalence relations.
Equations
- One or more equations did not get rendered due to their size.
The infimum of 2 equivalence relations r and s is the same relation as the infimum of the underlying binary operations.
The infimum of a set of equivalence relations.
Equations
- One or more equations did not get rendered due to their size.
The underlying binary operation of the infimum of a set of equivalence relations is the infimum of the set's image under the map to the underlying binary operation.
The complete lattice of equivalence relations on a type, with bottom element =
and top element the trivial equivalence relation.
Equations
- One or more equations did not get rendered due to their size.
The inductively defined equivalence closure of a binary relation r is the infimum of the set of all equivalence relations containing r.
The supremum of two equivalence relations r and s is the equivalence closure of the binary
relation x is related to y by r or s
.
The supremum of 2 equivalence relations r and s is the equivalence closure of the supremum of the underlying binary operations.
The supremum of a set S of equivalence relations is the equivalence closure of the binary
relation there exists r ∈ S relating x and y
.
The supremum of a set of equivalence relations is the equivalence closure of the supremum of the set's image under the map to the underlying binary operation.
The equivalence closure of an equivalence relation r is r.
Equivalence closure is idempotent.
The equivalence closure of a binary relation r is contained in any equivalence relation containing r.
Equivalence closure of binary relations is monotone.
There is a Galois insertion of equivalence relations on α into binary relations on α, with equivalence closure the lower adjoint.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A function from α to β is injective iff its kernel is the bottom element of the complete lattice of equivalence relations on α.
The elements related to x ∈ α by the kernel of f are those in the preimage of f(x) under f.
Equivalence between functions α → β
such that r x y → f x = f y
and functions
quotient r → β
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The uniqueness part of the universal property for quotients of an arbitrary type.
Given a map f from α to β, the natural map from the quotient of α by the kernel of f is injective.
Given a map f from α to β, the kernel of f is the unique equivalence relation on α whose induced map from the quotient of α to β is injective.
The first isomorphism theorem for sets: the quotient of α by the kernel of a function f bijects with f's image.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If f
has a computable right-inverse, then the quotient by its kernel is equivalent to its
domain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The quotient of α by the kernel of a surjective function f bijects with f's codomain.
If a specific right-inverse of f
is known, Setoid.quotientKerEquivOfRightInverse
can be
definitionally more useful.
Equations
Instances For
Given a function f : α → β
and equivalence relation r
on α
, the equivalence
closure of the relation on f
's image defined by 'x ≈ y
iff the elements of f⁻¹(x)
are
related to the elements of f⁻¹(y)
by r
.'
Equations
- Setoid.map r f = EqvGen.Setoid fun x y => ∃ a b, f a = x ∧ f b = y ∧ Setoid.Rel r a b
Instances For
Given a surjective function f whose kernel is contained in an equivalence relation r, the equivalence relation on f's codomain defined by x ≈ y ↔ the elements of f⁻¹(x) are related to the elements of f⁻¹(y) by r.
Equations
- Setoid.mapOfSurjective r f h hf = { r := fun x y => ∃ a b, f a = x ∧ f b = y ∧ Setoid.Rel r a b, iseqv := (_ : Equivalence fun x y => ∃ a b, f a = x ∧ f b = y ∧ Setoid.Rel r a b) }
Instances For
A special case of the equivalence closure of an equivalence relation r equalling r.
Given a function f : α → β
, an equivalence relation r
on β
induces an equivalence
relation on α
defined by 'x ≈ y
iff f(x)
is related to f(y)
by r
'.
See note [reducible non-instances].
Equations
- Setoid.comap f r = { r := Setoid.Rel r on f, iseqv := (_ : Equivalence (Setoid.r on f)) }
Instances For
Given a map f : N → M
and an equivalence relation r
on β
, the equivalence relation
induced on α
by f
equals the kernel of r
's quotient map composed with f
.
The second isomorphism theorem for sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The third isomorphism theorem for sets.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an equivalence relation r
on α
, the order-preserving bijection between the set of
equivalence relations containing r
and the equivalence relations on the quotient of α
by r
.
Equations
- One or more equations did not get rendered due to their size.