Skip to content

Commit f786e14

Browse files
committed
chore: backports for leanprover/lean4#4814 (part 32) (#15577)
1 parent f29176d commit f786e14

File tree

14 files changed

+343
-244
lines changed

14 files changed

+343
-244
lines changed

Mathlib/Algebra/Algebra/NonUnitalSubalgebra.lean

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,13 @@ lemma span_eq_toSubmodule (s : NonUnitalSubalgebra R A) :
509509
Submodule.span R (s : Set A) = s.toSubmodule := by
510510
simp [SetLike.ext'_iff, Submodule.coe_span_eq_self]
511511

512-
variable [IsScalarTower R A A] [SMulCommClass R A A]
513-
variable [NonUnitalNonAssocSemiring B] [Module R B] [IsScalarTower R B B] [SMulCommClass R B B]
512+
variable [NonUnitalNonAssocSemiring B] [Module R B]
514513
variable [FunLike F A B] [NonUnitalAlgHomClass F R A B]
515514

515+
section IsScalarTower
516+
517+
variable [IsScalarTower R A A] [SMulCommClass R A A]
518+
516519
/-- The minimal non-unital subalgebra that includes `s`. -/
517520
def adjoin (s : Set A) : NonUnitalSubalgebra R A :=
518521
{ Submodule.span R (NonUnitalSubsemiring.closure s : Set A) with
@@ -657,15 +660,15 @@ theorem adjoin_univ : adjoin R (Set.univ : Set A) = ⊤ :=
657660
eq_top_iff.2 fun _x hx => subset_adjoin R hx
658661

659662
open NonUnitalSubalgebra in
660-
lemma _root_.NonUnitalAlgHom.map_adjoin (f : F) (s : Set A) :
661-
map f (adjoin R s) = adjoin R (f '' s) :=
663+
lemma _root_.NonUnitalAlgHom.map_adjoin [IsScalarTower R B B] [SMulCommClass R B B]
664+
(f : F) (s : Set A) : map f (adjoin R s) = adjoin R (f '' s) :=
662665
Set.image_preimage.l_comm_of_u_comm (gc_map_comap f) NonUnitalAlgebra.gi.gc
663666
NonUnitalAlgebra.gi.gc fun _t => rfl
664667

665668
open NonUnitalSubalgebra in
666669
@[simp]
667-
lemma _root_.NonUnitalAlgHom.map_adjoin_singleton (f : F) (x : A) :
668-
map f (adjoin R {x}) = adjoin R {f x} := by
670+
lemma _root_.NonUnitalAlgHom.map_adjoin_singleton [IsScalarTower R B B] [SMulCommClass R B B]
671+
(f : F) (x : A) : map f (adjoin R {x}) = adjoin R {f x} := by
669672
simp [NonUnitalAlgHom.map_adjoin]
670673

671674
variable {R A}
@@ -718,7 +721,8 @@ theorem mul_mem_sup {S T : NonUnitalSubalgebra R A} {x y : A} (hx : x ∈ S) (hy
718721
x * y ∈ S ⊔ T :=
719722
mul_mem (mem_sup_left hx) (mem_sup_right hy)
720723

721-
theorem map_sup (f : F) (S T : NonUnitalSubalgebra R A) :
724+
theorem map_sup [IsScalarTower R B B] [SMulCommClass R B B]
725+
(f : F) (S T : NonUnitalSubalgebra R A) :
722726
((S ⊔ T).map f : NonUnitalSubalgebra R B) = S.map f ⊔ T.map f :=
723727
(NonUnitalSubalgebra.gc_map_comap f).l_sup
724728

@@ -788,10 +792,6 @@ theorem coe_bot : ((⊥ : NonUnitalSubalgebra R A) : Set A) = {0} := by
788792
theorem eq_top_iff {S : NonUnitalSubalgebra R A} : S = ⊤ ↔ ∀ x : A, x ∈ S :=
789793
fun h x => by rw [h]; exact mem_top, fun h => by ext x; exact ⟨fun _ => mem_top, fun _ => h x⟩⟩
790794

791-
theorem range_top_iff_surjective (f : A →ₙₐ[R] B) :
792-
NonUnitalAlgHom.range f = (⊤ : NonUnitalSubalgebra R B) ↔ Function.Surjective f :=
793-
NonUnitalAlgebra.eq_top_iff
794-
795795
@[simp]
796796
theorem range_id : NonUnitalAlgHom.range (NonUnitalAlgHom.id R A) = ⊤ :=
797797
SetLike.coe_injective Set.range_id
@@ -801,17 +801,25 @@ theorem map_top (f : A →ₙₐ[R] B) : (⊤ : NonUnitalSubalgebra R A).map f =
801801
SetLike.coe_injective Set.image_univ
802802

803803
@[simp]
804-
theorem map_bot (f : A →ₙₐ[R] B) : (⊥ : NonUnitalSubalgebra R A).map f = ⊥ :=
804+
theorem map_bot [IsScalarTower R B B] [SMulCommClass R B B]
805+
(f : A →ₙₐ[R] B) : (⊥ : NonUnitalSubalgebra R A).map f = ⊥ :=
805806
SetLike.coe_injective <| by simp [NonUnitalAlgebra.coe_bot, NonUnitalSubalgebra.coe_map]
806807

807808
@[simp]
808-
theorem comap_top (f : A →ₙₐ[R] B) : (⊤ : NonUnitalSubalgebra R B).comap f = ⊤ :=
809+
theorem comap_top [IsScalarTower R B B] [SMulCommClass R B B]
810+
(f : A →ₙₐ[R] B) : (⊤ : NonUnitalSubalgebra R B).comap f = ⊤ :=
809811
eq_top_iff.2 fun _ => mem_top
810812

811813
/-- `NonUnitalAlgHom` to `⊤ : NonUnitalSubalgebra R A`. -/
812814
def toTop : A →ₙₐ[R] (⊤ : NonUnitalSubalgebra R A) :=
813815
NonUnitalAlgHom.codRestrict (NonUnitalAlgHom.id R A) ⊤ fun _ => mem_top
814816

817+
end IsScalarTower
818+
819+
theorem range_top_iff_surjective [IsScalarTower R B B] [SMulCommClass R B B] (f : A →ₙₐ[R] B) :
820+
NonUnitalAlgHom.range f = (⊤ : NonUnitalSubalgebra R B) ↔ Function.Surjective f :=
821+
NonUnitalAlgebra.eq_top_iff
822+
815823
end NonUnitalAlgebra
816824

817825
namespace NonUnitalSubalgebra
@@ -831,9 +839,48 @@ theorem range_val : NonUnitalAlgHom.range (NonUnitalSubalgebraClass.subtype S) =
831839
instance subsingleton_of_subsingleton [Subsingleton A] : Subsingleton (NonUnitalSubalgebra R A) :=
832840
fun B C => ext fun x => by simp only [Subsingleton.elim x 0, zero_mem B, zero_mem C]⟩
833841

834-
variable [IsScalarTower R A A] [SMulCommClass R A A]
835842
variable [NonUnitalNonAssocSemiring B] [Module R B]
836843

844+
section Prod
845+
846+
variable (S₁ : NonUnitalSubalgebra R B)
847+
848+
/-- The product of two non-unital subalgebras is a non-unital subalgebra. -/
849+
def prod : NonUnitalSubalgebra R (A × B) :=
850+
{ S.toNonUnitalSubsemiring.prod S₁.toNonUnitalSubsemiring with
851+
carrier := S ×ˢ S₁
852+
smul_mem' := fun r _x hx => ⟨SMulMemClass.smul_mem r hx.1, SMulMemClass.smul_mem r hx.2⟩ }
853+
854+
@[simp]
855+
theorem coe_prod : (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ S₁ :=
856+
rfl
857+
858+
theorem prod_toSubmodule : (S.prod S₁).toSubmodule = S.toSubmodule.prod S₁.toSubmodule :=
859+
rfl
860+
861+
@[simp]
862+
theorem mem_prod {S : NonUnitalSubalgebra R A} {S₁ : NonUnitalSubalgebra R B} {x : A × B} :
863+
x ∈ prod S S₁ ↔ x.1 ∈ S ∧ x.2 ∈ S₁ :=
864+
Set.mem_prod
865+
866+
variable [IsScalarTower R A A] [SMulCommClass R A A] [IsScalarTower R B B] [SMulCommClass R B B]
867+
868+
@[simp]
869+
theorem prod_top : (prod ⊤ ⊤ : NonUnitalSubalgebra R (A × B)) = ⊤ := by ext; simp
870+
871+
theorem prod_mono {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
872+
S ≤ T → S₁ ≤ T₁ → prod S S₁ ≤ prod T T₁ :=
873+
Set.prod_mono
874+
875+
@[simp]
876+
theorem prod_inf_prod {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
877+
S.prod S₁ ⊓ T.prod T₁ = (S ⊓ T).prod (S₁ ⊓ T₁) :=
878+
SetLike.coe_injective Set.prod_inter_prod
879+
880+
end Prod
881+
882+
variable [IsScalarTower R A A] [SMulCommClass R A A]
883+
837884
instance _root_.NonUnitalAlgHom.subsingleton [Subsingleton (NonUnitalSubalgebra R A)] :
838885
Subsingleton (A →ₙₐ[R] B) :=
839886
fun f g =>
@@ -880,44 +927,6 @@ theorem coe_inclusion {S T : NonUnitalSubalgebra R A} (h : S ≤ T) (s : S) :
880927
(inclusion h s : A) = s :=
881928
rfl
882929

883-
section Prod
884-
885-
variable (S₁ : NonUnitalSubalgebra R B)
886-
887-
/-- The product of two non-unital subalgebras is a non-unital subalgebra. -/
888-
def prod : NonUnitalSubalgebra R (A × B) :=
889-
{ S.toNonUnitalSubsemiring.prod S₁.toNonUnitalSubsemiring with
890-
carrier := S ×ˢ S₁
891-
smul_mem' := fun r _x hx => ⟨SMulMemClass.smul_mem r hx.1, SMulMemClass.smul_mem r hx.2⟩ }
892-
893-
@[simp]
894-
theorem coe_prod : (prod S S₁ : Set (A × B)) = (S : Set A) ×ˢ S₁ :=
895-
rfl
896-
897-
theorem prod_toSubmodule : (S.prod S₁).toSubmodule = S.toSubmodule.prod S₁.toSubmodule :=
898-
rfl
899-
900-
@[simp]
901-
theorem mem_prod {S : NonUnitalSubalgebra R A} {S₁ : NonUnitalSubalgebra R B} {x : A × B} :
902-
x ∈ prod S S₁ ↔ x.1 ∈ S ∧ x.2 ∈ S₁ :=
903-
Set.mem_prod
904-
905-
variable [IsScalarTower R B B] [SMulCommClass R B B]
906-
907-
@[simp]
908-
theorem prod_top : (prod ⊤ ⊤ : NonUnitalSubalgebra R (A × B)) = ⊤ := by ext; simp
909-
910-
theorem prod_mono {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
911-
S ≤ T → S₁ ≤ T₁ → prod S S₁ ≤ prod T T₁ :=
912-
Set.prod_mono
913-
914-
@[simp]
915-
theorem prod_inf_prod {S T : NonUnitalSubalgebra R A} {S₁ T₁ : NonUnitalSubalgebra R B} :
916-
S.prod S₁ ⊓ T.prod T₁ = (S ⊓ T).prod (S₁ ⊓ T₁) :=
917-
SetLike.coe_injective Set.prod_inter_prod
918-
919-
end Prod
920-
921930
section SuprLift
922931

923932
variable {ι : Type*}

Mathlib/Algebra/DirectLimit.lean

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,9 @@ nonrec theorem DirectedSystem.map_map [DirectedSystem G fun i j h => f i j h] {i
7979
DirectedSystem.map_map (fun i j h => f i j h) hij hjk x
8080

8181
variable (G)
82-
variable [DecidableEq ι]
8382

8483
/-- The direct limit of a directed system is the modules glued together along the maps. -/
85-
def DirectLimit : Type max v w :=
84+
def DirectLimit [DecidableEq ι] : Type max v w :=
8685
DirectSum ι G ⧸
8786
(span R <|
8887
{ a |
@@ -91,6 +90,10 @@ def DirectLimit : Type max v w :=
9190

9291
namespace DirectLimit
9392

93+
section Basic
94+
95+
variable [DecidableEq ι]
96+
9497
instance addCommGroup : AddCommGroup (DirectLimit G f) :=
9598
Quotient.addCommGroup _
9699

@@ -247,10 +250,9 @@ lemma congr_symm_apply_of [IsDirected ι (· ≤ ·)]
247250

248251
end functorial
249252

250-
section Totalize
251-
253+
end Basic
252254

253-
variable (G f)
255+
section Totalize
254256

255257
open Classical in
256258
/-- `totalize G f i j` is a linear map from `G i` to `G j`, for *every* `i` and `j`.
@@ -269,7 +271,8 @@ theorem totalize_of_not_le {i j} (h : ¬i ≤ j) : totalize G f i j = 0 :=
269271

270272
end Totalize
271273

272-
variable [DirectedSystem G fun i j h => f i j h]
274+
variable [DecidableEq ι] [DirectedSystem G fun i j h => f i j h]
275+
variable {G f}
273276

274277
theorem toModule_totalize_of_le [∀ i (k : G i), Decidable (k ≠ 0)] {x : DirectSum ι G} {i j : ι}
275278
(hij : i ≤ j) (hx : ∀ k ∈ x.support, k ≤ i) :
@@ -343,10 +346,10 @@ end Module
343346

344347
namespace AddCommGroup
345348

346-
variable [DecidableEq ι] [∀ i, AddCommGroup (G i)]
349+
variable [∀ i, AddCommGroup (G i)]
347350

348351
/-- The direct limit of a directed system is the abelian groups glued together along the maps. -/
349-
def DirectLimit (f : ∀ i j, i ≤ j → G i →+ G j) : Type _ :=
352+
def DirectLimit [DecidableEq ι] (f : ∀ i j, i ≤ j → G i →+ G j) : Type _ :=
350353
@Module.DirectLimit ℤ _ ι _ G _ _ (fun i j hij => (f i j hij).toIntLinearMap) _
351354

352355
namespace DirectLimit
@@ -359,6 +362,8 @@ protected theorem directedSystem [h : DirectedSystem G fun i j h => f i j h] :
359362

360363
attribute [local instance] DirectLimit.directedSystem
361364

365+
variable [DecidableEq ι]
366+
362367
instance : AddCommGroup (DirectLimit G f) :=
363368
Module.DirectLimit.addCommGroup G fun i j hij => (f i j hij).toIntLinearMap
364369

@@ -842,7 +847,7 @@ variable {G' : ι → Type v'} [∀ i, CommRing (G' i)]
842847
variable {f' : ∀ i j, i ≤ j → G' i →+* G' j}
843848
variable {G'' : ι → Type v''} [∀ i, CommRing (G'' i)]
844849
variable {f'' : ∀ i j, i ≤ j → G'' i →+* G'' j}
845-
variable [Nonempty ι]
850+
846851
/--
847852
Consider direct limits `lim G` and `lim G'` with direct system `f` and `f'` respectively, any
848853
family of ring homomorphisms `gᵢ : Gᵢ ⟶ G'ᵢ` such that `g ∘ f = f' ∘ g` induces a ring
@@ -862,6 +867,8 @@ def map (g : (i : ι) → G i →+* G' i)
862867
map g hg (of G _ _ x) = of G' (fun _ _ h ↦ f' _ _ h) i (g i x) :=
863868
lift_of _ _ _ _ _
864869

870+
variable [Nonempty ι]
871+
865872
@[simp] lemma map_id [IsDirected ι (· ≤ ·)] :
866873
map (fun i ↦ RingHom.id _) (fun _ _ _ ↦ rfl) =
867874
RingHom.id (DirectLimit G fun _ _ h ↦ f _ _ h) :=

Mathlib/Algebra/DirectSum/Module.lean

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ theorem smul_apply (b : R) (v : ⨁ i, M i) (i : ι) : (b • v) i = b • v i :
5454
DFinsupp.smul_apply _ _ _
5555

5656
variable (R ι M)
57+
58+
section DecidableEq
59+
5760
variable [DecidableEq ι]
5861

5962
/-- Create the direct sum given a family `M` of `R` modules indexed over `ι`. -/
@@ -158,6 +161,8 @@ theorem linearEquivFunOnFintype_symm_single [Fintype ι] (i : ι) (m : M i) :
158161
rw [DFinsupp.equivFunOnFintype_symm_single i m]
159162
rfl
160163

164+
end DecidableEq
165+
161166
@[simp]
162167
theorem linearEquivFunOnFintype_symm_coe [Fintype ι] (f : ⨁ i, M i) :
163168
(linearEquivFunOnFintype R ι M).symm f = f := by
@@ -168,8 +173,6 @@ protected def lid (M : Type v) (ι : Type* := PUnit) [AddCommMonoid M] [Module R
168173
(⨁ _ : ι, M) ≃ₗ[R] M :=
169174
{ DirectSum.id M ι, toModule R ι M fun _ ↦ LinearMap.id with }
170175

171-
variable (ι M)
172-
173176
/-- The projection map onto one component, as a linear map. -/
174177
def component (i : ι) : (⨁ i, M i) →ₗ[R] M i :=
175178
DFinsupp.lapply i
@@ -187,14 +190,15 @@ theorem ext_iff {f g : ⨁ i, M i} : f = g ↔ ∀ i, component R ι M i f = com
187190
fun h _ ↦ by rw [h], ext R⟩
188191

189192
@[simp]
190-
theorem lof_apply (i : ι) (b : M i) : ((lof R ι M i) b) i = b :=
193+
theorem lof_apply [DecidableEq ι] (i : ι) (b : M i) : ((lof R ι M i) b) i = b :=
191194
DFinsupp.single_eq_same
192195

193196
@[simp]
194-
theorem component.lof_self (i : ι) (b : M i) : component R ι M i ((lof R ι M i) b) = b :=
197+
theorem component.lof_self [DecidableEq ι] (i : ι) (b : M i) :
198+
component R ι M i ((lof R ι M i) b) = b :=
195199
lof_apply R i b
196200

197-
theorem component.of (i j : ι) (b : M j) :
201+
theorem component.of [DecidableEq ι] (i j : ι) (b : M j) :
198202
component R ι M i ((lof R ι M j) b) = if h : j = i then Eq.recOn h b else 0 :=
199203
DFinsupp.single_apply
200204

@@ -216,7 +220,7 @@ end CongrLeft
216220
section Sigma
217221

218222
variable {α : ι → Type*} {δ : ∀ i, α i → Type w}
219-
variable [∀ i j, AddCommMonoid (δ i j)] [∀ i j, Module R (δ i j)]
223+
variable [DecidableEq ι] [∀ i j, AddCommMonoid (δ i j)] [∀ i j, Module R (δ i j)]
220224

221225
/-- `curry` as a linear map. -/
222226
def sigmaLcurry : (⨁ i : Σi, _, δ i.1 i.2) →ₗ[R] ⨁ (i) (j), δ i j :=

Mathlib/Algebra/Lie/Abelian.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,7 @@ open LieSubmodule LieSubalgebra
271271

272272
variable {R : Type u} {L : Type v} {M : Type w}
273273
variable [CommRing R] [LieRing L] [LieAlgebra R L] [AddCommGroup M] [Module R M]
274-
variable [LieRingModule L M] [LieModule R L M]
275-
variable (N N' : LieSubmodule R L M) (I J : LieIdeal R L)
274+
variable [LieRingModule L M] (N N' : LieSubmodule R L M) (I J : LieIdeal R L)
276275

277276
@[simp]
278277
theorem LieSubmodule.trivial_lie_oper_zero [LieModule.IsTrivial L M] : ⁅I, N⁆ = ⊥ := by

0 commit comments

Comments
 (0)