Skip to content

[Merged by Bors] - feat(LinearAlgebra/PiTensorProduct): add version of subsingletonEquiv for dependent case - #32598

Closed
PrParadoxy wants to merge 6 commits into
leanprover-community:masterfrom
PrParadoxy:pi-set-1
Closed

PrParadoxy wants to merge 6 commits into
leanprover-community:masterfrom
PrParadoxy:pi-set-1

Conversation

@PrParadoxy

@PrParadoxy PrParadoxy commented Dec 8, 2025 •

Copy link
Copy Markdown
Contributor

Dependent PiTensorProducts over singleton types occur naturally when
using tmulEquivDep to split off one index from a dependent
PiTensorProduct. This PR creates subsingletonEquivDep to deal with
this situation.

The non-dependent subsingletonEquiv is re-defined as a specialization
of the general case. This changes the definition of toDirectSum_ι in
TensorAlgebra/ToTensorPower, and so its proof is therefore changed.

Open in Gitpod

…v` for dependent case

Dependent `PiTensorProduct`s over singleton types occur naturally when
using `tmulEquivDep` to split off one index from a dependent
`PiTensorProduct`. This PR creates `subsingletonEquivDep` to deal with
this situation.

The non-dependent `subsingletonEquiv` is re-defined as a specialization
of the general case. This breaks `toDirectSum_ι` in
TensorAlgebra/ToTensorPower, which relies on the precise definition of
`subsingletonEquiv`. Its proof is therefore changed to use `simp`
lemmas.
@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 Dec 8, 2025
@github-actions

github-actions Bot commented Dec 8, 2025 •

Copy link
Copy Markdown

PR summary 88aaf58be6

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ subsingletonEquiv_symm_apply
+ subsingletonEquiv_symm_apply'

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/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).

@ocfnash ocfnash self-assigned this Dec 10, 2025
@ocfnash ocfnash added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Dec 10, 2025
@goliath-klein

Copy link
Copy Markdown
Contributor

Thanks, Kevin & Oliver!!

New version ready for review.

As suggested:

  • We removed the non-dependent version of the equivalence.
  • Gave the @[simp] attribute to a non-dependent _symm lemma.

On the other hand:

  • We didn't use the "function coercion formulation". That's because there are many related lemmas in the file (some ending _symm_apply, some in _tprod), none of which is phrased this way.
  • In the forward direction, we did not include an extra non-dependent lemma. The reason is that in this direction, simp can apply the dependently stated version to non-dependent terms. (There's no cast here, which spoils it for _symm).

We don't feel very strongly about the two last points, though.

BTW: Our initial formulation mirrored the pair tmulEquiv / tmulEquivDep which are defined in the section just below. As for subsingletonEquiv, the non-dependent version was written first, and the dependent one added after the fact. Following our discussion, we have verified that one can remove the old non-dependent version here as well. (It's even simpler: the dependent simp lemmas pick up non-dependent terms in both directions). Should we turn this into a PR?

@goliath-klein

Copy link
Copy Markdown
Contributor

-awaiting-author

@github-actions github-actions Bot removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Dec 10, 2025
@PrParadoxy

Copy link
Copy Markdown
Contributor Author

!bench

@leanprover-radar

leanprover-radar commented Dec 10, 2025 •

Copy link
Copy Markdown

Benchmark results for 5e5a247 against 88aaf58 are in! @PrParadoxy

No significant changes detected.

@ocfnash

ocfnash commented Dec 11, 2025 •

Copy link
Copy Markdown
Contributor

I can't quite tell what you mean by this:

(It's even simpler: the dependent simp lemmas pick up non-dependent terms in both directions). Should we turn this into a PR?

but if you comment further here or open a PR I will answer.

The comparison to tmulEquiv vs tmulEquivDep is a good one and highlights that the decision about whether to repeat with a non-dependent version is a marginal. Duplication like this is bad but can be justified if sufficiently convenient. In this case, it looks like it's not justified (for now anyway).

The point about my "function coercion formulation" version versus symm_apply lemma is very minor. I claim that my version is slightly superior but it's so unlikely to matter that I'm happy to opt for local consistency and stick with what you've proposed.

Thanks!

bors merge

@ghost ghost added the ready-to-merge This PR has been sent to bors. label Dec 11, 2025
mathlib-bors Bot pushed a commit that referenced this pull request Dec 11, 2025
…v` for dependent case (#32598)

Dependent `PiTensorProduct`s over singleton types occur naturally when
using `tmulEquivDep` to split off one index from a dependent
`PiTensorProduct`. This PR creates `subsingletonEquivDep` to deal with
this situation.

The non-dependent `subsingletonEquiv` is re-defined as a specialization
of the general case. This changes the definition of `toDirectSum_ι` in
TensorAlgebra/ToTensorPower, and so its proof is therefore changed.

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/from-referrer/)

Co-authored-by: david <[email protected]>
Co-authored-by: David Gross <[email protected]>
@mathlib-bors

mathlib-bors Bot commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors Bot changed the title feat(LinearAlgebra/PiTensorProduct): add version of subsingletonEquiv for dependent case [Merged by Bors] - feat(LinearAlgebra/PiTensorProduct): add version of subsingletonEquiv for dependent case Dec 11, 2025
@mathlib-bors mathlib-bors Bot closed this Dec 11, 2025
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! ready-to-merge This PR has been sent to bors. t-algebra Algebra (groups, rings, fields, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants