-
Notifications
You must be signed in to change notification settings - Fork 248
Adds Algebra.Morphism.Construct.DirectProduct #2715
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
Open
carlostome
wants to merge
6
commits into
agda:master
Choose a base branch
from
carlostome:carlos/add-projection-morphisms
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
472e462
[ add ] product structure on `RawSetoid`
jamesmckinna 416f9a9
Adds Algebra.Morphism.Construct.DirectProduct
carlostome 95061ac
Update src/Algebra/Morphism/Construct/DirectProduct.agda
carlostome 1b7d503
Address comments
carlostome 21eaa08
Add module to reexport with implicit arguments
carlostome 0b14e5b
Removed unused private module
carlostome 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- The projection morphisms for algebraic structures arising from the | ||
-- direct product construction | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --safe --cubical-compatible #-} | ||
|
||
module Algebra.Morphism.Construct.DirectProduct where | ||
|
||
open import Algebra.Bundles using (RawMagma; RawMonoid) | ||
open import Algebra.Construct.DirectProduct using (rawMagma; rawMonoid) | ||
open import Algebra.Morphism.Structures | ||
using ( module MagmaMorphisms | ||
; module MonoidMorphisms | ||
) | ||
open import Data.Product as Product | ||
using (_,_) | ||
open import Level using (Level) | ||
open import Relation.Binary.Definitions using (Reflexive) | ||
import Relation.Binary.Morphism.Construct.Product as RP | ||
|
||
private | ||
variable | ||
a b c ℓ₁ ℓ₂ ℓ₃ : Level | ||
|
||
------------------------------------------------------------------------ | ||
-- Magmas | ||
|
||
module Magma (M : RawMagma a ℓ₁) (N : RawMagma b ℓ₂) where | ||
open MagmaMorphisms | ||
|
||
private | ||
module M = RawMagma M | ||
module N = RawMagma N | ||
|
||
module Proj₁ (refl : Reflexive M._≈_) where | ||
|
||
isMagmaHomomorphism : IsMagmaHomomorphism (rawMagma M N) M Product.proj₁ | ||
isMagmaHomomorphism = record | ||
{ isRelHomomorphism = RP.proj₁ | ||
; homo = λ _ _ → refl | ||
} | ||
|
||
module Proj₂ (refl : Reflexive N._≈_) where | ||
|
||
isMagmaHomomorphism : IsMagmaHomomorphism (rawMagma M N) N Product.proj₂ | ||
isMagmaHomomorphism = record | ||
{ isRelHomomorphism = RP.proj₂ | ||
; homo = λ _ _ → refl | ||
} | ||
|
||
module Pair (P : RawMagma c ℓ₃) where | ||
|
||
isMagmaHomomorphism : ∀ {f h} → | ||
IsMagmaHomomorphism P M f → | ||
IsMagmaHomomorphism P N h → | ||
IsMagmaHomomorphism P (rawMagma M N) (Product.< f , h >) | ||
isMagmaHomomorphism F H = record | ||
{ isRelHomomorphism = RP.< F.isRelHomomorphism , H.isRelHomomorphism > | ||
; homo = λ x y → F.homo x y , H.homo x y | ||
} | ||
where | ||
module F = IsMagmaHomomorphism F | ||
module H = IsMagmaHomomorphism H | ||
|
||
-- Package for export | ||
module Magma-Export {M : RawMagma a ℓ₁} {N : RawMagma b ℓ₂} where | ||
open Magma | ||
|
||
private | ||
module M = RawMagma M | ||
module N = RawMagma N | ||
|
||
module _ {refl : Reflexive M._≈_} where | ||
proj₁ = Proj₁.isMagmaHomomorphism M M refl | ||
|
||
module _ {refl : Reflexive N._≈_} where | ||
proj₂ = Proj₂.isMagmaHomomorphism M N refl | ||
|
||
module _ {P : RawMagma c ℓ₃} where | ||
<_,_> = Pair.isMagmaHomomorphism M N P | ||
|
||
------------------------------------------------------------------------ | ||
-- Monoids | ||
|
||
module Monoid (M : RawMonoid a ℓ₁) (N : RawMonoid b ℓ₂) where | ||
open MonoidMorphisms | ||
|
||
private | ||
module M = RawMonoid M | ||
module N = RawMonoid N | ||
|
||
module Proj₁ (refl : Reflexive M._≈_) where | ||
|
||
isMonoidHomomorphism : IsMonoidHomomorphism (rawMonoid M N) M Product.proj₁ | ||
isMonoidHomomorphism = record | ||
{ isMagmaHomomorphism = Magma.Proj₁.isMagmaHomomorphism M.rawMagma N.rawMagma refl | ||
; ε-homo = refl | ||
} | ||
|
||
module Proj₂ (refl : Reflexive N._≈_) where | ||
|
||
isMonoidHomomorphism : IsMonoidHomomorphism (rawMonoid M N) N Product.proj₂ | ||
isMonoidHomomorphism = record | ||
{ isMagmaHomomorphism = Magma.Proj₂.isMagmaHomomorphism M.rawMagma N.rawMagma refl | ||
; ε-homo = refl | ||
} | ||
|
||
module Pair (P : RawMonoid c ℓ₃) where | ||
|
||
private | ||
module P = RawMonoid P | ||
|
||
isMonoidHomomorphism : ∀ {f h} → | ||
IsMonoidHomomorphism P M f → | ||
IsMonoidHomomorphism P N h → | ||
IsMonoidHomomorphism P (rawMonoid M N) (Product.< f , h >) | ||
isMonoidHomomorphism F H = record | ||
{ isMagmaHomomorphism = Magma.Pair.isMagmaHomomorphism M.rawMagma N.rawMagma P.rawMagma F.isMagmaHomomorphism H.isMagmaHomomorphism | ||
; ε-homo = F.ε-homo , H.ε-homo } | ||
where | ||
module F = IsMonoidHomomorphism F | ||
module H = IsMonoidHomomorphism H | ||
|
||
-- Package for export | ||
module Monoid-Export {M : RawMonoid a ℓ₁} {N : RawMonoid b ℓ₂} where | ||
open Monoid | ||
|
||
private | ||
module M = RawMonoid M | ||
module N = RawMonoid N | ||
|
||
module _ {refl : Reflexive M._≈_} where | ||
proj₁ = Proj₁.isMonoidHomomorphism M M refl | ||
|
||
module _ {refl : Reflexive N._≈_} where | ||
proj₂ = Proj₂.isMonoidHomomorphism M N refl | ||
|
||
module _ {P : RawMonoid c ℓ₃} where | ||
<_,_> = Pair.isMonoidHomomorphism M N P |
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,81 @@ | ||
------------------------------------------------------------------------ | ||
-- The Agda standard library | ||
-- | ||
-- The projection morphisms for relational structures arising from the | ||
-- non-dependent product construction | ||
------------------------------------------------------------------------ | ||
|
||
{-# OPTIONS --safe --cubical-compatible #-} | ||
|
||
module Relation.Binary.Morphism.Construct.Product where | ||
|
||
import Data.Product.Base as Product using (<_,_>; proj₁; proj₂) | ||
open import Data.Product.Relation.Binary.Pointwise.NonDependent as Pointwise | ||
using (Pointwise) | ||
open import Level using (Level) | ||
open import Relation.Binary.Bundles.Raw using (RawSetoid) | ||
open import Relation.Binary.Core using (Rel) | ||
open import Relation.Binary.Morphism.Structures using (IsRelHomomorphism) | ||
|
||
private | ||
variable | ||
a b c ℓ₁ ℓ₂ ℓ : Level | ||
A : Set a | ||
B : Set b | ||
C : Set c | ||
|
||
|
||
------------------------------------------------------------------------ | ||
-- definitions | ||
|
||
module _ (_≈₁_ : Rel A ℓ₁) (_≈₂_ : Rel B ℓ₂) where | ||
|
||
private | ||
|
||
_≈_ = Pointwise _≈₁_ _≈₂_ | ||
|
||
module Proj₁ where | ||
|
||
isRelHomomorphism : IsRelHomomorphism _≈_ _≈₁_ Product.proj₁ | ||
isRelHomomorphism = record { cong = Product.proj₁ } | ||
|
||
|
||
module Proj₂ where | ||
|
||
isRelHomomorphism : IsRelHomomorphism _≈_ _≈₂_ Product.proj₂ | ||
isRelHomomorphism = record { cong = Product.proj₂ } | ||
|
||
|
||
module Pair (_≈′_ : Rel C ℓ) where | ||
|
||
isRelHomomorphism : ∀ {h k} → | ||
IsRelHomomorphism _≈′_ _≈₁_ h → | ||
IsRelHomomorphism _≈′_ _≈₂_ k → | ||
IsRelHomomorphism _≈′_ _≈_ Product.< h , k > | ||
isRelHomomorphism H K = record { cong = Product.< H.cong , K.cong > } | ||
where | ||
module H = IsRelHomomorphism H | ||
module K = IsRelHomomorphism K | ||
|
||
|
||
------------------------------------------------------------------------ | ||
-- package up for export | ||
|
||
module _ {M : RawSetoid a ℓ₁} {N : RawSetoid b ℓ₂} where | ||
|
||
private | ||
|
||
module M = RawSetoid M | ||
module N = RawSetoid N | ||
|
||
proj₁ = Proj₁.isRelHomomorphism M._≈_ N._≈_ | ||
proj₂ = Proj₂.isRelHomomorphism M._≈_ N._≈_ | ||
|
||
module _ {P : RawSetoid c ℓ} where | ||
|
||
private | ||
|
||
module P = RawSetoid P | ||
|
||
<_,_> = Pair.isRelHomomorphism M._≈_ N._≈_ P._≈_ | ||
|
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.