Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR fixes #12842 where `grind` exhausts memory on goals involving high-degree polynomials such as `(x + y)^2 = x^128 + y^2` over `Fin 2`. The root cause is that `incSteps` in the ring module's Groebner basis engine increments the step counter by 1 per simplification, regardless of polynomial size. For high-degree polynomials (e.g., degree 128), intermediate results can have hundreds of terms, making each operation extremely expensive — but the flat counter cannot catch this before memory is exhausted. The fix weights each step by `Poly.numTerms` of the result polynomial and increases the default `ringSteps` from 10 000 to 100 000 to accommodate the new cost model. Note: the example from #12842 will not be *proved* by `grind` even after this fix, because Frobenius / Fermat's little theorem (`x^p = x` in `Fin p`) is not available in core Lean. The long-term plan is to introduce a type class in core stating this property, with an instance provided by Mathlib, so that `grind` can exploit it when Mathlib is imported. Closes #12842 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| .github | ||
| .vscode | ||
| doc | ||
| images | ||
| releases_drafts | ||
| script | ||
| src | ||
| stage0 | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .gitpod.Dockerfile | ||
| .gitpod.yml | ||
| .ignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| lean-toolchain | ||
| LICENSE | ||
| LICENSES | ||
| README.md | ||
| RELEASES.md | ||
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.