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

refactor: WF.Fix: gather subgoals #3017

Merged
merged 1 commit into from
Dec 4, 2023
Merged

Conversation

nomeata
Copy link
Contributor

@nomeata nomeata commented Dec 4, 2023

This is pure refactoring: Instead of solving each subgoal as we
encounter it while traversing the syntax tree, we leave the MVar
there, at the end collect them all using getMVarsNoDelayed, and then
solve them.

This is a refactoring preparing for two upcoming changes:

In order to not regress with error locations, we have to associated the
TermElabM’s syntax refernce with the MVar somehow. I do this using
the existing mkRecAppWithSyntax expression annotation, on the MVar’s
type. Alternatives would be stack another StateT on the traversal
and accumulate Array (MVarId, Syntax) explicitly, but that did not
seem to be more appealing.

This is pure refactoring: Instead of solving each subgoal as we
encounter it while traversing the syntax tree, we leave the `MVar`
there, at the end collect them all using `getMVarsNoDelayed`, and then
solve them.

This is a refactoring preparing for two upcoming changes:

 * removing unexpected duplicate goals that can arise from term
   duplication
 * running interactive tactics on all, not each goal (#2921)

In order to not regress with error locations, we have to associated the
`TermElabM`’s syntax refernce with the `MVar` somehow. I do this using
the existing `mkRecAppWithSyntax` expression annotation, on the `MVar`’s
type. Alternatives would be stack another `StateT` on the traversal
and accumulate `Array (MVarId, Syntax)` explicitly, but that did not
seem to be more appealing.
@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 Dec 4, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 4, 2023
@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Dec 4, 2023
@leanprover-community-mathlib4-bot
Copy link
Collaborator

leanprover-community-mathlib4-bot commented Dec 4, 2023

leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 4, 2023
@nomeata nomeata added the will-merge-soon …unless someone speaks up label Dec 4, 2023
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Dec 4, 2023
@nomeata nomeata changed the title refactor: WF.Fix: gather all decreasing subgoal refactor: WF.Fix: gather subgoals Dec 4, 2023
@nomeata nomeata added this pull request to the merge queue Dec 4, 2023
Merged via the queue into master with commit 9290b49 Dec 4, 2023
20 checks passed
@nomeata nomeata deleted the joachim/wf-fix-collect-goals branch December 5, 2023 07:38
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants