-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added unique morphisms * refactored for uniformity's sake * exploit the uniformity * add missing instances * finish up, for now * `CHANGELOG` * `CHANGELOG` * `TheMorphism` * comment * comment * comment * `The` to `Unique` * lifted out istantiated `import` * blank line * note on instantiated `import`s * parametrise on the `Raw` bundle * parametrise on the `Raw` bundle * Rerranged to get rid of lots of boilerplate --------- Co-authored-by: MatthewDaggitt <[email protected]>
- Loading branch information
1 parent
2f5d88d
commit 4529e73
Showing
7 changed files
with
179 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- The unique morphism from the initial object, | ||
-- for each of the relevant categories. Since | ||
-- `Semigroup` and `Band` are simply `Magma`s | ||
-- satisfying additional properties, it suffices to | ||
-- define the morphism on the underlying `RawMagma`. | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
open import Level using (Level) | ||
|
||
module Algebra.Morphism.Construct.Initial {c ℓ : Level} where | ||
|
||
open import Algebra.Bundles.Raw using (RawMagma) | ||
open import Algebra.Morphism.Structures | ||
open import Function.Definitions using (Injective) | ||
import Relation.Binary.Morphism.Definitions as Rel | ||
open import Relation.Binary.Morphism.Structures | ||
open import Relation.Binary.Core using (Rel) | ||
|
||
open import Algebra.Construct.Initial {c} {ℓ} | ||
|
||
private | ||
variable | ||
a m ℓm : Level | ||
A : Set a | ||
≈ : Rel A ℓm | ||
|
||
------------------------------------------------------------------------ | ||
-- The unique morphism | ||
|
||
zero : ℤero.Carrier → A | ||
zero () | ||
|
||
------------------------------------------------------------------------ | ||
-- Basic properties | ||
|
||
cong : (≈ : Rel A ℓm) → Rel.Homomorphic₂ ℤero.Carrier A ℤero._≈_ ≈ zero | ||
cong _ {x = ()} | ||
|
||
injective : (≈ : Rel A ℓm) → Injective ℤero._≈_ ≈ zero | ||
injective _ {x = ()} | ||
|
||
------------------------------------------------------------------------ | ||
-- Morphism structures | ||
|
||
isMagmaHomomorphism : (M : RawMagma m ℓm) → | ||
IsMagmaHomomorphism rawMagma M zero | ||
isMagmaHomomorphism M = record | ||
{ isRelHomomorphism = record { cong = cong (RawMagma._≈_ M) } | ||
; homo = λ() | ||
} | ||
|
||
isMagmaMonomorphism : (M : RawMagma m ℓm) → | ||
IsMagmaMonomorphism rawMagma M zero | ||
isMagmaMonomorphism M = record | ||
{ isMagmaHomomorphism = isMagmaHomomorphism M | ||
; injective = injective (RawMagma._≈_ M) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- The unique morphism to the terminal object, | ||
-- for each of the relevant categories. Since | ||
-- each terminal algebra builds on `Monoid`, | ||
-- possibly with additional (trivial) operations, | ||
-- satisfying additional properties, it suffices to | ||
-- define the morphism on the underlying `RawMonoid` | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --cubical-compatible --safe #-} | ||
|
||
open import Level using (Level) | ||
|
||
module Algebra.Morphism.Construct.Terminal {c ℓ : Level} where | ||
|
||
open import Algebra.Bundles.Raw | ||
using (RawMagma; RawMonoid; RawGroup; RawNearSemiring; RawSemiring; RawRing) | ||
open import Algebra.Morphism.Structures | ||
|
||
open import Data.Product.Base using (_,_) | ||
open import Function.Definitions using (StrictlySurjective) | ||
import Relation.Binary.Morphism.Definitions as Rel | ||
open import Relation.Binary.Morphism.Structures | ||
|
||
open import Algebra.Construct.Terminal {c} {ℓ} | ||
|
||
private | ||
variable | ||
a ℓa : Level | ||
A : Set a | ||
|
||
------------------------------------------------------------------------ | ||
-- The unique morphism | ||
|
||
one : A → 𝕆ne.Carrier | ||
one _ = _ | ||
|
||
------------------------------------------------------------------------ | ||
-- Basic properties | ||
|
||
strictlySurjective : A → StrictlySurjective 𝕆ne._≈_ one | ||
strictlySurjective x _ = x , _ | ||
|
||
------------------------------------------------------------------------ | ||
-- Homomorphisms | ||
|
||
isMagmaHomomorphism : (M : RawMagma a ℓa) → | ||
IsMagmaHomomorphism M rawMagma one | ||
isMagmaHomomorphism M = record | ||
{ isRelHomomorphism = record { cong = _ } | ||
; homo = _ | ||
} | ||
|
||
isMonoidHomomorphism : (M : RawMonoid a ℓa) → | ||
IsMonoidHomomorphism M rawMonoid one | ||
isMonoidHomomorphism M = record | ||
{ isMagmaHomomorphism = isMagmaHomomorphism (RawMonoid.rawMagma M) | ||
; ε-homo = _ | ||
} | ||
|
||
isGroupHomomorphism : (G : RawGroup a ℓa) → | ||
IsGroupHomomorphism G rawGroup one | ||
isGroupHomomorphism G = record | ||
{ isMonoidHomomorphism = isMonoidHomomorphism (RawGroup.rawMonoid G) | ||
; ⁻¹-homo = λ _ → _ | ||
} | ||
|
||
isNearSemiringHomomorphism : (N : RawNearSemiring a ℓa) → | ||
IsNearSemiringHomomorphism N rawNearSemiring one | ||
isNearSemiringHomomorphism N = record | ||
{ +-isMonoidHomomorphism = isMonoidHomomorphism (RawNearSemiring.+-rawMonoid N) | ||
; *-homo = λ _ _ → _ | ||
} | ||
|
||
isSemiringHomomorphism : (S : RawSemiring a ℓa) → | ||
IsSemiringHomomorphism S rawSemiring one | ||
isSemiringHomomorphism S = record | ||
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism (RawSemiring.rawNearSemiring S) | ||
; 1#-homo = _ | ||
} | ||
|
||
isRingHomomorphism : (R : RawRing a ℓa) → IsRingHomomorphism R rawRing one | ||
isRingHomomorphism R = record | ||
{ isSemiringHomomorphism = isSemiringHomomorphism (RawRing.rawSemiring R) | ||
; -‿homo = λ _ → _ | ||
} |