Commit graph

8525 commits

Author SHA1 Message Date
Lev Nachmanson
d098dfe326 dev(lp): fix infeasibility evidence check
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:34 -08:00
Leonardo de Moura
d9acf90f7b refactor(util/lp): use Lean exception 2016-02-05 10:04:34 -08:00
Leonardo de Moura
8fbf66d01a chore(util/lp): no "using", indentation 2016-02-05 10:04:34 -08:00
Leonardo de Moura
1841d17544 refactor(lp): NDEBUG ==> LEAN_DEBUG 2016-02-05 10:04:34 -08:00
Lev Nachmanson
fbb3ed8911 feat(lp): add LP solver and incremental LU factorization
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:34 -08:00
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
Leonardo de Moura
30d6853ffd 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
Leonardo de Moura
a08bc408c8 fix(frontends/lean/structure_cmd): fixes #967 2016-02-04 16:15:18 -08:00
Leonardo de Moura
31cc0ebb6a fix(frontends/lean/structure_cmd): fixes #968 2016-02-04 15:45:38 -08:00
Leonardo de Moura
496c84dac6 fix(frontends/lean/elaborator): fixes #982 2016-02-04 15:14:30 -08:00
Leonardo de Moura
774fa01b1a chore(library/pp_options): reduce pp default limits 2016-02-04 14:55:21 -08:00
Leonardo de Moura
f62e22b34c fix(util/sexpr/format): fixes #955
Lean was crashing because separate_tokes was traversing a DAG as a tree.
Lean was dying without memory (and getting stack overflows) because the procedure was also converting
the DAG into a tree.

This example also suggests we should reduce the limits for the pretty printer.
2016-02-04 14:55:11 -08:00
Leonardo de Moura
0268f92eb4 fix(frontends/lean/elaborator): fixes #965 2016-02-04 13:41:21 -08:00
Leonardo de Moura
42fbc63bb6 fix(library/tc_multigraph): avoid name collisions
@avigad, @fpvandoorn, @rlewis1988, @dselsam

I changed how transitive instances are named.
The motivation is to avoid a naming collision problem found by Daniel.
Before this commit, we were getting an error on the following file
tests/lean/run/collision_bug.lean.

Now, transitive instances contain the prefix "_trans_".
It makes it clear this is an internal definition and it should not be used
by users.

This change also demonstrates (again) how the `rewrite` tactic is
fragile. The problem is that the matching procedure used by it has
very little support for solving matching constraints that involving type
class instances. Eventually, we will need to reimplement `rewrite`
using the new unification procedure used in blast.

