Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR adds level instantiation and normalization in `getDecLevel` and `getDecLevel?` before calling `decLevel`. `getLevel` can return levels with uninstantiated metavariables or un-normalized structure, such as `max ?u ?v` where the metavariables have already been assigned. After instantiation and normalization (via `normalizeLevel`), a level like `max ?u ?v` (with `?u := 1, ?v := 0`) simplifies to `1 = succ 0`, which `decLevel` can decrement. Without this step, `decLevel` sees `max ?u ?v`, tries to decrement both arms, fails on a zero-valued arm, and reports "invalid universe level". Concretely, this fixes `for` loops with `mut` variables of sort-polymorphic type (e.g. `PProd Nat True`) where the state tuple's universe level ends up as an uninstantiated `max`. The expected-output change in `doNotation1.lean` is because the `for` loop's unit type now resolves to `Unit` instead of `PUnit` due to the improved level handling. |
||
|---|---|---|
| .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.