Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
this improves support for structural recursion over inductive *predicates* when there are reflexive arguments. Consider ```lean inductive F: Prop where | base | step (fn: Nat → F) -- set_option trace.Meta.IndPredBelow.search true set_option pp.proofs true def F.asdf1 : (f : F) → True | base => trivial | step f => F.asdf1 (f 0) termination_by structural f => f` ``` Previously the search for the right induction hypothesis would fail with ``` could not solve using backwards chaining x✝¹ : F x✝ : x✝¹.below f : Nat → F a✝¹ : ∀ (a : Nat), (f a).below a✝ : Nat → True ⊢ True ``` The backchaining process will try to use `a✝ : Nat → True`, but then has no idea what to use for `Nat`. There are three steps here to fix this. 1. We let-bind the function's type before the whole process. Now the goal is ``` funType : F → Prop := fun x => True x✝ : x✝¹.below f : Nat → F a✝¹ : ∀ (a : Nat), (f a).below a✝ : ∀ (a : Nat), funType (f a) ⊢ funType (f 0) ``` 2. Instead of using the general purpose backchaining proof search, which is more powerful than we need here (we need on recursive search and no backtracking), we have a custom search that looks for local assumptions that provide evidence of `funType`, and extracts the arguments from that “type” application to construct the recursive call. Above, it will thus unify `f a =?= f 0`. 3. In order to make progress here, we also turn on use `withoutProofIrrelevance`, because else `isDefEq` is happy to say “they are equal” without actually looking at the terms and thus assigning `?a := 0`. This idea of let-binding the function's motive may also be useful for the other recursion compilers, as it may simplify the FunInd construction. This is to be investigated. fixes #4751 |
||
|---|---|---|
| .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).