refactor(Data/Finsupp): deprecate direct single ↔ Set.indicator shortcuts, add indicator_eq_set_indicator#34182
Conversation
PR summary cd8272a9d5
|
| File | Base Count | Head Count | Change |
|---|---|---|---|
| Mathlib.Data.Finsupp.Single | 439 | 447 | +8 (+1.82%) |
| Mathlib.Data.Finsupp.Indicator | 440 | 448 | +8 (+1.82%) |
Import changes for all files
| Files | Import difference |
|---|---|
33 filesMathlib.Algebra.BigOperators.Associated Mathlib.Algebra.BigOperators.Finsupp.Basic Mathlib.Algebra.BigOperators.Finsupp.Fin Mathlib.Algebra.FreeAbelianGroup.Finsupp Mathlib.Algebra.FreeAbelianGroup.UniqueSums Mathlib.Algebra.FreeMonoid.UniqueProds Mathlib.Algebra.Group.Finsupp Mathlib.Algebra.Group.Subgroup.Finsupp Mathlib.Algebra.Group.Submonoid.Finsupp Mathlib.Algebra.Group.UniqueProds.Basic Mathlib.Algebra.GroupWithZero.Torsion Mathlib.Algebra.Order.Antidiag.Finsupp Mathlib.Algebra.Order.Floor.Div Mathlib.Algebra.Star.BigOperators Mathlib.Combinatorics.Enumerative.Partition.Basic Mathlib.Combinatorics.Enumerative.Partition Mathlib.Data.DFinsupp.Notation Mathlib.Data.Finset.Finsupp Mathlib.Data.Finsupp.BigOperators Mathlib.Data.Finsupp.Ext Mathlib.Data.Finsupp.NeLocus Mathlib.Data.Finsupp.Pointwise Mathlib.Data.Finsupp.SMulWithZero Mathlib.Data.List.ToFinsupp Mathlib.Data.ZMod.Units Mathlib.RingTheory.Localization.NumDen Mathlib.RingTheory.UniqueFactorizationDomain.Basic Mathlib.RingTheory.UniqueFactorizationDomain.FactorSet Mathlib.RingTheory.UniqueFactorizationDomain.Finite Mathlib.RingTheory.UniqueFactorizationDomain.GCDMonoid Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative Mathlib.RingTheory.UniqueFactorizationDomain.Nat Mathlib.RingTheory.UniqueFactorizationDomain.NormalizedFactors |
1 |
Mathlib.Data.Finsupp.Fintype |
2 |
4 filesMathlib.Data.Finsupp.Fin Mathlib.Data.Finsupp.Indicator Mathlib.Data.Finsupp.Notation Mathlib.Data.Finsupp.Single |
8 |
Declarations diff
+ indicator_eq_set_indicator
+ indicator_singleton
+ set_indicator_singleton
- Set.indicator_singleton_eq
You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>
## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.
No changes to technical debt.
You can run this locally as
./scripts/reporting/technical-debt-metrics.sh pr_summary
- The
relativevalue is the weighted sum of the differences with weight given by the inverse of the current value of the statistic. - The
absolutevalue is therelativevalue divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).
eric-wieser
left a comment
There was a problem hiding this comment.
Please update the PR title; this commit does not add anything, it just golfs!
bors d+
|
✌️ IlPreteRosso can now approve this pull request. To approve and merge a pull request, simply reply with |
|
bors d- |
|
🚫 All delegations have been removed from this PR. To re-add a delegation, reply with |
|
@eric-wieser We have in Mathlib.Algebra.Group.Indicator, with @[to_additive]. In fact this was added to Mathlib by my previous PR #34083 We don't have the coe version of this in Mathlib.Data.Finsupp.Single, only the one specialized to constant function. For this PR I wanted to add this coe statement in Finsupp. |
…leton_indicator_eq to Mathlib.Data.Finsupp.Single
|
@eric-wieser I added all the versions in question please let me know which one we want and in what direction, I'm a bit confused by the similar theorem names and files. One thing is that My intention was simple, I saw theorems A c = B c taking in a constant function c, I stated A f = B f, for general f, in the same direction and in the same namespace, with the same type signature, and then golfed the constant version using the general version. |
…ngle.lean and Indicator.lean
| Set.indicator {a} f = ⇑(single a (f a)) := by | ||
| classical | ||
| ext x | ||
| simp only [Set.indicator, Set.mem_singleton_iff, single_apply, @eq_comm _ a] | ||
| split_ifs with h <;> simp [h] |
There was a problem hiding this comment.
This has a much shorter proof which I think is classical rw [Set.indicator_singleton, Finsupp.single_eq_pi_single].
There was a problem hiding this comment.
Set.indicator_singleton changes import Mathlib.Algebra.Notation.Indicator to import Mathlib.Algebra.Group.Indicator, need to move single_eq_pi_single to before set_indicator_singleton within Single.lean. Then set_indicator_singleton is golfed. Also golfed the relocated single_eq_pi_single.
Sorry about this, indeed the lemma I was asking for is already there!
I would actually lean towards deprecating it, and making the user rewrite through Generally I would think of theorems as filling out the edges of a hypercube, not as also filling every possible diagonal. |
|
Let's see what @urkud thinks |
|
@eric-wieser No worries! I'll wait for more input then. Also as my earlier reply
Now bot added large-import warning. So a trade off between golf and import.
I like this way of thinking. |
|
@urkud Sorry to tag you again, just in case you missed the previous tag |
|
I'm sorry for the delay. I'll look into this over the weekend. |
|
Hi @urkud, sorry to tag you again, just would like to remind you that here's still a PR awaiting your review. |
…ndicator_eq_set_indicator` theorem
✅ PR Title Formatted CorrectlyThe title of this PR has been updated to match our commit style conventions. |
|
@eric-wieser Updated per your suggestion — |
Routes Finsupp.single ↔ Set.indicator through Pi.single instead of direct shortcuts.
Adds
indicator_eq_set_indicatorbridgingFinsupp.indicatorandSet.indicatorfor non-dependent functions. Deprecatessingle_eq_set_indicatorandsingle_eq_indicator— users should compose throughsingle_eq_pi_single+Set.indicator_singletoninstead. Golfssingle_eq_updateviasingle_eq_pi_single.Continues #34083.