-
Notifications
You must be signed in to change notification settings - Fork 451
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
perf: use with_reducible in special-purpose decreasing_trivial macros #3991
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Because of the last-added-tried-first rule for macros, all the special purpose `decreasing_trivial` rules are tried for most recursive definitions out there, and because they use `apply` and `assumption` with default transparency may cause some definitoins to be unfolded over and over again. A quick test with one of the funcitons in the leansat project shows that elaboration time goes down from 600ms to 375ms when using ``` decreasing_by all_goals decreasing_with with_reducible decreasing_trivial ``` instead of ``` decreasing_by all_goals decreasing_with decreasing_trivial ``` This change uses `with_reducible` in most of these macros. This means that these tactics will no longer work when the relations/definitions they look for is hidden behind a definition.
github-actions
bot
added
the
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
label
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 25, 2024
leanprover-community-mathlib4-bot
added
the
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
label
Apr 25, 2024
Mathlib CI status (docs):
|
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 25, 2024
!bench |
Here are the benchmark results for commit c97e21f. Benchmark Metric Change
=================================================
+ stdlib instructions -1.9% (-704.2 σ)
+ stdlib tactic execution -55.0% (-9162.0 σ)
- stdlib type checking 2.9% (12.0 σ) |
leanprover-community-mathlib4-bot
added
builds-mathlib
CI has verified that Mathlib builds against this PR
and removed
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
labels
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 25, 2024
digama0
approved these changes
Apr 25, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/batteries
that referenced
this pull request
Apr 26, 2024
leanprover-community-mathlib4-bot
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Apr 26, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Aug 14, 2024
Using `Nat.lt_trans` is too restrictive, and using `Nat.lt_of_lt_of_le` should make this tactic prove more goals. This fixes a regression probably introduced by #3991; at least in some cases before that `apply sizeOf_get` would have solved the goal here. And it’s true that this is now subsumed by `simp`, but because of the order that `macro_rules` are tried, the too restrictive variant with `Nat.lt_trans` would be tried before `simp`, without backtracking. Fixes #5027
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
builds-mathlib
CI has verified that Mathlib builds against this PR
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
will-merge-soon
…unless someone speaks up
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because of the last-added-tried-first rule for macros, all the special
purpose
decreasing_trivial
rules are tried for most recursivedefinitions out there, and because they use
apply
andassumption
with default transparency may cause some definitoins to be unfolded over
and over again.
A quick test with one of the functions in the leansat project shows that
elaboration time goes down from 600ms to 375ms when using
instead of
This change uses
with_reducible
in most of these macros.This means that these tactics will no longer work when the
relations/definitions they look for is hidden behind a definition.
This affected in particular
Array.sizeOf_get
, which now has a companionsizeOf_getElem
.In addition, there were three tactics using
apply
to apply Nat-related lemmasthat we now expect
omega
to solve. We still need them when buildingInit
modulesthat don’t have access to
omega
, but they now live indecreasing_trivial_pre_omega
,meant to be only used internally.