In the meantime, the workaround is to use `krewrite` (as usual).
2016-02-04 13:15:42 -08:00
Ulrik Buchholtz
dcb35008e1 feat(hott/homotopy): general connectivity elimination and the wedge connectivity lemma 2016-02-04 11:07:22 -08:00
Rob Lewis
87ec5ada07 fix(analysis/metric_space): unnecessary import, style, remove unnecessary lines 2016-02-04 11:03:28 -08:00
Rob Lewis
a675a5ede2 fix(algebra/ordered_field, analysis/real_limit): generalize theorem to ordered fields 2016-02-04 11:03:28 -08:00
Rob Lewis
f402f322aa feat(theories/analysis): add theorems about convergent sequences, functions, and continuity 2016-02-04 11:03:28 -08:00
Rob Lewis
ffed988a34 feat(data/list): add missing theorems 2016-02-04 11:03:28 -08:00
Rob Lewis
dcfc496992 feat(algebra/ordered_field): ad missing theorem 2016-02-04 11:03:28 -08:00
Rob Lewis
40a1371cd0 feat(theories/analysis): define real square roots 2016-02-04 11:03:28 -08:00
Rob Lewis
796e16bdb7 feat(library/theories/analysis): add theorems about convergent functions in metric spaces 2016-02-04 11:03:28 -08:00
Rob Lewis
cb4f71b16c feat(library/data/real): add more theorems concerning rationals embedded in reals 2016-02-04 11:03:28 -08:00
Rob Lewis
110036c4dc feat(library/algebra/ordered_field): add missing theorems 2016-02-04 11:03:28 -08:00
Leonardo de Moura
790dbc53c3 refactor(library/algebra/ring): cleanup 2016-02-03 20:07:12 -08:00
Leonardo de Moura
cb12b9b876 refactor(library): cleanup proofs
Fixed proofs that broke when we tried to implement a "checkpoint" have.
2016-02-03 19:52:23 -08:00
Leonardo de Moura
9d88db3941 perf(library/type_context): add cache for minimizing the access to is_opaque and environment::find 2016-02-02 19:47:58 -08:00
Leonardo de Moura
701d6b5016 perf(library/blast/forward/pattern): simplify is_higher_order test 2016-02-02 18:56:48 -08:00
Leonardo de Moura
a7b3dcbc09 perf(library/blast/state): do not add hypotheses that are Pi-expressions into discrimination trees 2016-02-02 18:50:23 -08:00
Leonardo de Moura
4324726a8e perf(kernel/expr_eq_fn): minimize number of calls to check_system 2016-02-02 18:16:14 -08:00
Leonardo de Moura
c55b10af1b perf(library/type_context): move check_system to strategic places 2016-02-02 16:12:53 -08:00
Leonardo de Moura
b508cf813c perf(library/type_context): small optimization 2016-02-02 15:36:53 -08:00
Leonardo de Moura
bc86e9f179 perf(library/type_context): add caching for type_context::infer 2016-02-02 15:24:57 -08:00
Leonardo de Moura
bd52e58294 perf(util/name): use quick_cmp at name_pair_quick_cmp 2016-02-02 13:56:02 -08:00
Leonardo de Moura
cb203c3272 perf(src/util/name): if the hashcodes are equal, then there is a high probability the names are equal
So, we use == before trying cmp.
Reason: == is much faster.
2016-02-02 12:52:06 -08:00
Leonardo de Moura
a9cb9ff912 perf(util/name): more inlining 2016-02-02 09:49:50 -08:00
Leonardo de Moura
187bce307e perf(src/util/name): inline hash 2016-02-02 09:21:01 -08:00
Leonardo de Moura
c779590517 feat(library/algebra/ring): add lemma 2016-01-30 16:34:59 -08:00
Leonardo de Moura
a7b37d0e09 perf(library/type_context): cache type class resolution failures too 2016-01-29 14:06:47 -08:00
Leonardo de Moura
6b137b7dd3 chore(library/blast/forward/ematch): improve comment 2016-01-29 11:55:51 -08:00
Leonardo de Moura
587c263c28 feat(library/blast/forward/ematch): improve support for casts in the e-matcher 2016-01-29 11:38:43 -08:00
Daniel Selsam
6ed6306c3f fix(library/blast/unit/unit_propagate): use ppb when tracing 2016-01-27 15:23:52 -08:00
Leonardo de Moura
684995640a fix(library/blast/unit/unit_propagate): memory access violation 2016-01-27 15:22:34 -08:00
Leonardo de Moura
fb95b71a5e fix(library/blast/forward/pattern): bug in the pattern inference code 2016-01-27 13:39:19 -08:00
Leonardo de Moura
a713ca9686 feat(library/type_context): add helper method get_num_choice_points 2016-01-26 22:02:25 -08:00
Daniel Selsam
12e148c7b6 feat(library/blast/forward/ematch): even more tracing 2016-01-26 21:40:46 -08:00
Soonho Kong
30b5313118 feat(CMakeLists.txt): handle new/old ABIs issue for MSYS2 + g++ combination
related issue: #930
2016-01-26 20:41:20 -08:00
Daniel Selsam
2868ec9c43 fix(library/blast/trace): missing pragma 2016-01-26 20:41:01 -08:00
Daniel Selsam
eca079a4fc feat(library/blast/unit/unit_propagate): basic tracing 2016-01-26 20:40:42 -08:00
Floris van Doorn
29c84aad19 fix(book.md): add types.arrow to 2.9
closes #976
2016-01-26 20:40:22 -08:00