-
Notifications
You must be signed in to change notification settings - Fork 839
feat: grind annotations for Disjoint
#28026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
kim-em
commented
Aug 6, 2025
PR summary 59e3f72dd9Import changes for modified filesNo significant changes to the import graph Import changes for all files
Declarations diff
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 No changes to technical debt.You can run this locally as
|
!bench |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the golfs, but would like somebody else to review the grind tagging.
Here are the benchmark results for commit e348c36. Benchmark Metric Change
===============================================
- ~Mathlib.Order.Disjoint instructions 79.9% |
7 files, Instructions +6.0⬝10⁹
3 files, Instructions +5.0⬝10⁹
22 files, Instructions +4.0⬝10⁹
75 files, Instructions +3.0⬝10⁹
86 files, Instructions +2.0⬝10⁹
443 files, Instructions +1.0⬝10⁹
427 files, Instructions -2.0⬝10⁹
68 files, Instructions -3.0⬝10⁹
45 files, Instructions -4.0⬝10⁹
15 files, Instructions -5.0⬝10⁹
5 files, Instructions -6.0⬝10⁹
2 files, Instructions -7.0⬝10⁹
|
This pull request has conflicts, please merge |
This pull request has conflicts, please merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much experience with grind
, but we need to increase the number of capable grind
-annotations reviewers, so I left some hopefully useful comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be worried about the performance here? I flagged one proof that got noticeably slower, otherwise the file seems still fast. If the numbers are reliable (which I am not so sure they are, overall +208.968⬝10⁹
does not seem great, given the scale of the changes. Do we / you have some tooling that can track the global effect of an added grind annotation? For example, how often was a specific lemma tried, how often was it successfully instantiated and how often was it used in the final proof (i.e., how often would it appear if every grind
was squeezed?).
Yes, this is worth paying attention to. I've reverted the four slow proofs, and will re-benchmark to see if it has downstream effects. |
!bench |
Here are the benchmark results for commit 9da2a7b. Benchmark Metric Change
===================================
+ build interpretation -5.3%
+ build linting -13.6% |
|
I took the liberty to merge master to get a more reliable benchmark, I hope you don't mind. The main regression in |
-- Add this line: | ||
--attribute [-grind] Disjoint.out | ||
-- or add both of these: | ||
--attribute [-grind] disjoint_comm | ||
--attribute [-grind] Disjoint.mono_left | ||
-- to make plain `grind` with default e-match instance threshold succeed | ||
|
||
example : Pairwise (Function.onFun Disjoint fun x ↦ S1 x) := by | ||
grind | ||
grind (instances := 2000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only be a temporary fix to get the test working and to get a benchmark. We should remove grind
from some of the mentioned lemmas above, to make the old test working again. My suggestion is to remove the ones from Disjoint.out
(which suffices to fix the test). More details in the corresponding comment.
grind_pattern Disjoint.mono_right => b ≤ c, Disjoint a c | ||
grind_pattern Disjoint.mono_right => b ≤ c, Disjoint a b | ||
grind_pattern Disjoint.mono_right => Disjoint a c, Disjoint a b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these are redundant, because disjoint_comm
and the corresponding patterns for Disjoint.mono_left
should be sufficient (similarly for Codisjoint.mono_right
).
Removing these alone does not fix the test failure though.
grind_pattern Disjoint.out => Disjoint a b, x ≤ a | ||
grind_pattern Disjoint.out => Disjoint a b, x ≤ b | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grind_pattern Disjoint.out => Disjoint a b, x ≤ a | |
grind_pattern Disjoint.out => Disjoint a b, x ≤ b |
Given that Disjoint.eq_bot_of_le
has a grind_pattern
, I think these are redundant. At least
example (h : Disjoint a b) (x : α) : x ≤ a → x ≤ b → x = ⊥ := by
grind
works without the annotations on Disjoint.out
. If these are removed, the test goes through again without the instances
bump.
!bench |
Here are the benchmark results for commit 800b9db. |
|