Skip to content

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

Merged
sgraf812 merged 1 commit into
masterfrom
sg/sym-mode-mvcgen
May 26, 2026
Merged

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

Conversation

@sgraf812
Copy link
Copy Markdown
Contributor

@sgraf812 sgraf812 commented May 7, 2026

This PR makes mvcgen' usable as a step inside sym => … blocks. Leftover VCs become subgoals for subsequent grind steps; mvcgen' invariants works inline, mvcgen' invariants? is rejected.

A grind-mode step operates on a Grind.Goal, which carries the E-graph and internalized hypotheses built up by earlier steps in the block. The VC driver now consumes a Grind.Goal directly and emits each VC as a Grind.Goal carrying the same state, so the next grind step continues from where mvcgen' left off instead of rebuilding the E-graph from scratch.

@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-lean-pr-testing Bot commented May 7, 2026

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)
  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase b5f7399bf19d623b3a5171732f1b3e617cfac38f --onto 2cd98639c40d2d2a026dd599093b70f55f55ffaf. You can force Mathlib CI using the force-mathlib-ci label. (2026-05-26 14:42:28)

@leanprover-bot
Copy link
Copy Markdown
Collaborator

leanprover-bot commented May 7, 2026

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)
  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase b5f7399bf19d623b3a5171732f1b3e617cfac38f --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-05-26 14:42:30)

@sgraf812 sgraf812 force-pushed the sg/sym-mode-mvcgen branch 2 times, most recently from 26930ff to a493166 Compare May 7, 2026 18:40
@sgraf812 sgraf812 force-pushed the sg/sym-mode-mvcgen branch from a493166 to a34e101 Compare May 26, 2026 13:54
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 a34e101 to 9145499 Compare May 26, 2026 16:13
@sgraf812 sgraf812 marked this pull request as ready for review May 26, 2026 16:15
@sgraf812 sgraf812 enabled auto-merge May 26, 2026 16:15
@sgraf812 sgraf812 added this pull request to the merge queue May 26, 2026
Merged via the queue into master with commit 4a75f1d May 26, 2026
19 checks passed
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