Mirror of https://github.com/leanprover/lean2 in case it ever disappears
04eaf184a9
@avigad, @fpvandoorn, @rlewis1988, @dselsam This commit modifies how have-expressions are elaborated. Now, to process have H : <type>, from <proof>, <rest> we first process the constraints in <type> and <proof> simultaneously. After all these constraints are solved, the elaborator performs a Prolog-like cut, and process the constraints in <rest>. So, all overloads, type classes and coercions in <type> and <proof> are solved before we start processing <rest>. Moreover, while processing <rest>, we cannot backtrack to <type> and <proof> anymore. I fixed all affected proofs in the standard and HoTT libraries in previous commits pushed today and yesterday. I think most affected proofs were not using a good style and/or were easy to fix. Here is a common pattern that does not work anymore. structure has_scalar [class] (F V : Type) := (smul : F → V → V) infixl ` • `:73 := has_scalar.smul proposition smul_zero (a : R) : a • (0 : M) = 0 := have a • 0 + a • 0 = a • 0 + 0, by rewrite [-smul_left_distrib, *add_zero], !add.left_cancel this The `have` doesn't work because Lean can't figure out the type of 0 before it starts processing `!add.left_cancel this`. This is easy to fix, we just have to annotate one of the `0`s in the `have`: proposition smul_zero (a : R) : a • (0 : M) = 0 := have a • (0:M) + a • 0 = a • 0 + 0, by rewrite [-smul_left_distrib, *add_zero], !add.left_cancel this BTW, all tactics are still being executed after all constraints are solved. We may change that in the future. I didn't want to execute the tactics at <proof> before <rest> because of universe meta-variables. In Lean, unassigned universe meta-variables become parameters. Moreover, we perform this conversion *before* we start processing tactics. Reason: universe meta-variables create many problems for tactics such as `rewrite`, `blast` and `simp`. Finally, we can recover the previous behavior using the option set_option parser.checkpoint_have false |
||
---|---|---|
bin | ||
doc | ||
extras | ||
hott | ||
images | ||
library | ||
script | ||
src | ||
tests | ||
.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
- Short Tutorial
- To Do list
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