Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR adds checkSystem calls to the LCNF compiler to improve IDE cancellation responsiveness during compilation of large declarations. Two changes: 1. `Pass.mkPerDeclaration` now calls `checkSystem` before processing each declaration, allowing interruption between declarations. 2. The LCNF `simp` pass calls `checkSystem` every 128 recursive visits, allowing interruption within large single-declaration simplifications. Note: LCNF simp has its own custom `withIncRecDepth` (in `SimpM.lean`) that does **not** call `checkInterrupted`, unlike `Core.withIncRecDepth`. So this `checkSystem` call is the only cancellation check on this code path. Performance: unconditional `checkSystem` added +0.44% instructions on `big_do.lean` per CI benchmarks. Amortizing to every 128 visits brings overhead to noise level while keeping the max simp gap under ~80M instructions (~14ms at 6 Ginstr/s). **Before** (measured with `LEAN_CHECK_SYSTEM_INTERVAL_INSN` on the instrumentation branch): | Test | Largest LCNF gap | Time at 6 Ginstr/s | |------|------------------|-------------------| | `big_do.lean` | 12,623M insn (simp) | 2.1s | | `riscv-ast.lean` | 1,162M insn (simp) | 194ms | | `riscv-ast.lean` | 37 gaps total | — | **After:** | Test | Largest LCNF gap | Time at 6 Ginstr/s | |------|------------------|-------------------| | `big_do.lean` | 869M insn (resetReuse) | 145ms | | `riscv-ast.lean` | 232M insn (simp) | 39ms | | `riscv-ast.lean` | reduced gap count | — | Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- 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.