Mirror of https://github.com/leanprover/lean2 in case it ever disappears
Find a file
Leonardo de Moura 04eaf184a9 feat(frontends/lean,library/unifier): checkpoints at have-expressions
@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
2016-02-04 19:01:19 -08:00
bin feat(bin/leanutil): start "compilation server" 2015-08-16 12:20:48 -07:00
doc feat(doc/lean/library_style.org): clarify C_of_A_of_B convention 2015-12-31 15:16:57 -08:00
extras chore(extras/latex/lstlean.tex): update list of modifiers 2015-12-31 15:16:57 -08:00
hott refactor(hott,tests): make sure HoTT library and tests still work if we introduce checkpoints in have-expressions 2016-02-04 16:58:32 -08:00
images chore(CMakeLists.txt): move Lean logo to make sure we can test leanemacs without installing Lean 2015-01-31 17:38:49 -08:00
library fix(library/tc_multigraph): avoid name collisions 2016-02-04 13:15:42 -08:00
script chore(hott): cleanup 2015-12-10 10:42:16 -08:00
src feat(frontends/lean,library/unifier): checkpoints at have-expressions 2016-02-04 19:01:19 -08:00
tests refactor(hott,tests): make sure HoTT library and tests still work if we introduce checkpoints in have-expressions 2016-02-04 16:58:32 -08:00
.gitignore feat(util/file_lock): add support for Windows 2015-12-14 10:07:26 -08:00
.travis.osx.yml fix(.travis.osx.yml): explicitly turn on multi-thread support 2015-05-06 02:37:31 -04:00
.travis.windows.yml fix(.travis.windows.yml): use cmake-2.8.11.2 2015-05-05 17:17:37 -04:00
.travis.yml fix(.travis.yml): add missing ';'s 2015-05-13 17:52:39 -04:00
LICENSE Add LICENSE file 2013-07-15 18:55:48 -07:00
README.md chore(README): remove coveralls "badge" 2015-08-20 18:00:15 -07:00

logo

LicenseWindowsUbuntuOS XBuilds/Tests

Issue Stats Issue Stats

About

Requirements

Installing required packages at

Windows

Linux

OS X

Build Instructions

Miscellaneous