{-# OPTIONS --without-K --exact-split --safe #-} open import Overture using (π ; π₯ ; Signature ) module Base.Subalgebras.Properties {π : Signature π π₯} where -- Imports from Agda and the Agda Standard Library ------------------------------- open import Data.Product using ( _,_ ) renaming ( projβ to fst ; projβ to snd ) open import Function using ( _β_ ; id ; flip ; Injection ) open import Level using ( Level; _β_ ) open import Relation.Unary using ( Pred ; _β_ ) open import Relation.Binary using ( _RespectsΚ³_ ; _RespectsΛ‘_ ) open import Relation.Binary.PropositionalEquality as β‘ using ( _β‘_ ; module β‘-Reasoning ) -- Imports from the Agda Universal Algebra Library -------------------- open import Overture using ( β£_β£ ; β₯_β₯ ; _β»ΒΉ ) open import Base.Functions using ( id-is-injective ; IsInjective ; β-injective ) open import Base.Algebras {π = π} using ( Algebra ; Lift-Alg ; ov ) open import Base.Homomorphisms {π = π} using ( is-homomorphism ; β-hom ) using ( β-is-hom ; _β _ ; β toInjective ) using ( β fromInjective ; β -refl ; β -sym ) using ( β -trans ; Lift-β ; mkiso ) open import Base.Subalgebras.Subalgebras {π = π} using ( _β€_ ; _β₯_ ; _IsSubalgebraOfClass_ ) private variable Ξ± Ξ² Ξ³ π§ : Level -- The subalgebra relation is a *preorder* (a reflexive, transitive, binary relation). open _β _ β€-refl : {π¨ : Algebra Ξ±}{π© : Algebra Ξ²} β π¨ β π© β π¨ β€ π© β€-refl Ο = (to Ο) , β toInjective Ο β₯-refl : {π¨ : Algebra Ξ±}{π© : Algebra Ξ²} β π¨ β π© β π¨ β₯ π© β₯-refl Ο = (from Ο) , β fromInjective Ο β€-reflexive : (π¨ : Algebra Ξ±) β π¨ β€ π¨ β€-reflexive π¨ = (id , Ξ» π π β β‘.refl) , Injection.injective id-is-injective β€-trans : (π¨ : Algebra Ξ±){π© : Algebra Ξ²}(πͺ : Algebra Ξ³) β π¨ β€ π© β π© β€ πͺ β π¨ β€ πͺ β€-trans π¨ πͺ Aβ€B Bβ€C = (β-hom π¨ πͺ β£ Aβ€B β£ β£ Bβ€C β£) , β-injective β₯ Aβ€B β₯ β₯ Bβ€C β₯ β₯-trans : (π¨ : Algebra Ξ±){π© : Algebra Ξ²}(πͺ : Algebra Ξ³) β π¨ β₯ π© β π© β₯ πͺ β π¨ β₯ πͺ β₯-trans π¨ πͺ Aβ₯B Bβ₯C = β€-trans πͺ π¨ Bβ₯C Aβ₯B
In case all algebras live in the same universe level, we can use some of the definitions in the standard library. However, to obtain more general versions, we need to either extend the standard libraryβs Binary.Structures module to be universe polymorphic, or just implement what we need here. For now we do the latter (below).
module _ {Ξ± : Level} where open import Relation.Binary.Structures {a = (ov Ξ±)}{β = (π β π₯ β Ξ±)} (_β _ {Ξ±}{Ξ±}) open IsPreorder β€-preorder : IsPreorder _β€_ isEquivalence β€-preorder = record { refl = β -refl ; sym = β -sym ; trans = β -trans } reflexive β€-preorder = β€-refl trans β€-preorder {π¨}{π©}{πͺ} Aβ€B Bβ€C = β€-trans π¨ πͺ Aβ€B Bβ€C β₯-preorder : IsPreorder _β₯_ isEquivalence β₯-preorder = record { refl = β -refl ; sym = β -sym ; trans = β -trans } reflexive β₯-preorder = β₯-refl trans β₯-preorder {π¨}{π©}{πͺ} Aβ₯B Bβ₯C = β₯-trans π¨ πͺ Aβ₯B Bβ₯C
Here are some consequences of the fact that _β€_
and _β₯_
are preorders relative
to _β
_
. These are essentially equivalent variations on the following obvious fact:
If two algebras are isomorphic and one of them is a subalgebra, then so is the other.
-- 1a. If π¨ β€ π© and π© β πͺ, then π¨ β€ πͺ β€-resp-β : _β€_ RespectsΚ³ _β _ -- usage: (note the argument order) β€-resp-β = βΌ-respΛ‘-β β₯-preorder -- (p : π© β πͺ) (q : π¨ β€ π©) β (β€-resp-β p q) : π¨ β€ πͺ -- 2a. If π¨ β₯ π© and π© β πͺ, then π¨ β₯ πͺ β₯-resp-β : _β₯_ RespectsΚ³ _β _ β₯-resp-β {π¨} = βΌ-respΛ‘-β β€-preorder {π¨} -- 1b. If π© β πͺ and π© β₯ π¨, then πͺ β₯ π¨ β -resp-β₯ : _β₯_ RespectsΛ‘ _β _ β -resp-β₯ = β€-resp-β -- 2b. If π© β πͺ and π© β€ π¨, then πͺ β€ π¨ β -resp-β€ : _β€_ RespectsΛ‘ _β _ β -resp-β€ {π¨} = β₯-resp-β {π¨}
module _ {π¨ : Algebra Ξ±}{π© : Algebra Ξ²}{πͺ : Algebra Ξ³} where β€-RESP-β : π¨ β€ π© β π© β πͺ β π¨ β€ πͺ β€-RESP-β a<b bc = β€-trans π¨ πͺ a<b (β€-refl bc) β₯-RESP-β : π¨ β₯ π© β π© β πͺ β π¨ β₯ πͺ β₯-RESP-β a<b ac = β€-trans πͺ π¨ (β€-refl (β -sym ac)) a<b module _ {π¨ : Algebra Ξ±}{π© : Algebra Ξ²}{πͺ : Algebra Ξ³} where β -RESP-β€ : π¨ β π© β π© β€ πͺ β π¨ β€ πͺ β -RESP-β€ ab b<c = β₯-RESP-β {π¨ = πͺ} b<c (β -sym ab) β -RESP-β₯ : π¨ β π© β π© β₯ πͺ β π¨ β₯ πͺ β -RESP-β₯ ab b<c = β€-RESP-β b<c (β -sym ab) open β‘-Reasoning isoβinjective : {π¨ : Algebra Ξ±}{π© : Algebra Ξ²} β (Ο : π¨ β π©) β IsInjective β£ to Ο β£ isoβinjective {π¨ = π¨} (mkiso f g fβΌg gβΌf) {x} {y} fxfy = x β‘β¨ (gβΌf x)β»ΒΉ β© (β£ g β£ β β£ f β£) x β‘β¨ β‘.cong β£ g β£ fxfy β© (β£ g β£ β β£ f β£) y β‘β¨ gβΌf y β© y β β€-mono : (π© : Algebra Ξ²){π¦ π¦' : Pred (Algebra Ξ±) Ξ³} β π¦ β π¦' β π© IsSubalgebraOfClass π¦ β π© IsSubalgebraOfClass π¦' β€-mono π© KK' KB = β£ KB β£ , fst β₯ KB β₯ , KK' (β£ snd β₯ KB β₯ β£) , β₯ (snd β₯ KB β₯) β₯
module _ {π¦ : Pred (Algebra Ξ±)(ov Ξ±)}{π© : Algebra Ξ±} where Lift-is-sub : π© IsSubalgebraOfClass π¦ β (Lift-Alg π© Ξ±) IsSubalgebraOfClass π¦ Lift-is-sub (π¨ , (sa , (KA , Bβ sa))) = π¨ , sa , KA , β -trans (β -sym Lift-β ) Bβ sa β€-Lift : {π¨ : Algebra Ξ±}(π© : Algebra Ξ²){β : Level} β π¨ β€ π© β π¨ β€ Lift-Alg π© β β€-Lift π© a<b = β€-RESP-β {π© = π©} a<b Lift-β β₯-Lift : (π¨ : Algebra Ξ±){π© : Algebra Ξ²}{β : Level} β π¨ β₯ π© β π¨ β₯ Lift-Alg π© β β₯-Lift π¨ a>b = β₯-RESP-β {π¨ = π¨} a>b Lift-β Lift-β€-Lift : {π¨ : Algebra Ξ±}(βα΅ : Level){π© : Algebra Ξ²}(βα΅ : Level) β π¨ β€ π© β Lift-Alg π¨ βα΅ β€ Lift-Alg π© βα΅ Lift-β€-Lift βα΅ {π©} βα΅ a<b = β₯-Lift (Lift-Alg π© βα΅) (β€-Lift π© a<b)