Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR simplifies the `grind` canonicalizer by removing dead state and unnecessary complexity, and fixes two bugs discovered during the cleanup. ## Changes **Canonicalizer cleanup:** - Remove dead `Canon.State.canon` field — values were inserted but never read. The canonicalizer uses a transient `HashMap` local to each `canonImpl` invocation. - Remove `proofCanon` — it deduplicated `Grind.nestedProof` terms by mapping canonicalized propositions to a single representative, but different proofs may reference different hypotheses, making the result context-dependent and preventing cache sharing across goals. - Remove `isDefEqBounded` — a fallback that retried `isDefEq` at default transparency with a heartbeat budget. The one test that depended on it was actually masking a transparency bug in `propagateCtorHomo`. **Bug fixes:** - Use `withDefault` for `mkAppOptM` in `propagateCtorHomo` (`Ctor.lean`) — the injectivity proof construction needs default transparency to unify implicit arguments of indexed inductive types like `Vector`. - Add `Grind.abstractFn` gadget to protect lambda abstractions created by `abstractGroundMismatches?` from beta reduction during preprocessing. Without this, `Core.betaReduce` in `preprocessLight` collapses `(fun x => body) arg` back to `body[arg/x]`, undoing the abstraction that congruence closure needs. **Eta reduction infrastructure:** - Lower `etaReduceAll` from `MetaM` to `CoreM` — it only performs structural operations, no `MetaM` needed. - Add `etaReduceWithCache` that takes and returns an explicit `HashMap` cache, enabling callers to thread a single cache across multiple expressions. The net effect on `Canon.State` is removing 3 fields (`canon`, `proofCanon`) and the `isDefEqBounded` function, along with the `useIsDefEqBounded` and `parent` parameters from `canonElemCore`. --------- Co-authored-by: Claude Opus 4.6 (1M context) <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.