| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- The unique morphism to the terminal object, |
| 5 |
-- for each of the relevant categories. Since |
| 6 |
-- each terminal algebra builds on `Monoid`, |
| 7 |
-- possibly with additional (trivial) operations, |
| 8 |
-- satisfying additional properties, it suffices to |
| 9 |
-- define the morphism on the underlying `RawMonoid` |
| 10 |
------------------------------------------------------------------------ |
| 11 |
|
| 12 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 13 |
|
| 14 |
open import Level using (Level) |
| 15 |
|
| 16 |
module Algebra.Morphism.Construct.Terminal {c ℓ : Level} where |
| 17 |
|
| 18 |
open import Algebra.Bundles.Raw |
| 19 |
using (RawMagma; RawMonoid; RawGroup; RawNearSemiring; RawSemiring; RawRing) |
| 20 |
open import Algebra.Morphism.Structures |
| 21 |
using(IsMagmaHomomorphism; IsMonoidHomomorphism; IsGroupHomomorphism |
| 22 |
; IsNearSemiringHomomorphism; IsSemiringHomomorphism |
| 23 |
; IsRingHomomorphism) |
| 24 |
open import Data.Product.Base using (_,_) |
| 25 |
open import Function.Definitions using (StrictlySurjective) |
| 26 |
import Relation.Binary.Morphism.Definitions as Rel |
| 27 |
open import Relation.Binary.Morphism.Structures using (IsRelHomomorphism) |
| 28 |
|
| 29 |
open import Algebra.Construct.Terminal {c} {ℓ} |
| 30 |
|
| 31 |
private |
| 32 |
variable |
| 33 |
a ℓa : Level |
| 34 |
A : Set a |
| 35 |
|
| 36 |
------------------------------------------------------------------------ |
| 37 |
-- The unique morphism |
| 38 |
|
| 39 |
one : A → 𝕆ne.Carrier |
| 40 |
one _ = _ |
| 41 |
|
| 42 |
------------------------------------------------------------------------ |
| 43 |
-- Basic properties |
| 44 |
|
| 45 |
strictlySurjective : A → StrictlySurjective 𝕆ne._≈_ one |
| 46 |
strictlySurjective x _ = x , _ |
| 47 |
|
| 48 |
------------------------------------------------------------------------ |
| 49 |
-- Homomorphisms |
| 50 |
|
| 51 |
isMagmaHomomorphism : (M : RawMagma a ℓa) → |
| 52 |
IsMagmaHomomorphism M rawMagma one |
| 53 |
isMagmaHomomorphism M = record |
| 54 |
{ isRelHomomorphism = record { cong = _ } |
| 55 |
; homo = _ |
| 56 |
} |
| 57 |
|
| 58 |
isMonoidHomomorphism : (M : RawMonoid a ℓa) → |
| 59 |
IsMonoidHomomorphism M rawMonoid one |
| 60 |
isMonoidHomomorphism M = record |
| 61 |
{ isMagmaHomomorphism = isMagmaHomomorphism (RawMonoid.rawMagma M) |
| 62 |
; ε-homo = _ |
| 63 |
} |
| 64 |
|
| 65 |
isGroupHomomorphism : (G : RawGroup a ℓa) → |
| 66 |
IsGroupHomomorphism G rawGroup one |
| 67 |
isGroupHomomorphism G = record |
| 68 |
{ isMonoidHomomorphism = isMonoidHomomorphism (RawGroup.rawMonoid G) |
| 69 |
; ⁻¹-homo = λ _ → _ |
| 70 |
} |
| 71 |
|
| 72 |
isNearSemiringHomomorphism : (N : RawNearSemiring a ℓa) → |
| 73 |
IsNearSemiringHomomorphism N rawNearSemiring one |
| 74 |
isNearSemiringHomomorphism N = record |
| 75 |
{ +-isMonoidHomomorphism = isMonoidHomomorphism (RawNearSemiring.+-rawMonoid N) |
| 76 |
; *-homo = λ _ _ → _ |
| 77 |
} |
| 78 |
|
| 79 |
isSemiringHomomorphism : (S : RawSemiring a ℓa) → |
| 80 |
IsSemiringHomomorphism S rawSemiring one |
| 81 |
isSemiringHomomorphism S = record |
| 82 |
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism (RawSemiring.rawNearSemiring S) |
| 83 |
; 1#-homo = _ |
| 84 |
} |
| 85 |
|
| 86 |
isRingHomomorphism : (R : RawRing a ℓa) → IsRingHomomorphism R rawRing one |
| 87 |
isRingHomomorphism R = record |
| 88 |
{ isSemiringHomomorphism = isSemiringHomomorphism (RawRing.rawSemiring R) |
| 89 |
; -‿homo = λ _ → _ |
| 90 |
} |