Skip to content

feat(LinearAlgebra/MultilinearMap): generalize MultilinearMap with common RingHom - #42534

Open
gloges wants to merge 21 commits into
leanprover-community:masterfrom
gloges:multi-linear-map
Open

feat(LinearAlgebra/MultilinearMap): generalize MultilinearMap with common RingHom#42534
gloges wants to merge 21 commits into
leanprover-community:masterfrom
gloges:multi-linear-map

Conversation

@gloges

@gloges gloges commented Aug 7, 2026

Copy link
Copy Markdown

Generalizes multilinear maps to multi-semilinear maps.
In analogy with LinearMap σ M N, MultilinearMap σ M N is the space of multilinear maps from the R-module ∀ i, M i to the S-module N over a ring homomorphism σ : R →+* S: fixing all but one coordinate gives a map M i →ₛₗ[σ] N.

Both ContinuousLinearMap and AlternatingMap extend MultilinearMap and are left defined in terms of RingHom.id.


Open in Gitpod

@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR summary 179fedd67f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

+ _root_.LinearEquiv.multilinearMapCongrRightₛₗ
+ _root_.LinearMap.compMultilinearMapₛₗ
+ compMultilinearMap_smulₛₗ
+ instance : Add (MultilinearMap σ M N)
+ instance : AddCommGroup (MultilinearMap σ M N) := fast_instance% FunLike.addCommGroup
+ instance : AddMonoid (MultilinearMap σ M N) := fast_instance% FunLike.addMonoid
+ instance : FunLike (MultilinearMap σ M N) (∀ i, M i) N
+ instance : Inhabited (MultilinearMap σ M N)
+ instance : IsAddApply (MultilinearMap σ M N) (∀ i, M i) N
+ instance : IsNegApply (MultilinearMap σ M N) (∀ i, M i) N
+ instance : IsSMulApply S' (MultilinearMap σ M N) (∀ i, M i) N
+ instance : IsSubApply (MultilinearMap σ M N) (∀ i, M i) N
+ instance : IsZeroApply (MultilinearMap σ M N) (∀ i, M i) N
+ instance : Module S (MultilinearMap σ₁₂ M₁ N₂) := fast_instance%
+ instance : Neg (MultilinearMap σ M N)
+ instance : SMul S' (MultilinearMap σ M N)
+ instance : Sub (MultilinearMap σ M N)
+ instance : Zero (MultilinearMap σ M N)
+ instance [Module.IsTorsionFree S N₂] : Module.IsTorsionFree S (MultilinearMap σ₁₂ M₁ N₂)
+ instance [Monoid S] [DistribMulAction S N₂] [SMulCommClass R₂ S N₂] :
+ instance _root_.Module.Finite.multilinearMap : Module.Finite R (MultilinearMap (.id R) M₁ M₂)
+ instance _root_.Module.Free.multilinearMap : Module.Free R (MultilinearMap (.id R) M₁ M₂)
+-++-- tprod
+-+- coe_mk
- instance : Add (MultilinearMap R M₁ M₂)
- instance : AddCommGroup (MultilinearMap R M₁ M₂) := fast_instance% FunLike.addCommGroup
- instance : AddMonoid (MultilinearMap R M₁ M₂) := fast_instance% FunLike.addMonoid
- instance : FunLike (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : Inhabited (MultilinearMap R M₁ M₂)
- instance : IsAddApply (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : IsNegApply (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : IsSMulApply S (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : IsSubApply (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : IsZeroApply (MultilinearMap R M₁ M₂) (∀ i, M₁ i) M₂
- instance : Module S (MultilinearMap R M₁ M₂) := fast_instance%
- instance : Neg (MultilinearMap R M₁ M₂)
- instance : SMul S (MultilinearMap R M₁ M₂)
- instance : Sub (MultilinearMap R M₁ M₂)
- instance : Zero (MultilinearMap R M₁ M₂)
- instance [Module.IsTorsionFree S M₂] : Module.IsTorsionFree S (MultilinearMap R M₁ M₂)
- instance [Monoid S] [DistribMulAction S M₂] [SMulCommClass R S M₂] :
- instance _root_.Module.Finite.multilinearMap : Module.Finite R (MultilinearMap R M₁ M₂)
- instance _root_.Module.Free.multilinearMap : Module.Free R (MultilinearMap R M₁ M₂)
-+-+ compMultilinearMap

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit 179fedd).

  • +13 new declarations
  • −0 removed declarations
+LinearEquiv.multilinearMapCongrLeft.congr_simp
+LinearEquiv.multilinearMapCongrRightₛₗ
+LinearEquiv.multilinearMapCongrRightₛₗ_apply
+LinearEquiv.multilinearMapCongrRightₛₗ_symm_apply
+LinearMap.compMultilinearMap.congr_simp
+LinearMap.compMultilinearMap_smulₛₗ
+LinearMap.compMultilinearMapₛₗ
+LinearMap.compMultilinearMapₛₗ.congr_simp
+LinearMap.compMultilinearMapₛₗ_apply
+MultilinearMap.compLinearMap.congr_simp
+MultilinearMap.compLinearMapMultilinear.congr_simp
+MultilinearMap.compLinearMapₗ.congr_simp
+MultilinearMap.piLinearMap.congr_simp

No changes to strong technical debt.

No changes to weak technical debt.

Current commit 179fedd67f
Reference commit 20a3b032e0

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

g.compMultilinearMap (s • f) = s • g.compMultilinearMap f :=
theorem compMultilinearMap_smul [DistribSMul S' N₂] [DistribSMul S' N₂']
[SMulCommClass R₂ S' N₂] [SMulCommClass R₂ S' N₂'] [CompatibleSMul N₂ N₂' S' R₂]
(g : N₂ →ₗ[R₂] N₂') (s : S') (f : MultilinearMap σ₁₂ M₁ N₂) :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we want a semilinear version of this lemma too?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Sounds good - added as compMultilinearMap_smulₛₗ.

Comment on lines +936 to +937
[LinearMap.CompatibleSMul N₂' N₂ S R] (g : N₂ ≃ₗ[R₂] N₂') :
MultilinearMap σ₁₂ M₁ N₂ ≃ₗ[S] MultilinearMap σ₁₂ M₁ N₂' where

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here I think we can introduce another ring in g

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've added LinearMap.compMultilinearMapₛₗ and LinearEquiv.multilinearMapCongrRightₛₗ for when R₂ and R₃ are commutative (making use of the new compMultilinearMap_smulₛₗ). Are these name okay?

theorem map_piecewise_smul [DecidableEq ι] (c : ι → R) (m : ∀ i, M i) (s : Finset ι) :
f (s.piecewise (fun i => c i • m i) m) = (∏ i ∈ s, c i) • f m := by
theorem map_piecewise_smul [DecidableEq ι] (c : ι → R) (m : ∀ i, M i) (s : Finset ι) :
f (s.piecewise (fun i => c i • m i) m) = (∏ i ∈ s, σ (c i)) • f m := by

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would we prefer the following, do you think?

Suggested change
f (s.piecewise (fun i => c i • m i) m) = (∏ i ∈ s, σ (c i)) • f m := by
f (s.piecewise (fun i => c i • m i) m) = σ (∏ i ∈ s, c i) • f m := by

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think ∏ i ∈ s, σ (c i) would be better - it doesn't require that R be commutative and is in normal form even when it is (c.f. map_prod).

`MultilinearMap R s E` with the property that its composition with the canonical
`MultilinearMap R s (⨂[R] i, s i)` is the given multilinear map. -/
def liftAux (φ : MultilinearMap R s E) : (⨂[R] i, s i) →+ E :=
def liftAux (φ : MultilinearMap (.id R) s E) : (⨂[R] i, s i) →+ E :=

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is the intent to generalize this in a follow-up PR?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes - after some tinkering I think it will take more than superficial changes to generalize the TensorProduct.lift and TensorProduct.map machinery, so I'd like to do this in a separate PR.

@eric-wieser eric-wieser left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great, thanks! I think it's ok to keep MultilinearMap (.id R) around in downstream files in this PR, and address those in a follow-up.

@gloges
gloges marked this pull request as ready for review August 8, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants