Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR roughly halves the time needed to load the .ilean files by optimizing the JSON parser and the conversion from JSON to Lean data structures. The code is optimized roughly as follows: - String operations are inlined more aggressively - Parsers are changed to use new `String.Iterator` functions `curr'` and `next'` that receive a proof and hence do not need to perform an additional check - The `RefIdent` of .ilean files now uses a `String` instead of a `Name` to avoid the expensive parse step from `String` to `Name` (despite the fact that we only very rarely actually need a `Name` in downstream code) - Instead of `List`s and `Subarray`s, the JSON to Lean conversion now directly passes around arrays and array indices to avoid redundant boxing - Parsec's `peek?` sometimes generates redundant `Option` wrappers because the generation of basic blocks interferes with the ctor-match optimization, so it is changed to use an `isEof` check where possible - Early returns and inline-do-blocks cause the code generator to generate new functions, which then interfere with optimizations, so they are now avoided - Mutual defs are used instead of unspecialized passing of higher-order functions to generate faster code - The object parser is made tail-recursive This PR also fixes a stack overflow in `Lean.Json.compress` that would occur with long lists and adds a benchmark for the .ilean roundtrip (compressed pretty-printing -> parsing). |
||
|---|---|---|
| .github | ||
| doc | ||
| images | ||
| nix | ||
| releases_drafts | ||
| script | ||
| src | ||
| stage0 | ||
| tests | ||
| .gitattributes | ||
| .gitignore | ||
| .ignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| CODEOWNERS | ||
| CONTRIBUTING.md | ||
| flake.lock | ||
| flake.nix | ||
| lean-toolchain | ||
| lean.code-workspace | ||
| LICENSE | ||
| LICENSES | ||
| README.md | ||
| RELEASES.md | ||
This is the repository for Lean 4.
About
- Quickstart
- Homepage
- Theorem Proving Tutorial
- Functional Programming in Lean
- Manual
- Release notes starting at v4.0.0-m3
- Examples
- External Contribution Guidelines
- FAQ
Installation
See Setting Up Lean.
Contributing
Please read our Contribution Guidelines first.
Building from Source
See Building Lean (documentation source: doc/make/index.md).