Skip to content

Commit 1c558eb

Browse files
droctaeric-wieser
andcommitted
feat(Algebra/Colimit/DirectLimit): add star structures (Star, StarRing, etc.) on DirectLimit (leanprover-community#38308)
add `Star`, `InvolutiveStar`, `StarMul`, `StarAddMonoid`, `StarRing`, and `StarModule` instances to `DirectLimit`, following the pattern of existing algebraic structures in `Mathlib.Algebra.Colimit.DirectLimit`. also add the universal property API (`of`, `lift`, `hom_ext`, `of_f`, `lift_of`) for `StarRing`. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent f5b4932 commit 1c558eb

1 file changed

Lines changed: 146 additions & 7 deletions

File tree

Mathlib/Algebra/Colimit/DirectLimit.lean

Lines changed: 146 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Junyan Xu
66
module
77

88
public import Mathlib.Algebra.Module.LinearMap.Defs
9+
public import Mathlib.Algebra.Star.StarRingHom
910
public import Mathlib.Data.Rat.Cast.Defs
1011
public import Mathlib.Order.DirectedInverseSystem
1112
public import Mathlib.Tactic.SuppressCompilation
@@ -37,7 +38,13 @@ universal object for each type of algebraic structure; the same type `DirectLimi
3738
works for all of them. This file is therefore more general than the `Module` and `Ring`
3839
files in terms of the variety of algebraic structures supported.
3940
40-
So far we only show that `DirectLimit` is the colimit in the categories of modules and rings,
41+
So far we only show that `DirectLimit` is the colimit in the following categories:
42+
43+
* modules
44+
* non-unital semirings
45+
* rings
46+
* (non-unital) star rings
47+
4148
but for the other algebraic structures the constructions and proofs will be easy following
4249
the same pattern. Since any two colimits are isomorphic, this allows us to golf proofs of
4350
equality criteria for `Module/AddCommGroup/Ring.DirectLimit`.
@@ -73,6 +80,29 @@ variable [∀ i j h, OneHomClass (T h) (G i) (G j)]
7380

7481
end ZeroOne
7582

83+
section Star
84+
variable [∀ i, Star (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
85+
86+
instance : Star (DirectLimit G f) where
87+
star := .map f f (fun _ x ↦ star x) (fun i j h x ↦ map_star (f i j h) x)
88+
89+
lemma star_def (i : ι) (x : G i) :
90+
star ⟦⟨i, x⟩⟧ = (⟦⟨i, star x⟩⟧ : DirectLimit G f) := by
91+
rfl
92+
93+
end Star
94+
95+
section InvolutiveStar
96+
variable [∀ i, InvolutiveStar (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
97+
98+
instance : InvolutiveStar (DirectLimit G f) where
99+
star_involutive := by
100+
apply DirectLimit.induction
101+
intro i x
102+
rw [star_def, star_def, star_star]
103+
104+
end InvolutiveStar
105+
76106
section AddMul
77107
variable [∀ i, Mul (G i)] [∀ i j h, MulHomClass (T h) (G i) (G j)]
78108

@@ -97,6 +127,15 @@ end AddMul
97127
CommSemigroup (DirectLimit G f) where
98128
mul_comm := mul_comm
99129

130+
section StarMul
131+
variable [∀ i, Mul (G i)] [∀ i j h, MulHomClass (T h) (G i) (G j)]
132+
variable [∀ i, StarMul (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
133+
134+
instance : StarMul (DirectLimit G f) where
135+
star_mul := DirectLimit.induction₂ _ fun i _ _ ↦ by simp_rw [mul_def, star_def, star_mul, mul_def]
136+
137+
end StarMul
138+
100139
section SMul
101140
variable [∀ i, SMul R (G i)] [∀ i j h, MulActionHomClass (T h) R (G i) (G j)]
102141

@@ -108,6 +147,13 @@ variable [∀ i, SMul R (G i)] [∀ i j h, MulActionHomClass (T h) R (G i) (G j)
108147

109148
end SMul
110149

150+
instance [Star R] [∀ i, Star (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
151+
[∀ i, SMul R (G i)] [∀ i j h, MulActionHomClass (T h) R (G i) (G j)]
152+
[∀ i, StarModule R (G i)] :
153+
StarModule R (DirectLimit G f) where
154+
star_smul r := DirectLimit.induction _ fun i x ↦ by
155+
simp_rw [star_def, smul_def, ← star_smul, star_def]
156+
111157
@[to_additive] instance [Monoid R] [∀ i, MulAction R (G i)]
112158
[∀ i j h, MulActionHomClass (T h) R (G i) (G j)] :
113159
MulAction R (DirectLimit G f) where
@@ -140,6 +186,15 @@ end Monoid
140186
CommMonoid (DirectLimit G f) where
141187
mul_comm := mul_comm
142188

189+
section StarAddMonoid
190+
variable [∀ i, AddMonoid (G i)] [∀ i j h, AddMonoidHomClass (T h) (G i) (G j)]
191+
variable [∀ i, StarAddMonoid (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
192+
193+
instance : StarAddMonoid (DirectLimit G f) where
194+
star_add := DirectLimit.induction₂ _ fun i _ _ ↦ by simp_rw [add_def, star_def, star_add, add_def]
195+
196+
end StarAddMonoid
197+
143198
section Group
144199
variable [∀ i, Group (G i)] [∀ i j h, MonoidHomClass (T h) (G i) (G j)]
145200

@@ -291,6 +346,11 @@ instance [∀ i, NonUnitalNonAssocSemiring (G i)] [∀ i j h, NonUnitalRingHomCl
291346
zero_mul := zero_mul
292347
mul_zero := mul_zero
293348

349+
instance [∀ i, NonUnitalNonAssocSemiring (G i)] [∀ i j h, NonUnitalRingHomClass (T h) (G i) (G j)]
350+
[∀ i, StarRing (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)] :
351+
StarRing (DirectLimit G f) where
352+
star_add := star_add
353+
294354
instance [∀ i, NonUnitalSemiring (G i)] [∀ i j h, NonUnitalRingHomClass (T h) (G i) (G j)] :
295355
NonUnitalSemiring (DirectLimit G f) where
296356
mul_assoc := mul_assoc
@@ -480,18 +540,57 @@ theorem hom_ext {g₁ g₂ : DirectLimit G f →ₗ[R] P}
480540

481541
end Module
482542

543+
namespace NonUnitalRing
544+
variable [∀ i, NonUnitalNonAssocSemiring (G i)] [∀ i j h, NonUnitalRingHomClass (T h) (G i) (G j)]
545+
variable [Nonempty ι]
546+
547+
variable (G f) in
548+
/-- The canonical map from a component to the direct limit. -/
549+
nonrec def of (i) : G i →ₙ+* DirectLimit G f where
550+
toFun x := ⟦⟨i, x⟩⟧
551+
map_mul' _ _ := (mul_def ..).symm
552+
map_zero' := (zero_def i).symm
553+
map_add' _ _ := (add_def ..).symm
554+
555+
@[simp] theorem of_f {i j} (hij) (x) : of G f j (f i j hij x) = of G f i x := .symm <| eq_of_le ..
556+
557+
variable (P : Type*) [NonUnitalNonAssocSemiring P]
558+
variable (G f) in
559+
/-- The universal property of the direct limit: maps from the components to another
560+
NonUnitalNonAsssocSemiRing that respect the directed system structure
561+
(i.e. make some diagram commute) give rise to a unique map out of the direct limit.
562+
-/
563+
noncomputable def lift
564+
(g : ∀ i, (G i) →ₙ+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x) :
565+
DirectLimit G f →ₙ+* P where
566+
toFun := _root_.DirectLimit.lift _ (g · ·) (fun i j hij x ↦ (Hg i j hij x).symm)
567+
map_mul' := DirectLimit.induction₂ _ fun i x y ↦ by simp_rw [mul_def, lift_def, map_mul (g i)]
568+
map_zero' := by simp_rw [zero_def (Classical.arbitrary ι), lift_def, map_zero]
569+
map_add' := DirectLimit.induction₂ _ fun i x y ↦ by simp_rw [add_def, lift_def, map_add (g i)]
570+
571+
variable (g : ∀ i, G i →ₙ+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x)
572+
573+
@[simp] theorem lift_of (i x) : lift G f P g Hg (of G f i x) = g i x := rfl
574+
575+
@[ext]
576+
theorem hom_ext {g₁ g₂ : DirectLimit G f →ₙ+* P} (h : ∀ i, g₁.comp (of G f i) = g₂.comp (of G f i)):
577+
g₁ = g₂ := by
578+
ext x
579+
induction x using DirectLimit.induction with | _ i x
580+
exact congr($(h i) x)
581+
582+
end NonUnitalRing
583+
483584
namespace Ring
484585

485586
variable [∀ i, NonAssocSemiring (G i)] [∀ i j h, RingHomClass (T h) (G i) (G j)] [Nonempty ι]
486587

487588
variable (G f) in
488589
/-- The canonical map from a component to the direct limit. -/
489590
nonrec def of (i) : G i →+* DirectLimit G f where
591+
__ := NonUnitalRing.of G f i
490592
toFun x := ⟦⟨i, x⟩⟧
491593
map_one' := (one_def i).symm
492-
map_mul' _ _ := (mul_def ..).symm
493-
map_zero' := (zero_def i).symm
494-
map_add' _ _ := (add_def ..).symm
495594

496595
@[simp] theorem of_f {i j} (hij) (x) : of G f j (f i j hij x) = of G f i x := .symm <| eq_of_le ..
497596

@@ -504,11 +603,9 @@ to a unique map out of the direct limit.
504603
-/
505604
def lift (g : ∀ i, G i →+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x) :
506605
DirectLimit G f →+* P where
606+
__ := (NonUnitalRing.lift G f P (fun _ => (g _).toNonUnitalRingHom) Hg)
507607
toFun := _root_.DirectLimit.lift _ (g · ·) fun i j h x ↦ (Hg i j h x).symm
508608
map_one' := by rw [one_def (Classical.arbitrary ι), lift_def, map_one]
509-
map_mul' := DirectLimit.induction₂ _ fun i x y ↦ by simp_rw [mul_def, lift_def, map_mul]
510-
map_zero' := by simp_rw [zero_def (Classical.arbitrary ι), lift_def, map_zero]
511-
map_add' := DirectLimit.induction₂ _ fun i x y ↦ by simp_rw [add_def, lift_def, map_add]
512609

513610
variable (g : ∀ i, G i →+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x)
514611

@@ -523,4 +620,46 @@ theorem hom_ext {g₁ g₂ : DirectLimit G f →+* P} (h : ∀ i, g₁.comp (of
523620

524621
end Ring
525622

623+
namespace NonUnitalStarRing
624+
625+
variable [∀ i, NonUnitalNonAssocSemiring (G i)] [∀ i j h, NonUnitalRingHomClass (T h) (G i) (G j)]
626+
variable [∀ i, StarRing (G i)] [∀ i j h, StarHomClass (T h) (G i) (G j)]
627+
variable [Nonempty ι]
628+
629+
variable (G f) in
630+
/-- The canonical map from a component to the direct limit. -/
631+
noncomputable def of (i) : G i →⋆ₙ+* DirectLimit G f where
632+
__ := NonUnitalRing.of G f i
633+
toFun x := ⟦⟨i, x⟩⟧
634+
map_star' _ := (star_def ..).symm
635+
636+
@[simp] lemma of_f {i j} (hij) (x) : of G f j (f i j hij x) = of G f i x := .symm <| eq_of_le ..
637+
638+
variable (P : Type*) [NonUnitalNonAssocSemiring P] [StarRing P]
639+
variable (G f) in
640+
/-- The universal property of the direct limit: maps from the components to another StarRing
641+
that respect the directed system structure (i.e. make some diagram commute) give rise
642+
to a unique map out of the direct limit.
643+
-/
644+
noncomputable def lift
645+
(g : ∀ i, (G i) →⋆ₙ+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x) :
646+
DirectLimit G f →⋆ₙ+* P where
647+
__ := (NonUnitalRing.lift G f P (fun _ => (g _).toNonUnitalRingHom) Hg)
648+
toFun := _root_.DirectLimit.lift _ (g · ·) (fun i j hij x ↦ (Hg i j hij x).symm)
649+
map_star' := DirectLimit.induction _ fun i x ↦ by simp_rw [star_def, lift_def, map_star (g i)]
650+
651+
variable (g : ∀ i, G i →⋆ₙ+* P) (Hg : ∀ i j hij x, g j (f i j hij x) = g i x)
652+
653+
@[simp] theorem lift_of (i x) : lift G f P g Hg (of G f i x) = g i x := rfl
654+
655+
@[ext]
656+
theorem hom_ext {g₁ g₂ : DirectLimit G f →⋆ₙ+* P}
657+
(h : ∀ i, g₁.comp (of G f i) = g₂.comp (of G f i)) :
658+
g₁ = g₂ := by
659+
ext x
660+
induction x using DirectLimit.induction with | _ i x
661+
exact congr($(h i) x)
662+
663+
end NonUnitalStarRing
664+
526665
end DirectLimit

0 commit comments

Comments
 (0)