Skip to content

Commit 80a0eb2

Browse files
committed
chore: refactor Submodule.baseChange (#26019)
1 parent e53b981 commit 80a0eb2

File tree

6 files changed

+145
-172
lines changed

6 files changed

+145
-172
lines changed

Mathlib/Algebra/Category/ModuleCat/ChangeOfRings.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ Authors: Jujian Zhang
66
import Mathlib.Algebra.Category.ModuleCat.EpiMono
77
import Mathlib.Algebra.Category.ModuleCat.Colimits
88
import Mathlib.Algebra.Category.ModuleCat.Limits
9-
import Mathlib.RingTheory.TensorProduct.Basic
9+
import Mathlib.Algebra.Algebra.RestrictScalars
1010
import Mathlib.CategoryTheory.Adjunction.Mates
1111
import Mathlib.CategoryTheory.Linear.LinearFunctor
12+
import Mathlib.LinearAlgebra.TensorProduct.Tower
1213

1314
/-!
1415
# Change Of Rings

Mathlib/Algebra/Lie/BaseChange.lean

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Authors: Oliver Nash
55
-/
66
import Mathlib.Algebra.Algebra.RestrictScalars
77
import Mathlib.Algebra.Lie.TensorProduct
8-
import Mathlib.LinearAlgebra.TensorProduct.Tower
9-
import Mathlib.RingTheory.TensorProduct.Basic
108

119
/-!
1210
# Extension and restriction of scalars for Lie algebras and Lie modules
@@ -165,16 +163,14 @@ def baseChange : LieSubmodule A (A ⊗[R] L) (A ⊗[R] M) :=
165163
{ (N : Submodule R M).baseChange A with
166164
lie_mem := by
167165
intro x m hm
168-
simp only [AddSubsemigroup.mem_carrier, AddSubmonoid.mem_toSubsemigroup,
169-
Submodule.mem_toAddSubmonoid] at hm
166+
rw [Submodule.mem_carrier, SetLike.mem_coe] at hm ⊢
167+
rw [Submodule.baseChange_eq_span] at hm
170168
obtain ⟨c, rfl⟩ := (Finsupp.mem_span_iff_linearCombination _ _ _).mp hm
171169
refine x.induction_on (by simp) (fun a y ↦ ?_) (fun y z hy hz ↦ ?_)
172170
· change toEnd A (A ⊗[R] L) (A ⊗[R] M) _ _ ∈ _
173171
simp_rw [Finsupp.linearCombination_apply, Finsupp.sum, map_sum, map_smul, toEnd_apply_apply]
174-
suffices ∀ n : (N : Submodule R M).map (TensorProduct.mk R A M 1),
175-
⁅a ⊗ₜ[R] y, (n : A ⊗[R] M)⁆ ∈ (N : Submodule R M).baseChange A by
176-
exact Submodule.sum_mem _ fun n _ ↦ Submodule.smul_mem _ _ (this n)
177-
rintro ⟨-, ⟨n : M, hn : n ∈ N, rfl⟩⟩
172+
refine Submodule.sum_mem _ fun ⟨_, n, hn, h⟩ _ ↦ Submodule.smul_mem _ _ ?_
173+
rw [Subtype.coe_mk, ← h]
178174
exact Submodule.tmul_mem_baseChange_of_mem _ (N.lie_mem hn)
179175
· rw [add_lie]
180176
exact ((N : Submodule R M).baseChange A).add_mem hy hz }
@@ -193,8 +189,8 @@ lemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m ∈ N) :
193189

194190
lemma mem_baseChange_iff {m : A ⊗[R] M} :
195191
m ∈ N.baseChange A ↔
196-
m ∈ Submodule.span A ((N : Submodule R M).map (TensorProduct.mk R A M 1)) :=
197-
Iff.rfl
192+
m ∈ Submodule.span A ((N : Submodule R M).map (TensorProduct.mk R A M 1)) := by
193+
rw [← Submodule.baseChange_eq_span]; rfl
198194

