mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
a32be44f909683a2f5dff4bb955dfa986bbc9b1c
@[mvcgen_witness_type] attribute for extensible witness classification (#12882)
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 (before `invariants`). 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 `SquareRootWitness` value 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 and `isMVCGenWitnessType` helper - `src/Lean/Elab/Tactic/Do/VCGen/Basic.lean`: add `witnesses` field to `State`, three-way classification in `addSubGoalAsVC` - `src/Std/Tactic/Do/Syntax.lean`: add `witnesses` section syntax (before `invariants`), extract shared `goalDotAlt`/`goalCaseAlt` syntax kinds - `src/Lean/Elab/Tactic/Do/VCGen.lean`: extract shared `elabGoalSection`, add `elabWitnesses`, wire up witness labeling and elaboration - `tests/elab/mvcgenWitnessType.lean`: end-to-end tests for witness-only, witness with `-leave`, and combined witness+invariant scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This is the repository for Lean 4.
About
- Quickstart
- Homepage
- Theorem Proving Tutorial
- Functional Programming in Lean
- Documentation Overview
- Language Reference
- Release notes starting at v4.0.0-m3
- Examples
- External Contribution Guidelines
Installation
See Install Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean.
Languages
Lean
94.3%
C++
4.1%
Python
0.6%
Shell
0.4%
CMake
0.3%