Congruence relations #
This file defines congruence relations: equivalence relations that preserve a binary operation,
which in this case is multiplication or addition. The principal definition is a structure
extending a Setoid
(an equivalence relation), and the inductive definition of the smallest
congruence relation containing a binary relation is also given (see ConGen
).
The file also proves basic properties of the quotient of a type by a congruence relation, and the
complete lattice of congruence relations on a type. We then establish an order-preserving bijection
between the set of congruence relations containing a congruence relation c
and the set of
congruence relations on the quotient by c
.
The second half of the file concerns congruence relations on monoids, in which case the quotient by the congruence relation is also a monoid.
Implementation notes #
The inductive definition of a congruence relation could be a nested inductive type, defined using
the equivalence closure of a binary relation EqvGen
, but the recursor generated does not work.
A nested inductive definition could conceivably shorten proofs, because they would allow invocation
of the corresponding lemmas about EqvGen
.
The lemmas refl
, symm
and trans
are not tagged with @[refl]
, @[symm]
, and @[trans]
respectively as these tags do not work on a structure coerced to a binary relation.
There is a coercion from elements of a type to the element's equivalence class under a congruence relation.
A congruence relation on a monoid M
can be thought of as a submonoid of M × M
for which
membership is an equivalence relation, but whilst this fact is established in the file, it is not
used, since this perspective adds more layers of definitional unfolding.
Tags #
congruence, congruence relation, quotient, quotient by congruence relation, monoid, quotient monoid, isomorphism theorems
A congruence relation on a type with an addition is an equivalence relation which preserves addition.
- iseqv : Equivalence ⇑self.toSetoid
Additive congruence relations are closed under addition
Instances For
A congruence relation on a type with a multiplication is an equivalence relation which preserves multiplication.
- iseqv : Equivalence ⇑self.toSetoid
Congruence relations are closed under multiplication
Instances For
The inductively defined smallest additive congruence relation containing a given binary relation.
- of: ∀ {M : Type u_1} [inst : Add M] {r : M → M → Prop} (x y : M), r x y → AddConGen.Rel r x y
- refl: ∀ {M : Type u_1} [inst : Add M] {r : M → M → Prop} (x : M), AddConGen.Rel r x x
- symm: ∀ {M : Type u_1} [inst : Add M] {r : M → M → Prop} {x y : M}, AddConGen.Rel r x y → AddConGen.Rel r y x
- trans: ∀ {M : Type u_1} [inst : Add M] {r : M → M → Prop} {x y z : M}, AddConGen.Rel r x y → AddConGen.Rel r y z → AddConGen.Rel r x z
- add: ∀ {M : Type u_1} [inst : Add M] {r : M → M → Prop} {w x y z : M}, AddConGen.Rel r w x → AddConGen.Rel r y z → AddConGen.Rel r (w + y) (x + z)
Instances For
The inductively defined smallest multiplicative congruence relation containing a given binary relation.
- of: ∀ {M : Type u_1} [inst : Mul M] {r : M → M → Prop} (x y : M), r x y → ConGen.Rel r x y
- refl: ∀ {M : Type u_1} [inst : Mul M] {r : M → M → Prop} (x : M), ConGen.Rel r x x
- symm: ∀ {M : Type u_1} [inst : Mul M] {r : M → M → Prop} {x y : M}, ConGen.Rel r x y → ConGen.Rel r y x
- trans: ∀ {M : Type u_1} [inst : Mul M] {r : M → M → Prop} {x y z : M}, ConGen.Rel r x y → ConGen.Rel r y z → ConGen.Rel r x z
- mul: ∀ {M : Type u_1} [inst : Mul M] {r : M → M → Prop} {w x y z : M}, ConGen.Rel r w x → ConGen.Rel r y z → ConGen.Rel r (w * y) (x * z)
Instances For
Additive congruence relations are reflexive.
Additive congruence relations are symmetric.
Additive congruence relations are transitive.
Given a type M
with a multiplication, a congruence relation c
on M
, and elements of M
x, y
, (x, y) ∈ M × M
iff x
is related to y
by c
.
Given a type M
with an addition, x, y ∈ M
, and an additive congruence relation
c
on M
, (x, y) ∈ M × M
iff x
is related to y
by c
.
The kernel of a multiplication-preserving function as a congruence relation.
Equations
- Con.mulKer f h = { toSetoid := Setoid.ker f, mul' := ⋯ }
Instances For
The kernel of an addition-preserving function as an additive congruence relation.
Equations
- AddCon.addKer f h = { toSetoid := Setoid.ker f, add' := ⋯ }
Instances For
The quotient by a decidable congruence relation has decidable equality.
Equations
- c.instDecidableEqQuotientOfDecidableCoeForallProp = inferInstanceAs (DecidableEq (Quotient c.toSetoid))
The quotient by a decidable additive congruence relation has decidable equality.
Equations
- c.instDecidableEqQuotientOfDecidableCoeForallProp = inferInstanceAs (DecidableEq (Quotient c.toSetoid))
The function on the quotient by a congruence relation c
induced by a function that is
constant on c
's equivalence classes.
Equations
- Con.liftOn q f h = Quotient.liftOn' q f h
Instances For
The function on the quotient by a congruence relation c
induced by a function that is constant on c
's equivalence classes.
Equations
- AddCon.liftOn q f h = Quotient.liftOn' q f h
Instances For
The binary function on the quotient by a congruence relation c
induced by a binary function
that is constant on c
's equivalence classes.
Equations
- Con.liftOn₂ q r f h = Quotient.liftOn₂' q r f h
Instances For
The binary function on the quotient by a congruence relation c
induced by a binary function that is constant on c
's equivalence classes.
Equations
- AddCon.liftOn₂ q r f h = Quotient.liftOn₂' q r f h
Instances For
A version of Quotient.hrecOn₂'
for quotients by Con
.
Equations
- Con.hrecOn₂ a b f h = Quotient.hrecOn₂' a b f h
Instances For
A version of Quotient.hrecOn₂'
for quotients by AddCon
.
Equations
- AddCon.hrecOn₂ a b f h = Quotient.hrecOn₂' a b f h
Instances For
A version of Con.induction_on
for predicates which take two arguments.
A version of AddCon.induction_on
for predicates which take
two arguments.
The multiplication induced on the quotient by a congruence relation on a type with a multiplication.
Equations
- c.hasMul = { mul := Quotient.map₂' (fun (x1 x2 : M) => x1 * x2) ⋯ }
The addition induced on the quotient by an additive congruence relation on a type with an addition.
Equations
- c.hasAdd = { add := Quotient.map₂' (fun (x1 x2 : M) => x1 + x2) ⋯ }
The kernel of the quotient map induced by a congruence relation c
equals c
.
The kernel of the quotient map induced by an additive congruence
relation c
equals c
.
Definition of the function on the quotient by a congruence relation c
induced by a function
that is constant on c
's equivalence classes.
Definition of the function on the quotient by an additive congruence
relation c
induced by a function that is constant on c
's equivalence classes.
Equations
- Con.instPartialOrder = PartialOrder.mk ⋯
Equations
- AddCon.instPartialOrder = PartialOrder.mk ⋯
The complete lattice of congruence relations on a given type with a multiplication.
Equations
- Con.instCompleteLattice = CompleteLattice.mk ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
The complete lattice of additive congruence relations on a given type with an addition.
Equations
- AddCon.instCompleteLattice = CompleteLattice.mk ⋯ ⋯ ⋯ ⋯ ⋯ ⋯
The inductively defined smallest additive congruence relation
containing a binary relation r
equals the infimum of the set of additive congruence relations
containing r
.
Given binary relations r, s
with r
contained in s
, the
smallest additive congruence relation containing s
contains the smallest additive congruence
relation containing r
.
The supremum of a set of additive congruence relations S
equals
the smallest additive congruence relation containing the binary relation 'there exists c ∈ S
such that x
is related to y
by c
'.
The supremum of a set of additive congruence relations is the same as the smallest additive congruence relation containing the supremum of the set's image under the map to the underlying binary relation.
There is a Galois insertion of congruence relations on a type with a multiplication M
into
binary relations on M
.
Equations
Instances For
There is a Galois insertion of additive congruence relations on a type with
an addition M
into binary relations on M
.
Equations
Instances For
Given a function f
, the smallest congruence relation containing the binary relation on f
's
image defined by 'x ≈ y
iff the elements of f⁻¹(x)
are related to the elements of f⁻¹(y)
by a congruence relation c
.'
Instances For
Given a function f
, the smallest additive congruence relation containing the
binary relation on f
's image defined by 'x ≈ y
iff the elements of f⁻¹(x)
are related to the
elements of f⁻¹(y)
by an additive congruence relation c
.'
Instances For
Given a surjective multiplicative-preserving function f
whose kernel is contained in a
congruence relation c
, the congruence relation on f
's codomain defined by 'x ≈ y
iff the
elements of f⁻¹(x)
are related to the elements of f⁻¹(y)
by c
.'
Equations
- c.mapOfSurjective f H h hf = { toSetoid := c.mapOfSurjective f h hf, mul' := ⋯ }
Instances For
Given a surjective addition-preserving function f
whose kernel is contained in
an additive congruence relation c
, the additive congruence relation on f
's codomain defined
by 'x ≈ y
iff the elements of f⁻¹(x)
are related to the elements of f⁻¹(y)
by c
.'
Equations
- c.mapOfSurjective f H h hf = { toSetoid := c.mapOfSurjective f h hf, add' := ⋯ }
Instances For
A specialization of 'the smallest congruence relation containing a congruence relation c
equals c
'.
A specialization of 'the smallest additive congruence relation containing
an additive congruence relation c
equals c
'.
Given types with multiplications M, N
and a congruence relation c
on N
, a
multiplication-preserving map f : M → N
induces a congruence relation on f
's domain
defined by 'x ≈ y
iff f(x)
is related to f(y)
by c
.'
Equations
- Con.comap f H c = { toSetoid := Setoid.comap f c.toSetoid, mul' := ⋯ }
Instances For
Given types with additions M, N
and an additive congruence relation c
on N
,
an addition-preserving map f : M → N
induces an additive congruence relation on f
's domain
defined by 'x ≈ y
iff f(x)
is related to f(y)
by c
.'
Equations
- AddCon.comap f H c = { toSetoid := Setoid.comap f c.toSetoid, add' := ⋯ }
Instances For
Given a congruence relation c
on a type M
with a multiplication, the order-preserving
bijection between the set of congruence relations containing c
and the congruence relations
on the quotient of M
by c
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given an additive congruence relation c
on a type M
with an addition,
the order-preserving bijection between the set of additive congruence relations containing c
and
the additive congruence relations on the quotient of M
by c
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The quotient of a monoid by a congruence relation is a monoid.
Equations
- c.mulOneClass = MulOneClass.mk ⋯ ⋯
The quotient of an AddMonoid
by an additive congruence relation is
an AddMonoid
.
Equations
- c.addZeroClass = AddZeroClass.mk ⋯ ⋯
The 1 of the quotient of a monoid by a congruence relation is the equivalence class of the monoid's 1.
There exists an element of the quotient of a monoid by a congruence relation (namely 1).
Equations
- Con.Quotient.inhabited = { default := ↑1 }
There exists an element of the quotient of an AddMonoid
by a congruence relation
(namely 0).
Equations
- AddCon.Quotient.inhabited = { default := ↑0 }
Equations
- c.one = { one := Quotient.mk'' 1 }
Equations
- c.zero = { zero := Quotient.mk'' 0 }
Equations
- AddCon.Quotient.nsmul c = { smul := fun (n : ℕ) => Quotient.map' (fun (x : M) => n • x) ⋯ }
The quotient of a semigroup by a congruence relation is a semigroup.
Equations
- c.semigroup = Semigroup.mk ⋯
The quotient of an AddSemigroup
by an additive congruence relation is
an AddSemigroup
.
Equations
- c.addSemigroup = AddSemigroup.mk ⋯
The quotient of a commutative semigroup by a congruence relation is a semigroup.
Equations
- c.commSemigroup = CommSemigroup.mk ⋯
The quotient of an AddCommSemigroup
by an additive congruence relation is
an AddCommSemigroup
.
Equations
- c.addCommSemigroup = AddCommSemigroup.mk ⋯
The quotient of an AddMonoid
by an additive congruence relation is
an AddMonoid
.
Equations
- c.addMonoid = AddMonoid.mk ⋯ ⋯ AddMonoid.nsmul ⋯ ⋯
The quotient of a CommMonoid
by a congruence relation is a CommMonoid
.
Equations
- c.commMonoid = CommMonoid.mk ⋯
The quotient of an AddCommMonoid
by an additive congruence
relation is an AddCommMonoid
.
Equations
- c.addCommMonoid = AddCommMonoid.mk ⋯
Sometimes, a group is defined as a quotient of a monoid by a congruence relation.
Usually, the inverse operation is defined as Setoid.map f _
for some f
.
This lemma allows to avoid code duplication in the definition of the inverse operation:
instead of proving both ∀ x y, c x y → c (f x) (f y)
(to define the operation)
and ∀ x, c (f x * x) 1
(to prove the group laws), one can only prove the latter.
Sometimes, an additive group is defined as a quotient of a monoid
by an additive congruence relation.
Usually, the inverse operation is defined as Setoid.map f _
for some f
.
This lemma allows to avoid code duplication in the definition of the inverse operation:
instead of proving both ∀ x y, c x y → c (f x) (f y)
(to define the operation)
and ∀ x, c (f x + x) 0
(to prove the group laws), one can only prove the latter.
The inversion induced on the quotient by a congruence relation on a type with an inversion.
Equations
- c.hasInv = { inv := Quotient.map' Inv.inv ⋯ }
The negation induced on the quotient by an additive congruence relation on a type with a negation.
Equations
- c.hasNeg = { neg := Quotient.map' Neg.neg ⋯ }
The division induced on the quotient by a congruence relation on a type with a division.
Equations
- c.hasDiv = { div := Quotient.map₂' (fun (x1 x2 : M) => x1 / x2) ⋯ }
The subtraction induced on the quotient by an additive congruence relation on a type with a subtraction.
Equations
- c.hasSub = { sub := Quotient.map₂' (fun (x1 x2 : M) => x1 - x2) ⋯ }
The integer scaling induced on the quotient by a congruence relation on a type with a subtraction.
Equations
- AddCon.Quotient.zsmul c = { smul := fun (z : ℤ) => Quotient.map' (fun (x : M) => z • x) ⋯ }
The quotient of an AddGroup
by an additive congruence relation is
an AddGroup
.
Equations
- c.addGroup = AddGroup.mk ⋯
In order to define a function (Con.Quotient c)ˣ → α
on the units of Con.Quotient c
,
where c : Con M
is a multiplicative congruence on a monoid, it suffices to define a function f
that takes elements x y : M
with proofs of c (x * y) 1
and c (y * x) 1
, and returns an element
of α
provided that f x y _ _ = f x' y' _ _
whenever c x x'
and c y y'
.
Equations
- Con.liftOnUnits u f Hf = Con.hrecOn₂ (↑u) (↑u⁻¹) (fun (x y : M) (hxy : ↑x * ↑y = 1) (hyx : ↑y * ↑x = 1) => f x y ⋯ ⋯) ⋯ ⋯ ⋯
Instances For
In order to define a function (Con.Quotient c)ˣ → α
on the units of Con.Quotient c
,
where c : Con M
is a multiplicative congruence on a monoid, it suffices to define a function f
that takes elements x y : M
with proofs of c (x * y) 1
and c (y * x) 1
, and returns an element
of α
provided that f x y _ _ = f x' y' _ _
whenever c x x'
and c y y'
.
Equations
- AddCon.liftOnAddUnits u f Hf = AddCon.hrecOn₂ (↑u) (↑(-u)) (fun (x y : M) (hxy : ↑x + ↑y = 0) (hyx : ↑y + ↑x = 0) => f x y ⋯ ⋯) ⋯ ⋯ ⋯