This is the Setoid.Subalgebras.Subalgebras module of the Agda Universal Algebra Library.
{-# OPTIONS --without-K --exact-split --safe #-} open import Overture using (π ; π₯ ; Signature) module Setoid.Subalgebras.Subalgebras {π : Signature π π₯} where -- imports from Agda and the Agda Standard Library ------------------------------------------ open import Agda.Primitive using () renaming ( Set to Type ) open import Data.Product using ( _,_ ; Ξ£-syntax ) renaming ( _Γ_ to _β§_ ; projβ to snd ) open import Level using ( Level ; _β_ ) open import Relation.Binary using ( REL ) open import Relation.Unary using ( Pred ; _β_ ) -- Imports from the Agda Universal Algebra Library ------------------------------------------ open import Overture using ( β£_β£ ; β₯_β₯ ) open import Setoid.Functions using ( IsInjective ) open import Setoid.Algebras {π = π} using ( Algebra ; ov ) open import Setoid.Homomorphisms {π = π} using ( hom ; mon ; monβintohom ; kerquo ; FirstHomTheorem ) private variable Ξ± Οα΅ Ξ² Οα΅ β : Level _β₯_ -- (alias for supalgebra (aka overalgebra)) _IsSupalgebraOf_ : Algebra Ξ± Οα΅ β Algebra Ξ² Οα΅ β Type _ π¨ IsSupalgebraOf π© = Ξ£[ h β hom π© π¨ ] IsInjective β£ h β£ _β€_ -- (alias for subalgebra relation)) _IsSubalgebraOf_ : Algebra Ξ± Οα΅ β Algebra Ξ² Οα΅ β Type (π β π₯ β Ξ± β Οα΅ β Ξ² β Οα΅) π¨ IsSubalgebraOf π© = Ξ£[ h β hom π¨ π© ] IsInjective β£ 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 Ξ± Οα΅, inhabitant of `Subalgebra π¨` is a pair `(π© , p) : Subalgebra π¨` providing - `π© : Algebra Ξ² Οα΅` and - `p : π© β€ π¨`, a proof that π© is a subalgebra of π΄. -} IsSubalgebraREL : {Ξ± Οα΅ Ξ² Οα΅ : Level} β REL (Algebra Ξ± Οα΅)(Algebra Ξ² Οα΅) β β Type _ IsSubalgebraREL {Ξ±}{Οα΅}{Ξ²}{Οα΅} R = β {π¨ : Algebra Ξ± Οα΅}{π© : Algebra Ξ² Οα΅} β π¨ β€ π© record SubalgebraREL(R : REL (Algebra Ξ² Οα΅)(Algebra Ξ± Οα΅) β) : Type (ov (Ξ± β Ξ² β Οα΅ β β)) where field isSubalgebraREL : IsSubalgebraREL R
From now on we will use π© β€ π¨
to express the assertion that π©
is a subalgebra of π¨
.
Suppose π¦ : Pred (Algebra Ξ± π) Ξ³
denotes a class of π
-algebras and
π© : Algebra Ξ² Οα΅
denotes an arbitrary π
-algebra. Then we might wish to
consider the assertion that π©
is a subalgebra of an algebra in the class π¦
.
The next type we define allows us to 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 π¦
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 = β£ FirstHomTheorem hh β£ , snd β₯ FirstHomTheorem hh β₯
β Setoid.Subalgebras.Subuniverses Setoid.Subalgebras.Properties β