| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- The composition of morphisms between algebraic structures. |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --safe --cubical-compatible #-} |
| 8 |
|
| 9 |
module Algebra.Morphism.Construct.Composition where |
| 10 |
|
| 11 |
open import Algebra.Bundles |
| 12 |
open import Algebra.Morphism.Bundles |
| 13 |
open import Algebra.Morphism.Structures |
| 14 |
open import Function.Base using (_∘_) |
| 15 |
import Function.Construct.Composition as Func |
| 16 |
open import Level using (Level) |
| 17 |
open import Relation.Binary.Morphism.Construct.Composition using (isRelHomomorphism) |
| 18 |
open import Relation.Binary.Definitions using (Transitive) |
| 19 |
|
| 20 |
private |
| 21 |
variable |
| 22 |
a b c ℓ₁ ℓ₂ ℓ₃ : Level |
| 23 |
|
| 24 |
|
| 25 |
------------------------------------------------------------------------ |
| 26 |
-- Magmas |
| 27 |
|
| 28 |
module _ {M₁ : RawMagma a ℓ₁} |
| 29 |
{M₂ : RawMagma b ℓ₂} |
| 30 |
{M₃ : RawMagma c ℓ₃} |
| 31 |
(open RawMagma) |
| 32 |
(≈₃-trans : Transitive (_≈_ M₃)) |
| 33 |
{f : Carrier M₁ → Carrier M₂} |
| 34 |
{g : Carrier M₂ → Carrier M₃} |
| 35 |
where |
| 36 |
|
| 37 |
isMagmaHomomorphism |
| 38 |
: IsMagmaHomomorphism M₁ M₂ f |
| 39 |
→ IsMagmaHomomorphism M₂ M₃ g |
| 40 |
→ IsMagmaHomomorphism M₁ M₃ (g ∘ f) |
| 41 |
isMagmaHomomorphism f-homo g-homo = record |
| 42 |
{ isRelHomomorphism = isRelHomomorphism F.isRelHomomorphism G.isRelHomomorphism |
| 43 |
; homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.homo x y)) (G.homo (f x) (f y)) |
| 44 |
} where module F = IsMagmaHomomorphism f-homo; module G = IsMagmaHomomorphism g-homo |
| 45 |
|
| 46 |
isMagmaMonomorphism |
| 47 |
: IsMagmaMonomorphism M₁ M₂ f |
| 48 |
→ IsMagmaMonomorphism M₂ M₃ g |
| 49 |
→ IsMagmaMonomorphism M₁ M₃ (g ∘ f) |
| 50 |
isMagmaMonomorphism f-mono g-mono = record |
| 51 |
{ isMagmaHomomorphism = isMagmaHomomorphism F.isMagmaHomomorphism G.isMagmaHomomorphism |
| 52 |
; injective = F.injective ∘ G.injective |
| 53 |
} where module F = IsMagmaMonomorphism f-mono; module G = IsMagmaMonomorphism g-mono |
| 54 |
|
| 55 |
isMagmaIsomorphism |
| 56 |
: IsMagmaIsomorphism M₁ M₂ f |
| 57 |
→ IsMagmaIsomorphism M₂ M₃ g |
| 58 |
→ IsMagmaIsomorphism M₁ M₃ (g ∘ f) |
| 59 |
isMagmaIsomorphism f-iso g-iso = record |
| 60 |
{ isMagmaMonomorphism = isMagmaMonomorphism F.isMagmaMonomorphism G.isMagmaMonomorphism |
| 61 |
; surjective = Func.surjective _ _ (_≈_ M₃) F.surjective G.surjective |
| 62 |
} where module F = IsMagmaIsomorphism f-iso; module G = IsMagmaIsomorphism g-iso |
| 63 |
|
| 64 |
|
| 65 |
------------------------------------------------------------------------ |
| 66 |
-- Monoids |
| 67 |
|
| 68 |
module _ {M₁ : RawMonoid a ℓ₁} |
| 69 |
{M₂ : RawMonoid b ℓ₂} |
| 70 |
{M₃ : RawMonoid c ℓ₃} |
| 71 |
(open RawMonoid) |
| 72 |
(≈₃-trans : Transitive (_≈_ M₃)) |
| 73 |
{f : Carrier M₁ → Carrier M₂} |
| 74 |
{g : Carrier M₂ → Carrier M₃} |
| 75 |
where |
| 76 |
|
| 77 |
isMonoidHomomorphism |
| 78 |
: IsMonoidHomomorphism M₁ M₂ f |
| 79 |
→ IsMonoidHomomorphism M₂ M₃ g |
| 80 |
→ IsMonoidHomomorphism M₁ M₃ (g ∘ f) |
| 81 |
isMonoidHomomorphism f-homo g-homo = record |
| 82 |
{ isMagmaHomomorphism = isMagmaHomomorphism ≈₃-trans F.isMagmaHomomorphism G.isMagmaHomomorphism |
| 83 |
; ε-homo = ≈₃-trans (G.⟦⟧-cong F.ε-homo) G.ε-homo |
| 84 |
} where module F = IsMonoidHomomorphism f-homo; module G = IsMonoidHomomorphism g-homo |
| 85 |
|
| 86 |
isMonoidMonomorphism |
| 87 |
: IsMonoidMonomorphism M₁ M₂ f |
| 88 |
→ IsMonoidMonomorphism M₂ M₃ g |
| 89 |
→ IsMonoidMonomorphism M₁ M₃ (g ∘ f) |
| 90 |
isMonoidMonomorphism f-mono g-mono = record |
| 91 |
{ isMonoidHomomorphism = isMonoidHomomorphism F.isMonoidHomomorphism G.isMonoidHomomorphism |
| 92 |
; injective = F.injective ∘ G.injective |
| 93 |
} where module F = IsMonoidMonomorphism f-mono; module G = IsMonoidMonomorphism g-mono |
| 94 |
|
| 95 |
isMonoidIsomorphism |
| 96 |
: IsMonoidIsomorphism M₁ M₂ f |
| 97 |
→ IsMonoidIsomorphism M₂ M₃ g |
| 98 |
→ IsMonoidIsomorphism M₁ M₃ (g ∘ f) |
| 99 |
isMonoidIsomorphism f-iso g-iso = record |
| 100 |
{ isMonoidMonomorphism = isMonoidMonomorphism F.isMonoidMonomorphism G.isMonoidMonomorphism |
| 101 |
; surjective = Func.surjective _ _(_≈_ M₃) F.surjective G.surjective |
| 102 |
} where module F = IsMonoidIsomorphism f-iso; module G = IsMonoidIsomorphism g-iso |
| 103 |
|
| 104 |
|
| 105 |
------------------------------------------------------------------------ |
| 106 |
-- Groups |
| 107 |
|
| 108 |
module _ {G₁ : RawGroup a ℓ₁} |
| 109 |
{G₂ : RawGroup b ℓ₂} |
| 110 |
{G₃ : RawGroup c ℓ₃} |
| 111 |
(open RawGroup) |
| 112 |
(≈₃-trans : Transitive (_≈_ G₃)) |
| 113 |
{f : Carrier G₁ → Carrier G₂} |
| 114 |
{g : Carrier G₂ → Carrier G₃} |
| 115 |
where |
| 116 |
|
| 117 |
|
| 118 |
isGroupHomomorphism |
| 119 |
: IsGroupHomomorphism G₁ G₂ f |
| 120 |
→ IsGroupHomomorphism G₂ G₃ g |
| 121 |
→ IsGroupHomomorphism G₁ G₃ (g ∘ f) |
| 122 |
isGroupHomomorphism f-homo g-homo = record |
| 123 |
{ isMonoidHomomorphism = isMonoidHomomorphism ≈₃-trans F.isMonoidHomomorphism G.isMonoidHomomorphism |
| 124 |
; ⁻¹-homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.⁻¹-homo x)) (G.⁻¹-homo (f x)) |
| 125 |
} where module F = IsGroupHomomorphism f-homo; module G = IsGroupHomomorphism g-homo |
| 126 |
|
| 127 |
isGroupMonomorphism |
| 128 |
: IsGroupMonomorphism G₁ G₂ f |
| 129 |
→ IsGroupMonomorphism G₂ G₃ g |
| 130 |
→ IsGroupMonomorphism G₁ G₃ (g ∘ f) |
| 131 |
isGroupMonomorphism f-mono g-mono = record |
| 132 |
{ isGroupHomomorphism = isGroupHomomorphism F.isGroupHomomorphism G.isGroupHomomorphism |
| 133 |
; injective = F.injective ∘ G.injective |
| 134 |
} where module F = IsGroupMonomorphism f-mono; module G = IsGroupMonomorphism g-mono |
| 135 |
|
| 136 |
isGroupIsomorphism |
| 137 |
: IsGroupIsomorphism G₁ G₂ f |
| 138 |
→ IsGroupIsomorphism G₂ G₃ g |
| 139 |
→ IsGroupIsomorphism G₁ G₃ (g ∘ f) |
| 140 |
isGroupIsomorphism f-iso g-iso = record |
| 141 |
{ isGroupMonomorphism = isGroupMonomorphism F.isGroupMonomorphism G.isGroupMonomorphism |
| 142 |
; surjective = Func.surjective _ _ (_≈_ G₃) F.surjective G.surjective |
| 143 |
} where module F = IsGroupIsomorphism f-iso; module G = IsGroupIsomorphism g-iso |
| 144 |
|
| 145 |
|
| 146 |
------------------------------------------------------------------------ |
| 147 |
-- Near semirings |
| 148 |
|
| 149 |
module _ {R₁ : RawNearSemiring a ℓ₁} |
| 150 |
{R₂ : RawNearSemiring b ℓ₂} |
| 151 |
{R₃ : RawNearSemiring c ℓ₃} |
| 152 |
(open RawNearSemiring) |
| 153 |
(≈₃-trans : Transitive (_≈_ R₃)) |
| 154 |
{f : Carrier R₁ → Carrier R₂} |
| 155 |
{g : Carrier R₂ → Carrier R₃} |
| 156 |
where |
| 157 |
|
| 158 |
isNearSemiringHomomorphism |
| 159 |
: IsNearSemiringHomomorphism R₁ R₂ f |
| 160 |
→ IsNearSemiringHomomorphism R₂ R₃ g |
| 161 |
→ IsNearSemiringHomomorphism R₁ R₃ (g ∘ f) |
| 162 |
isNearSemiringHomomorphism f-homo g-homo = record |
| 163 |
{ +-isMonoidHomomorphism = isMonoidHomomorphism ≈₃-trans F.+-isMonoidHomomorphism G.+-isMonoidHomomorphism |
| 164 |
; *-homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.*-homo x y)) (G.*-homo (f x) (f y)) |
| 165 |
} where module F = IsNearSemiringHomomorphism f-homo; module G = IsNearSemiringHomomorphism g-homo |
| 166 |
|
| 167 |
isNearSemiringMonomorphism |
| 168 |
: IsNearSemiringMonomorphism R₁ R₂ f |
| 169 |
→ IsNearSemiringMonomorphism R₂ R₃ g |
| 170 |
→ IsNearSemiringMonomorphism R₁ R₃ (g ∘ f) |
| 171 |
isNearSemiringMonomorphism f-mono g-mono = record |
| 172 |
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism F.isNearSemiringHomomorphism G.isNearSemiringHomomorphism |
| 173 |
; injective = F.injective ∘ G.injective |
| 174 |
} where module F = IsNearSemiringMonomorphism f-mono; module G = IsNearSemiringMonomorphism g-mono |
| 175 |
|
| 176 |
isNearSemiringIsomorphism |
| 177 |
: IsNearSemiringIsomorphism R₁ R₂ f |
| 178 |
→ IsNearSemiringIsomorphism R₂ R₃ g |
| 179 |
→ IsNearSemiringIsomorphism R₁ R₃ (g ∘ f) |
| 180 |
isNearSemiringIsomorphism f-iso g-iso = record |
| 181 |
{ isNearSemiringMonomorphism = isNearSemiringMonomorphism F.isNearSemiringMonomorphism G.isNearSemiringMonomorphism |
| 182 |
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective |
| 183 |
} where module F = IsNearSemiringIsomorphism f-iso; module G = IsNearSemiringIsomorphism g-iso |
| 184 |
|
| 185 |
|
| 186 |
------------------------------------------------------------------------ |
| 187 |
-- Semirings |
| 188 |
|
| 189 |
module _ |
| 190 |
{R₁ : RawSemiring a ℓ₁} |
| 191 |
{R₂ : RawSemiring b ℓ₂} |
| 192 |
{R₃ : RawSemiring c ℓ₃} |
| 193 |
(open RawSemiring) |
| 194 |
(≈₃-trans : Transitive (_≈_ R₃)) |
| 195 |
{f : Carrier R₁ → Carrier R₂} |
| 196 |
{g : Carrier R₂ → Carrier R₃} |
| 197 |
where |
| 198 |
|
| 199 |
|
| 200 |
isSemiringHomomorphism |
| 201 |
: IsSemiringHomomorphism R₁ R₂ f |
| 202 |
→ IsSemiringHomomorphism R₂ R₃ g |
| 203 |
→ IsSemiringHomomorphism R₁ R₃ (g ∘ f) |
| 204 |
isSemiringHomomorphism f-homo g-homo = record |
| 205 |
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism ≈₃-trans F.isNearSemiringHomomorphism G.isNearSemiringHomomorphism |
| 206 |
; 1#-homo = ≈₃-trans (G.⟦⟧-cong F.1#-homo) G.1#-homo |
| 207 |
} where module F = IsSemiringHomomorphism f-homo; module G = IsSemiringHomomorphism g-homo |
| 208 |
|
| 209 |
isSemiringMonomorphism |
| 210 |
: IsSemiringMonomorphism R₁ R₂ f |
| 211 |
→ IsSemiringMonomorphism R₂ R₃ g |
| 212 |
→ IsSemiringMonomorphism R₁ R₃ (g ∘ f) |
| 213 |
isSemiringMonomorphism f-mono g-mono = record |
| 214 |
{ isSemiringHomomorphism = isSemiringHomomorphism F.isSemiringHomomorphism G.isSemiringHomomorphism |
| 215 |
; injective = F.injective ∘ G.injective |
| 216 |
} where module F = IsSemiringMonomorphism f-mono; module G = IsSemiringMonomorphism g-mono |
| 217 |
|
| 218 |
isSemiringIsomorphism |
| 219 |
: IsSemiringIsomorphism R₁ R₂ f |
| 220 |
→ IsSemiringIsomorphism R₂ R₃ g |
| 221 |
→ IsSemiringIsomorphism R₁ R₃ (g ∘ f) |
| 222 |
isSemiringIsomorphism f-iso g-iso = record |
| 223 |
{ isSemiringMonomorphism = isSemiringMonomorphism F.isSemiringMonomorphism G.isSemiringMonomorphism |
| 224 |
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective |
| 225 |
} where module F = IsSemiringIsomorphism f-iso; module G = IsSemiringIsomorphism g-iso |
| 226 |
|
| 227 |
------------------------------------------------------------------------ |
| 228 |
-- RingWithoutOne |
| 229 |
|
| 230 |
module _ {R₁ : RawRingWithoutOne a ℓ₁} |
| 231 |
{R₂ : RawRingWithoutOne b ℓ₂} |
| 232 |
{R₃ : RawRingWithoutOne c ℓ₃} |
| 233 |
(open RawRingWithoutOne) |
| 234 |
(≈₃-trans : Transitive (_≈_ R₃)) |
| 235 |
{f : Carrier R₁ → Carrier R₂} |
| 236 |
{g : Carrier R₂ → Carrier R₃} |
| 237 |
where |
| 238 |
|
| 239 |
|
| 240 |
isRingWithoutOneHomomorphism |
| 241 |
: IsRingWithoutOneHomomorphism R₁ R₂ f |
| 242 |
→ IsRingWithoutOneHomomorphism R₂ R₃ g |
| 243 |
→ IsRingWithoutOneHomomorphism R₁ R₃ (g ∘ f) |
| 244 |
isRingWithoutOneHomomorphism f-homo g-homo = record |
| 245 |
{ +-isGroupHomomorphism = isGroupHomomorphism ≈₃-trans F.+-isGroupHomomorphism G.+-isGroupHomomorphism |
| 246 |
; *-homo = λ x y → ≈₃-trans (G.⟦⟧-cong (F.*-homo x y)) (G.*-homo (f x) (f y)) |
| 247 |
} where module F = IsRingWithoutOneHomomorphism f-homo; module G = IsRingWithoutOneHomomorphism g-homo |
| 248 |
|
| 249 |
isRingWithoutOneMonomorphism |
| 250 |
: IsRingWithoutOneMonomorphism R₁ R₂ f |
| 251 |
→ IsRingWithoutOneMonomorphism R₂ R₃ g |
| 252 |
→ IsRingWithoutOneMonomorphism R₁ R₃ (g ∘ f) |
| 253 |
isRingWithoutOneMonomorphism f-mono g-mono = record |
| 254 |
{ isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism F.isRingWithoutOneHomomorphism G.isRingWithoutOneHomomorphism |
| 255 |
; injective = F.injective ∘ G.injective |
| 256 |
} where module F = IsRingWithoutOneMonomorphism f-mono; module G = IsRingWithoutOneMonomorphism g-mono |
| 257 |
|
| 258 |
isRingWithoutOneIsoMorphism |
| 259 |
: IsRingWithoutOneIsoMorphism R₁ R₂ f |
| 260 |
→ IsRingWithoutOneIsoMorphism R₂ R₃ g |
| 261 |
→ IsRingWithoutOneIsoMorphism R₁ R₃ (g ∘ f) |
| 262 |
isRingWithoutOneIsoMorphism f-iso g-iso = record |
| 263 |
{ isRingWithoutOneMonomorphism = isRingWithoutOneMonomorphism F.isRingWithoutOneMonomorphism G.isRingWithoutOneMonomorphism |
| 264 |
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective |
| 265 |
} where module F = IsRingWithoutOneIsoMorphism f-iso; module G = IsRingWithoutOneIsoMorphism g-iso |
| 266 |
|
| 267 |
------------------------------------------------------------------------ |
| 268 |
-- Rings |
| 269 |
|
| 270 |
module _ {R₁ : RawRing a ℓ₁} |
| 271 |
{R₂ : RawRing b ℓ₂} |
| 272 |
{R₃ : RawRing c ℓ₃} |
| 273 |
(open RawRing) |
| 274 |
(≈₃-trans : Transitive (_≈_ R₃)) |
| 275 |
{f : Carrier R₁ → Carrier R₂} |
| 276 |
{g : Carrier R₂ → Carrier R₃} |
| 277 |
where |
| 278 |
|
| 279 |
|
| 280 |
isRingHomomorphism |
| 281 |
: IsRingHomomorphism R₁ R₂ f |
| 282 |
→ IsRingHomomorphism R₂ R₃ g |
| 283 |
→ IsRingHomomorphism R₁ R₃ (g ∘ f) |
| 284 |
isRingHomomorphism f-homo g-homo = record |
| 285 |
{ isSemiringHomomorphism = isSemiringHomomorphism ≈₃-trans F.isSemiringHomomorphism G.isSemiringHomomorphism |
| 286 |
; -‿homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.-‿homo x)) (G.-‿homo (f x)) |
| 287 |
} where module F = IsRingHomomorphism f-homo; module G = IsRingHomomorphism g-homo |
| 288 |
|
| 289 |
isRingMonomorphism |
| 290 |
: IsRingMonomorphism R₁ R₂ f |
| 291 |
→ IsRingMonomorphism R₂ R₃ g |
| 292 |
→ IsRingMonomorphism R₁ R₃ (g ∘ f) |
| 293 |
isRingMonomorphism f-mono g-mono = record |
| 294 |
{ isRingHomomorphism = isRingHomomorphism F.isRingHomomorphism G.isRingHomomorphism |
| 295 |
; injective = F.injective ∘ G.injective |
| 296 |
} where module F = IsRingMonomorphism f-mono; module G = IsRingMonomorphism g-mono |
| 297 |
|
| 298 |
isRingIsomorphism |
| 299 |
: IsRingIsomorphism R₁ R₂ f |
| 300 |
→ IsRingIsomorphism R₂ R₃ g |
| 301 |
→ IsRingIsomorphism R₁ R₃ (g ∘ f) |
| 302 |
isRingIsomorphism f-iso g-iso = record |
| 303 |
{ isRingMonomorphism = isRingMonomorphism F.isRingMonomorphism G.isRingMonomorphism |
| 304 |
; surjective = Func.surjective _ _ (_≈_ R₃) F.surjective G.surjective |
| 305 |
} where module F = IsRingIsomorphism f-iso; module G = IsRingIsomorphism g-iso |
| 306 |
|
| 307 |
------------------------------------------------------------------------ |
| 308 |
-- Quasigroup |
| 309 |
|
| 310 |
module _ {Q₁ : RawQuasigroup a ℓ₁} |
| 311 |
{Q₂ : RawQuasigroup b ℓ₂} |
| 312 |
{Q₃ : RawQuasigroup c ℓ₃} |
| 313 |
(open RawQuasigroup) |
| 314 |
(≈₃-trans : Transitive (_≈_ Q₃)) |
| 315 |
{f : Carrier Q₁ → Carrier Q₂} |
| 316 |
{g : Carrier Q₂ → Carrier Q₃} |
| 317 |
where |
| 318 |
|
| 319 |
|
| 320 |
isQuasigroupHomomorphism |
| 321 |
: IsQuasigroupHomomorphism Q₁ Q₂ f |
| 322 |
→ IsQuasigroupHomomorphism Q₂ Q₃ g |
| 323 |
→ IsQuasigroupHomomorphism Q₁ Q₃ (g ∘ f) |
| 324 |
isQuasigroupHomomorphism f-homo g-homo = record |
| 325 |
{ isRelHomomorphism = isRelHomomorphism F.isRelHomomorphism G.isRelHomomorphism |
| 326 |
; ∙-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.∙-homo x y )) ( G.∙-homo (f x) (f y) ) |
| 327 |
; \\-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.\\-homo x y )) ( G.\\-homo (f x) (f y) ) |
| 328 |
; //-homo = λ x y → ≈₃-trans (G.⟦⟧-cong ( F.//-homo x y )) ( G.//-homo (f x) (f y) ) |
| 329 |
} where module F = IsQuasigroupHomomorphism f-homo; module G = IsQuasigroupHomomorphism g-homo |
| 330 |
|
| 331 |
isQuasigroupMonomorphism |
| 332 |
: IsQuasigroupMonomorphism Q₁ Q₂ f |
| 333 |
→ IsQuasigroupMonomorphism Q₂ Q₃ g |
| 334 |
→ IsQuasigroupMonomorphism Q₁ Q₃ (g ∘ f) |
| 335 |
isQuasigroupMonomorphism f-mono g-mono = record |
| 336 |
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism F.isQuasigroupHomomorphism G.isQuasigroupHomomorphism |
| 337 |
; injective = F.injective ∘ G.injective |
| 338 |
} where module F = IsQuasigroupMonomorphism f-mono; module G = IsQuasigroupMonomorphism g-mono |
| 339 |
|
| 340 |
isQuasigroupIsomorphism |
| 341 |
: IsQuasigroupIsomorphism Q₁ Q₂ f |
| 342 |
→ IsQuasigroupIsomorphism Q₂ Q₃ g |
| 343 |
→ IsQuasigroupIsomorphism Q₁ Q₃ (g ∘ f) |
| 344 |
isQuasigroupIsomorphism f-iso g-iso = record |
| 345 |
{ isQuasigroupMonomorphism = isQuasigroupMonomorphism F.isQuasigroupMonomorphism G.isQuasigroupMonomorphism |
| 346 |
; surjective = Func.surjective _ _ (_≈_ Q₃) F.surjective G.surjective |
| 347 |
} where module F = IsQuasigroupIsomorphism f-iso; module G = IsQuasigroupIsomorphism g-iso |
| 348 |
|
| 349 |
------------------------------------------------------------------------ |
| 350 |
-- Loop |
| 351 |
|
| 352 |
module _ {L₁ : RawLoop a ℓ₁} |
| 353 |
{L₂ : RawLoop b ℓ₂} |
| 354 |
{L₃ : RawLoop c ℓ₃} |
| 355 |
(open RawLoop) |
| 356 |
(≈₃-trans : Transitive (_≈_ L₃)) |
| 357 |
{f : Carrier L₁ → Carrier L₂} |
| 358 |
{g : Carrier L₂ → Carrier L₃} |
| 359 |
where |
| 360 |
|
| 361 |
|
| 362 |
isLoopHomomorphism |
| 363 |
: IsLoopHomomorphism L₁ L₂ f |
| 364 |
→ IsLoopHomomorphism L₂ L₃ g |
| 365 |
→ IsLoopHomomorphism L₁ L₃ (g ∘ f) |
| 366 |
isLoopHomomorphism f-homo g-homo = record |
| 367 |
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism ≈₃-trans F.isQuasigroupHomomorphism G.isQuasigroupHomomorphism |
| 368 |
; ε-homo = ≈₃-trans (G.⟦⟧-cong F.ε-homo) G.ε-homo |
| 369 |
} where module F = IsLoopHomomorphism f-homo; module G = IsLoopHomomorphism g-homo |
| 370 |
|
| 371 |
isLoopMonomorphism |
| 372 |
: IsLoopMonomorphism L₁ L₂ f |
| 373 |
→ IsLoopMonomorphism L₂ L₃ g |
| 374 |
→ IsLoopMonomorphism L₁ L₃ (g ∘ f) |
| 375 |
isLoopMonomorphism f-mono g-mono = record |
| 376 |
{ isLoopHomomorphism = isLoopHomomorphism F.isLoopHomomorphism G.isLoopHomomorphism |
| 377 |
; injective = F.injective ∘ G.injective |
| 378 |
} where module F = IsLoopMonomorphism f-mono; module G = IsLoopMonomorphism g-mono |
| 379 |
|
| 380 |
isLoopIsomorphism |
| 381 |
: IsLoopIsomorphism L₁ L₂ f |
| 382 |
→ IsLoopIsomorphism L₂ L₃ g |
| 383 |
→ IsLoopIsomorphism L₁ L₃ (g ∘ f) |
| 384 |
isLoopIsomorphism f-iso g-iso = record |
| 385 |
{ isLoopMonomorphism = isLoopMonomorphism F.isLoopMonomorphism G.isLoopMonomorphism |
| 386 |
; surjective = Func.surjective _ _ (_≈_ L₃) F.surjective G.surjective |
| 387 |
} where module F = IsLoopIsomorphism f-iso; module G = IsLoopIsomorphism g-iso |
| 388 |
|
| 389 |
------------------------------------------------------------------------ |
| 390 |
-- KleeneAlgebra |
| 391 |
|
| 392 |
module _ {K₁ : RawKleeneAlgebra a ℓ₁} |
| 393 |
{K₂ : RawKleeneAlgebra b ℓ₂} |
| 394 |
{K₃ : RawKleeneAlgebra c ℓ₃} |
| 395 |
(open RawKleeneAlgebra) |
| 396 |
(≈₃-trans : Transitive (_≈_ K₃)) |
| 397 |
{f : Carrier K₁ → Carrier K₂} |
| 398 |
{g : Carrier K₂ → Carrier K₃} |
| 399 |
where |
| 400 |
|
| 401 |
isKleeneAlgebraHomomorphism |
| 402 |
: IsKleeneAlgebraHomomorphism K₁ K₂ f |
| 403 |
→ IsKleeneAlgebraHomomorphism K₂ K₃ g |
| 404 |
→ IsKleeneAlgebraHomomorphism K₁ K₃ (g ∘ f) |
| 405 |
isKleeneAlgebraHomomorphism f-homo g-homo = record |
| 406 |
{ isSemiringHomomorphism = isSemiringHomomorphism ≈₃-trans F.isSemiringHomomorphism G.isSemiringHomomorphism |
| 407 |
; ⋆-homo = λ x → ≈₃-trans (G.⟦⟧-cong (F.⋆-homo x)) (G.⋆-homo (f x)) |
| 408 |
} where module F = IsKleeneAlgebraHomomorphism f-homo; module G = IsKleeneAlgebraHomomorphism g-homo |
| 409 |
|
| 410 |
isKleeneAlgebraMonomorphism |
| 411 |
: IsKleeneAlgebraMonomorphism K₁ K₂ f |
| 412 |
→ IsKleeneAlgebraMonomorphism K₂ K₃ g |
| 413 |
→ IsKleeneAlgebraMonomorphism K₁ K₃ (g ∘ f) |
| 414 |
isKleeneAlgebraMonomorphism f-mono g-mono = record |
| 415 |
{ isKleeneAlgebraHomomorphism = isKleeneAlgebraHomomorphism F.isKleeneAlgebraHomomorphism G.isKleeneAlgebraHomomorphism |
| 416 |
; injective = F.injective ∘ G.injective |
| 417 |
} where module F = IsKleeneAlgebraMonomorphism f-mono; module G = IsKleeneAlgebraMonomorphism g-mono |
| 418 |
|
| 419 |
isKleeneAlgebraIsomorphism |
| 420 |
: IsKleeneAlgebraIsomorphism K₁ K₂ f |
| 421 |
→ IsKleeneAlgebraIsomorphism K₂ K₃ g |
| 422 |
→ IsKleeneAlgebraIsomorphism K₁ K₃ (g ∘ f) |
| 423 |
isKleeneAlgebraIsomorphism f-iso g-iso = record |
| 424 |
{ isKleeneAlgebraMonomorphism = isKleeneAlgebraMonomorphism F.isKleeneAlgebraMonomorphism G.isKleeneAlgebraMonomorphism |
| 425 |
; surjective = Func.surjective (_≈_ K₁) (_≈_ K₂) (_≈_ K₃) F.surjective G.surjective |
| 426 |
} where module F = IsKleeneAlgebraIsomorphism f-iso; module G = IsKleeneAlgebraIsomorphism g-iso |
| 427 |
|
| 428 |
----------------------------------------------------------------------- |
| 429 |
-- Bundled morphisms between algebras |
| 430 |
------------------------------------------------------------------------ |
| 431 |
|
| 432 |
-- Magma |
| 433 |
|
| 434 |
module _ {M₁ : Magma a ℓ₁} {M₂ : Magma b ℓ₂} {M₃ : Magma c ℓ₃} where |
| 435 |
|
| 436 |
private |
| 437 |
module M₁ = Magma M₁ |
| 438 |
module M₂ = Magma M₂ |
| 439 |
module M₃ = Magma M₃ |
| 440 |
|
| 441 |
magmaHomomorphism : (h : MagmaHomomorphism M₁.rawMagma M₂.rawMagma) → |
| 442 |
(k : MagmaHomomorphism M₂.rawMagma M₃.rawMagma) → |
| 443 |
MagmaHomomorphism M₁.rawMagma M₃.rawMagma |
| 444 |
magmaHomomorphism h k = record |
| 445 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 446 |
; isMagmaHomomorphism = isMagmaHomomorphism M₃.trans H.isMagmaHomomorphism K.isMagmaHomomorphism |
| 447 |
} |
| 448 |
where |
| 449 |
module H = MagmaHomomorphism h |
| 450 |
module K = MagmaHomomorphism k |
| 451 |
|
| 452 |
-- Monoid |
| 453 |
|
| 454 |
module _ {M₁ : Monoid a ℓ₁} {M₂ : Monoid b ℓ₂} {M₃ : Monoid c ℓ₃} where |
| 455 |
|
| 456 |
private |
| 457 |
module M₁ = Monoid M₁ |
| 458 |
module M₂ = Monoid M₂ |
| 459 |
module M₃ = Monoid M₃ |
| 460 |
|
| 461 |
monoidHomomorphism : (h : MonoidHomomorphism M₁.rawMonoid M₂.rawMonoid) → |
| 462 |
(k : MonoidHomomorphism M₂.rawMonoid M₃.rawMonoid) → |
| 463 |
MonoidHomomorphism M₁.rawMonoid M₃.rawMonoid |
| 464 |
monoidHomomorphism h k = record |
| 465 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 466 |
; isMonoidHomomorphism = isMonoidHomomorphism M₃.trans H.isMonoidHomomorphism K.isMonoidHomomorphism |
| 467 |
} |
| 468 |
where |
| 469 |
module H = MonoidHomomorphism h |
| 470 |
module K = MonoidHomomorphism k |
| 471 |
|
| 472 |
-- Group |
| 473 |
|
| 474 |
module _ {M₁ : Group a ℓ₁} {M₂ : Group b ℓ₂} {M₃ : Group c ℓ₃} where |
| 475 |
|
| 476 |
private |
| 477 |
module M₁ = Group M₁ |
| 478 |
module M₂ = Group M₂ |
| 479 |
module M₃ = Group M₃ |
| 480 |
|
| 481 |
groupHomomorphism : (h : GroupHomomorphism M₁.rawGroup M₂.rawGroup) → |
| 482 |
(k : GroupHomomorphism M₂.rawGroup M₃.rawGroup) → |
| 483 |
GroupHomomorphism M₁.rawGroup M₃.rawGroup |
| 484 |
groupHomomorphism h k = record |
| 485 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 486 |
; isGroupHomomorphism = isGroupHomomorphism M₃.trans H.isGroupHomomorphism K.isGroupHomomorphism |
| 487 |
} |
| 488 |
where |
| 489 |
module H = GroupHomomorphism h |
| 490 |
module K = GroupHomomorphism k |
| 491 |
|
| 492 |
-- NearSemiring |
| 493 |
|
| 494 |
module _ {M₁ : NearSemiring a ℓ₁} {M₂ : NearSemiring b ℓ₂} {M₃ : NearSemiring c ℓ₃} where |
| 495 |
|
| 496 |
private |
| 497 |
module M₁ = NearSemiring M₁ |
| 498 |
module M₂ = NearSemiring M₂ |
| 499 |
module M₃ = NearSemiring M₃ |
| 500 |
|
| 501 |
nearSemiringHomomorphism : (h : NearSemiringHomomorphism M₁.rawNearSemiring M₂.rawNearSemiring) → |
| 502 |
(k : NearSemiringHomomorphism M₂.rawNearSemiring M₃.rawNearSemiring) → |
| 503 |
NearSemiringHomomorphism M₁.rawNearSemiring M₃.rawNearSemiring |
| 504 |
nearSemiringHomomorphism h k = record |
| 505 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 506 |
; isNearSemiringHomomorphism = isNearSemiringHomomorphism M₃.trans H.isNearSemiringHomomorphism K.isNearSemiringHomomorphism |
| 507 |
} |
| 508 |
where |
| 509 |
module H = NearSemiringHomomorphism h |
| 510 |
module K = NearSemiringHomomorphism k |
| 511 |
|
| 512 |
-- Semiring |
| 513 |
|
| 514 |
module _ {M₁ : Semiring a ℓ₁} {M₂ : Semiring b ℓ₂} {M₃ : Semiring c ℓ₃} where |
| 515 |
|
| 516 |
private |
| 517 |
module M₁ = Semiring M₁ |
| 518 |
module M₂ = Semiring M₂ |
| 519 |
module M₃ = Semiring M₃ |
| 520 |
|
| 521 |
semiringHomomorphism : (h : SemiringHomomorphism M₁.rawSemiring M₂.rawSemiring) → |
| 522 |
(k : SemiringHomomorphism M₂.rawSemiring M₃.rawSemiring) → |
| 523 |
SemiringHomomorphism M₁.rawSemiring M₃.rawSemiring |
| 524 |
semiringHomomorphism h k = record |
| 525 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 526 |
; isSemiringHomomorphism = isSemiringHomomorphism M₃.trans H.isSemiringHomomorphism K.isSemiringHomomorphism |
| 527 |
} |
| 528 |
where |
| 529 |
module H = SemiringHomomorphism h |
| 530 |
module K = SemiringHomomorphism k |
| 531 |
|
| 532 |
-- RingWithoutOne |
| 533 |
|
| 534 |
module _ {M₁ : RingWithoutOne a ℓ₁} {M₂ : RingWithoutOne b ℓ₂} {M₃ : RingWithoutOne c ℓ₃} where |
| 535 |
|
| 536 |
private |
| 537 |
module M₁ = RingWithoutOne M₁ |
| 538 |
module M₂ = RingWithoutOne M₂ |
| 539 |
module M₃ = RingWithoutOne M₃ |
| 540 |
|
| 541 |
ringWithoutOneHomomorphism : (h : RingWithoutOneHomomorphism M₁.rawRingWithoutOne M₂.rawRingWithoutOne) → |
| 542 |
(k : RingWithoutOneHomomorphism M₂.rawRingWithoutOne M₃.rawRingWithoutOne) → |
| 543 |
RingWithoutOneHomomorphism M₁.rawRingWithoutOne M₃.rawRingWithoutOne |
| 544 |
ringWithoutOneHomomorphism h k = record |
| 545 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 546 |
; isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism M₃.trans H.isRingWithoutOneHomomorphism K.isRingWithoutOneHomomorphism |
| 547 |
} |
| 548 |
where |
| 549 |
module H = RingWithoutOneHomomorphism h |
| 550 |
module K = RingWithoutOneHomomorphism k |
| 551 |
|
| 552 |
-- Ring |
| 553 |
|
| 554 |
module _ {M₁ : Ring a ℓ₁} {M₂ : Ring b ℓ₂} {M₃ : Ring c ℓ₃} where |
| 555 |
|
| 556 |
private |
| 557 |
module M₁ = Ring M₁ |
| 558 |
module M₂ = Ring M₂ |
| 559 |
module M₃ = Ring M₃ |
| 560 |
|
| 561 |
ringHomomorphism : (h : RingHomomorphism M₁.rawRing M₂.rawRing) → |
| 562 |
(k : RingHomomorphism M₂.rawRing M₃.rawRing) → |
| 563 |
RingHomomorphism M₁.rawRing M₃.rawRing |
| 564 |
ringHomomorphism h k = record |
| 565 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 566 |
; isRingHomomorphism = isRingHomomorphism M₃.trans H.isRingHomomorphism K.isRingHomomorphism |
| 567 |
} |
| 568 |
where |
| 569 |
module H = RingHomomorphism h |
| 570 |
module K = RingHomomorphism k |
| 571 |
|
| 572 |
-- Quasigroup |
| 573 |
|
| 574 |
module _ {M₁ : Quasigroup a ℓ₁} {M₂ : Quasigroup b ℓ₂} {M₃ : Quasigroup c ℓ₃} where |
| 575 |
|
| 576 |
private |
| 577 |
module M₁ = Quasigroup M₁ |
| 578 |
module M₂ = Quasigroup M₂ |
| 579 |
module M₃ = Quasigroup M₃ |
| 580 |
|
| 581 |
quasigroupHomomorphism : (h : QuasigroupHomomorphism M₁.rawQuasigroup M₂.rawQuasigroup) → |
| 582 |
(k : QuasigroupHomomorphism M₂.rawQuasigroup M₃.rawQuasigroup) → |
| 583 |
QuasigroupHomomorphism M₁.rawQuasigroup M₃.rawQuasigroup |
| 584 |
quasigroupHomomorphism h k = record |
| 585 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 586 |
; isQuasigroupHomomorphism = isQuasigroupHomomorphism M₃.trans H.isQuasigroupHomomorphism K.isQuasigroupHomomorphism |
| 587 |
} |
| 588 |
where |
| 589 |
module H = QuasigroupHomomorphism h |
| 590 |
module K = QuasigroupHomomorphism k |
| 591 |
|
| 592 |
-- Loop |
| 593 |
|
| 594 |
module _ {M₁ : Loop a ℓ₁} {M₂ : Loop b ℓ₂} {M₃ : Loop c ℓ₃} where |
| 595 |
|
| 596 |
private |
| 597 |
module M₁ = Loop M₁ |
| 598 |
module M₂ = Loop M₂ |
| 599 |
module M₃ = Loop M₃ |
| 600 |
|
| 601 |
loopHomomorphism : (h : LoopHomomorphism M₁.rawLoop M₂.rawLoop) → |
| 602 |
(k : LoopHomomorphism M₂.rawLoop M₃.rawLoop) → |
| 603 |
LoopHomomorphism M₁.rawLoop M₃.rawLoop |
| 604 |
loopHomomorphism h k = record |
| 605 |
{ ⟦_⟧ = K.⟦_⟧ ∘ H.⟦_⟧ |
| 606 |
; isLoopHomomorphism = isLoopHomomorphism M₃.trans H.isLoopHomomorphism K.isLoopHomomorphism |
| 607 |
} |
| 608 |
where |
| 609 |
module H = LoopHomomorphism h |
| 610 |
module K = LoopHomomorphism k |
| 611 |
|