Lean 4 fork for HoTT-compatible kernel extensions (Path types, transport, HITs). Maintained against upstream leanprover/lean4.
This commit adds the auxiliary function `expand` to break a nasty interaction between code specialization, erasure and memory reuse. Suppose we have ```lean let new_array := array.update array i v in have pr : <some property that mentions array>, from <proof>, f new_array pr ``` Suppose `f` is not marked with `[specialize]`. Then, `pr` is erased and we get: ```lean let new_array := array.update array i v in f new_array box(0) ``` If `RC(array) == 1`, then the update performs a destructive update, and we are happy. Now, assume that `f` is marked with `[specialize]`. Moreover, function specialization occurs before erasure since we want to be able to use the to-be-implemented user-defined rewriting rules after specialization. When we specialize `f` we compute a closure of its dependencies, and one of them is array because of `pr`. Thus, we get ```lean let new_array := array.update array i v in f_spec new_array array ``` after specialization and erasure, but now, we don't perfom the destructive update. BTW, I assumed we should be able to reduce the arity of `f_spec` after erasure since the parameter `array` be dead after it. However, I found the following TODO: https://github.com/leanprover/lean4/blob/master/src/library/compiler/reduce_arity.cpp#L50 |
||
|---|---|---|
| .github | ||
| bin | ||
| doc | ||
| gen | ||
| images | ||
| lean4-mode | ||
| library | ||
| script | ||
| src | ||
| tests | ||
| .appveyor.yml | ||
| .clang-format | ||
| .codecov.yml | ||
| .gitattributes | ||
| .gitignore | ||
| .travis.yml | ||
| LICENSE | ||
| README.md | ||
| License | Windows | Linux / macOS | Test Coverage | Chat |
|---|---|---|---|---|
![]() |
About
- Homepage
- Theorem Proving in Lean
- Core library
- Change Log
- FAQ
- For HoTT mode, please use Lean2.
Installation
Stable and nightly binary releases of Lean are available on the homepage. For building Lean from source, see the build instructions.
Miscellaneous
- Building Doxygen Documentation:
doxygen src/Doxyfile - Coding Style
- Library Style Conventions
- Git Commit Conventions
- Automatic Builds
- Syntax Highlight Lean Code in LaTeX
- Exporting, and reference type-checkers
