Skip to content

Tensor space - #1970

Open
Tragicus wants to merge 3 commits into
math-comp:masterfrom
Tragicus:tensor
Open

Tragicus wants to merge 3 commits into
math-comp:masterfrom
Tragicus:tensor

Conversation

@Tragicus

Copy link
Copy Markdown
Collaborator
Motivation for this change

Binary and indexed product tensor spaces.
@CohenCyril I have little recollection of what we did, so I have no idea what the status of this is. In particular, I see the universal property of the binary tensor space but not the general product one.
@mkerjean FYI

Checklist
  • added corresponding entries in CHANGELOG_UNRELEASED.md
  • added corresponding documentation in the headers

Reference: How to document

Merge policy

As a rule of thumb:

  • PRs with several commits that make sense individually and that
    all compile are preferentially merged into master.
  • PRs with disorganized commits are very likely to be squash-rebased.
Reminder to reviewers

@mkerjean

Copy link
Copy Markdown
Collaborator

This looks nice, thank you for making this PR! Could you tell me what the \pi_Q map represents? Could you point me to the universal property for the binary tensor product within the code, so that I can start from here? More generally, happy to help on this PR, tell me what I can do.

@Tragicus

Copy link
Copy Markdown
Collaborator Author

If Q is a quotient of some type T \pi_Q is the projection from T to Q.

Comment thread classical/tensor.v

Variable (W : lmodType R).

Definition tensor_umap (f : U -> V -> W) (t : tensor) : W :=

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This is half of the bijection, which turns a bilinear map from U and V to a linear map from the tensor product (see the instance below).

@affeldt-aist

Copy link
Copy Markdown
Member

@CohenCyril who is working on this PR?

@affeldt-aist affeldt-aist added this to the 1.20.0 milestone Oct 22, 2026
@affeldt-aist affeldt-aist added the enhancement ✨ This issue/PR is about adding new features enhancing the library label Oct 22, 2026
@affeldt-aist
affeldt-aist marked this pull request as ready for review October 22, 2026 13:25
@affeldt-aist

Copy link
Copy Markdown
Member

(doc in progress, changelog to be done)

Comment thread classical/tensor.v
(* : the vector space whose basis is `T` *)
(* *)
(* `free_lmod_unit x` or `x%:lmod` *)
(* : This is the unit of the monad. *)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

of the monad : which monad ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

free_lmod_unit and a specialized version of free_lmod_eval make free_lmod a monad.

@mkerjean mkerjean left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks good, also I have a few suggestions for renaming. I'm also not completely sure I understand everything happening in the quotient part, so it would be good if someone else looked at it.

Comment thread classical/tensor.v
(* : with `f : T -> U` and `x` of type `free_lmod` *)
(* : $\mathrm{eval}_f(x) = \sum_{t : T} x_t f(r)$ where $x=\sum_{t:T}x_t t$ *)
(* *)
(* `ker_set f` *)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great this is to be reused in PR#2022, depending on which PR gets merged first

Comment thread classical/tensor.v
Elpi lock Definition free_lmod_eval (x : free_lmod) : U :=
\sum_(t <- finsupp x) x t *: f t.

Lemma free_lmod_eval_linear : linear free_lmod_eval.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should this be a local lemma ?

Comment thread classical/tensor.v
rewrite scalerA -scalerDl; apply/eqP; rewrite -subr_eq0 -scalerBl.
by rewrite free_lmodDE/= free_lmodZE/= subrr scale0r.
Qed.
HB.instance Definition _ (f : {bilinear U -> V -> W}) :=

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missing space above this line

Comment thread classical/tensor.v
(* `free_lmod_map f u` *)
(* : `:= free_lmod_eval (free_lmod_unit \o f) u` *)
(* *)
(* `Tensor.fiptensor U V ` *)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

To be described rather as : "the tensor product between finite dimensional vector space" ? Finite tensor product is confusing. Should it be renamed vect_tensor ?

Comment thread classical/tensor.v
End span.
End Tensor.

Section Biptensor.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Shouldn't Biptensor.tensor be documented ?

Comment thread classical/tensor.v
(* *)
(* `ptensor_ideal U_` *)
(* *)
(* `ptensor U_` *)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

When U is a familiy of lmodtype (I was comparing to fiptensor and not understanding)

Comment thread classical/tensor.v
Definition to_ptensor (u_ : forall i, U_ i) := \pi_ptensor (u_%:lmod).
Notation "u %:tensor" := (to_ptensor u) : ring_scope.

End ProdTensor.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there something to say to relate the fiptensor, tensor and ptensor ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ This issue/PR is about adding new features enhancing the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants