@@ -31,34 +31,6 @@ public import Mathlib.LinearAlgebra.Finsupp.SumProd
3131* `finsuppTensorFinsupp`, the tensor product of `ι →₀ M` and `κ →₀ N`
3232 is linearly equivalent to `(ι × κ) →₀ (M ⊗ N)`.
3333
34- ## Case of MvPolynomial
35-
36- These functions apply to `MvPolynomial`, one can define
37- ```
38- noncomputable def MvPolynomial.rTensor' :
39- MvPolynomial σ S ⊗[R] N ≃ₗ[S] (σ →₀ ℕ) →₀ (S ⊗[R] N) :=
40- TensorProduct.finsuppLeft'
41-
42- noncomputable def MvPolynomial.rTensor :
43- MvPolynomial σ R ⊗[R] N ≃ₗ[R] (σ →₀ ℕ) →₀ N :=
44- TensorProduct.finsuppScalarLeft
45- ```
46-
47- However, to be actually usable, these definitions need lemmas to be given in companion PR.
48-
49- ## Case of `Polynomial`
50-
51- `Polynomial` is a structure containing a `Finsupp`, so these functions
52- can't be applied directly to `Polynomial`.
53-
54- Some linear equivs need to be added to mathlib for that.
55- This belongs to a companion PR.
56-
57- ## TODO
58-
59- * generalize to `MonoidAlgebra`, `AlgHom `
60-
61- * reprove `TensorProduct.finsuppLeft'` using existing heterobasic version of `TensorProduct.congr`
6234 -/
6335
6436@[expose] public section
@@ -72,8 +44,8 @@ open Set LinearMap Submodule
7244
7345section TensorProduct
7446
75- variable (R : Type *) [CommSemiring R]
76- (M : Type *) [AddCommMonoid M] [Module R M]
47+ variable (R S : Type *) [CommSemiring R] [Semiring S] [Algebra R S ]
48+ (M : Type *) [AddCommMonoid M] [Module R M] [Module S M] [IsScalarTower R S M]
7749 (N : Type *) [AddCommMonoid N] [Module R N]
7850
7951namespace TensorProduct
@@ -82,110 +54,95 @@ variable (ι : Type*) [DecidableEq ι]
8254
8355/-- The tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N` -/
8456noncomputable def finsuppLeft :
85- (ι →₀ M) ⊗[R] N ≃ₗ[R ] ι →₀ M ⊗[R] N :=
86- congr (finsuppLEquivDirectSum R M ι) (.refl R N) ≪≫ₗ
87- directSumLeft R (fun _ ↦ M) N ≪≫ₗ (finsuppLEquivDirectSum R _ ι).symm
57+ (ι →₀ M) ⊗[R] N ≃ₗ[S ] ι →₀ M ⊗[R] N :=
58+ AlgebraTensorModule. congr (finsuppLEquivDirectSum S M ι) (.refl R N) ≪≫ₗ
59+ directSumLeft _ S (fun _ ↦ M) N ≪≫ₗ (finsuppLEquivDirectSum _ _ ι).symm
8860
89- variable {R M N ι}
61+ variable {R S M N ι}
9062
9163lemma finsuppLeft_apply_tmul (p : ι →₀ M) (n : N) :
92- finsuppLeft R M N ι (p ⊗ₜ[R] n) = p.sum fun i m ↦ Finsupp.single i (m ⊗ₜ[R] n) := by
64+ finsuppLeft R S M N ι (p ⊗ₜ[R] n) = p.sum fun i m ↦ Finsupp.single i (m ⊗ₜ[R] n) := by
9365 induction p using Finsupp.induction_linear with
9466 | zero => simp
9567 | add f g hf hg => simp [add_tmul, map_add, hf, hg, Finsupp.sum_add_index]
9668 | single => simp [finsuppLeft]
9769
9870@[simp]
9971lemma finsuppLeft_apply_tmul_apply (p : ι →₀ M) (n : N) (i : ι) :
100- finsuppLeft R M N ι (p ⊗ₜ[R] n) i = p i ⊗ₜ[R] n := by
72+ finsuppLeft R S M N ι (p ⊗ₜ[R] n) i = p i ⊗ₜ[R] n := by
10173 rw [finsuppLeft_apply_tmul, Finsupp.sum_apply,
10274 Finsupp.sum_eq_single i (fun _ _ ↦ Finsupp.single_eq_of_ne') (by simp), Finsupp.single_eq_same]
10375
10476theorem finsuppLeft_apply (t : (ι →₀ M) ⊗[R] N) (i : ι) :
105- finsuppLeft R M N ι t i = rTensor N (Finsupp.lapply i) t := by
77+ finsuppLeft R S M N ι t i = rTensor N (Finsupp.lapply i) t := by
10678 induction t with
10779 | zero => simp
10880 | tmul f n => simp only [finsuppLeft_apply_tmul_apply, rTensor_tmul, Finsupp.lapply_apply]
10981 | add x y hx hy => simp [map_add, hx, hy]
11082
11183@[simp]
11284lemma finsuppLeft_symm_apply_single (i : ι) (m : M) (n : N) :
113- (finsuppLeft R M N ι).symm (Finsupp.single i (m ⊗ₜ[R] n)) =
85+ (finsuppLeft R S M N ι).symm (Finsupp.single i (m ⊗ₜ[R] n)) =
11486 Finsupp.single i m ⊗ₜ[R] n := by
11587 simp [finsuppLeft]
11688
117- variable (R M N ι)
89+ variable (R S M N ι) in
11890/-- The tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N` -/
11991noncomputable def finsuppRight :
120- M ⊗[R] (ι →₀ N) ≃ₗ[R] ι →₀ M ⊗[R] N :=
121- congr (.refl R M) (finsuppLEquivDirectSum R N ι) ≪≫ₗ
122- directSumRight R M (fun _ : ι ↦ N) ≪≫ₗ (finsuppLEquivDirectSum R _ ι).symm
123-
124- variable {R M N ι}
92+ M ⊗[R] (ι →₀ N) ≃ₗ[S] ι →₀ M ⊗[R] N :=
93+ AlgebraTensorModule.congr (.refl S M) (finsuppLEquivDirectSum R N ι) ≪≫ₗ
94+ directSumRight' R S M (fun _ : ι ↦ N) ≪≫ₗ (finsuppLEquivDirectSum _ _ ι).symm
12595
12696lemma finsuppRight_apply_tmul (m : M) (p : ι →₀ N) :
127- finsuppRight R M N ι (m ⊗ₜ[R] p) = p.sum fun i n ↦ Finsupp.single i (m ⊗ₜ[R] n) := by
97+ finsuppRight R S M N ι (m ⊗ₜ[R] p) = p.sum fun i n ↦ Finsupp.single i (m ⊗ₜ[R] n) := by
12898 induction p using Finsupp.induction_linear with
12999 | zero => simp
130100 | add f g hf hg => simp [tmul_add, map_add, hf, hg, Finsupp.sum_add_index]
131- | single => simp [finsuppRight]
101+ | single => simp [finsuppRight, directSumRight']; simp [lof_eq_of R, ← lof_eq_of S ]
132102
133103@[simp]
134104lemma finsuppRight_apply_tmul_apply (m : M) (p : ι →₀ N) (i : ι) :
135- finsuppRight R M N ι (m ⊗ₜ[R] p) i = m ⊗ₜ[R] p i := by
105+ finsuppRight R S M N ι (m ⊗ₜ[R] p) i = m ⊗ₜ[R] p i := by
136106 rw [finsuppRight_apply_tmul, Finsupp.sum_apply,
137107 Finsupp.sum_eq_single i (fun _ _ ↦ Finsupp.single_eq_of_ne') (by simp), Finsupp.single_eq_same]
138108
139109theorem finsuppRight_apply (t : M ⊗[R] (ι →₀ N)) (i : ι) :
140- finsuppRight R M N ι t i = lTensor M (Finsupp.lapply i) t := by
110+ finsuppRight R S M N ι t i = lTensor M (Finsupp.lapply i) t := by
141111 induction t with
142112 | zero => simp
143113 | tmul m f => simp [finsuppRight_apply_tmul_apply]
144114 | add x y hx hy => simp [map_add, hx, hy]
145115
116+ @[simp]
117+ lemma finsuppRight_tmul_single (i : ι) (m : M) (n : N) :
118+ finsuppRight R S M N ι (m ⊗ₜ[R] Finsupp.single i n) = Finsupp.single i (m ⊗ₜ[R] n) := by
119+ ext; simp +contextual [Finsupp.single_apply, apply_ite]
120+
146121@[simp]
147122lemma finsuppRight_symm_apply_single (i : ι) (m : M) (n : N) :
148- (finsuppRight R M N ι).symm (Finsupp.single i (m ⊗ₜ[R] n)) =
123+ (finsuppRight R S M N ι).symm (Finsupp.single i (m ⊗ₜ[R] n)) =
149124 m ⊗ₜ[R] Finsupp.single i n := by
150- simp [finsuppRight]
151-
152- variable {S : Type *} [CommSemiring S] [Algebra R S]
153- [Module S M] [IsScalarTower R S M]
125+ simp [LinearEquiv.symm_apply_eq]
154126
155127lemma finsuppLeft_smul' (s : S) (t : (ι →₀ M) ⊗[R] N) :
156- finsuppLeft R M N ι (s • t) = s • finsuppLeft R M N ι t := by
128+ finsuppLeft R S M N ι (s • t) = s • finsuppLeft R S M N ι t := by
157129 induction t with
158130 | zero => simp
159131 | add x y hx hy => simp [hx, hy]
160132 | tmul p n => ext; simp [smul_tmul', finsuppLeft_apply_tmul_apply]
161133
162- variable (R M N ι S)
163- /-- When `M` is also an `S`-module, then `TensorProduct.finsuppLeft R M N`
164- is an `S`-linear equiv -/
165- noncomputable def finsuppLeft' :
166- (ι →₀ M) ⊗[R] N ≃ₗ[S] ι →₀ M ⊗[R] N where
167- __ := finsuppLeft R M N ι
168- map_smul' := finsuppLeft_smul'
134+ @ [deprecated (since := "2026-01-01" )] alias finsuppLeft' := finsuppLeft
169135
170- variable {R M N ι S}
136+ @ [ nolint synTaut, deprecated "is syntactic rfl now" (since := "2026-01-01" )]
171137lemma finsuppLeft'_apply (x : (ι →₀ M) ⊗[R] N) :
172- finsuppLeft' R M N ι S x = finsuppLeft R M N ι x := rfl
173-
174- /- -- TODO : reprove using the existing heterobasic lemmas
175- noncomputable example :
176- (ι →₀ M) ⊗[ R ] N ≃ₗ[ S ] ι →₀ (M ⊗[ R ] N) := by
177- have f : (⨁ (i₁ : ι), M) ⊗[ R ] N ≃ₗ[ S ] ⨁ (i : ι), M ⊗[ R ] N := sorry
178- exact (AlgebraTensorModule.congr
179- (finsuppLEquivDirectSum S M ι) (.refl R N)).trans
180- (f.trans (finsuppLEquivDirectSum S (M ⊗[ R ] N) ι).symm) -/
138+ finsuppLeft R S M N ι x = finsuppLeft R S M N ι x := rfl
181139
182- variable (R M N ι)
140+ variable (R M N ι) in
183141/-- The tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N` -/
184142noncomputable def finsuppScalarLeft :
185143 (ι →₀ R) ⊗[R] N ≃ₗ[R] ι →₀ N :=
186- finsuppLeft R R N ι ≪≫ₗ (Finsupp.mapRange.linearEquiv (TensorProduct.lid R N))
144+ finsuppLeft R R R N ι ≪≫ₗ (Finsupp.mapRange.linearEquiv (TensorProduct.lid R N))
187145
188- variable {R M N ι}
189146@[simp]
190147lemma finsuppScalarLeft_apply_tmul_apply (p : ι →₀ R) (n : N) (i : ι) :
191148 finsuppScalarLeft R N ι (p ⊗ₜ[R] n) i = p i • n := by
@@ -207,38 +164,36 @@ lemma finsuppScalarLeft_symm_apply_single (i : ι) (n : N) :
207164 (Finsupp.single i 1 ) ⊗ₜ[R] n := by
208165 simp [finsuppScalarLeft, finsuppLeft_symm_apply_single]
209166
210- variable (R M N ι)
211-
167+ variable (R S M N ι) in
212168/-- The tensor product of `M` and `ι →₀ R` is linearly equivalent to `ι →₀ M` -/
213169noncomputable def finsuppScalarRight :
214- M ⊗[R] (ι →₀ R) ≃ₗ[R] ι →₀ M :=
215- finsuppRight R M R ι ≪≫ₗ Finsupp.mapRange.linearEquiv (TensorProduct.rid R M)
216-
217- variable {R M N ι}
170+ M ⊗[R] (ι →₀ R) ≃ₗ[S] ι →₀ M :=
171+ finsuppRight R S M R ι ≪≫ₗ Finsupp.mapRange.linearEquiv (AlgebraTensorModule.rid R S M)
218172
219173@[simp]
220174lemma finsuppScalarRight_apply_tmul_apply (m : M) (p : ι →₀ R) (i : ι) :
221- finsuppScalarRight R M ι (m ⊗ₜ[R] p) i = p i • m := by
175+ finsuppScalarRight R S M ι (m ⊗ₜ[R] p) i = p i • m := by
222176 simp [finsuppScalarRight]
223177
224178lemma finsuppScalarRight_apply_tmul (m : M) (p : ι →₀ R) :
225- finsuppScalarRight R M ι (m ⊗ₜ[R] p) = p.sum fun i n ↦ Finsupp.single i (n • m) := by
179+ finsuppScalarRight R S M ι (m ⊗ₜ[R] p) = p.sum fun i n ↦ Finsupp.single i (n • m) := by
226180 ext i
227181 rw [finsuppScalarRight_apply_tmul_apply, Finsupp.sum_apply,
228182 Finsupp.sum_eq_single i (fun _ _ ↦ Finsupp.single_eq_of_ne') (by simp), Finsupp.single_eq_same]
229183
230184lemma finsuppScalarRight_apply (t : M ⊗[R] (ι →₀ R)) (i : ι) :
231- finsuppScalarRight R M ι t i = TensorProduct.rid R M ((Finsupp.lapply i).lTensor M t) := by
185+ finsuppScalarRight R S M ι t i =
186+ AlgebraTensorModule.rid R S M ((Finsupp.lapply i).lTensor M t) := by
232187 simp [finsuppScalarRight, finsuppRight_apply]
233188
234189@[simp]
235190lemma finsuppScalarRight_symm_apply_single (i : ι) (m : M) :
236- (finsuppScalarRight R M ι).symm (Finsupp.single i m) =
191+ (finsuppScalarRight R S M ι).symm (Finsupp.single i m) =
237192 m ⊗ₜ[R] (Finsupp.single i 1 ) := by
238193 simp [finsuppScalarRight, finsuppRight_symm_apply_single]
239194
240195theorem finsuppScalarRight_smul (s : S) (t) :
241- finsuppScalarRight R M ι (s • t) = s • finsuppScalarRight R M ι t := by
196+ finsuppScalarRight R S M ι (s • t) = s • finsuppScalarRight R S M ι t := by
242197 induction t using TensorProduct.induction_on with
243198 | zero => simp
244199 | add x y hx hy => simp [hx, hy]
@@ -248,15 +203,11 @@ theorem finsuppScalarRight_smul (s : S) (t) :
248203 ext i n j
249204 simp [smul_comm n s m]
250205
251- variable (R S M ι) in
252- /-- When `M` is also an `S`-module, `TensorProduct.finsuppScalarRight R M ι` is `S`-linear. -/
253- noncomputable def finsuppScalarRight' :
254- M ⊗[R] (ι →₀ R) ≃ₗ[S] ι →₀ M where
255- toAddEquiv := finsuppScalarRight R M ι
256- map_smul' s x := finsuppScalarRight_smul s x
206+ @ [deprecated (since := "2026-01-01" )] alias finsuppScalarRight' := finsuppScalarRight
257207
208+ @ [nolint synTaut, deprecated "is syntactic rfl now" (since := "2026-01-01" )]
258209theorem coe_finsuppScalarRight' :
259- ⇑(finsuppScalarRight' R M ι S ) = finsuppScalarRight R M ι :=
210+ ⇑(finsuppScalarRight R S M ι) = finsuppScalarRight R S M ι :=
260211 rfl
261212
262213end TensorProduct
@@ -269,7 +220,7 @@ variable (R S M N ι κ : Type*)
269220
270221theorem Finsupp.linearCombination_one_tmul [DecidableEq ι] {v : ι → M} :
271222 (linearCombination S ((1 : S) ⊗ₜ[R] v ·)).restrictScalars R =
272- (linearCombination R v).lTensor S ∘ₗ (finsuppScalarRight R S ι).symm := by
223+ (linearCombination R v).lTensor S ∘ₗ (finsuppScalarRight R R S ι).symm := by
273224 ext; simp [smul_tmul']
274225
275226variable [Module S M] [IsScalarTower R S M]
0 commit comments