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

feat(LinearAlgebra/DirectSum/Finsupp) : tensor products of finsupp functions #10824

Closed
wants to merge 68 commits into from

Conversation

AntoineChambert-Loir
Copy link
Collaborator

@AntoineChambert-Loir AntoineChambert-Loir commented Feb 21, 2024

Modules

  • TensorProduct.finsuppLeft, the tensor product of ι →₀ M and N is linearly equivalent to ι →₀ M ⊗[R] N

  • TensorProduct.finsuppScalarLeft, the tensor product of ι →₀ R and N is linearly equivalent to ι →₀ N

  • TensorProduct.finsuppRight, the tensor product of M and ι →₀ N is linearly equivalent to ι →₀ M ⊗[R] N

  • TensorProduct.finsuppLeft', if M is an S-module, then the tensor product of ι →₀ M and N is S-linearly equivalent to ι →₀ M ⊗[R] N

Monoid algebras

  • MonoidAlgebra.rTensorAlgEquiv: the tensor product of MonoidAlgebra M α with N is R-linearly equivalent to MonoidAlgebra (M ⊗[R] N) α

  • MonoidAlgebra.scalarRTensorAlgEquiv, the tensor product of MonoidAlgebra R α with N is R-linearly equivalent to MonoidAlgebra N α

Case of MvPolynomial

These functions apply to MvPolynomial, one can define

noncomputable def MvPolynomial.rTensor' :
    MvPolynomial σ S ⊗[R] N ≃ₗ[S] (σ →₀ ℕ) →₀ (S ⊗[R] N) :=
  TensorProduct.finsuppLeft'

