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

feat: push/pop tactic API #5720

Merged
merged 3 commits into from
Oct 16, 2024
Merged

feat: push/pop tactic API #5720

merged 3 commits into from
Oct 16, 2024

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Oct 15, 2024

Adds pushGoal/pushGoals and popGoal for manipulating the goal state. These are an alternative to replaceMainGoal and getMainGoal, and with them you don't need to worry about making sure nothing clears assigned metavariables from the goal list between assigning the main goal and using replaceMainGoal.

Modifies closeMainGoalUsing, which is like a TacticM version of liftMetaTactic. Now the callback is run in a context where the main goal is removed from the goal list, and the callback is free to modify the goal list. Furthermore, the checkUnassigned argument has been replaced with checkNewUnassigned, which checks whether the value assigned to the goal has any new metavariables, relative to the start of execution of the callback. This API is sufficient for the exact tactic for example.

Modifies withCollectingNewGoalsFrom to take the parentTag argument explicitly rather than indirectly via getMainTag. This is needed when used under closeMainGoalUsing.

Modifies elabTermWithHoles to optionally take parentTag?. It defaults to getMainTag if it is none.

Renames Tactic.tryCatch to Tactic.tryCatchRestore, and adds a Tactic.tryCatch that doesn't do backtracking.

@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 Oct 15, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 15, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 15, 2024
@leanprover-community-bot leanprover-community-bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Oct 15, 2024
@leanprover-community-bot
Copy link
Collaborator

leanprover-community-bot commented Oct 15, 2024

Mathlib CI status (docs):

  • ✅ Mathlib branch lean-pr-testing-5720 has successfully built against this PR. (2024-10-15 08:27:53) View Log
  • 💥 Mathlib branch lean-pr-testing-5720 build failed against this PR. (2024-10-15 17:30:25) View Log
  • ✅ Mathlib branch lean-pr-testing-5720 has successfully built against this PR. (2024-10-15 18:48:46) View Log
  • ✅ Mathlib branch lean-pr-testing-5720 has successfully built against this PR. (2024-10-16 01:38:52) View Log
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 831fa0899fd0397e5a8f21abc2c5fcee8883c481 --onto 225e08965d644715e8961cd205ffedf1cf7d24c2. (2024-10-16 03:50:43)

leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 15, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 15, 2024
@leanprover-community-bot leanprover-community-bot added breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan builds-mathlib CI has verified that Mathlib builds against this PR and removed builds-mathlib CI has verified that Mathlib builds against this PR breaks-mathlib This is not necessarily a blocker for merging: but there needs to be a plan labels Oct 15, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/batteries that referenced this pull request Oct 16, 2024
leanprover-community-mathlib4-bot added a commit to leanprover-community/mathlib4 that referenced this pull request Oct 16, 2024
@kmill kmill added this pull request to the merge queue Oct 16, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 16, 2024
kmill and others added 3 commits October 15, 2024 20:25
Adds `pushGoal`/`pushGoals` and `popGoal` for manipulating the goal state. These are an alternative to `replaceMainGoal` and `getMainGoal`, but without needing to reason about goal lists that still contain unassigned metavariables.

Modifies `closeMainGoalUsing`. Now the callback is run in a context where the main goal is not present in the goal list. Furthermore, the `checkUnassigned` argument has been replaced with `checkNewUnassigned`, which checks whether the value assigned to the goal has any *new* metavariables, relative to the start of execution of the callback. This is sufficient for the `exact` tactic.
Co-authored-by: Kim Morrison <[email protected]>
@kmill kmill enabled auto-merge October 16, 2024 03:34
@kmill kmill added this pull request to the merge queue Oct 16, 2024
Merged via the queue into leanprover:master with commit eea953b Oct 16, 2024
13 checks passed
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants