| 1 |
------------------------------------------------------------------------ |
| 2 |
-- The Agda standard library |
| 3 |
-- |
| 4 |
-- Consequences of a monomomorphism between right semimodules |
| 5 |
------------------------------------------------------------------------ |
| 6 |
|
| 7 |
{-# OPTIONS --cubical-compatible --safe #-} |
| 8 |
|
| 9 |
open import Algebra.Module.Bundles.Raw using (RawRightSemimodule) |
| 10 |
open import Algebra.Module.Morphism.Structures using (IsRightSemimoduleMonomorphism) |
| 11 |
|
| 12 |
module Algebra.Module.Morphism.RightSemimoduleMonomorphism |
| 13 |
{r a b ℓ₁ ℓ₂} {R : Set r} {M : RawRightSemimodule R a ℓ₁} {N : RawRightSemimodule R b ℓ₂} {⟦_⟧} |
| 14 |
(isRightSemimoduleMonomorphism : IsRightSemimoduleMonomorphism M N ⟦_⟧) |
| 15 |
where |
| 16 |
|
| 17 |
open IsRightSemimoduleMonomorphism isRightSemimoduleMonomorphism |
| 18 |
private |
| 19 |
module M = RawRightSemimodule M |
| 20 |
module N = RawRightSemimodule N |
| 21 |
|
| 22 |
open import Algebra.Bundles using (Semiring) |
| 23 |
open import Algebra.Core using (Op₂) |
| 24 |
import Algebra.Module.Definitions.Right as RightDefs |
| 25 |
open import Algebra.Module.Structures using (IsRightSemimodule) |
| 26 |
open import Algebra.Structures using (IsMagma; IsSemiring) |
| 27 |
open import Function.Base using (flip; _$_) |
| 28 |
open import Level using (Level) |
| 29 |
open import Relation.Binary.Core using (Rel) |
| 30 |
import Relation.Binary.Reasoning.Setoid as SetoidReasoning |
| 31 |
|
| 32 |
private |
| 33 |
variable |
| 34 |
ℓr : Level |
| 35 |
_≈_ : Rel R ℓr |
| 36 |
_+_ _*_ : Op₂ R |
| 37 |
0# 1# : R |
| 38 |
|
| 39 |
------------------------------------------------------------------------ |
| 40 |
-- Re-exports |
| 41 |
|
| 42 |
open import Algebra.Morphism.MonoidMonomorphism |
| 43 |
+ᴹ-isMonoidMonomorphism public |
| 44 |
using () |
| 45 |
renaming |
| 46 |
( cong to +ᴹ-cong |
| 47 |
; assoc to +ᴹ-assoc |
| 48 |
; comm to +ᴹ-comm |
| 49 |
; identityˡ to +ᴹ-identityˡ |
| 50 |
; identityʳ to +ᴹ-identityʳ |
| 51 |
; identity to +ᴹ-identity |
| 52 |
; isMagma to +ᴹ-isMagma |
| 53 |
; isSemigroup to +ᴹ-isSemigroup |
| 54 |
; isMonoid to +ᴹ-isMonoid |
| 55 |
; isCommutativeMonoid to +ᴹ-isCommutativeMonoid |
| 56 |
) |
| 57 |
|
| 58 |
------------------------------------------------------------------------ |
| 59 |
-- Properties |
| 60 |
|
| 61 |
module _ (+ᴹ-isMagma : IsMagma N._≈ᴹ_ N._+ᴹ_) where |
| 62 |
|
| 63 |
open IsMagma +ᴹ-isMagma |
| 64 |
using (setoid) |
| 65 |
renaming (∙-cong to +ᴹ-cong′) |
| 66 |
open SetoidReasoning setoid |
| 67 |
|
| 68 |
module MDefs = RightDefs R M._≈ᴹ_ |
| 69 |
module NDefs = RightDefs R N._≈ᴹ_ |
| 70 |
|
| 71 |
*ᵣ-cong : NDefs.Congruent _≈_ N._*ᵣ_ → MDefs.Congruent _≈_ M._*ᵣ_ |
| 72 |
*ᵣ-cong *ᵣ-cong {x} {y} {u} {v} x≈ᴹy u≈v = injective $ begin |
| 73 |
⟦ x M.*ᵣ u ⟧ ≈⟨ *ᵣ-homo u x ⟩ |
| 74 |
⟦ x ⟧ N.*ᵣ u ≈⟨ *ᵣ-cong (⟦⟧-cong x≈ᴹy) u≈v ⟩ |
| 75 |
⟦ y ⟧ N.*ᵣ v ≈˘⟨ *ᵣ-homo v y ⟩ |
| 76 |
⟦ y M.*ᵣ v ⟧ ∎ |
| 77 |
|
| 78 |
*ᵣ-zeroʳ : NDefs.RightZero 0# N.0ᴹ N._*ᵣ_ → MDefs.RightZero 0# M.0ᴹ M._*ᵣ_ |
| 79 |
*ᵣ-zeroʳ {0# = 0#} *ᵣ-zeroʳ x = injective $ begin |
| 80 |
⟦ x M.*ᵣ 0# ⟧ ≈⟨ *ᵣ-homo 0# x ⟩ |
| 81 |
⟦ x ⟧ N.*ᵣ 0# ≈⟨ *ᵣ-zeroʳ ⟦ x ⟧ ⟩ |
| 82 |
N.0ᴹ ≈˘⟨ 0ᴹ-homo ⟩ |
| 83 |
⟦ M.0ᴹ ⟧ ∎ |
| 84 |
|
| 85 |
*ᵣ-distribˡ : N._*ᵣ_ NDefs.DistributesOverˡ _+_ ⟶ N._+ᴹ_ → M._*ᵣ_ MDefs.DistributesOverˡ _+_ ⟶ M._+ᴹ_ |
| 86 |
*ᵣ-distribˡ {_+_ = _+_} *ᵣ-distribˡ x m n = injective $ begin |
| 87 |
⟦ x M.*ᵣ (m + n) ⟧ ≈⟨ *ᵣ-homo (m + n) x ⟩ |
| 88 |
⟦ x ⟧ N.*ᵣ (m + n) ≈⟨ *ᵣ-distribˡ ⟦ x ⟧ m n ⟩ |
| 89 |
⟦ x ⟧ N.*ᵣ m N.+ᴹ ⟦ x ⟧ N.*ᵣ n ≈˘⟨ +ᴹ-cong′ (*ᵣ-homo m x) (*ᵣ-homo n x) ⟩ |
| 90 |
⟦ x M.*ᵣ m ⟧ N.+ᴹ ⟦ x M.*ᵣ n ⟧ ≈˘⟨ +ᴹ-homo (x M.*ᵣ m) (x M.*ᵣ n) ⟩ |
| 91 |
⟦ x M.*ᵣ m M.+ᴹ x M.*ᵣ n ⟧ ∎ |
| 92 |
|
| 93 |
*ᵣ-identityʳ : NDefs.RightIdentity 1# N._*ᵣ_ → MDefs.RightIdentity 1# M._*ᵣ_ |
| 94 |
*ᵣ-identityʳ {1# = 1#} *ᵣ-identityʳ m = injective $ begin |
| 95 |
⟦ m M.*ᵣ 1# ⟧ ≈⟨ *ᵣ-homo 1# m ⟩ |
| 96 |
⟦ m ⟧ N.*ᵣ 1# ≈⟨ *ᵣ-identityʳ ⟦ m ⟧ ⟩ |
| 97 |
⟦ m ⟧ ∎ |
| 98 |
|
| 99 |
*ᵣ-assoc : NDefs.RightCongruent N._*ᵣ_ → NDefs.Associative _*_ N._*ᵣ_ → MDefs.Associative _*_ M._*ᵣ_ |
| 100 |
*ᵣ-assoc {_*_ = _*_} *ᵣ-congʳ *ᵣ-assoc m x y = injective $ begin |
| 101 |
⟦ m M.*ᵣ x M.*ᵣ y ⟧ ≈⟨ *ᵣ-homo y (m M.*ᵣ x) ⟩ |
| 102 |
⟦ m M.*ᵣ x ⟧ N.*ᵣ y ≈⟨ *ᵣ-congʳ (*ᵣ-homo x m) ⟩ |
| 103 |
⟦ m ⟧ N.*ᵣ x N.*ᵣ y ≈⟨ *ᵣ-assoc ⟦ m ⟧ x y ⟩ |
| 104 |
⟦ m ⟧ N.*ᵣ (x * y) ≈˘⟨ *ᵣ-homo (x * y) m ⟩ |
| 105 |
⟦ m M.*ᵣ (x * y) ⟧ ∎ |
| 106 |
|
| 107 |
*ᵣ-zeroˡ : NDefs.RightCongruent N._*ᵣ_ → NDefs.LeftZero N.0ᴹ N._*ᵣ_ → MDefs.LeftZero M.0ᴹ M._*ᵣ_ |
| 108 |
*ᵣ-zeroˡ *ᵣ-congʳ *ᵣ-zeroˡ x = injective $ begin |
| 109 |
⟦ M.0ᴹ M.*ᵣ x ⟧ ≈⟨ *ᵣ-homo x M.0ᴹ ⟩ |
| 110 |
⟦ M.0ᴹ ⟧ N.*ᵣ x ≈⟨ *ᵣ-congʳ 0ᴹ-homo ⟩ |
| 111 |
N.0ᴹ N.*ᵣ x ≈⟨ *ᵣ-zeroˡ x ⟩ |
| 112 |
N.0ᴹ ≈˘⟨ 0ᴹ-homo ⟩ |
| 113 |
⟦ M.0ᴹ ⟧ ∎ |
| 114 |
|
| 115 |
*ᵣ-distribʳ : NDefs.RightCongruent N._*ᵣ_ → N._*ᵣ_ NDefs.DistributesOverʳ N._+ᴹ_ → M._*ᵣ_ MDefs.DistributesOverʳ M._+ᴹ_ |
| 116 |
*ᵣ-distribʳ *ᵣ-congʳ *ᵣ-distribʳ x m n = injective $ begin |
| 117 |
⟦ (m M.+ᴹ n) M.*ᵣ x ⟧ ≈⟨ *ᵣ-homo x (m M.+ᴹ n) ⟩ |
| 118 |
⟦ m M.+ᴹ n ⟧ N.*ᵣ x ≈⟨ *ᵣ-congʳ (+ᴹ-homo m n) ⟩ |
| 119 |
(⟦ m ⟧ N.+ᴹ ⟦ n ⟧) N.*ᵣ x ≈⟨ *ᵣ-distribʳ x ⟦ m ⟧ ⟦ n ⟧ ⟩ |
| 120 |
⟦ m ⟧ N.*ᵣ x N.+ᴹ ⟦ n ⟧ N.*ᵣ x ≈˘⟨ +ᴹ-cong′ (*ᵣ-homo x m) (*ᵣ-homo x n) ⟩ |
| 121 |
⟦ m M.*ᵣ x ⟧ N.+ᴹ ⟦ n M.*ᵣ x ⟧ ≈˘⟨ +ᴹ-homo (m M.*ᵣ x) (n M.*ᵣ x) ⟩ |
| 122 |
⟦ m M.*ᵣ x M.+ᴹ n M.*ᵣ x ⟧ ∎ |
| 123 |
|
| 124 |
------------------------------------------------------------------------ |
| 125 |
-- Structures |
| 126 |
|
| 127 |
module _ (R-isSemiring : IsSemiring _≈_ _+_ _*_ 0# 1#) where |
| 128 |
|
| 129 |
private |
| 130 |
R-semiring : Semiring _ _ |
| 131 |
R-semiring = record { isSemiring = R-isSemiring } |
| 132 |
|
| 133 |
isRightSemimodule |
| 134 |
: IsRightSemimodule R-semiring N._≈ᴹ_ N._+ᴹ_ N.0ᴹ N._*ᵣ_ |
| 135 |
→ IsRightSemimodule R-semiring M._≈ᴹ_ M._+ᴹ_ M.0ᴹ M._*ᵣ_ |
| 136 |
isRightSemimodule isRightSemimodule = record |
| 137 |
{ +ᴹ-isCommutativeMonoid = +ᴹ-isCommutativeMonoid NN.+ᴹ-isCommutativeMonoid |
| 138 |
; isPrerightSemimodule = record |
| 139 |
{ *ᵣ-cong = *ᵣ-cong NN.+ᴹ-isMagma NN.*ᵣ-cong |
| 140 |
; *ᵣ-zeroʳ = *ᵣ-zeroʳ NN.+ᴹ-isMagma NN.*ᵣ-zeroʳ |
| 141 |
; *ᵣ-distribˡ = *ᵣ-distribˡ NN.+ᴹ-isMagma NN.*ᵣ-distribˡ |
| 142 |
; *ᵣ-identityʳ = *ᵣ-identityʳ NN.+ᴹ-isMagma NN.*ᵣ-identityʳ |
| 143 |
; *ᵣ-assoc = *ᵣ-assoc NN.+ᴹ-isMagma NN.*ᵣ-congʳ NN.*ᵣ-assoc |
| 144 |
; *ᵣ-zeroˡ = *ᵣ-zeroˡ NN.+ᴹ-isMagma NN.*ᵣ-congʳ NN.*ᵣ-zeroˡ |
| 145 |
; *ᵣ-distribʳ = *ᵣ-distribʳ NN.+ᴹ-isMagma NN.*ᵣ-congʳ NN.*ᵣ-distribʳ |
| 146 |
} |
| 147 |
} where module NN = IsRightSemimodule isRightSemimodule |