-
Notifications
You must be signed in to change notification settings - Fork 438
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
feat: add simp
configuration option Simp.Config.instances
#3151
Closed
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
The new test exposes a performance problem found in software verification applications.
See new test for example that takes exponential time without new simp theorems. TODO: replace auxiliary theorems with simprocs as soon as we implement them.
The example was looping with the new `simp` reduction strategy. Here is the looping trace. ``` List.reverseAux (List.reverseAux as []) bs ==> rewrite using reverseAux_reverseAux List.reverseAux [] (List.reverseAux (List.reverseAux as []) bs) ==> unfold reverseAux List.reverseAux (List.reverseAux as []) bs ==> rewrite using reverseAux_reverseAux List.reverseAux [] (List.reverseAux (List.reverseAux as []) bs) ==> ... ```
Motivations: - We can simplify the big mutual recursion and the implementation. - We can implement the support for `match`-expressions in the `pre` method. - It is easier to define and simplify `Simprocs`.
TODO: - `builtin_simproc` attribute - more tests
Allow `simproc`s to be declared without setting the `[simproc]` attribute. A `simproc` declaration is function + pattern. Motivation: allow them to be provided as arguments to `simp` **and** `simp only`. TODO: track their use in `simp`. TODO: builtin simprocs
`Origin.decl` constructor has an extra field.
It is true by default. Packages can set it to false to disable simplification procedue support for backward compatibility.
We can now disable `simproc`s using the same notation we use to disable rewriting rules in the simplifier.
Motivation: better `simp` cache behavior. Recall that `simp` cache uses `dischargeDepth`.
When `instances := false`, instance implicit arguments are not visited during `simp`. `Std` does not seem affected by this change.
!bench |
github-actions
bot
added
the
toolchain-available
A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
label
Jan 9, 2024
|
Here are the benchmark results for commit 9be86b5. Benchmark Metric Change
===============================================================
- import Lean branches 1.8% (105.8 σ)
- import Lean instructions 1.8% (136.9 σ)
- import Lean maxrss 1.5% (53.7 σ)
- lake startup instructions 1.5% (54.6 σ)
- libleanshared.so binary size 2.0%
- reduceMatch maxrss 1.3% (101.8 σ)
- stdlib instructions 1.4% (1184.2 σ)
- stdlib wall-clock 1.6% (18.8 σ)
- stdlib size bytes .olean 1.4%
- stdlib size lines C 2.5%
- tests/bench/ interpreted maxrss 1.3% (56.7 σ)
- tests/compiler sum binary sizes 1.9%
- workspaceSymbols instructions 2.2% (3266.8 σ)
- workspaceSymbols maxrss 1.5% (88.3 σ) |
kim-em
added a commit
to leanprover-community/mathlib4
that referenced
this pull request
Jan 9, 2024
1 task
leanprover-community-mathlib4-bot
added
the
breaks-mathlib
This is not necessarily a blocker for merging: but there needs to be a plan
label
Jan 9, 2024
Maybe it's not so bad. I think we could proceed with this. |
I've created a discussion on zulip to forewarn users about this, and to discuss impact. |
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
Jan 9, 2024
This PR was superseded by #3507. |
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
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.
Depends on #3124
Mathlib adaptation PR is at leanprover-community/mathlib4#9572