/
Basic.lean
349 lines (275 loc) Β· 14.5 KB
/
Basic.lean
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
/-
Copyright (c) 2021 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser, Kevin Buzzard, Jujian Zhang
-/
import Mathlib.Algebra.DirectSum.Algebra
import Mathlib.Algebra.DirectSum.Decomposition
import Mathlib.Algebra.DirectSum.Internal
import Mathlib.Algebra.DirectSum.Ring
#align_import ring_theory.graded_algebra.basic from "leanprover-community/mathlib"@"70fd9563a21e7b963887c9360bd29b2393e6225a"
/-!
# Internally-graded rings and algebras
This file defines the typeclass `GradedAlgebra π`, for working with an algebra `A` that is
internally graded by a collection of submodules `π : ΞΉ β Submodule R A`.
See the docstring of that typeclass for more information.
## Main definitions
* `GradedRing π`: the typeclass, which is a combination of `SetLike.GradedMonoid`, and
`DirectSum.Decomposition π`.
* `GradedAlgebra π`: A convenience alias for `GradedRing` when `π` is a family of submodules.
* `DirectSum.decomposeRingEquiv π : A ββ[R] β¨ i, π i`, a more bundled version of
`DirectSum.decompose π`.
* `DirectSum.decomposeAlgEquiv π : A ββ[R] β¨ i, π i`, a more bundled version of
`DirectSum.decompose π`.
* `GradedAlgebra.proj π i` is the linear map from `A` to its degree `i : ΞΉ` component, such that
`proj π i x = decompose π x i`.
## Implementation notes
For now, we do not have internally-graded semirings and internally-graded rings; these can be
represented with `π : ΞΉ β Submodule β A` and `π : ΞΉ β Submodule β€ A` respectively, since all
`Semiring`s are β-algebras via `algebraNat`, and all `Ring`s are `β€`-algebras via `algebraInt`.
## Tags
graded algebra, graded ring, graded semiring, decomposition
-/
open DirectSum BigOperators
variable {ΞΉ R A Ο : Type*}
section GradedRing
variable [DecidableEq ΞΉ] [AddMonoid ΞΉ] [CommSemiring R] [Semiring A] [Algebra R A]
variable [SetLike Ο A] [AddSubmonoidClass Ο A] (π : ΞΉ β Ο)
open DirectSum
/-- An internally-graded `R`-algebra `A` is one that can be decomposed into a collection
of `Submodule R A`s indexed by `ΞΉ` such that the canonical map `A β β¨ i, π i` is bijective and
respects multiplication, i.e. the product of an element of degree `i` and an element of degree `j`
is an element of degree `i + j`.
Note that the fact that `A` is internally-graded, `GradedAlgebra π`, implies an externally-graded
algebra structure `DirectSum.GAlgebra R (fun i β¦ β₯(π i))`, which in turn makes available an
`Algebra R (β¨ i, π i)` instance.
-/
class GradedRing (π : ΞΉ β Ο) extends SetLike.GradedMonoid π, DirectSum.Decomposition π
#align graded_ring GradedRing
variable [GradedRing π]
namespace DirectSum
/-- If `A` is graded by `ΞΉ` with degree `i` component `π i`, then it is isomorphic as
a ring to a direct sum of components. -/
def decomposeRingEquiv : A β+* β¨ i, π i :=
RingEquiv.symm
{ (decomposeAddEquiv π).symm with
map_mul' := (coeRingHom π).map_mul }
#align direct_sum.decompose_ring_equiv DirectSum.decomposeRingEquiv
@[simp]
theorem decompose_one : decompose π (1 : A) = 1 :=
map_one (decomposeRingEquiv π)
#align direct_sum.decompose_one DirectSum.decompose_one
@[simp]
theorem decompose_symm_one : (decompose π).symm 1 = (1 : A) :=
map_one (decomposeRingEquiv π).symm
#align direct_sum.decompose_symm_one DirectSum.decompose_symm_one
@[simp]
theorem decompose_mul (x y : A) : decompose π (x * y) = decompose π x * decompose π y :=
map_mul (decomposeRingEquiv π) x y
#align direct_sum.decompose_mul DirectSum.decompose_mul
@[simp]
theorem decompose_symm_mul (x y : β¨ i, π i) :
(decompose π).symm (x * y) = (decompose π).symm x * (decompose π).symm y :=
map_mul (decomposeRingEquiv π).symm x y
#align direct_sum.decompose_symm_mul DirectSum.decompose_symm_mul
end DirectSum
/-- The projection maps of a graded ring -/
def GradedRing.proj (i : ΞΉ) : A β+ A :=
(AddSubmonoidClass.subtype (π i)).comp <|
(DFinsupp.evalAddMonoidHom i).comp <|
RingHom.toAddMonoidHom <| RingEquiv.toRingHom <| DirectSum.decomposeRingEquiv π
#align graded_ring.proj GradedRing.proj
@[simp]
theorem GradedRing.proj_apply (i : ΞΉ) (r : A) :
GradedRing.proj π i r = (decompose π r : β¨ i, π i) i :=
rfl
#align graded_ring.proj_apply GradedRing.proj_apply
theorem GradedRing.proj_recompose (a : β¨ i, π i) (i : ΞΉ) :
GradedRing.proj π i ((decompose π).symm a) = (decompose π).symm (DirectSum.of _ i (a i)) := by
rw [GradedRing.proj_apply, decompose_symm_of, Equiv.apply_symm_apply]
#align graded_ring.proj_recompose GradedRing.proj_recompose
theorem GradedRing.mem_support_iff [β (i) (x : π i), Decidable (x β 0)] (r : A) (i : ΞΉ) :
i β (decompose π r).support β GradedRing.proj π i r β 0 :=
DFinsupp.mem_support_iff.trans ZeroMemClass.coe_eq_zero.not.symm
#align graded_ring.mem_support_iff GradedRing.mem_support_iff
end GradedRing
section AddCancelMonoid
open DirectSum
variable [DecidableEq ΞΉ] [Semiring A] [SetLike Ο A] [AddSubmonoidClass Ο A] (π : ΞΉ β Ο)
variable {i j : ΞΉ}
namespace DirectSum
theorem coe_decompose_mul_add_of_left_mem [AddLeftCancelMonoid ΞΉ] [GradedRing π] {a b : A}
(a_mem : a β π i) : (decompose π (a * b) (i + j) : A) = a * decompose π b j := by
lift a to π i using a_mem
rw [decompose_mul, decompose_coe, coe_of_mul_apply_add]
#align direct_sum.coe_decompose_mul_add_of_left_mem DirectSum.coe_decompose_mul_add_of_left_mem
theorem coe_decompose_mul_add_of_right_mem [AddRightCancelMonoid ΞΉ] [GradedRing π] {a b : A}
(b_mem : b β π j) : (decompose π (a * b) (i + j) : A) = decompose π a i * b := by
lift b to π j using b_mem
rw [decompose_mul, decompose_coe, coe_mul_of_apply_add]
#align direct_sum.coe_decompose_mul_add_of_right_mem DirectSum.coe_decompose_mul_add_of_right_mem
theorem decompose_mul_add_left [AddLeftCancelMonoid ΞΉ] [GradedRing π] (a : π i) {b : A} :
decompose π (βa * b) (i + j) =
@GradedMonoid.GMul.mul ΞΉ (fun i => π i) _ _ _ _ a (decompose π b j) :=
Subtype.ext <| coe_decompose_mul_add_of_left_mem π a.2
#align direct_sum.decompose_mul_add_left DirectSum.decompose_mul_add_left
theorem decompose_mul_add_right [AddRightCancelMonoid ΞΉ] [GradedRing π] {a : A} (b : π j) :
decompose π (a * βb) (i + j) =
@GradedMonoid.GMul.mul ΞΉ (fun i => π i) _ _ _ _ (decompose π a i) b :=
Subtype.ext <| coe_decompose_mul_add_of_right_mem π b.2
#align direct_sum.decompose_mul_add_right DirectSum.decompose_mul_add_right
end DirectSum
end AddCancelMonoid
section GradedAlgebra
variable [DecidableEq ΞΉ] [AddMonoid ΞΉ] [CommSemiring R] [Semiring A] [Algebra R A]
variable (π : ΞΉ β Submodule R A)
/-- A special case of `GradedRing` with `Ο = Submodule R A`. This is useful both because it
can avoid typeclass search, and because it provides a more concise name. -/
@[reducible]
def GradedAlgebra :=
GradedRing π
#align graded_algebra GradedAlgebra
/-- A helper to construct a `GradedAlgebra` when the `SetLike.GradedMonoid` structure is already
available. This makes the `left_inv` condition easier to prove, and phrases the `right_inv`
condition in a way that allows custom `@[ext]` lemmas to apply.
See note [reducible non-instances]. -/
@[reducible]
def GradedAlgebra.ofAlgHom [SetLike.GradedMonoid π] (decompose : A ββ[R] β¨ i, π i)
(right_inv : (DirectSum.coeAlgHom π).comp decompose = AlgHom.id R A)
(left_inv : β i (x : π i), decompose (x : A) = DirectSum.of (fun i => β₯(π i)) i x) :
GradedAlgebra π where
decompose' := decompose
left_inv := AlgHom.congr_fun right_inv
right_inv := by
suffices decompose.comp (DirectSum.coeAlgHom π) = AlgHom.id _ _ from AlgHom.congr_fun this
-- Porting note: was ext i x : 2
refine DirectSum.algHom_ext' _ _ fun i => ?_
ext x
exact (decompose.congr_arg <| DirectSum.coeAlgHom_of _ _ _).trans (left_inv i x)
#align graded_algebra.of_alg_hom GradedAlgebra.ofAlgHom
variable [GradedAlgebra π]
namespace DirectSum
/-- If `A` is graded by `ΞΉ` with degree `i` component `π i`, then it is isomorphic as
an algebra to a direct sum of components. -/
-- Porting note: deleted [simps] and added the corresponding lemmas by hand
def decomposeAlgEquiv : A ββ[R] β¨ i, π i :=
AlgEquiv.symm
{ (decomposeAddEquiv π).symm with
map_mul' := (coeAlgHom π).map_mul
commutes' := (coeAlgHom π).commutes }
#align direct_sum.decompose_alg_equiv DirectSum.decomposeAlgEquiv
@[simp]
lemma decomposeAlgEquiv_apply (a : A) :
decomposeAlgEquiv π a = decompose π a := rfl
@[simp]
lemma decomposeAlgEquiv_symm_apply (a : β¨ i, π i) :
(decomposeAlgEquiv π).symm a = (decompose π).symm a := rfl
@[simp]
lemma decompose_algebraMap (r : R) :
decompose π (algebraMap R A r) = algebraMap R (β¨ i, π i) r :=
(decomposeAlgEquiv π).commutes r
@[simp]
lemma decompose_symm_algebraMap (r : R) :
(decompose π).symm (algebraMap R (β¨ i, π i) r) = algebraMap R A r :=
(decomposeAlgEquiv π).symm.commutes r
end DirectSum
open DirectSum
/-- The projection maps of graded algebra-/
def GradedAlgebra.proj (π : ΞΉ β Submodule R A) [GradedAlgebra π] (i : ΞΉ) : A ββ[R] A :=
(π i).subtype.comp <| (DFinsupp.lapply i).comp <| (decomposeAlgEquiv π).toAlgHom.toLinearMap
#align graded_algebra.proj GradedAlgebra.proj
@[simp]
theorem GradedAlgebra.proj_apply (i : ΞΉ) (r : A) :
GradedAlgebra.proj π i r = (decompose π r : β¨ i, π i) i :=
rfl
#align graded_algebra.proj_apply GradedAlgebra.proj_apply
theorem GradedAlgebra.proj_recompose (a : β¨ i, π i) (i : ΞΉ) :
GradedAlgebra.proj π i ((decompose π).symm a) = (decompose π).symm (of _ i (a i)) := by
rw [GradedAlgebra.proj_apply, decompose_symm_of, Equiv.apply_symm_apply]
#align graded_algebra.proj_recompose GradedAlgebra.proj_recompose
theorem GradedAlgebra.mem_support_iff [DecidableEq A] (r : A) (i : ΞΉ) :
i β (decompose π r).support β GradedAlgebra.proj π i r β 0 :=
DFinsupp.mem_support_iff.trans Submodule.coe_eq_zero.not.symm
#align graded_algebra.mem_support_iff GradedAlgebra.mem_support_iff
end GradedAlgebra
section CanonicalOrder
open SetLike.GradedMonoid DirectSum
variable [Semiring A] [DecidableEq ΞΉ]
variable [CanonicallyOrderedAddCommMonoid ΞΉ]
variable [SetLike Ο A] [AddSubmonoidClass Ο A] (π : ΞΉ β Ο) [GradedRing π]
/-- If `A` is graded by a canonically ordered add monoid, then the projection map `x β¦ xβ` is a ring
homomorphism.
-/
@[simps]
def GradedRing.projZeroRingHom : A β+* A where
toFun a := decompose π a 0
map_one' :=
-- Porting note: qualified `one_mem`
decompose_of_mem_same π SetLike.GradedOne.one_mem
map_zero' := by
simp only -- Porting note: added
rw [decompose_zero]
rfl
map_add' _ _ := by
simp only -- Porting note: added
rw [decompose_add]
rfl
map_mul' := by
refine' DirectSum.Decomposition.inductionOn π (fun x => _) _ _
Β· simp only [zero_mul, decompose_zero, zero_apply, ZeroMemClass.coe_zero]
Β· rintro i β¨c, hcβ©
refine' DirectSum.Decomposition.inductionOn π _ _ _
Β· simp only [mul_zero, decompose_zero, zero_apply, ZeroMemClass.coe_zero]
Β· rintro j β¨c', hc'β©
Β· simp only [Subtype.coe_mk]
by_cases h : i + j = 0
Β· rw [decompose_of_mem_same π
(show c * c' β π 0 from h βΈ SetLike.GradedMul.mul_mem hc hc'),
decompose_of_mem_same π (show c β π 0 from (add_eq_zero_iff.mp h).1 βΈ hc),
decompose_of_mem_same π (show c' β π 0 from (add_eq_zero_iff.mp h).2 βΈ hc')]
Β· rw [decompose_of_mem_ne π (SetLike.GradedMul.mul_mem hc hc') h]
cases' show i β 0 β¨ j β 0 by rwa [add_eq_zero_iff, not_and_or] at h with h' h'
Β· simp only [decompose_of_mem_ne π hc h', zero_mul]
Β· simp only [decompose_of_mem_ne π hc' h', mul_zero]
Β· intro _ _ hd he
simp only at hd he -- Porting note: added
simp only [mul_add, decompose_add, add_apply, AddMemClass.coe_add, hd, he]
Β· rintro _ _ ha hb _
simp only at ha hb -- Porting note: added
simp only [add_mul, decompose_add, add_apply, AddMemClass.coe_add, ha, hb]
#align graded_ring.proj_zero_ring_hom GradedRing.projZeroRingHom
variable {a b : A} {n i : ΞΉ}
namespace DirectSum
theorem coe_decompose_mul_of_left_mem_of_not_le (a_mem : a β π i) (h : Β¬i β€ n) :
(decompose π (a * b) n : A) = 0 := by
lift a to π i using a_mem
rwa [decompose_mul, decompose_coe, coe_of_mul_apply_of_not_le]
#align direct_sum.coe_decompose_mul_of_left_mem_of_not_le DirectSum.coe_decompose_mul_of_left_mem_of_not_le
theorem coe_decompose_mul_of_right_mem_of_not_le (b_mem : b β π i) (h : Β¬i β€ n) :
(decompose π (a * b) n : A) = 0 := by
lift b to π i using b_mem
rwa [decompose_mul, decompose_coe, coe_mul_of_apply_of_not_le]
#align direct_sum.coe_decompose_mul_of_right_mem_of_not_le DirectSum.coe_decompose_mul_of_right_mem_of_not_le
variable [Sub ΞΉ] [OrderedSub ΞΉ] [ContravariantClass ΞΉ ΞΉ (Β· + Β·) (Β· β€ Β·)]
theorem coe_decompose_mul_of_left_mem_of_le (a_mem : a β π i) (h : i β€ n) :
(decompose π (a * b) n : A) = a * decompose π b (n - i) := by
lift a to π i using a_mem
rwa [decompose_mul, decompose_coe, coe_of_mul_apply_of_le]
#align direct_sum.coe_decompose_mul_of_left_mem_of_le DirectSum.coe_decompose_mul_of_left_mem_of_le
theorem coe_decompose_mul_of_right_mem_of_le (b_mem : b β π i) (h : i β€ n) :
(decompose π (a * b) n : A) = decompose π a (n - i) * b := by
lift b to π i using b_mem
rwa [decompose_mul, decompose_coe, coe_mul_of_apply_of_le]
#align direct_sum.coe_decompose_mul_of_right_mem_of_le DirectSum.coe_decompose_mul_of_right_mem_of_le
theorem coe_decompose_mul_of_left_mem (n) [Decidable (i β€ n)] (a_mem : a β π i) :
(decompose π (a * b) n : A) = if i β€ n then a * decompose π b (n - i) else 0 := by
lift a to π i using a_mem
rw [decompose_mul, decompose_coe, coe_of_mul_apply]
#align direct_sum.coe_decompose_mul_of_left_mem DirectSum.coe_decompose_mul_of_left_mem
theorem coe_decompose_mul_of_right_mem (n) [Decidable (i β€ n)] (b_mem : b β π i) :
(decompose π (a * b) n : A) = if i β€ n then decompose π a (n - i) * b else 0 := by
lift b to π i using b_mem
rw [decompose_mul, decompose_coe, coe_mul_of_apply]
#align direct_sum.coe_decompose_mul_of_right_mem DirectSum.coe_decompose_mul_of_right_mem
end DirectSum
end CanonicalOrder