Skip to content

chore(Data/Finsupp/Order): add Finsupp.support_add_eq' for canonically ordered Finsupps#40210

Open
Yu-Misaka wants to merge 6 commits into
leanprover-community:masterfrom
Yu-Misaka:finsupp_support_add
Open

chore(Data/Finsupp/Order): add Finsupp.support_add_eq' for canonically ordered Finsupps#40210
Yu-Misaka wants to merge 6 commits into
leanprover-community:masterfrom
Yu-Misaka:finsupp_support_add

Conversation

@Yu-Misaka
Copy link
Copy Markdown
Collaborator

Greetings! This PR attempts to show that in a CanonicallyOrderedAdd setting, the support of f1 + f2 is exactly the union of the supports of f1 and f2. This result will be handy in combinatorics and when the coefficients are in natural number (for example here)


Open in Gitpod

Copilot AI review requested due to automatic review settings June 4, 2026 06:43
@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 Jun 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

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
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

PR summary a48f3f9d84

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

+ support_add_eq_union

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.


No changes to strong technical debt.
No changes to weak technical debt.

Current commit a48f3f9d84
Reference commit 97f12126be

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

@github-actions github-actions Bot added the t-data Data (lists, quotients, numbers, etc) label Jun 4, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a lemma characterizing Finsupp.support of an addition as the union of supports, in the canonically-ordered setting used by this file.

Changes:

  • Introduces support_add_eq', proving support (f1 + f2) = support f1 ∪ support f2.
  • Uses support_mono plus le_self_add/le_add_self to prove the reverse inclusion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Mathlib/Data/Finsupp/Order.lean Outdated
Comment thread Mathlib/Data/Finsupp/Order.lean Outdated
(f1 - f2).embDomain f = f1.embDomain f - f2.embDomain f := by
simp_rw [embDomain_eq_mapDomain, mapDomain_tsub f.injective]

lemma support_add_eq' {f1 f2 : ι →₀ α} [DecidableEq ι] :
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 4, 2026

✅ PR Title Formatted Correctly

The title of this PR has been updated to match our commit style conventions.
Thank you!

@Yu-Misaka Yu-Misaka added the easy < 20s of review time. See the lifecycle page for guidelines. label Jun 4, 2026
@Yu-Misaka Yu-Misaka changed the title chore(Data/Finsupp/Order) add Finsupp.support_add_eq' for canonically ordered Finsupps chore(Data/Finsupp/Order): add Finsupp.support_add_eq' for canonically ordered Finsupps Jun 4, 2026
@Yu-Misaka Yu-Misaka temporarily deployed to cache-upload-forks June 4, 2026 07:13 — with GitHub Actions Inactive
@Yu-Misaka Yu-Misaka temporarily deployed to cache-upload-forks June 4, 2026 08:09 — with GitHub Actions Inactive
@Yu-Misaka Yu-Misaka requested a review from faenuccio June 4, 2026 09:29
@faenuccio faenuccio removed the easy < 20s of review time. See the lifecycle page for guidelines. label Jun 4, 2026
@faenuccio
Copy link
Copy Markdown
Contributor

Thanks for the PR! I'm having a look, but please consider that although this PR is quite short, we only add the easy label for much shorter things, that are probably completely uncontroversial. In this case, one might wonder if the variables are correct, if the file is the right one, if the style is OK... (I'm not saying that they are not, just that this PR is above what we call "easy").

@faenuccio faenuccio self-assigned this Jun 4, 2026
Comment thread Mathlib/Data/Finsupp/Order.lean Outdated
(f1 - f2).embDomain f = f1.embDomain f - f2.embDomain f := by
simp_rw [embDomain_eq_mapDomain, mapDomain_tsub f.injective]

lemma support_add_eq' {f1 f2 : ι →₀ α} [DecidableEq ι] :
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you need a prime?

Copy link
Copy Markdown
Collaborator Author

@Yu-Misaka Yu-Misaka Jun 4, 2026

Choose a reason for hiding this comment

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

Beacuse we have a Finsupp.support_add_eq that takes disjoint support set (although I do believe this needs a better name, will support_add_eq_union suggested by copilot sounds better?)

@Yu-Misaka
Copy link
Copy Markdown
Collaborator Author

Thanks for the PR! I'm having a look, but please consider that although this PR is quite short, we only add the easy label for much shorter things, that are probably completely uncontroversial. In this case, one might wonder if the variables are correct, if the file is the right one, if the style is OK... (I'm not saying that they are not, just that this PR is above what we call "easy").

Ah! I see, thanks for pointing this out!

Copy link
Copy Markdown
Contributor

@faenuccio faenuccio left a comment

Choose a reason for hiding this comment

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

Beacuse we have a Finsupp.support_add_eq that takes disjoint support set (although I do believe this needs a better name, will support_add_eq_union suggested by copilot sounds better?)

Ah sure, good point. Can you then please add a small doc both to this and to support_add_eq, mutually pointing to one another and saying " in the case... there is also..."?

@Yu-Misaka
Copy link
Copy Markdown
Collaborator Author

Beacuse we have a Finsupp.support_add_eq that takes disjoint support set (although I do believe this needs a better name, will support_add_eq_union suggested by copilot sounds better?)

Ah sure, good point. Can you then please add a small doc both to this and to support_add_eq, mutually pointing to one another and saying " in the case... there is also..."?

Sure! Does it look better now?

@Yu-Misaka Yu-Misaka temporarily deployed to cache-upload-forks June 4, 2026 11:27 — with GitHub Actions Inactive
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! t-data Data (lists, quotients, numbers, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants