forked from agda/agda-stdlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIdentity.agda
276 lines (221 loc) · 8.38 KB
/
Identity.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
------------------------------------------------------------------------
-- The Agda standard library
--
-- The identity morphism for algebraic structures
------------------------------------------------------------------------
{-# OPTIONS --safe --cubical-compatible #-}
module Algebra.Morphism.Construct.Identity where
open import Algebra.Bundles
open import Algebra.Morphism.Structures
using ( module MagmaMorphisms
; module MonoidMorphisms
; module GroupMorphisms
; module NearSemiringMorphisms
; module SemiringMorphisms
; module RingWithoutOneMorphisms
; module RingMorphisms
; module QuasigroupMorphisms
; module LoopMorphisms
; module KleeneAlgebraMorphisms
)
open import Data.Product.Base using (_,_)
open import Function.Base using (id)
import Function.Construct.Identity as Id
open import Level using (Level)
open import Relation.Binary.Morphism.Construct.Identity using (isRelHomomorphism)
open import Relation.Binary.Definitions using (Reflexive)
private
variable
c ℓ : Level
------------------------------------------------------------------------
-- Magmas
module _ (M : RawMagma c ℓ) (open RawMagma M) (refl : Reflexive _≈_) where
open MagmaMorphisms M M
isMagmaHomomorphism : IsMagmaHomomorphism id
isMagmaHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism _
; homo = λ _ _ → refl
}
isMagmaMonomorphism : IsMagmaMonomorphism id
isMagmaMonomorphism = record
{ isMagmaHomomorphism = isMagmaHomomorphism
; injective = id
}
isMagmaIsomorphism : IsMagmaIsomorphism id
isMagmaIsomorphism = record
{ isMagmaMonomorphism = isMagmaMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Monoids
module _ (M : RawMonoid c ℓ) (open RawMonoid M) (refl : Reflexive _≈_) where
open MonoidMorphisms M M
isMonoidHomomorphism : IsMonoidHomomorphism id
isMonoidHomomorphism = record
{ isMagmaHomomorphism = isMagmaHomomorphism _ refl
; ε-homo = refl
}
isMonoidMonomorphism : IsMonoidMonomorphism id
isMonoidMonomorphism = record
{ isMonoidHomomorphism = isMonoidHomomorphism
; injective = id
}
isMonoidIsomorphism : IsMonoidIsomorphism id
isMonoidIsomorphism = record
{ isMonoidMonomorphism = isMonoidMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Groups
module _ (G : RawGroup c ℓ) (open RawGroup G) (refl : Reflexive _≈_) where
open GroupMorphisms G G
isGroupHomomorphism : IsGroupHomomorphism id
isGroupHomomorphism = record
{ isMonoidHomomorphism = isMonoidHomomorphism _ refl
; ⁻¹-homo = λ _ → refl
}
isGroupMonomorphism : IsGroupMonomorphism id
isGroupMonomorphism = record
{ isGroupHomomorphism = isGroupHomomorphism
; injective = id
}
isGroupIsomorphism : IsGroupIsomorphism id
isGroupIsomorphism = record
{ isGroupMonomorphism = isGroupMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Near semirings
module _ (R : RawNearSemiring c ℓ) (open RawNearSemiring R) (refl : Reflexive _≈_) where
open NearSemiringMorphisms R R
isNearSemiringHomomorphism : IsNearSemiringHomomorphism id
isNearSemiringHomomorphism = record
{ +-isMonoidHomomorphism = isMonoidHomomorphism _ refl
; *-homo = λ _ _ → refl
}
isNearSemiringMonomorphism : IsNearSemiringMonomorphism id
isNearSemiringMonomorphism = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism
; injective = id
}
isNearSemiringIsomorphism : IsNearSemiringIsomorphism id
isNearSemiringIsomorphism = record
{ isNearSemiringMonomorphism = isNearSemiringMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Semirings
module _ (R : RawSemiring c ℓ) (open RawSemiring R) (refl : Reflexive _≈_) where
open SemiringMorphisms R R
isSemiringHomomorphism : IsSemiringHomomorphism id
isSemiringHomomorphism = record
{ isNearSemiringHomomorphism = isNearSemiringHomomorphism _ refl
; 1#-homo = refl
}
isSemiringMonomorphism : IsSemiringMonomorphism id
isSemiringMonomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism
; injective = id
}
isSemiringIsomorphism : IsSemiringIsomorphism id
isSemiringIsomorphism = record
{ isSemiringMonomorphism = isSemiringMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- RingWithoutOne
module _ (R : RawRingWithoutOne c ℓ) (open RawRingWithoutOne R) (refl : Reflexive _≈_) where
open RingWithoutOneMorphisms R R
isRingWithoutOneHomomorphism : IsRingWithoutOneHomomorphism id
isRingWithoutOneHomomorphism = record
{ +-isGroupHomomorphism = isGroupHomomorphism _ refl
; *-homo = λ _ _ → refl
}
isRingWithoutOneMonomorphism : IsRingWithoutOneMonomorphism id
isRingWithoutOneMonomorphism = record
{ isRingWithoutOneHomomorphism = isRingWithoutOneHomomorphism
; injective = id
}
isRingWithoutOneIsoMorphism : IsRingWithoutOneIsoMorphism id
isRingWithoutOneIsoMorphism = record
{ isRingWithoutOneMonomorphism = isRingWithoutOneMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Rings
module _ (R : RawRing c ℓ) (open RawRing R) (refl : Reflexive _≈_) where
open RingMorphisms R R
isRingHomomorphism : IsRingHomomorphism id
isRingHomomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism _ refl
; -‿homo = λ _ → refl
}
isRingMonomorphism : IsRingMonomorphism id
isRingMonomorphism = record
{ isRingHomomorphism = isRingHomomorphism
; injective = id
}
isRingIsomorphism : IsRingIsomorphism id
isRingIsomorphism = record
{ isRingMonomorphism = isRingMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Quasigroup
module _ (Q : RawQuasigroup c ℓ) (open RawQuasigroup Q) (refl : Reflexive _≈_) where
open QuasigroupMorphisms Q Q
isQuasigroupHomomorphism : IsQuasigroupHomomorphism id
isQuasigroupHomomorphism = record
{ isRelHomomorphism = isRelHomomorphism _
; ∙-homo = λ _ _ → refl
; \\-homo = λ _ _ → refl
; //-homo = λ _ _ → refl
}
isQuasigroupMonomorphism : IsQuasigroupMonomorphism id
isQuasigroupMonomorphism = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism
; injective = id
}
isQuasigroupIsomorphism : IsQuasigroupIsomorphism id
isQuasigroupIsomorphism = record
{ isQuasigroupMonomorphism = isQuasigroupMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- Loop
module _ (L : RawLoop c ℓ) (open RawLoop L) (refl : Reflexive _≈_) where
open LoopMorphisms L L
isLoopHomomorphism : IsLoopHomomorphism id
isLoopHomomorphism = record
{ isQuasigroupHomomorphism = isQuasigroupHomomorphism _ refl
; ε-homo = refl
}
isLoopMonomorphism : IsLoopMonomorphism id
isLoopMonomorphism = record
{ isLoopHomomorphism = isLoopHomomorphism
; injective = id
}
isLoopIsomorphism : IsLoopIsomorphism id
isLoopIsomorphism = record
{ isLoopMonomorphism = isLoopMonomorphism
; surjective = Id.surjective _
}
------------------------------------------------------------------------
-- KleeneAlgebra
module _ (K : RawKleeneAlgebra c ℓ) (open RawKleeneAlgebra K) (refl : Reflexive _≈_) where
open KleeneAlgebraMorphisms K K
isKleeneAlgebraHomomorphism : IsKleeneAlgebraHomomorphism id
isKleeneAlgebraHomomorphism = record
{ isSemiringHomomorphism = isSemiringHomomorphism _ refl
; ⋆-homo = λ _ → refl
}
isKleeneAlgebraMonomorphism : IsKleeneAlgebraMonomorphism id
isKleeneAlgebraMonomorphism = record
{ isKleeneAlgebraHomomorphism = isKleeneAlgebraHomomorphism
; injective = id
}
isKleeneAlgebraIsomorphism : IsKleeneAlgebraIsomorphism id
isKleeneAlgebraIsomorphism = record
{ isKleeneAlgebraMonomorphism = isKleeneAlgebraMonomorphism
; surjective = Id.surjective _
}