Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat(Mathlib.RingTheory.TensorProduct.MvPolynomial) : tensor product of a (multivariate) polynomial ring #12293

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from 70 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d8e50fc
generalize to CommSemiring / AddCommMonoid
Feb 21, 2024
fa4cb7e
generalize to CommSemiring / AddCommMonoid
Feb 21, 2024
53ee15d
add finsupp_sum_tmul and 3 variants
Feb 21, 2024
d55ac1e
revert
Feb 21, 2024
2f1ebe7
rename (temp)
Feb 21, 2024
c28b2e6
something working
Feb 21, 2024
2320a61
lint 100
Feb 21, 2024
1fdd0aa
revert the generalization (-> AddCommGroup/CommSemiring in the initia…
Feb 21, 2024
d76a5a9
rename following EW's suggestion
Feb 21, 2024
423a61d
namespace TensorProduct
Feb 21, 2024
2efdc69
add docstring
Feb 21, 2024
98b197b
update Mathlib.lean
Feb 21, 2024
7f13321
update Mathlib.lean
Feb 21, 2024
aa3eaf6
better inferface for polynomial (via finsuppScalarLeft)
Feb 22, 2024
3e12239
add letI in RingTheory/Flat/Basic
Feb 22, 2024
8458d4e
adjust `simp` to make Lie/TensorProduct compile
Feb 22, 2024
e259731
remove useless import
Feb 22, 2024
2e74096
Merge branch 'master' into ACL/FinsuppTensorProd
eric-wieser Feb 23, 2024
19af3b0
re-add variable
Feb 23, 2024
d26f775
remove multiplicativity (doesn't work yet)
Feb 23, 2024
660e471
Update Mathlib/LinearAlgebra/DirectSum/Finsupp.lean
AntoineChambert-Loir Feb 23, 2024
65e6c20
add finsuppScalarRight
Feb 23, 2024
a7b0441
add TensorProduct of MonoidAlgebra
Feb 23, 2024
8af8487
add docstring
Feb 23, 2024
4f65f96
add docstrings for definitions
Feb 23, 2024
b1742d9
lint100
Feb 23, 2024
85b2839
update Mathlib.lean
Feb 23, 2024
3fb1a0a
add "todo" note
Feb 23, 2024
c375537
do the construction in the other directions (using AlgebraTensorProduct)
Feb 24, 2024
e296050
small progress
Feb 24, 2024
ef9a571
delete garbage
Feb 24, 2024
6c74740
remove bad "end"
Feb 24, 2024
d9ce8e2
Algebra for MvPolynomial
Feb 24, 2024
ec42703
cleanup
Feb 25, 2024
d7c43b0
cleanup
Feb 25, 2024
32d9c2e
move files
Feb 25, 2024
417d963
adjust Mathlib.lean
Feb 25, 2024
337b52a
equiv for polynomial
Feb 25, 2024
5a5f1a9
shorten some lines; review-dog
Feb 25, 2024
cdc4ef9
linter 100
Feb 25, 2024
5112ca4
dedup namespace
Feb 25, 2024
47a6c00
Merge branch 'master' into ACL/FinsuppTensorProd
Feb 29, 2024
746bb43
Do what review dog suggests
AntoineChambert-Loir Feb 29, 2024
20c8b2d
generalize Monoid to MulOneClass
Feb 29, 2024
1665702
add docstrings
Feb 29, 2024
f0a5d8b
add docstrings
Feb 29, 2024
fc8f0d1
one more doctring
Feb 29, 2024
0e751b9
yet another docstring
Feb 29, 2024
d3ade35
docstring : change i to iota (3 lines)
Feb 29, 2024
87d6d87
lint 100
Feb 29, 2024
cdfd7b1
remove unused equiv
Feb 29, 2024
91c0278
Merge branch 'master' into ACL/FinsuppTensorProd
Mar 13, 2024
c2496b2
Update Mathlib/Algebra/Lie/TensorProduct.lean
AntoineChambert-Loir Mar 13, 2024
02e19a6
change import in 3 files
Mar 13, 2024
073c214
correct badly formed import line
Mar 13, 2024
47be110
import lines were still wrong…
Mar 13, 2024
119763f
that should be good…
Mar 13, 2024
c16067f
generalize one universe
AntoineChambert-Loir Mar 21, 2024
845bb95
add MvPolynomial.lcoeff
AntoineChambert-Loir Mar 21, 2024
8004cfc
add lemmas
AntoineChambert-Loir Mar 21, 2024
de94570
indent correctly
AntoineChambert-Loir Mar 21, 2024
cfa238f
correct the unfinished proof
AntoineChambert-Loir Mar 21, 2024
aa4b9a4
Merge branch 'master' into ACL/FinsuppTensorProd
AntoineChambert-Loir Apr 9, 2024
f3d3ee2
adjust MvPolynomial to merged version of finsupptensorprod
AntoineChambert-Loir Apr 9, 2024
df63d70
mv two lemmas to Data/Finsupp
AntoineChambert-Loir Apr 9, 2024
8d31f5d
add explicit arguments
AntoineChambert-Loir Apr 9, 2024
f1719b8
Replace noisy `simp?`
ocfnash Apr 10, 2024
c724436
Merge branch 'master' into ACL/FinsuppTensorProd
AntoineChambert-Loir Apr 11, 2024
31e2899
Merge branch 'ACL/FinsuppTensorProd' into ACL/FinsuppTensorProdMvPoly…
AntoineChambert-Loir Apr 20, 2024
394b285
initial commit
AntoineChambert-Loir Apr 20, 2024
95f1ad3
follow suggestions
AntoineChambert-Loir Apr 21, 2024
ed28368
make one lemma simps and delete the one that is now generated
AntoineChambert-Loir Apr 21, 2024
12426ac
delete one lemma that is obtained by two existing simp lemmas
AntoineChambert-Loir Apr 21, 2024
be85260
use monoidhomclass
AntoineChambert-Loir Apr 21, 2024
0c364ae
Merge branch 'master' into ACL/FinsuppTensorProdMvPolynomial
AntoineChambert-Loir May 4, 2024
118c80a
minor generalizations
AntoineChambert-Loir May 4, 2024
c9ac993
Revert "minor generalizations"
AntoineChambert-Loir May 4, 2024
7abb26e
update
AntoineChambert-Loir May 4, 2024
3f4b748
revert modif in Lie
AntoineChambert-Loir May 4, 2024
554fdf4
use "variable (R) in"…
AntoineChambert-Loir May 4, 2024
b583540
udpate docstring
AntoineChambert-Loir May 4, 2024
42a2dab
de-simp lemmas that make the simpNF linter complain
AntoineChambert-Loir May 4, 2024
e729f94
Update Mathlib/RingTheory/TensorProduct/MvPolynomial.lean
AntoineChambert-Loir Jun 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Mathlib.lean
Original file line number Diff line number Diff line change
Expand Up @@ -3465,6 +3465,7 @@ import Mathlib.RingTheory.Subsemiring.Basic
import Mathlib.RingTheory.Subsemiring.Order
import Mathlib.RingTheory.Subsemiring.Pointwise
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.RingTheory.TensorProduct.MvPolynomial
import Mathlib.RingTheory.Trace
import Mathlib.RingTheory.UniqueFactorizationDomain
import Mathlib.RingTheory.Unramified.Basic
Expand Down
9 changes: 2 additions & 7 deletions Mathlib/Algebra/Lie/TensorProduct.lean
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ instance lieRingModule : LieRingModule L (M ⊗[R] N) where
hasBracketAux ⁅x, y⁆ + (hasBracketAux y).comp (hasBracketAux x) by
simp only [← LinearMap.add_apply]; rw [← LinearMap.comp_apply, this]; rfl
ext m n
simp only [hasBracketAux, LieRing.of_associative_ring_bracket, LinearMap.mul_apply, mk_apply,
LinearMap.lTensor_sub, LinearMap.compr₂_apply, Function.comp_apply, LinearMap.coe_comp,
LinearMap.rTensor_tmul, LieHom.map_lie, toEndomorphism_apply_apply, LinearMap.add_apply,
LinearMap.map_add, LinearMap.rTensor_sub, LinearMap.sub_apply, LinearMap.lTensor_tmul]
simp [hasBracketAux, LieRing.of_associative_ring_bracket]
abel
#align tensor_product.lie_module.lie_ring_module TensorProduct.LieModule.lieRingModule

Expand Down Expand Up @@ -91,9 +88,7 @@ def lift : (M →ₗ[R] N →ₗ[R] P) ≃ₗ⁅R,L⁆ M ⊗[R] N →ₗ[R] P :=
{ TensorProduct.lift.equiv R M N P with
map_lie' := fun {x f} => by
ext m n
simp only [mk_apply, LinearMap.compr₂_apply, lie_tmul_right, LinearMap.sub_apply,
lift.equiv_apply, LinearEquiv.toFun_eq_coe, LieHom.lie_apply, LinearMap.map_add]
abel }
simp [sub_add_eq_sub_sub_swap] }
#align tensor_product.lie_module.lift TensorProduct.LieModule.lift

@[simp]
Expand Down
14 changes: 14 additions & 0 deletions Mathlib/Algebra/MvPolynomial/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,20 @@ def coeffAddMonoidHom (m : σ →₀ ℕ) : MvPolynomial σ R →+ R
map_add' := coeff_add m
#align mv_polynomial.coeff_add_monoid_hom MvPolynomial.coeffAddMonoidHom

variable (R)
/-- `MvPolynomial.coeff m` but promoted to a `LinearMap`. -/
def lcoeff (m : σ →₀ ℕ) : MvPolynomial σ R →ₗ[R] R where
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved
toFun := coeff m
map_add' := coeff_add m
map_smul' := coeff_smul m

variable {R}

@[simp]
theorem lcoeff_apply (m : σ →₀ ℕ) (f : MvPolynomial σ R) :
lcoeff R m f = coeff m f :=
rfl

theorem coeff_sum {X : Type*} (s : Finset X) (f : X → MvPolynomial σ R) (m : σ →₀ ℕ) :
coeff m (∑ x in s, f x) = ∑ x in s, coeff m (f x) :=
map_sum (@coeffAddMonoidHom R σ _ _) _ s
Expand Down
5 changes: 5 additions & 0 deletions Mathlib/Data/Finsupp/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ def mapRange.addMonoidHom (f : M →+ N) : (α →₀ M) →+ α →₀ N
map_add' a b := by dsimp only; exact mapRange_add f.map_add _ _; -- Porting note: `dsimp` needed
#align finsupp.map_range.add_monoid_hom Finsupp.mapRange.addMonoidHom

lemma mapRange.addMonoidHom_apply_single
[AddCommMonoid N] [AddCommMonoid P] (e : N →+ P) (a : α) (n : N) :
mapRange.addMonoidHom e (single a n) = single a (e n) := by
simp only [addMonoidHom_apply, mapRange_single]
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved

@[simp]
theorem mapRange.addMonoidHom_id :
mapRange.addMonoidHom (AddMonoidHom.id M) = AddMonoidHom.id (α →₀ M) :=
Expand Down
7 changes: 7 additions & 0 deletions Mathlib/Data/Finsupp/Defs.lean
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@ theorem unique_single_eq_iff [Unique α] {b' : M} : single a b = single a' b'
rw [unique_ext_iff, Unique.eq_default a, Unique.eq_default a', single_eq_same, single_eq_same]
#align finsupp.unique_single_eq_iff Finsupp.unique_single_eq_iff

lemma apply_single [AddCommMonoid N] [AddCommMonoid P]
(e : N →+ P) (a : α) (n : N) (b : α) :
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved
e ((single a n) b) = single a (e n) b := by
classical
simp only [single_apply]
split_ifs; rfl; exact map_zero e

theorem support_eq_singleton {f : α →₀ M} {a : α} :
f.support = {a} ↔ f a ≠ 0 ∧ f = single a (f a) :=
⟨fun h =>
Expand Down
169 changes: 169 additions & 0 deletions Mathlib/RingTheory/TensorProduct/MvPolynomial.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/-
Copyright (c) 2024 Antoine Chambert-Loir. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Antoine Chambert-Loir
-/

import Mathlib.LinearAlgebra.DirectSum.Finsupp
import Mathlib.Algebra.MvPolynomial.Basic
import Mathlib.RingTheory.TensorProduct.Basic
import Mathlib.Algebra.MvPolynomial.Equiv
/-!

# Tensor Product of (multivariate) polynomial rings

* `MvPolynomial.rTensor`, `MvPolynomial.scalarRTensor`: the tensor product of
a polynomial algebra by a module is linearly equivalent
to a Finsupp of a tensor product
* `MvPolynomial.rTensorAlgHom`, the algebra morphism from the tensor product
of a polynomial algebra by an algebra to a polynomial algebra
* `MvPolynomial.rTensorAlgEquiv`, `MvPolynomial.scalarRTensorAlgEquiv`,
the tensor product of a polynomial algebra by an algebra
is algebraically equivalent to a polynomial algebra

## TODO :
* `MvPolynomial.rTensor` could be phrased in terms of `AddMonoidAlgebra`, and
`MvPolynomial.rTensor` then has `smul` by the polynomial algebra.
* `MvPolynomial.rTensorAlgHom` and `MvPolynomial.scalarRTensorAlgEquiv`
are morphisms for the algebra structure by `MvPolynomial σ R`.
-/


universe u v w

noncomputable section

namespace MvPolynomial

open DirectSum TensorProduct

open Set LinearMap Submodule

variable {R : Type u} {M : Type v} {N : Type w}
[CommSemiring R] [AddCommMonoid M] [Module R M]

variable {σ : Type*} [DecidableEq σ]

variable {S : Type*} [CommSemiring S] [Algebra R S]

section Module

variable [AddCommMonoid N] [Module R N]
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved

/-- The tensor product of a polynomial ring by a module is
linearly equivalent to a Finsupp of a tensor product -/
noncomputable def rTensor :
MvPolynomial σ S ⊗[R] N ≃ₗ[S] (σ →₀ ℕ) →₀ (S ⊗[R] N) :=
TensorProduct.finsuppLeft' _ _ _ _ _

lemma rTensor_apply_tmul (p : MvPolynomial σ S) (n : N) :
rTensor (p ⊗ₜ[R] n) = p.sum (fun i m ↦ Finsupp.single i (m ⊗ₜ[R] n)) :=
TensorProduct.finsuppLeft_apply_tmul p n

lemma rTensor_apply_tmul_apply (p : MvPolynomial σ S) (n : N) (d : σ →₀ ℕ) :
rTensor (p ⊗ₜ[R] n) d = (coeff d p) ⊗ₜ[R] n :=
TensorProduct.finsuppLeft_apply_tmul_apply p n d
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved

lemma rTensor_apply (t : MvPolynomial σ S ⊗[R] N) (d : σ →₀ ℕ) :
rTensor t d = ((lcoeff S d).restrictScalars R).rTensor N t :=
TensorProduct.finsuppLeft_apply t d

lemma rTensor_symm_apply_single (d : σ →₀ ℕ) (s : S) (n : N) :
rTensor.symm (Finsupp.single d (s ⊗ₜ n)) =
(monomial d s) ⊗ₜ[R] n :=
TensorProduct.finsuppLeft_symm_apply_single d s n
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved

/-- The tensor product of the polynomial algebra by a module
is linearly equivalent to a Finsupp of that module -/
noncomputable def scalarRTensor :
MvPolynomial σ R ⊗[R] N ≃ₗ[R] (σ →₀ ℕ) →₀ N :=
TensorProduct.finsuppScalarLeft _ _ _

lemma scalarRTensor_apply_tmul (p : MvPolynomial σ R) (n : N) :
scalarRTensor (p ⊗ₜ[R] n) = p.sum (fun i m ↦ Finsupp.single i (m • n)) :=
TensorProduct.finsuppScalarLeft_apply_tmul p n

lemma scalarRTensor_apply_tmul_apply (p : MvPolynomial σ R) (n : N) (d : σ →₀ ℕ):
scalarRTensor (p ⊗ₜ[R] n) d = (coeff d p) • n :=
TensorProduct.finsuppScalarLeft_apply_tmul_apply p n d

lemma scalarRTensor_symm_apply_single (d : σ →₀ ℕ) (n : N) :
scalarRTensor.symm (Finsupp.single d n) = (monomial d 1) ⊗ₜ[R] n :=
TensorProduct.finsuppScalarLeft_symm_apply_single d n

end Module

section Algebra

variable [CommSemiring N] [Algebra R N]

/-- The algebra morphism from a tensor product of a polynomial algebra
by an algebra to a polynomial algebra -/
noncomputable def rTensorAlgHom :
(MvPolynomial σ S) ⊗[R] N →ₐ[S] MvPolynomial σ (S ⊗[R] N) :=
Algebra.TensorProduct.lift
(mapAlgHom Algebra.TensorProduct.includeLeft)
((IsScalarTower.toAlgHom R (S ⊗[R] N) _).comp Algebra.TensorProduct.includeRight)
(fun p n => by simp [commute_iff_eq, algebraMap_eq, mul_comm])

lemma rTensorAlgHom_coeff_tmul
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved
(p : MvPolynomial σ S) (n : N) (d : σ →₀ ℕ) :
coeff d (rTensorAlgHom (p ⊗ₜ[R] n)) = (coeff d p) ⊗ₜ[R] n := by
rw [rTensorAlgHom, Algebra.TensorProduct.lift_tmul]
rw [AlgHom.coe_comp, IsScalarTower.coe_toAlgHom', Function.comp_apply,
Algebra.TensorProduct.includeRight_apply]
rw [algebraMap_eq, mul_comm, coeff_C_mul]
simp [mapAlgHom, coeff_map]

lemma rTensorAlgHom_toLinearMap :
(rTensorAlgHom :
MvPolynomial σ S ⊗[R] N →ₐ[S] MvPolynomial σ (S ⊗[R] N)).toLinearMap =
(finsuppLeft' _ _ _ _ _).toLinearMap := by
AntoineChambert-Loir marked this conversation as resolved.
Show resolved Hide resolved
ext d n e
dsimp only [AlgebraTensorModule.curry_apply, TensorProduct.curry_apply,
LinearMap.coe_restrictScalars, AlgHom.toLinearMap_apply]
simp only [coe_comp, Function.comp_apply, AlgebraTensorModule.curry_apply, curry_apply,
LinearMap.coe_restrictScalars, AlgHom.toLinearMap_apply]
rw [rTensorAlgHom_coeff_tmul]
simp only [coeff]
erw [finsuppLeft_apply_tmul_apply]

lemma rTensorAlgHom_toLinearMap' :
(rTensorAlgHom :
MvPolynomial σ S ⊗[R] N →ₐ[S] MvPolynomial σ (S ⊗[R] N)).toLinearMap.restrictScalars R =
(finsuppLeft _ _ _ _).toLinearMap := by
rw [rTensorAlgHom_toLinearMap]
rfl

lemma rTensorAlgHom_apply_eq (p : MvPolynomial σ S ⊗[R] N) :
rTensorAlgHom (S := S) p = finsuppLeft' _ _ _ _ S p := by
rw [← AlgHom.toLinearMap_apply, rTensorAlgHom_toLinearMap]
rfl

/-- The tensor product of a polynomial algebra by an algebra
is algebraically equivalent to a polynomial algebra -/
noncomputable def rTensorAlgEquiv :
(MvPolynomial σ S) ⊗[R] N ≃ₐ[S] MvPolynomial σ (S ⊗[R] N) := by
apply AlgEquiv.ofLinearEquiv
(finsuppLeft' _ _ _ _ _ : MvPolynomial σ S ⊗[R] N ≃ₗ[S] MvPolynomial σ (S ⊗[R] N))
· simp only [Algebra.TensorProduct.one_def]
apply symm
rw [← LinearEquiv.symm_apply_eq]
exact finsuppLeft_symm_apply_single (0 : σ →₀ ℕ) (1 : S) (1 : N)
· intro x y
erw [← rTensorAlgHom_apply_eq (S := S)]
simp only [_root_.map_mul, rTensorAlgHom_apply_eq]
rfl

/-- The tensor product of the polynomial algebra by an algebra
is algebraically equivalent to a polynomial algebra with
coefficients in that algegra -/
noncomputable def scalarRTensorAlgEquiv :
MvPolynomial σ R ⊗[R] N ≃ₐ[R] MvPolynomial σ N :=
rTensorAlgEquiv.trans (mapAlgEquiv σ (Algebra.TensorProduct.lid R N))

end Algebra

end MvPolynomial

end
Loading