199195
@[simp]
200196
lemma baseChange_bot : (⊥ : LieSubmodule R L M).baseChange A = ⊥ := by
@@ -219,30 +215,11 @@ lemma lie_baseChange {I : LieIdeal R L} {N : LieSubmodule R L M} :
219215
exact ⟨1 ⊗ₜ x, tmul_mem_baseChange_of_mem 1 hx,
220216
1 ⊗ₜ m, tmul_mem_baseChange_of_mem 1 hm, by simp⟩
221217
· rintro - ⟨x, hx, m, hm, rfl⟩
222-
revert m
223-
apply Submodule.span_induction
224-
(p := fun x' _ ↦ ∀ m' ∈ N.baseChange A, ⁅x', m'⁆ ∈ Submodule.span A s) (hx := hx)
225-
· rintro _ ⟨y : L, hy : y ∈ I, rfl⟩ m hm
226-
apply Submodule.span_induction
227-
(p := fun m' _ ↦ ⁅(1 : A) ⊗ₜ[R] y, m'⁆ ∈ Submodule.span A s) (hx := hm)
228-
· rintro - ⟨m', hm' : m' ∈ N, rfl⟩
229-
rw [TensorProduct.mk_apply, LieAlgebra.ExtendScalars.bracket_tmul, mul_one]
230-
apply Submodule.subset_span
231-
exact ⟨y, hy, m', hm', rfl⟩
232-
· simp
233-
· intro u v _ _ hu hv
234-
rw [lie_add]
235-
exact Submodule.add_mem _ hu hv
236-
· intro a u _ hu
237-
rw [lie_smul]
238-
exact Submodule.smul_mem _ a hu
239-
· simp
240-
· intro x y _ _ hx hy m' hm'
241-
rw [add_lie]
242-
exact Submodule.add_mem _ (hx _ hm') (hy _ hm')
243-
· intro a x _ hx m' hm'
244-
rw [smul_lie]
245-
exact Submodule.smul_mem _ a (hx _ hm')
218+
rw [mem_baseChange_iff] at hx hm
219+
refine Submodule.span_induction₂ (p := fun x m _ _ ↦ ⁅x, m⁆ ∈ Submodule.span A s)
220+
?_ (by simp) (by simp) ?_ ?_ ?_ ?_ hx hm
221+
· rintro - - ⟨x, hx, rfl⟩ ⟨y, hy, rfl⟩; exact Submodule.subset_span ⟨x, hx, y, hy, by simp⟩
222+
all_goals { intros; simp [add_mem, Submodule.smul_mem, *] }
246223

247224
end LieSubmodule
248225

Mathlib/LinearAlgebra/TensorProduct/Submodule.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Copyright (c) 2024 Jz Pan. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Jz Pan
55
-/
6-
import Mathlib.LinearAlgebra.DirectSum.Finsupp
76
import Mathlib.Algebra.Algebra.Operations
87
import Mathlib.Algebra.Algebra.Subalgebra.Lattice
8+
import Mathlib.LinearAlgebra.DirectSum.Finsupp
99

1010
/-!
1111

Mathlib/LinearAlgebra/TensorProduct/Tower.lean

Lines changed: 131 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ In this file, we use the convention that `M`, `N`, `P`, `Q` are all `R`-modules,
3535
* `TensorProduct.AlgebraTensorModule.leftComm`
3636
* `TensorProduct.AlgebraTensorModule.rightComm`
3737
* `TensorProduct.AlgebraTensorModule.tensorTensorTensorComm`
38+
* `LinearMap.baseChange A f` is the `A`-linear map `A ⊗ f`, for an `R`-linear map `f`.
3839
3940
## Implementation notes
4041
@@ -576,6 +577,116 @@ end AlgebraTensorModule
576577

577578
end TensorProduct
578579

580+
namespace LinearMap
581+
582+
open TensorProduct
583+
584+
/-!
585+
### The base-change of a linear map of `R`-modules to a linear map of `A`-modules
586+
-/
587+
588+
589+
section Semiring
590+
591+
variable {R A B M N P : Type*} [CommSemiring R]
592+
variable [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]
593+
variable [AddCommMonoid M] [AddCommMonoid N] [AddCommMonoid P]
594+
variable [Module R M] [Module R N] [Module R P]
595+
variable (r : R) (f g : M →ₗ[R] N)
596+
597+
variable (A) in
598+
/-- `baseChange A f` for `f : M →ₗ[R] N` is the `A`-linear map `A ⊗[R] M →ₗ[A] A ⊗[R] N`.
599+
600+
This "base change" operation is also known as "extension of scalars". -/
601+
def baseChange (f : M →ₗ[R] N) : A ⊗[R] M →ₗ[A] A ⊗[R] N :=
602+
AlgebraTensorModule.map (LinearMap.id : A →ₗ[A] A) f
603+
604+
@[simp]
605+
theorem baseChange_tmul (a : A) (x : M) : f.baseChange A (a ⊗ₜ x) = a ⊗ₜ f x :=
606+
rfl
607+
608+
theorem baseChange_eq_ltensor : (f.baseChange A : A ⊗ M → A ⊗ N) = f.lTensor A :=
609+
rfl
610+
611+
@[simp]
612+
theorem baseChange_add : (f + g).baseChange A = f.baseChange A + g.baseChange A := by
613+
ext
614+
-- Porting note: added `-baseChange_tmul`
615+
simp [baseChange_eq_ltensor, -baseChange_tmul]
616+
617+
@[simp]
618+
theorem baseChange_zero : baseChange A (0 : M →ₗ[R] N) = 0 := by
619+
ext
620+
simp [baseChange_eq_ltensor]
621+
622+
@[simp]
623+
theorem baseChange_smul : (r • f).baseChange A = r • f.baseChange A := by
624+
ext
625+
simp [baseChange_tmul]
626+
627+
@[simp]
628+
lemma baseChange_id : (.id : M →ₗ[R] M).baseChange A = .id := by
629+
ext; simp
630+
631+
lemma baseChange_comp (g : N →ₗ[R] P) :
632+
(g ∘ₗ f).baseChange A = g.baseChange A ∘ₗ f.baseChange A := by
633+
ext; simp
634+
635+
variable (R M) in
636+
@[simp]
637+
lemma baseChange_one : (1 : Module.End R M).baseChange A = 1 := baseChange_id
638+
639+
lemma baseChange_mul (f g : Module.End R M) :
640+
(f * g).baseChange A = f.baseChange A * g.baseChange A := by
641+
ext; simp
642+
643+
variable (R A M N)
644+
645+
/-- `baseChange A e` for `e : M ≃ₗ[R] N` is the `A`-linear map `A ⊗[R] M ≃ₗ[A] A ⊗[R] N`. -/
646+
def _root_.LinearEquiv.baseChange (e : M ≃ₗ[R] N) : A ⊗[R] M ≃ₗ[A] A ⊗[R] N :=
647+
AlgebraTensorModule.congr (.refl _ _) e
648+
649+
/-- `baseChange` as a linear map.
650+
651+
When `M = N`, this is true more strongly as `Module.End.baseChangeHom`. -/
652+
@[simps]
653+
def baseChangeHom : (M →ₗ[R] N) →ₗ[R] A ⊗[R] M →ₗ[A] A ⊗[R] N where
654+
toFun := baseChange A
655+
map_add' := baseChange_add
656+
map_smul' := baseChange_smul
657+
658+
/-- `baseChange` as an `AlgHom`. -/
659+
@[simps!]
660+
def _root_.Module.End.baseChangeHom : Module.End R M →ₐ[R] Module.End A (A ⊗[R] M) :=
661+
.ofLinearMap (LinearMap.baseChangeHom _ _ _ _) (baseChange_one _ _) baseChange_mul
662+
663+
lemma baseChange_pow (f : Module.End R M) (n : ℕ) :
664+
(f ^ n).baseChange A = f.baseChange A ^ n :=
665+
map_pow (Module.End.baseChangeHom _ _ _) f n
666+
667+
end Semiring
668+
669+
section Ring
670+
671+
variable {R A B M N : Type*} [CommRing R]
672+
variable [Ring A] [Algebra R A] [Ring B] [Algebra R B]
673+
variable [AddCommGroup M] [Module R M] [AddCommGroup N] [Module R N]
674+
variable (f g : M →ₗ[R] N)
675+
676+
@[simp]
677+
theorem baseChange_sub : (f - g).baseChange A = f.baseChange A - g.baseChange A := by
678+
ext
679+
simp [baseChange_eq_ltensor, tmul_sub]
680+
681+
@[simp]
682+
theorem baseChange_neg : (-f).baseChange A = -f.baseChange A := by
683+
ext
684+
simp [baseChange_eq_ltensor, tmul_neg]
685+
686+
end Ring
687+
688+
end LinearMap
689+
579690
namespace Submodule
580691

581692
open TensorProduct
@@ -588,42 +699,34 @@ an `A`-submodule of `A ⊗ M`.
588699
589700
This "base change" operation is also known as "extension of scalars". -/
590701
def baseChange : Submodule A (A ⊗[R] M) :=
591-
span A <| p.map (TensorProduct.mk R A M 1)
702+
LinearMap.range (p.subtype.baseChange A)
703+
704+
variable {A p} in
705+
lemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m ∈ p) :
706+
a ⊗ₜ[R] m ∈ p.baseChange A :=
707+
⟨a ⊗ₜ[R] ⟨m, hm⟩, rfl⟩
708+
709+
lemma baseChange_eq_span : p.baseChange A = span A (p.map (TensorProduct.mk R A M 1)) := by
710+
refine le_antisymm ?_ ?_
711+
· rw [baseChange, LinearMap.range_le_iff_comap, eq_top_iff,
712+
← span_eq_top_of_span_eq_top R A _ (span_tmul_eq_top R ..), span_le]
713+
refine fun _ ⟨a, m, h⟩ ↦ ?_
714+
rw [← h, SetLike.mem_coe, mem_comap, LinearMap.baseChange_tmul, ← mul_one a, ← smul_eq_mul,
715+
← smul_tmul']
716+
exact smul_mem _ a (subset_span ⟨m, m.2, rfl⟩)
717+
· refine span_le.2 fun _ ⟨m, hm, h⟩ ↦ h ▸ ⟨1 ⊗ₜ[R] ⟨m, hm⟩, rfl⟩
592718

593719
@[simp]
594-
lemma baseChange_bot : (⊥ : Submodule R M).baseChange A = ⊥ := by simp [baseChange]
720+
lemma baseChange_bot : (⊥ : Submodule R M).baseChange A = ⊥ := by simp [baseChange_eq_span]
595721

596722
@[simp]
597723
lemma baseChange_top : (⊤ : Submodule R M).baseChange A = ⊤ := by
598-
rw [baseChange, map_top, eq_top_iff']
599-
intro x
600-
refine x.induction_on (by simp) (fun a y ↦ ?_) (fun _ _ ↦ Submodule.add_mem _)
601-
rw [← mul_one a, ← smul_eq_mul, ← smul_tmul']
602-
refine smul_mem _ _ (subset_span ?_)
603-
simp
604-
605-
variable {A p} in
606-
lemma tmul_mem_baseChange_of_mem (a : A) {m : M} (hm : m ∈ p) :
607-
a ⊗ₜ[R] m ∈ p.baseChange A := by
608-
rw [← mul_one a, ← smul_eq_mul, ← smul_tmul']
609-
exact smul_mem (baseChange A p) a (subset_span ⟨m, hm, rfl⟩)
724+
rw [eq_top_iff, ← span_eq_top_of_span_eq_top R A _ (span_tmul_eq_top R ..)]
725+
exact span_le.2 fun _ ⟨a, m, h⟩ ↦ h ▸ tmul_mem_baseChange_of_mem _ trivial
610726

611727
@[simp]
612728
lemma baseChange_span (s : Set M) :
613729
(span R s).baseChange A = span A (TensorProduct.mk R A M 1 '' s) := by
614-
simp only [baseChange, map_coe]
615-
refine le_antisymm (span_le.mpr ?_) (span_mono <| Set.image_subset _ subset_span)
616-
rintro - ⟨m : M, hm : m ∈ span R s, rfl⟩
617-
apply span_induction (p := fun m' _ ↦ (1 : A) ⊗ₜ[R] m' ∈ span A (TensorProduct.mk R A M 1 '' s))
618-
(hx := hm)
619-
· intro m hm
620-
exact subset_span ⟨m, hm, rfl⟩
621-
· simp
622-
· intro m₁ m₂ _ _ hm₁ hm₂
623-
rw [tmul_add]
624-
exact Submodule.add_mem _ hm₁ hm₂
625-
· intro r m' _ hm'
626-
rw [tmul_smul, ← one_smul A ((1 : A) ⊗ₜ[R] m'), ← smul_assoc]
627-
exact smul_mem _ (r • 1) hm'
730+
rw [baseChange_eq_span, map_span, span_span_of_tower]
628731

629732
end Submodule

0 commit comments

Comments
 (0)