@@ -22,10 +22,31 @@ additively-graded ring. The typeclasses are:
22
22
23
23
Respectively, these imbue the direct sum `⨁ i, A i` with:
24
24
25
- * `has_one`
26
- * `mul_zero_class`, `distrib`
27
- * `semiring`, `ring`
28
- * `comm_semiring`, `comm_ring`
25
+ * `direct_sum.has_one`
26
+ * `direct_sum.mul_zero_class`, `direct_sum.distrib`
27
+ * `direct_sum.semiring`, `direct_sum.ring`
28
+ * `direct_sum.comm_semiring`, `direct_sum.comm_ring`
29
+
30
+ the base ring `A 0` with:
31
+
32
+ * `direct_sum.grade_zero.has_one`
33
+ * `direct_sum.grade_zero.mul_zero_class`, `direct_sum.grade_zero.distrib`
34
+ * `direct_sum.grade_zero.semiring`, `direct_sum.grade_zero.ring`
35
+ * `direct_sum.grade_zero.comm_semiring`, `direct_sum.grade_zero.comm_ring`
36
+
37
+ and the `i`th grade `A i` with `A 0`-actions (`•`) defined as left-multiplication:
38
+
39
+ * (nothing)
40
+ * `direct_sum.grade_zero.has_scalar (A 0)`, `direct_sum.grade_zero.smul_with_zero (A 0)`
41
+ * `direct_sum.grade_zero.semimodule (A 0)`
42
+ * (nothing)
43
+
44
+ Note that in the presence of these instances, `⨁ i, A i` itself inherits an `A 0`-action.
45
+
46
+ `direct_sum.of_zero_ring_hom : A 0 →+* ⨁ i, A i` provides `direct_sum.of A 0` as a ring
47
+ homomorphism.
48
+
49
+ ## Direct sums of subobjects
29
50
30
51
Additionally, this module provides helper functions to construct `gmonoid` and `gcomm_monoid`
31
52
instances for:
@@ -236,9 +257,10 @@ gcomm_monoid.of_add_submonoids (λ i, (carriers i).to_add_submonoid) one_mem mul
236
257
237
258
end shorthands
238
259
260
+ variables (A : ι → Type *)
261
+
239
262
/-! ### Instances for `⨁ i, A i` -/
240
263
241
- variables (A : ι → Type *)
242
264
243
265
section one
244
266
variables [has_zero ι] [ghas_one A] [Π i, add_comm_monoid (A i)]
@@ -433,6 +455,130 @@ instance comm_ring : comm_ring (⨁ i, A i) := {
433
455
434
456
end comm_ring
435
457
458
+
459
+ /-! ### Instances for `A 0`
460
+
461
+ The various `g*` instances are enough to promote the `add_comm_monoid (A 0)` structure to various
462
+ types of multiplicative structure.
463
+ -/
464
+
465
+ section grade_zero
466
+
467
+ section one
468
+ variables [has_zero ι] [ghas_one A] [Π i, add_comm_monoid (A i)]
469
+
470
+ /-- `1 : A 0` is the value provided in `direct_sum.ghas_one.one`. -/
471
+ @[nolint unused_arguments]
472
+ instance grade_zero.has_one : has_one (A 0 ) :=
473
+ ⟨ghas_one.one⟩
474
+
475
+ @[simp] lemma of_zero_one : of _ 0 (1 : A 0 ) = 1 := rfl
476
+
477
+ end one
478
+
479
+ section mul
480
+ variables [add_monoid ι] [Π i, add_comm_monoid (A i)] [ghas_mul A]
481
+
482
+ /-- `(•) : A 0 → A i → A i` is the value provided in `direct_sum.ghas_mul.mul`, composed with
483
+ an `eq.rec` to turn `A (0 + i)` into `A i`.
484
+ -/
485
+ instance grade_zero.has_scalar (i : ι) : has_scalar (A 0 ) (A i) :=
486
+ { smul := λ x y, (zero_add i).rec (ghas_mul.mul x y) }
487
+
488
+ /-- `(*) : A 0 → A 0 → A 0` is the value provided in `direct_sum.ghas_mul.mul`, composed with
489
+ an `eq.rec` to turn `A (0 + 0)` into `A 0`.
490
+ -/
491
+ instance grade_zero.has_mul : has_mul (A 0 ) :=
492
+ { mul := (•) }
493
+
494
+ @[simp] lemma grade_zero.smul_eq_mul (a b : A 0 ) : a • b = a * b := rfl
495
+
496
+ @[simp] lemma of_zero_smul {i} (a : A 0 ) (b : A i) : of _ _ (a • b) = of _ _ a * of _ _ b :=
497
+ begin
498
+ rw of_mul_of,
499
+ dsimp [has_mul.mul, direct_sum.of, dfinsupp.single_add_hom_apply],
500
+ congr' 1 ,
501
+ rw zero_add,
502
+ apply eq_rec_heq,
503
+ end
504
+
505
+ @[simp] lemma of_zero_mul (a b : A 0 ) : of _ 0 (a * b) = of _ 0 a * of _ 0 b:=
506
+ of_zero_smul A a b
507
+
508
+ instance grade_zero.mul_zero_class : mul_zero_class (A 0 ) :=
509
+ function.injective.mul_zero_class (of A 0 ) dfinsupp.single_injective
510
+ (of A 0 ).map_zero (of_zero_mul A)
511
+
512
+ instance grade_zero.distrib : distrib (A 0 ) :=
513
+ function.injective.distrib (of A 0 ) dfinsupp.single_injective
514
+ (of A 0 ).map_add (of_zero_mul A)
515
+
516
+ instance grade_zero.smul_with_zero (i : ι) : smul_with_zero (A 0 ) (A i) :=
517
+ begin
518
+ letI := smul_with_zero.comp_hom (⨁ i, A i) (of A 0 ).to_zero_hom,
519
+ refine dfinsupp.single_injective.smul_with_zero (of A i).to_zero_hom (of_zero_smul A),
520
+ end
521
+
522
+ end mul
523
+
524
+ section semiring
525
+ variables [Π i, add_comm_monoid (A i)] [add_monoid ι] [gmonoid A]
526
+
527
+ /-- The `semiring` structure derived from `gmonoid A`. -/
528
+ instance grade_zero.semiring : semiring (A 0 ) :=
529
+ function.injective.semiring (of A 0 ) dfinsupp.single_injective
530
+ (of A 0 ).map_zero (of_zero_one A) (of A 0 ).map_add (of_zero_mul A)
531
+
532
+ /-- `of A 0` is a `ring_hom`, using the `direct_sum.grade_zero.semiring` structure. -/
533
+ def of_zero_ring_hom : A 0 →+* (⨁ i, A i) :=
534
+ { map_one' := of_zero_one A, map_mul' := of_zero_mul A, ..(of _ 0 ) }
535
+
536
+ /-- Each grade `A i` derives a `A 0`-semimodule structure from `gmonoid A`. Note that this results
537
+ in an overall `semimodule (A 0) (⨁ i, A i)` structure via `direct_sum.semimodule`.
538
+ -/
539
+ instance grade_zero.semimodule {i} : semimodule (A 0 ) (A i) :=
540
+ begin
541
+ letI := semimodule.comp_hom (⨁ i, A i) (of_zero_ring_hom A),
542
+ exact dfinsupp.single_injective.semimodule (A 0 ) (of A i) (λ a, of_zero_smul A a),
543
+ end
544
+
545
+ end semiring
546
+
547
+ section comm_semiring
548
+
549
+ variables [Π i, add_comm_monoid (A i)] [add_comm_monoid ι] [gcomm_monoid A]
550
+
551
+ /-- The `comm_semiring` structure derived from `gcomm_monoid A`. -/
552
+ instance grade_zero.comm_semiring : comm_semiring (A 0 ) :=
553
+ function.injective.comm_semiring (of A 0 ) dfinsupp.single_injective
554
+ (of A 0 ).map_zero (of_zero_one A) (of A 0 ).map_add (of_zero_mul A)
555
+
556
+ end comm_semiring
557
+
558
+ section ring
559
+ variables [Π i, add_comm_group (A i)] [add_comm_monoid ι] [gmonoid A]
560
+
561
+ /-- The `ring` derived from `gmonoid A`. -/
562
+ instance grade_zero.ring : ring (A 0 ) :=
563
+ function.injective.ring (of A 0 ) dfinsupp.single_injective
564
+ (of A 0 ).map_zero (of_zero_one A) (of A 0 ).map_add (of_zero_mul A)
565
+ (of A 0 ).map_neg (of A 0 ).map_sub
566
+
567
+ end ring
568
+
569
+ section comm_ring
570
+ variables [Π i, add_comm_group (A i)] [add_comm_monoid ι] [gcomm_monoid A]
571
+
572
+ /-- The `comm_ring` derived from `gcomm_monoid A`. -/
573
+ instance grade_zero.comm_ring : comm_ring (A 0 ) :=
574
+ function.injective.comm_ring (of A 0 ) dfinsupp.single_injective
575
+ (of A 0 ).map_zero (of_zero_one A) (of A 0 ).map_add (of_zero_mul A)
576
+ (of A 0 ).map_neg (of A 0 ).map_sub
577
+
578
+ end comm_ring
579
+
580
+ end grade_zero
581
+
436
582
end direct_sum
437
583
438
584
/-! ### Concrete instances -/
0 commit comments