Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This PR introduces a fast pattern matching and unification module for the symbolic simulation framework (`Sym`). The design prioritizes performance by using a two-phase approach: **Phase 1 (Syntactic Matching)** - Patterns use de Bruijn indices for expression variables and renamed level params (`_uvar.0`, `_uvar.1`, ...) for universe variables - Matching is purely structural after reducible definitions are unfolded during preprocessing - Universe levels treat `max` and `imax` as uninterpreted functions (no AC reasoning) - Binders and term metavariables are deferred to Phase 2 **Phase 2 (Pending Constraints)** [WIP] - Handles binders (Miller patterns) and metavariable unification - Converts remaining de Bruijn variables to metavariables - Falls back to `isDefEq` when necessary **Key design decisions:** - Preprocessing unfolds reducible definitions and performs beta/zeta reduction - Kernel projections are expected to be folded as projection applications before matching - Assignment conflicts are deferred to pending rather than invoking `isDefEq` inline - `instantiateRevS` ensures maximal sharing of result expressions **TODO:** - Skip instance arguments during matching, synthesize later - Skip proof arguments (proof irrelevance) - Implement `processPending` for Phase 2 constraints |
||
|---|---|---|
| .claude | ||
| .github | ||
| 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 | ||
| 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
- 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.