feat: add @[mvcgen_witness_type] attribute for extensible witness classification#12882
Merged
feat: add @[mvcgen_witness_type] attribute for extensible witness classification#12882
@[mvcgen_witness_type] attribute for extensible witness classification#12882Conversation
…lassification This PR adds an `@[mvcgen_witness_type]` tag attribute, analogous to `@[mvcgen_invariant_type]`, that allows users to mark types as witness types. Goals whose type is an application of a tagged type are classified as witnesses rather than verification conditions, and appear in a new `witnesses` section in the `mvcgen` tactic syntax. Witnesses are concrete values the prover supplies (inspired by zero-knowledge proofs), as opposed to invariants (predicates maintained across iterations) or verification conditions (propositions to prove). Also extracts shared `elabGoalSection` logic to reduce duplication between witness and invariant elaboration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cgen` docstring Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sgraf812
added a commit
that referenced
this pull request
Mar 24, 2026
This reverts commit a32be44. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sgraf812
added a commit
that referenced
this pull request
Mar 25, 2026
This PR removes the witness classification semantics from `mvcgen` introduced in #12882: the `@[mvcgen_witness_type]` attribute, `witnesses` field in `VCGen.State`, three-way goal classification, `elabWitnesses`, and `elabGoalSection`. The `witnesses` syntax section is kept temporarily for stage0 compatibility and will be removed in a follow-up PR after the stage0 update. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 25, 2026
This PR reverts #12882 which added the `@[mvcgen_witness_type]` tag attribute and `witnesses` section to `mvcgen`. Théophile Wallez confirmed he doesn't need this feature and can get by with `invariants`, so there is no use in having it. The actual `mvcgen` syntax needs to be adjusted after a stage0 update in order for `elabMVCGen` to cope with both old and new syntax. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
sgraf812
added a commit
that referenced
this pull request
Mar 25, 2026
This PR reverts the `mvcgen witnesses` syntax addition and undoes the back compat hack in `elabMVCGen`.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Mar 25, 2026
This PR reverts the `mvcgen witnesses` syntax addition and undoes the back compat hack in `elabMVCGen`. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an
@[mvcgen_witness_type]tag attribute, analogous to@[mvcgen_invariant_type], that allows users to mark types as witness types. Goals whose type is an application of a tagged type are classified as witnesses rather than verification conditions, and appear in a newwitnessessection in themvcgentactic syntax (beforeinvariants).Witnesses are concrete values the prover supplies (inspired by zero-knowledge proofs), as opposed to invariants (predicates maintained across iterations) or verification conditions (propositions to prove). The test uses a ZK-inspired example where a
SquareRootWitnessvalue must be provided by the prover, with the resulting constraint auto-discharged.Changes:
src/Lean/Elab/Tactic/Do/Attr.lean: register@[mvcgen_witness_type]tag attribute andisMVCGenWitnessTypehelpersrc/Lean/Elab/Tactic/Do/VCGen/Basic.lean: addwitnessesfield toState, three-way classification inaddSubGoalAsVCsrc/Std/Tactic/Do/Syntax.lean: addwitnessessection syntax (beforeinvariants), extract sharedgoalDotAlt/goalCaseAltsyntax kindssrc/Lean/Elab/Tactic/Do/VCGen.lean: extract sharedelabGoalSection, addelabWitnesses, wire up witness labeling and elaborationtests/elab/mvcgenWitnessType.lean: end-to-end tests for witness-only, witness with-leave, and combined witness+invariant scenarios🤖 Generated with Claude Code