Debian Codegraph @

src/Algebra/Module/Morphism/LeftSemimoduleMonomorphism.agda

raw
1 ------------------------------------------------------------------------
2 -- The Agda standard library
3 --
4 -- Consequences of a monomorphism between left semimodules
5 ------------------------------------------------------------------------
6
7 {-# OPTIONS --cubical-compatible --safe #-}
8
9 open import Algebra.Module.Bundles.Raw using (RawLeftSemimodule)
10 open import Algebra.Module.Morphism.Structures using (IsLeftSemimoduleMonomorphism)
11
12 module Algebra.Module.Morphism.LeftSemimoduleMonomorphism
13 {r a b ℓ₁ ℓ₂} {R : Set r} {M₁ : RawLeftSemimodule R a ℓ₁} {M₂ : RawLeftSemimodule R b ℓ₂} {⟦_⟧}
14 (isLeftSemimoduleMonomorphism : IsLeftSemimoduleMonomorphism M₁ M₂ ⟦_⟧)
15 where
16
17 open IsLeftSemimoduleMonomorphism isLeftSemimoduleMonomorphism
18 private
19 module M = RawLeftSemimodule M₁
20 module N = RawLeftSemimodule M₂
21
22 open import Algebra.Bundles using (Semiring)
23 open import Algebra.Core using (Op₂)
24 import Algebra.Module.Definitions.Left as LeftDefs
25 open import Algebra.Module.Structures using (IsLeftSemimodule)
26 open import Algebra.Structures using (IsSemiring; IsMagma)
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-export most properties of monoid monomorphisms
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 = LeftDefs R M._≈ᴹ_
69 module NDefs = LeftDefs 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 x u ⟩
74 x N.*ₗ ⟦ u ⟧ ≈⟨ *ₗ-cong x≈y (⟦⟧-cong u≈ᴹv) ⟩
75 y N.*ₗ ⟦ v ⟧ ≈˘⟨ *ₗ-homo y v ⟩
76 ⟦ y M.*ₗ v ⟧ ∎
77
78 *ₗ-zeroˡ : NDefs.LeftZero 0# N.0ᴹ N._*ₗ_ → MDefs.LeftZero 0# M.0ᴹ M._*ₗ_
79 *ₗ-zeroˡ {0# = 0#} *ₗ-zeroˡ x = injective $ begin
80 ⟦ 0# M.*ₗ x ⟧ ≈⟨ *ₗ-homo 0# x ⟩
81 0# N.*ₗ ⟦ x ⟧ ≈⟨ *ₗ-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 ⟦ (m + n) M.*ₗ x ⟧ ≈⟨ *ₗ-homo (m + n) x ⟩
88 (m + n) N.*ₗ ⟦ x ⟧ ≈⟨ *ₗ-distribʳ ⟦ x ⟧ m n ⟩
89 m N.*ₗ ⟦ x ⟧ N.+ᴹ n N.*ₗ ⟦ x ⟧ ≈˘⟨ +ᴹ-cong′ (*ₗ-homo m x) (*ₗ-homo n x) ⟩
90 ⟦ m M.*ₗ x ⟧ N.+ᴹ ⟦ n M.*ₗ x ⟧ ≈˘⟨ +ᴹ-homo (m M.*ₗ x) (n M.*ₗ x) ⟩
91 ⟦ m M.*ₗ x M.+ᴹ n M.*ₗ x ⟧ ∎
92
93 *ₗ-identityˡ : NDefs.LeftIdentity 1# N._*ₗ_ → MDefs.LeftIdentity 1# M._*ₗ_
94 *ₗ-identityˡ {1# = 1#} *ₗ-identityˡ m = injective $ begin
95 ⟦ 1# M.*ₗ m ⟧ ≈⟨ *ₗ-homo 1# m ⟩
96 1# N.*ₗ ⟦ m ⟧ ≈⟨ *ₗ-identityˡ ⟦ m ⟧ ⟩
97 ⟦ m ⟧ ∎
98
99 *ₗ-assoc : NDefs.LeftCongruent N._*ₗ_ → NDefs.Associative _*_ N._*ₗ_ → MDefs.Associative _*_ M._*ₗ_
100 *ₗ-assoc {_*_ = _*_} *ₗ-congˡ *ₗ-assoc x y m = injective $ begin
101 ⟦ (x * y) M.*ₗ m ⟧ ≈⟨ *ₗ-homo (x * y) m ⟩
102 (x * y) N.*ₗ ⟦ m ⟧ ≈⟨ *ₗ-assoc x y ⟦ m ⟧ ⟩
103 x N.*ₗ y N.*ₗ ⟦ m ⟧ ≈˘⟨ *ₗ-congˡ (*ₗ-homo y m) ⟩
104 x N.*ₗ ⟦ y M.*ₗ m ⟧ ≈˘⟨ *ₗ-homo x (y M.*ₗ m) ⟩
105 ⟦ x M.*ₗ y M.*ₗ m ⟧ ∎
106
107 *ₗ-zeroʳ : NDefs.LeftCongruent N._*ₗ_ → NDefs.RightZero N.0ᴹ N._*ₗ_ → MDefs.RightZero M.0ᴹ M._*ₗ_
108 *ₗ-zeroʳ *ₗ-congˡ *ₗ-zeroʳ x = injective $ begin
109 ⟦ x M.*ₗ M.0ᴹ ⟧ ≈⟨ *ₗ-homo x M.0ᴹ ⟩
110 x N.*ₗ ⟦ M.0ᴹ ⟧ ≈⟨ *ₗ-congˡ 0ᴹ-homo ⟩
111 x N.*ₗ N.0ᴹ ≈⟨ *ₗ-zeroʳ x ⟩
112 N.0ᴹ ≈˘⟨ 0ᴹ-homo ⟩
113 ⟦ M.0ᴹ ⟧ ∎
114
115 *ₗ-distribˡ : NDefs.LeftCongruent N._*ₗ_ → N._*ₗ_ NDefs.DistributesOverˡ N._+ᴹ_ → M._*ₗ_ MDefs.DistributesOverˡ M._+ᴹ_
116 *ₗ-distribˡ *ₗ-congˡ *ₗ-distribˡ x m n = injective $ begin
117 ⟦ x M.*ₗ (m M.+ᴹ n) ⟧ ≈⟨ *ₗ-homo x (m M.+ᴹ n) ⟩
118 x N.*ₗ ⟦ m M.+ᴹ n ⟧ ≈⟨ *ₗ-congˡ (+ᴹ-homo m n) ⟩
119 x N.*ₗ (⟦ m ⟧ N.+ᴹ ⟦ n ⟧) ≈⟨ *ₗ-distribˡ x ⟦ m ⟧ ⟦ n ⟧ ⟩
120 x N.*ₗ ⟦ m ⟧ N.+ᴹ x N.*ₗ ⟦ n ⟧ ≈˘⟨ +ᴹ-cong′ (*ₗ-homo x m) (*ₗ-homo x n) ⟩
121 ⟦ x M.*ₗ m ⟧ N.+ᴹ ⟦ x M.*ₗ n ⟧ ≈˘⟨ +ᴹ-homo (x M.*ₗ m) (x M.*ₗ n) ⟩
122 ⟦ x M.*ₗ m M.+ᴹ x M.*ₗ n ⟧ ∎
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 isLeftSemimodule
134 : IsLeftSemimodule R-semiring N._≈ᴹ_ N._+ᴹ_ N.0ᴹ N._*ₗ_
135 → IsLeftSemimodule R-semiring M._≈ᴹ_ M._+ᴹ_ M.0ᴹ M._*ₗ_
136 isLeftSemimodule isLeftSemimodule = record
137 { +ᴹ-isCommutativeMonoid = +ᴹ-isCommutativeMonoid NN.+ᴹ-isCommutativeMonoid
138 ; isPreleftSemimodule = 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 = IsLeftSemimodule isLeftSemimodule