Skip to content
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

chore: fix superfluous lemmas in simp.trace #2923

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

kim-em
Copy link
Collaborator

@kim-em kim-em commented Nov 20, 2023

Fixes an issue reported on Zulip; see the test case.

  • Modifies the MonadBacktrack instance for SimpM to also backtrack the UsedSimps field.
  • When calling the discharger, saveState, and then restoreState if something goes wrong.

I'm not certain that it makes sense to restore the MetaM state if discharging fails. I can easily change this to more conservatively just backtrack the UsedSimps after failed discharging.

@kim-em kim-em added the awaiting-review Waiting for someone to review the PR label Nov 20, 2023
@kim-em kim-em force-pushed the backtrack_used_simps branch 2 times, most recently from 749bea7 to 0831ae8 Compare November 20, 2023 13:01
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 20, 2023
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Nov 20, 2023

leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Nov 22, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan label Nov 22, 2023
@kim-em
Copy link
Collaborator Author

kim-em commented Nov 22, 2023

Lovely -- the mathlib failures are simp? says complaining that the simp? output has improved!

github-merge-queue bot pushed a commit that referenced this pull request Nov 24, 2023
We noticed at
#2923 (comment)
that this instance is not used. It's arguably also incorrect (as it
doesn't backtrack the `usedTheorems` field).

Seems better to just remove to avoid confusion.

Evidence that this is dead code:
* After deleting the instance, calling `saveState` in the `SimpM` monad
raises an error `failed to synthesize instance MonadBacktrack PUnit
SimpM`.
* Understanding the `MonadBacktrack` monad leads one to believe that
would have happened, via the fact that the only instances for
`MonadBacktrack` are either concrete instances (e.g. for `MetaM`,
`TacticM`, etc), or a single lifting instance `instance [MonadBacktrack
s m] [Monad m] : MonadBacktrack s (ExceptT ε m)`. (This is good and
correct behaviour: lifting instances for `MonadBacktrack` would be hard
to model.)
* Mathlib builds after the instance is removed.

Potential evidence that I have not sought, because we don't have
sufficient tooling:
* Compiling Lean/Std/Mathlib with a debugger, breaking on entering this
code.
@leodemoura leodemoura removed the awaiting-review Waiting for someone to review the PR label Dec 1, 2023
@kim-em kim-em added this pull request to the merge queue Dec 11, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 11, 2023
@kim-em kim-em added the will-merge-soon …unless someone speaks up label Dec 11, 2023
Merged via the queue into leanprover:master with commit 20dd63a Dec 12, 2023
13 checks passed
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 12, 2023
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 14, 2023
This PR is targeting the `bump/v4.5.0` branch. It contains the adaptations required for leanprover/lean4#2923, which have now landed in the `2023-12-12` nightly toolchain.

The only changes are in `simp [...] says ...` statements, where some spurious lemmas are now no longer reported.

*Many* further `simp only` statements in Mathlib contain spurious lemmas which would now no longer be produced by a fresh `simp?`, and I would strongly encourage anyone interested in removing these! For now such changes will need to be made in a PR targeting `bump/v4.5.0` (like this PR), or in January they can be done on `master`.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Dec 22, 2023
…h. (#9188)

This PR:
* bumps to lean-toolchain to `v4.5.0-rc1`
* bumps the Std and Aesop dependencies to their versions using `v4.5.0-rc1`
* merge the already reviewed changes from the `bump/v4.5.0` branch
  * adaptations for leanprover/lean4#2923 in #9011
  * adaptations for leanprover/lean4#2973 in #9161
  * adaptations for leanprover/lean4#2964 in #9176

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN will-merge-soon …unless someone speaks up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants