-
Notifications
You must be signed in to change notification settings - Fork 249
Add unique morphisms from/to Initial
and Terminal
algebras
#2296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
MatthewDaggitt
merged 19 commits into
agda:master
from
jamesmckinna:initial+terminal-morphisms
Mar 16, 2024
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ad21935
added unique morphisms
jamesmckinna e6cba23
refactored for uniformity's sake
jamesmckinna 1d5bce2
exploit the uniformity
jamesmckinna 3bacd34
add missing instances
jamesmckinna 85490a3
finish up, for now
jamesmckinna 4dac066
`CHANGELOG`
jamesmckinna a6a3b85
`CHANGELOG`
jamesmckinna b34dd3d
`TheMorphism`
jamesmckinna f518f8c
comment
jamesmckinna 8daf869
comment
jamesmckinna 56ace7c
comment
jamesmckinna 066d5d6
`The` to `Unique`
jamesmckinna 81251de
lifted out istantiated `import`
jamesmckinna 5ea5071
blank line
jamesmckinna 62908aa
note on instantiated `import`s
jamesmckinna ee19191
parametrise on the `Raw` bundle
jamesmckinna 45002b0
parametrise on the `Raw` bundle
jamesmckinna 2d98ac4
Rerranged to get rid of lots of boilerplate
MatthewDaggitt fa86a30
Merge branch 'master' into initial+terminal-morphisms
MatthewDaggitt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 = λ _ → _ | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.