Skip to content

[Merged by Bors] - chore: use grw, gcongr even more#30632

Closed
YaelDillies wants to merge 8 commits intoleanprover-community:masterfrom
YaelDillies:more_grw_gcongr_controversial
Closed

[Merged by Bors] - chore: use grw, gcongr even more#30632
YaelDillies wants to merge 8 commits intoleanprover-community:masterfrom
YaelDillies:more_grw_gcongr_controversial

Conversation

@YaelDillies
Copy link
Copy Markdown
Contributor

@YaelDillies YaelDillies commented Oct 17, 2025

Also delete a redundant instance.


Open in Gitpod

@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 17, 2025

PR summary be9d1e4270

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

- instAddLeftMono

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

This is controversial because the style guide contains the "hypotheses left of colon" rule, but I claim this rule was written without pattern-matching in mind and should therefore be updated to include an exception.

Also delete a redundant instance.
@YaelDillies YaelDillies force-pushed the more_grw_gcongr_controversial branch from def7b3f to a726558 Compare October 19, 2025 14:19
@JovanGerb
Copy link
Copy Markdown
Contributor

I do somewhat agree with @grunweg that your refactor of inductive proofs is controversial. I think it is more readable if all proofs have the hypotheses on the left of the : and the whole proof is done in tactic mode (the induction tactic in this case).

And an advantage of the induction tactic over structural recursion is that the reader can see immediately that the proof is recursive, instead of figuring this out by seeing the name of the lemma mentioned somewhere in its proof.

@YaelDillies
Copy link
Copy Markdown
Contributor Author

So at least we agree that the style guide should be updated to include pattern-matching as a valid reason for having hypotheses right of the colon, and it's just that in those specific cases you believe we should rather use induction?

@JovanGerb
Copy link
Copy Markdown
Contributor

Sure, you could make an update to the style guide, but that is orthogonal to this PR

@YaelDillies
Copy link
Copy Markdown
Contributor Author

I've switched to using induction (although I must say it's longer and less esthetic...) and opened leanprover-community/leanprover-community.github.io#719 to clarify the rule (which, upon reading, was actually already pretty clear that it wouldn't apply here).

Copy link
Copy Markdown
Contributor

@JovanGerb JovanGerb left a comment

Choose a reason for hiding this comment

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

Thanks! I agree with these changes now :)

_ = abv n + 1 := congrArg (abv n + ·) abv.map_one
_ ≤ n + 1 := add_le_add_right hn 1
| succ n ih =>
· grw [Nat.cast_succ, Nat.cast_succ, abv.add_le, abv.map_one, ih]
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.

I think you accidentally left a focus dot

Comment on lines +409 to +411
grw [← Nat.sub_add_cancel <| Order.one_le_iff_pos.mpr (Finset.card_pos.mpr hJ),
Nat.findGreatest_le]
rfl
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.

Suggested change
grw [← Nat.sub_add_cancel <| Order.one_le_iff_pos.mpr (Finset.card_pos.mpr hJ),
Nat.findGreatest_le]
rfl
grw [Nat.findGreatest_le,
Nat.sub_add_cancel <| Order.one_le_iff_pos.mpr (Finset.card_pos.mpr hJ)]

@JovanGerb
Copy link
Copy Markdown
Contributor

Thanks!

maintainer delegate

@github-actions
Copy link
Copy Markdown

🚀 Pull request has been placed on the maintainer queue by JovanGerb.

@ghost ghost added the maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. label Oct 26, 2025
@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented Oct 26, 2025

!bench

Copy link
Copy Markdown
Contributor

@grunweg grunweg left a comment

Choose a reason for hiding this comment

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

Thanks for following up and your patience through the process. Assuming the benchmark is fine, can you update the PR description (this doesn't contain any "hypothesis left of colon"-related changes any more), please?
bors d+

@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Oct 26, 2025

✌️ YaelDillies can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@ghost ghost added delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). and removed maintainer-merge A reviewer has approved the changed; awaiting maintainer approval. labels Oct 26, 2025
@leanprover-bot
Copy link
Copy Markdown
Collaborator

Here are the benchmark results for commit 3c560da.
There were no significant changes against commit be9d1e4.

@github-actions
Copy link
Copy Markdown

File Instructions %
build -8.703⬝10⁹ (+0.00%)
lint -1.656⬝10⁹ (-0.02%)
Mathlib.MeasureTheory.Integral.IntervalIntegral.TrapezoidalRule +1.360⬝10⁹ (+3.82%)
3 files, Instructions -2.0⬝10⁹
File Instructions %
Mathlib.CategoryTheory.Sites.Limits -1.61⬝10⁹ (-6.12%)
Mathlib.CategoryTheory.Preadditive.Biproducts -1.168⬝10⁹ (-1.83%)
Mathlib.Topology.EMetricSpace.PairReduction -1.396⬝10⁹ (-2.73%)
File Instructions %
Mathlib.MeasureTheory.Function.SimpleFuncDenseLp -2.225⬝10⁹ (-2.04%)
CI run Lakeprof report

@YaelDillies YaelDillies changed the title chore: use grw, gcongr more, controversial version chore: use grw, gcongr even more Oct 28, 2025
@YaelDillies
Copy link
Copy Markdown
Contributor Author

bors merge

@YaelDillies YaelDillies assigned grunweg and unassigned thorimur Oct 28, 2025
mathlib-bors bot pushed a commit that referenced this pull request Oct 28, 2025
Also delete a redundant instance.
@mathlib-bors
Copy link
Copy Markdown
Contributor

mathlib-bors bot commented Oct 28, 2025

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title chore: use grw, gcongr even more [Merged by Bors] - chore: use grw, gcongr even more Oct 28, 2025
@mathlib-bors mathlib-bors bot closed this Oct 28, 2025
@YaelDillies YaelDillies deleted the more_grw_gcongr_controversial branch October 28, 2025 11:25
@JovanGerb
Copy link
Copy Markdown
Contributor

@YaelDillies, I think you forgot to address my comments above

@YaelDillies
Copy link
Copy Markdown
Contributor Author

I addressed it, pushed then called bors, but my github token had expired so the push failed... and the PR got merged before I noticed. I have already moved the lost commit to the next PR in the sequence

BeibeiX0 pushed a commit to BeibeiX0/mathlib4 that referenced this pull request Nov 7, 2025
FormulaRabbit81 pushed a commit to FormulaRabbit81/mathlib4 that referenced this pull request Nov 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants