Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
They were at src/library because we hoped we would be able to use them in the type_context unifier. However, the plan did not work for several reasons. We saved the partial implementation in the branch: https://github.com/leodemoura/lean/tree/type_context_with_refl_lemmas Here are the problems: 1) We have to be able to rewrite even when the type context is already in tmp-mode. This is an issue because the tmp metavariables in the refl lemma clash with the ones created in the type context. Solution: implemented lift operation for idx metavariables, and custom match. This solution is not perfect since the lifting is extra overhead. 2) The term being "unfolded" may be stuck. Example: nat.add n (@one nat ?m) will not match the pattern nat.add ?x_0 (nat.succ ?x_1) because ?m is not assigned yet. We can assign it during the matching process because it is a regular metavariable and the matching is performed in tmp_mode. Possible workaround a) try to instanciate type class instances before we try the refl lemmas. This is a potential performance problem because the term can be arbitrarily big. The current heuristics we use to speed up the process do not work for the example above. Possible workaround b) allow regular metavariables be assigned by type class resolution even when we are in tmp-mode. We have not tried to implement any of these workarounds. 3) There are many more lazy-delta steps. Before this feature, when we unfold `nat.add a (succ ... (succ b) ...)`, we are done with delta-reduction. It is just iota and beta after that. However, with refl-lemmas, the term `nat.add a (succ ... (succ b) ...)` produces one lazy-delta step per succ. This produces nasty side-effects because of the The heuristic (f t =?= f s) ==> (t =?= s). Examples such as (fib 8) =?= 34 will take a very long time because of this heuristic. Possible workaround: cache failures like we did in Lean2. However, failure are only easy to cache if there are no meta-variables. 4) The type context trace gets very confusing since we use is_def_eq for matching lhs while we are computing is_def_eq. Possible workaround: disable trace when trying refl_lemmas. 5) We must be able to temporarily disable the feature. Example: when proving a refl_lemma for a definition `f`, we may have to expand the nested definitions (e.g., for match-end blocks) 6) refl/simp lemmas were designed to rewrite elaborated terms. Using them during unification may produce a series of unexpected behaviors since terms usually contain many regular and universe meta-variables. 7) We need to define a notion of "refl stuck application". Right now, a metavar is stuck, a projection is stuck if the structure is stuck, a recursor is stuck is the major premise is stuck. An application (f ...) is refl-lemma stuck if f has refl-lemmas associated with it, AND metavariables occurring in arguments are preventing a refl-lemma from being applied. |
||
|---|---|---|
| bin | ||
| doc | ||
| extras | ||
| images | ||
| library | ||
| old_library | ||
| script | ||
| src | ||
| tests/lean | ||
| tmp | ||
| .gitignore | ||
| .travis.osx.yml | ||
| .travis.windows.yml | ||
| .travis.yml | ||
| LICENSE | ||
| README.md | ||
| License | Windows | Ubuntu | OS X | Builds/Tests |
|---|---|---|---|---|
![]() |
![]() |
![]() |
About
- Homepage
- Theorem Proving in Lean: HTML, PDF
- Authors
- Standard Library
- HoTT Library
- Emacs Mode
- Short Tutorial
Requirements
- C++11 compatible compiler: g++ (version >= 4.8.1), or clang++ (version >= 3.3)
- CMake
- GMP (GNU multiprecision library)
- MPFR (GNU MPFR Library)
- Lua 5.2 or 5.1, or LuaJIT 2.0
- (optional) gperftools
- (optional) Boost (version >= 1.54), we can build Lean using boost::thread instead of std::thread. When using Boost, Lean can modify the thread stack size.
Installing required packages at
Windows
Linux
OS X
Build Instructions
Miscellaneous
- Testing and Code Coverage
- Building Doxygen Documentation:
doxygen src/Doxyfile - Coding Style
- Library Style Conventions
- Git Commit Conventions
- Automatic Builds
- Syntax Highlight Lean Code in LaTeX