noncomputable def MvPolynomial.rTensor :
    MvPolynomial σ R ⊗[R] N ≃ₗ[R] (σ →₀ ℕ) →₀ N :=
  (MvPolynomial.rTensor' σ (S := R) (N := N) (R := R)).trans
    (Finsupp.mapRange.linearEquiv (TensorProduct.lid R N))

A proposition in this direction is given in LinearAlgebra/TensorProduct/MvPolynomial

Case of Polynomial

Polynomial is a structure containing a Finsupp, so these functions
can't be applied directly to Polynomial.

Some linear equivs need to be added to mathlib for that.

A proposition in this direction is given in LinearAlgebra.TensorProduct.Polynomial


TODO

  • reprove TensorProduct.finsuppLeft' using existing heterobasic version of TensorProduct.congr

  • align what has been done for monoid agebras with what is missing for MvPolynomial or Polynomial

Open in Gitpod

variable {ι : Type*} [DecidableEq ι]

/-- The tensor product of `i →₀ M` and `N` is linearly equivalent to `i →₀ M ⊗[R] N` -/
noncomputable def Finsupp.rTensor :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably this should be called TensorProduct.finsuppLeft for consistency with TensorProduct.directSumLeft and TensorProduct.prodLeft, and similarly for Right

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I had to check for the actual meaning of “Arguably” ! — it doesn't mean one can argue, and indeed, i won't…)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the initial file, finsuppTensorProductFinsupp is in the root name space. Is this reasonable? (but I don't want to have to track at all instances…)

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Feb 22, 2024
@eric-wieser eric-wieser self-assigned this Feb 23, 2024
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Feb 23, 2024
@AntoineChambert-Loir AntoineChambert-Loir added the awaiting-review The author would like community review of the PR label Feb 23, 2024
@AntoineChambert-Loir
Copy link
Collaborator Author

I am presently trying to prove the multiplicativity.
I will put it in another file (RingTheory/MonoidAlgebra/TensorProduct)

Change i to iota

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
@mattrobball
Copy link
Collaborator

!bench

@leanprover-bot
Copy link
Collaborator

Here are the benchmark results for commit cfa238f.
There were significant changes against commit 98385b0:

  Benchmark                                  Metric         Change
  ================================================================
- ~Mathlib.LinearAlgebra.DirectSum.Finsupp   instructions   243.8%

@acmepjz
Copy link
Collaborator

acmepjz commented Mar 23, 2024

Is it possible to split the changes in Mathlib/LinearAlgebra/DirectSum/Finsupp.lean as a separate PR? Probably my #11598 depends on it.

@AntoineChambert-Loir
Copy link
Collaborator Author

Not it's not really possible, that's the whole goal of having these results Mathlib/LinearAlgebra/DirectSum/Finsupp.lean to be able to have the other ones.
Or I make two different PR, one with that file Mathlib/LinearAlgebra/DirectSum/Finsupp.lean, and then with the applications. But my take is that the worthiness of the first file is judged by whether it fits the other ones.

@acmepjz
Copy link
Collaborator

acmepjz commented Mar 23, 2024

Or I make two different PR, one with that file Mathlib/LinearAlgebra/DirectSum/Finsupp.lean, and then with the applications.

It's best if the changes in Mathlib/LinearAlgebra/DirectSum/Finsupp.lean belongs a PR, and then your current PR (which can have further changes to that file) as well as my #11598 depend on that. Hopefully the changes in that single file will be approved quickly, as the current PR has more than 1000 lines.

@AntoineChambert-Loir
Copy link
Collaborator Author

AntoineChambert-Loir commented Mar 24, 2024

@acmepjz

Is it possible to split the changes in Mathlib/LinearAlgebra/DirectSum/Finsupp.lean as a separate PR? Probably my #11598 depends on it.

#11635

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Apr 5, 2024
mathlib-bors bot pushed a commit that referenced this pull request Apr 8, 2024
…supp sums (#11635)

## Modules

* `TensorProduct.finsuppLeft`, the tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppScalarLeft`, the tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N`

* `TensorProduct.finsuppRight`, the tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppLeft'`, if `M` is an `S`-module, then the tensor product of `ι →₀ M` and `N` is `S`-linearly equivalent to `ι →₀ M ⊗[R] N`


This is the first part of PR #10824 which contains three applications of these functions to monoid algebras, polynomials and multivariate polynomials.

It has been split because this part is reasonably sound, while the three other files are more like propositions.
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. label Apr 9, 2024
Louddy pushed a commit that referenced this pull request Apr 15, 2024
…supp sums (#11635)

## Modules

* `TensorProduct.finsuppLeft`, the tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppScalarLeft`, the tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N`

* `TensorProduct.finsuppRight`, the tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppLeft'`, if `M` is an `S`-module, then the tensor product of `ι →₀ M` and `N` is `S`-linearly equivalent to `ι →₀ M ⊗[R] N`


This is the first part of PR #10824 which contains three applications of these functions to monoid algebras, polynomials and multivariate polynomials.

It has been split because this part is reasonably sound, while the three other files are more like propositions.
atarnoam pushed a commit that referenced this pull request Apr 16, 2024
…supp sums (#11635)

## Modules

* `TensorProduct.finsuppLeft`, the tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppScalarLeft`, the tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N`

* `TensorProduct.finsuppRight`, the tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppLeft'`, if `M` is an `S`-module, then the tensor product of `ι →₀ M` and `N` is `S`-linearly equivalent to `ι →₀ M ⊗[R] N`


This is the first part of PR #10824 which contains three applications of these functions to monoid algebras, polynomials and multivariate polynomials.

It has been split because this part is reasonably sound, while the three other files are more like propositions.
uniwuni pushed a commit that referenced this pull request Apr 19, 2024
…supp sums (#11635)

## Modules

* `TensorProduct.finsuppLeft`, the tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppScalarLeft`, the tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N`

* `TensorProduct.finsuppRight`, the tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppLeft'`, if `M` is an `S`-module, then the tensor product of `ι →₀ M` and `N` is `S`-linearly equivalent to `ι →₀ M ⊗[R] N`


This is the first part of PR #10824 which contains three applications of these functions to monoid algebras, polynomials and multivariate polynomials.

It has been split because this part is reasonably sound, while the three other files are more like propositions.
Comment on lines +108 to +142
/-
lemma TensorProduct.map_isLinearMap'
[Module S M] [IsScalarTower R S M] [Module S N] [IsScalarTower R S N]
{P : Type*} [AddCommMonoid P] [Module R P]
{Q : Type*} [AddCommMonoid Q] [Module R Q]
(e : M →ₗ[S] N) (f : P →ₗ[R] Q) :
IsLinearMap S (TensorProduct.map (e.restrictScalars R) f) where
map_add := LinearMap.map_add _
map_smul := fun s t ↦ by
induction t using TensorProduct.induction_on with
| zero => simp
| add x y hx hy =>
simp only [smul_add, map_add] at hx hy ⊢
simp only [hx, hy]
| tmul m p =>
rw [smul_tmul']
simp only [map_tmul, coe_restrictScalars, map_smul]
rfl
-/

/- lemma TensorProduct.congr_isLinearMap'
[Module S M] [IsScalarTower R S M] [Module S N] [IsScalarTower R S N]
{P : Type*} [AddCommMonoid P] [Module R P]
{Q : Type*} [AddCommMonoid Q] [Module R Q]
(e : M ≃ₗ[S] N) (f : P ≃ₗ[R] Q) :
IsLinearMap S (TensorProduct.congr (e.restrictScalars R) f) :=
TensorProduct.map_isLinearMap' e.toLinearMap f.toLinearMap -/

/-
lemma LinearEquiv.rTensor_isLinearMap'
[Module S M] [IsScalarTower R S M] [Module S N] [IsScalarTower R S N]
(P : Type*) [AddCommMonoid P] [Module R P] (e : M ≃ₗ[S] N) :
IsLinearMap S (LinearEquiv.rTensor P (e.restrictScalars R)) :=
TensorProduct.map_isLinearMap' e.toLinearMap _
-/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these supposed to be here?
And is it possible to split the PR into three, considering there are three new files added?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #12292, #12293 and #12294

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this PR can be closed now.

callesonne pushed a commit that referenced this pull request Apr 22, 2024
…supp sums (#11635)

## Modules

* `TensorProduct.finsuppLeft`, the tensor product of `ι →₀ M` and `N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppScalarLeft`, the tensor product of `ι →₀ R` and `N` is linearly equivalent to `ι →₀ N`

* `TensorProduct.finsuppRight`, the tensor product of `M` and `ι →₀ N` is linearly equivalent to `ι →₀ M ⊗[R] N`

* `TensorProduct.finsuppLeft'`, if `M` is an `S`-module, then the tensor product of `ι →₀ M` and `N` is `S`-linearly equivalent to `ι →₀ M ⊗[R] N`


This is the first part of PR #10824 which contains three applications of these functions to monoid algebras, polynomials and multivariate polynomials.

It has been split because this part is reasonably sound, while the three other files are more like propositions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review The author would like community review of the PR t-algebra Algebra (groups, rings, fields etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants