Skip to content

feat: support mvcgen' inside sym => … blocks#13680

Draft
sgraf812 wants to merge 1 commit into
masterfrom
sg/sym-mode-mvcgen
Draft

feat: support mvcgen' inside sym => … blocks#13680
sgraf812 wants to merge 1 commit into
masterfrom
sg/sym-mode-mvcgen

Conversation

@sgraf812
Copy link
Copy Markdown
Contributor

@sgraf812 sgraf812 commented May 7, 2026

This PR registers mvcgen' as a step in the grind syntax category, so it can be used inside sym => … blocks. Leftover VCs become fresh subgoals for subsequent grind steps.

The : grind declaration mirrors the existing : tactic surface; the builtin grind handler re-tags the syntax kind and dispatches to the regular elabMVCGen', then wraps the leftover MVarIds as fresh Grind.Goals via mkGoalCore.

@sgraf812 sgraf812 added the changelog-tactics User facing tactics label May 7, 2026
@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 May 7, 2026
@mathlib-lean-pr-testing
Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 422920f6437f3b6beec0313bedac652e6980b06f --onto ea6e76707835317858b7dd36c95322679c50aaac. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-07 14:43:19)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 422920f6437f3b6beec0313bedac652e6980b06f --onto 5d5642107d0433519265f155ddbfbfb98007a80b. You can force reference manual CI using the force-manual-ci label. (2026-05-07 14:43:21)

@sgraf812 sgraf812 force-pushed the sg/sym-mode-mvcgen branch from 76aa5d2 to 26930ff Compare May 7, 2026 18:06
This PR registers `mvcgen'` as a step in the `grind` syntax category, so it
can be used inside `sym => …` blocks. Each leftover VC becomes a fresh
`Grind.Goal` built in the surrounding block's `Grind.GrindM`, with its local
hypotheses internalized (`processHypotheses`) and the block's user-supplied
e-match theorems activated (`assertExtra`), so subsequent grind steps see
them without explicit `internalize_all` or having to re-pass the lemmas.

Spec lookup (`mkBackwardRuleFromSpec`) wraps its three triple-defeq checks
in `Meta.withDefault`. The ambient grind transparency is `reducible` (set by
`Grind.withGTransparency` because `Grind.Config.reducible := true`), under
which instance projections like `WPMonad.toWP` don't unfold and so don't
compare equal to a direct `WP` instance. Standalone `mvcgen'` happens to
inherit default transparency from `MetaM`, so the issue only surfaces when
called from inside an outer `Grind.GrindM`.

`Driver.runFromGoal` is renamed to `Driver.run`; callers seed the `Grind.Goal`
themselves (via `Grind.mkGoalCore` from `TacticM`, or `getMainGoal` from
`Grind.GrindTacticM`).
@sgraf812 sgraf812 force-pushed the sg/sym-mode-mvcgen branch from 26930ff to a493166 Compare May 7, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-tactics User facing tactics 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.

2 participants