mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
b626c6d326043613ba296ef9869c19148c4f4297
This PR adds support for simp/equational spec theorems in the SymM-based `mvcgen'` tactic, catching up with a feature that the original `mvcgen` has supported for a long time. Users can write `@[spec] theorem : get (m := StateT σ m) = fun s => pure (s, s) := rfl` instead of manually specifying equivalent Hoare triples. The equational form is more concise and natural for specs that simply unfold definitions. The universe level normalization (`normalizeLevelsExpr`) applied in `work` and the backward rule constructors is a workaround; ideally this should be integrated into `preprocessMVar`/`preprocessExpr` in the SymM framework so all users benefit. Changes: - Add `SpecTheoremKind` to distinguish triple vs simp specs in `SpecTheoremNew` - Add `mkSpecTheoremNewFromSimpDecl?` to create spec entries from equational lemmas, filtering no-op equations - Add `mkBackwardRuleFromSimpSpec` to build backward rules via `Eq.mpr`/`congrArg`, with instance synthesis, projection reduction, and `unfoldReducible` on the RHS - Migrate simp theorems from `SimpTheorems` database during `migrateSpecTheoremsDatabase` - Normalize universe levels so structural matching in `BackwardRule.apply` succeeds when `max u v` vs `max v u` arise from different code paths - Simplify `mkSpecContext` by removing the mock `simp` context construction - Use `mkBackwardRuleFromExpr` instead of `mkAuxLemma` for triple specs, since the proof may contain free variables from the goal context - Add `AddSubCancelSimp` benchmark case and test exercising the simp spec code path - Change `AddSubCancel` spec proofs from `mvcgen` to `mvcgen'` (dogfooding) 🤖 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%