Setoid.Relations.Quotients¶
Quotients of setoids¶
This is the Setoid.Relations.Quotients module of the Agda Universal Algebra Library.
Quotienting is where the setoid formulation pays for itself. A quotient of a
setoid by an equivalence relation keeps the same carrier and changes only the
equality, so it needs neither a quotient type nor any axiom: _/_
takes a type together with an Equivalence bundle and returns the
setoid whose equality is that relation, and Quotient is the type
of its classes.
The module also supplies what makes quotients reachable in practice:
ker-IsEquivalence, that the kernel of a setoid function is an
equivalence relation, so that every kernel may be quotiented by; and the
machinery of equivalence classes and blocks. The algebraic counterpart, where the
quotient must respect the operations as well, is _β±_ of
Setoid.Congruences.Basic.
Kernels¶
A prominent example of an equivalence relation is the kernel of any function.
open _βΆ_ using ( cong ) module _ {π΄ : Setoid Ξ± Οα΅}{π΅ : Setoid Ξ² Οα΅} where open Setoid π΄ using ( refl ) renaming (Carrier to A ) open Setoid π΅ using ( sym ; trans ) ker-IsEquivalence : (f : π΄ βΆ π΅) β IsEquivalence (fker f) IsEquivalence.refl (ker-IsEquivalence f) = cong f refl IsEquivalence.sym (ker-IsEquivalence f) = sym IsEquivalence.trans (ker-IsEquivalence f) = trans record IsBlock {A : Type Ξ±}{Ο : Level} (P : Pred A Ο){R : BinaryRel A Ο} : Type(Ξ± β suc Ο) where constructor mkblk field a : A Pβ[a] : β x β (x β P β [ a ]{Ο} R x) β§ ([ a ]{Ο} R x β x β P) open IsBlock
If R is an equivalence relation on A, then the quotient of A modulo R is
denoted by A / R and is defined to be the collection {[ u ] β£ y : A} of all
R-blocks.
Quotient : (A : Type Ξ±) β Equivalence A{β} β Type(Ξ± β suc β) Quotient A R = Ξ£[ P β Pred A _ ] IsBlock P {(projβ R)} _/_ : (A : Type Ξ±) β Equivalence A{β} β Setoid _ _ A / R = record { Carrier = A ; _β_ = (projβ R) ; isEquivalence = (projβ R) } infix -1 _/_
We use the following type to represent an R-block with a designated representative.
open Setoid βͺ_β« : {Ξ± : Level}{A : Type Ξ±} β A β {R : Equivalence A{β}} β Carrier (A / R) βͺ a β«{R} = a module _ {A : Type Ξ±}{R : Equivalence A{β} } where open Setoid (A / R) using () renaming ( _β_ to _ββ_ ) βͺ_βΌ_β«-intro : (u v : A) β (projβ R) u v β βͺ u β«{R} ββ βͺ v β«{R} βͺ u βΌ v β«-intro = id βͺ_βΌ_β«-elim : (u v : A) β βͺ u β«{R} ββ βͺ v β«{R} β (projβ R) u v βͺ u βΌ v β«-elim = id β‘ββ : {A : Type Ξ±}{Ο : Level}(Q R : Pred A Ο) β Q β‘ R β Q β R β‘ββ Q .Q β‘.refl {x} Qx = Qx