Setoid.Subalgebras.Basic¶
Subalgebras of setoid algebras¶
This is the Setoid.Subalgebras.Basic module of the Agda Universal Algebra Library.
π¨ is a subalgebra of π©, written π¨ β€ π©, just in case π¨ can be
homomorphically embedded in π©: there is a homomorphism from π¨ to π© whose
underlying map is injective.
Note that the notion of subalgebra that we define here is different from the
standard textbook definition, which defines a subuniverse to be a subset of
the carrier of an algebra that is closed under the operations (as we do in the
Setoid.Subalgebras.Subuniverses module); a subalgebra is then a subuniverse
together with the operations of the larger algebra restricted to it. Nothing in
our definition requires the carrier of a subalgebra of π© to be a subset of the
carrier of π©.1
Our subalgebra relation _β€_ is clearly reflexive and transitive,
so it is a preorder; that is exactly what Setoid.Subalgebras.Properties
proves, as β€-preorder, and it is the only order-theoretic fact
about _β€_ that this subtree establishes.
It is not a partial order. Antisymmetry would require that π¨ β€ π© and π© β€ π¨
imply π¨ β π© for some suitable β, and read as "on the nose" equality that
plainly fails. The tempting repair is to read β as isomorphism, but that fails
too: π¨ β€ π© and π© β€ π¨ supply injective homomorphisms in both directions, and a
pair of injections is not an isomorphism. Neither map need invert the other, and
in general no isomorphism need exist at all β the free groups on two and on three
generators embed in each other yet are not isomorphic, as their abelianizations
β€Β² and β€Β³ already show. Extracting a bijection from two injections is
CantorβBernstein, which is unavailable constructively, and the bijection it
yields classically need not be a homomorphism.
For finite algebras the repair does work, and that is the setting much of this
library's later work lives in. Mutual injections between finite carriers force
equal cardinality; an injective map between finite sets of equal cardinality is
surjective; and an injective, surjective homomorphism is an isomorphism, by
Bijectiveββ
of Setoid.Homomorphisms.Isomorphisms. So on
finite algebras _β€_ is antisymmetric up to isomorphism, hence a
partial order on isomorphism classes. That chain of reasoning is not formalized
here; only Bijectiveββ
, its last step, is.
This module defines the subalgebra relation _β€_ and the several
ways of packaging it: as a record bundling both algebras, as a Ξ£-type over the
smaller algebra with the larger one fixed, and relative to a whole class rather
than to a single algebra. The class-relative form _β€c_ is the
one the closure operator S of Setoid.Varieties.Closure is
built from.
The relation comes in two directions and three packagings.
_IsSubalgebraOf_, with the infix alias_β€_, is the relation itself:π¨ β€ π©is the type of pairs(h , inj)withh : hom π¨ π©andinja proof that the underlying map ofhis injective._IsSupalgebraOf_, aliased_β₯_, is the converse, and is definitionally the same type read the other way round:π¨ β€ π©andπ© β₯ π¨both unfold to an injective homomorphism fromπ¨intoπ©.monββ€turns a monomorphism into a proof of the subalgebra relation. It is immediate, becausemonβintohomof Setoid.Homomorphisms.Basic already produces exactly this type.SubalgebraOfbundles both algebras and the proof into a single record.Subalgebrainstead fixes the larger algebra and collects the smaller one with its embedding, so an inhabitant ofSubalgebra π¨is a pair(π© , p)withp : π© β€ π¨.
module _ {π : Signature π π₯} where _β₯_ -- alias for supalgebra (aka overalgebra) _IsSupalgebraOf_ : Algebra {π = π} Ξ± Οα΅ β Algebra {π = π} Ξ² Οα΅ β Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) π¨ IsSupalgebraOf π© = Ξ£[ h β hom π© π¨ ] IsInjective (projβ h) _β€_ -- alias for subalgebra relation _IsSubalgebraOf_ : Algebra {π = π} Ξ± Οα΅ β Algebra {π = π} Ξ² Οα΅ β Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) π¨ IsSubalgebraOf π© = Ξ£[ h β hom π¨ π© ] IsInjective (projβ h) -- Syntactic sugar for sup/sub-algebra relations. π¨ β₯ π© = π¨ IsSupalgebraOf π© π¨ β€ π© = π¨ IsSubalgebraOf π© monββ€ : {π¨ : Algebra {π = π} Ξ± Οα΅}{π© : Algebra {π = π} Ξ² Οα΅} β mon π¨ π© β π¨ β€ π© monββ€ {π¨ = π¨}{π©} x = monβintohom π¨ π© x record SubalgebraOf : Type (ov {π = π} (Ξ± β Ξ² β Οα΅ β Οα΅)) where field algebra : Algebra {π = π} Ξ± Οα΅ subalgebra : Algebra {π = π} Ξ² Οα΅ issubalgebra : subalgebra β€ algebra Subalgebra : Algebra {π = π} Ξ± Οα΅ β {Ξ² Οα΅ : Level} β Type _ Subalgebra π¨ {Ξ²}{Οα΅} = Ξ£[ π© β (Algebra Ξ² Οα΅) ] π© β€ π¨ {- usage note: for π¨ : Algebra {π = π} Ξ± Οα΅, an inhabitant of `Subalgebra π¨` is a pair `(π© , p) : Subalgebra π¨` providing - `π© : Algebra {π = π} Ξ² Οα΅` and - `p : π© β€ π¨`, a proof that π© is a subalgebra of π΄. -}
From now on we will use π© β€ π¨ to express the assertion that π© is a subalgebra of π¨.
Subalgebras of classes of setoid algebras¶
Suppose π¦ : Pred (Algebra Ξ± π) Ξ³ denotes a class of π-algebras and π© : Algebra Ξ² Οα΅
denotes an arbitrary π-algebra. Consider the assertion that π© is a subalgebra of
an algebra in the class π¦. With the next definition we can express this
assertion as π© IsSubalgebraOfClass π¦.
_β€c_ _IsSubalgebraOfClass_ : Algebra {π = π} Ξ² Οα΅ β Pred (Algebra {π = π} Ξ± Οα΅) β β Type _ π© IsSubalgebraOfClass π¦ = Ξ£[ π¨ β Algebra _ _ ] ((π¨ β π¦) β§ (π© β€ π¨)) π© β€c π¦ = π© IsSubalgebraOfClass π¦ -- (alias) record SubalgebraOfClass : Type (ov {π = π} (Ξ± β Ξ² β Οα΅ β Οα΅ β β)) where field class : Pred (Algebra {π = π} Ξ± Οα΅) β subalgebra : Algebra {π = π} Ξ² Οα΅ issubalgebraofclass : subalgebra β€c class record SubalgebraOfClass' : Type (ov {π = π} (Ξ± β Ξ² β Οα΅ β Οα΅ β β)) where field class : Pred (Algebra {π = π} Ξ± Οα΅) β classalgebra : Algebra {π = π} Ξ± Οα΅ isclassalgebra : classalgebra β class subalgebra : Algebra {π = π} Ξ² Οα΅ issubalgebra : subalgebra β€ classalgebra -- The collection of subalgebras of algebras in class π¦. SubalgebrasOfClass : Pred (Algebra {π = π} Ξ± Οα΅) β β {Ξ² Οα΅ : Level} β Type _ SubalgebrasOfClass π¦ {Ξ²}{Οα΅} = Ξ£[ π© β Algebra Ξ² Οα΅ ] π© β€c π¦
Consequences of First Homomorphism Theorem¶
As an example use-case of the IsSubalgebraOf type defined above, we prove the
following easy but useful corollary of the First Homomorphism Theorem (proved
in the Setoid.Homomorphisms.Noether module): If π¨ and π© are π-algebras
and h : hom π¨ π© a homomorphism from π¨ to π©, then the quotient π¨ β± ker h
is (isomorphic to) a subalgebra of π©.
FirstHomCorollary : {π¨ : Algebra {π = π} Ξ± Οα΅} {π© : Algebra {π = π} Ξ² Οα΅} (hh : hom π¨ π©) β (kerquo hh) IsSubalgebraOf π© FirstHomCorollary hh = projβ (FirstHomTheorem hh) , projβ (projβ (FirstHomTheorem hh))
-
Note that we denote both the subalgebra and subuniverse relations by the same symbol,
_β€_. The two do not collide, because the subuniverse order lives inside the named moduleSublatticeof Setoid.Subalgebras.CompleteLattice, which qualifies it rather than exporting it. So importing the Setoid.Subalgebras barrel gives the subalgebra relation unqualified, and the subuniverse order becomes available as_β€_only whereSublatticeis opened, as inopen Sublattice π¨ ββ. ↩