Commit graph

5971 commits

Author SHA1 Message Date
Leonardo de Moura
16dc021736 fix(library/proof_irrel_expr_manager): add missing Let case 2016-03-01 14:27:37 -08:00
Leonardo de Moura
4e67a35179 feat(library/blast/blast): add missing Let case, and comment to indicate
performance problem
2016-03-01 13:47:43 -08:00
Daniel Selsam
c23528b5d8 feat(library/blast/blast): use defeq_simplifier to normalize 2016-03-01 13:44:33 -08:00
Daniel Selsam
20e7ff39cc feat(library/proof_irrel_expr_manager): eq and hash modulo proof irrelevance 2016-03-01 13:44:33 -08:00
Daniel Selsam
a9c6bce7cc feat(library/defeq_simplifier): some generic normalization 2016-03-01 13:43:50 -08:00
Leonardo de Moura
2982db6f80 feat(library/local_context): add new local context type 2016-03-01 13:40:37 -08:00
Leonardo de Moura
f3648e2ac8 refactor(library/blast/blast): remove old hack 2016-03-01 12:24:24 -08:00
Leonardo de Moura
56d7fc4c23 refactor(*): cleanup replace_visitor subclasses, and make sure let-expressions are handled 2016-02-29 16:55:19 -08:00
Leonardo de Moura
3c878ecd01 feat(kernel): add let-expressions to the kernel
The frontend is still using the old "let-expression macros".
We will use the new let-expressions to implement the new tactic framework.
2016-02-29 16:40:17 -08:00
Leonardo de Moura
f55e456c84 chore(*): remove remaining references to by+ and begin+ 2016-02-29 13:59:06 -08:00
Leonardo de Moura
b7b4b6d838 chore(src/frontends/lean/builtin_exprs): remove unnecessary parameter 2016-02-29 13:57:18 -08:00
Leonardo de Moura
f54963bc3e refactor(library/tactic/expr_to_tactic): remove 'by_plus' support 2016-02-29 13:50:05 -08:00
Leonardo de Moura
fbe5188480 refactor(frontends/lean): remove 'by+' and 'begin+' tokens 2016-02-29 13:45:43 -08:00
Leonardo de Moura
bf60999ede fix(frontends/lean/builtin_exprs): 'using' expression 2016-02-29 13:23:39 -08:00
Leonardo de Moura
15c4bc92b9 refactor(frontends/lean/elaborator): we only need to track one context 2016-02-29 12:49:17 -08:00
Leonardo de Moura
2b1d734544 feat(kernel/expr): remove 'contextual' flag from binder_info 2016-02-29 12:41:43 -08:00
Leonardo de Moura
b41c65f549 feat(frontends/lean): remove '[visible]' annotation, remove 'is_visible' tracking 2016-02-29 12:31:23 -08:00
Leonardo de Moura
101cf1ec4c feat(frontends/lean): remove difference between 'have' and 'assert' 2016-02-29 11:28:20 -08:00
Lev Nachmanson
23079a75a7 dev(lp): fix build for clang, avoid clang-3.3 bug, cleanup permutation_matrix
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-26 16:07:16 -08:00
Leonardo de Moura
2fd5347901 refactor(library/blast): ppb is not necessary anymore 2016-02-26 15:51:46 -08:00
Leonardo de Moura
eee74ef1b4 refactor(frontends/lean/pp): use abstract_type_context instead of type_checker 2016-02-26 15:35:29 -08:00
Leonardo de Moura
7d61f640f6 refactor(*): add abstract_type_context class 2016-02-26 14:17:34 -08:00
Leonardo de Moura
5a4dd3f237 feat(library/reducible): remove [quasireducible] annotation 2016-02-25 17:42:44 -08:00
Leonardo de Moura
146edde5b3 feat(library/class): mark instances as quasireducible by default
quasireducible are also known as lazyreducible.

There is a lot of work to be done.
We still need to revise blast, and add a normalizer for type class
instances. This commit worksaround that by eagerly unfolding
quasireducible.
2016-02-25 12:11:29 -08:00
Leonardo de Moura
1924b2884c refactor(library/tactic): remove 'append' and 'interleave' tacticals
Preparation for major refactoring in the tactic framework.
2016-02-24 16:02:16 -08:00
Leonardo de Moura
9b15c4c669 feat(util/rb_map): add find_if 2016-02-24 16:02:16 -08:00
Leonardo de Moura
494b88e103 fix(library/blast/forward/ematch): must used the right type_context 2016-02-23 13:32:34 -08:00
Sebastian Ullrich
2a35c0f49b feat(script): add .md link checker script 2016-02-23 10:11:24 -08:00
Leonardo de Moura
2a294bcc17 fix(frontends/lean/elaborator): fixes #996 2016-02-22 17:03:14 -08:00
Leonardo de Moura
96f391dda2 feat(library/definitional/projection,frontends/lean/structure_cmd): creating inductive predicates using structure command 2016-02-22 16:09:44 -08:00
Leonardo de Moura
49661a043d feat(library/definitional/equations): improve detection of infeasible cases in the definitional package 2016-02-22 14:16:24 -08:00
Soonho Kong
431ce6ff2d fix(util/lp): instantiate missing functions
close #1005
2016-02-22 16:19:28 -05:00
Floris van Doorn
eea2a1ac91 feat(hott): add some more abstracts 2016-02-22 11:15:39 -08:00
Floris van Doorn
facd94a1b4 feat(hott): various changes
more about pointed truncated types, including pointed sets.
also increase the priority of some basic instances that nat/num/pos_num/trunc_index have 0, 1 and + (in both libraries)
also move the notation + for sum into the namespace sum, to (sometimes) avoid overloading with add
2016-02-22 11:15:38 -08:00
Floris van Doorn
bac6d99cc7 style(hott): rename Pointed to pType
also rename sigma_equiv_sigma_id to sigma_equiv_sigma_right and similarly for pi
2016-02-22 11:15:38 -08:00
Floris van Doorn
43cf2ad23d style(hott): replace all other occurrences of hprop/hset
They are replaced by either Prop/Set or prop/set
2016-02-22 11:15:38 -08:00
Floris van Doorn
4e2cc66061 style(*): rename is_hprop/is_hset to is_prop/is_set 2016-02-22 11:15:38 -08:00
Floris van Doorn
816237315c feat(hott): various additions, especially for pointed maps/homotopies/equivalences 2016-02-22 11:15:38 -08:00
Floris van Doorn
ecc141779a feat(init.path): update init.path to use tactics, also some additions
Now the file hardly uses eq.rec explicitly anymore.
Also add the fact that horizontal and vertical inverses of paths are equal
Make one more argument explicit in eq.cancel_left and eq.cancel_right (to make it nicer to write 'apply cancel_right p')
2016-02-22 11:15:38 -08:00
Daniel Selsam
859a3d35ea feat(library/defeq_simplifier): no need to reverse args 2016-02-22 11:01:36 -08:00
Daniel Selsam
d521063dfb feat(library/defeq_simplifier): new simplifier that uses only definitional equalities 2016-02-22 11:01:36 -08:00
Leonardo de Moura
20f70035dd fix(frontends/lean/util): fixes #1007 2016-02-22 10:54:55 -08:00
Soonho Kong
ca1901bb2c feat(emacs/lean-project.el): ask 'project type' in lean-project-create
close #999
2016-02-12 22:02:24 -05:00
Daniel Selsam
bb4b8da582 feat(library/unification_hint): basic handling of user-supplied unification hints 2016-02-12 11:48:51 -08:00
Leonardo de Moura
632d4fae36 chore(library): rename local_context to old_local_context 2016-02-11 18:15:16 -08:00
Leonardo de Moura
74192b0cb8 chore(library): remove dead code 2016-02-11 18:08:44 -08:00
Leonardo de Moura
c9e9fee76a refactor(*): remove name_generator and use simpler mk_fresh_name 2016-02-11 18:05:57 -08:00
Leonardo de Moura
9cbda49297 chore(frontends/lean): remove script blocks 2016-02-11 17:26:44 -08:00
Leonardo de Moura
f67181baf3 chore(*): remove support for Lua 2016-02-11 17:17:55 -08:00
Daniel Selsam
3de4ec1a6c fix(library/blast/imp_extension): do not use the name 'assert'
Closes #994
2016-02-10 14:11:17 -08:00
Daniel Selsam
f06cdff2a1 fix(library/blast/simplifier/ceqv): fix error in is_permutation 2016-02-07 14:06:28 -08:00
Leonardo de Moura
668758c44e fix(library/blast/blast): compilation warning on OSX 2016-02-05 13:02:02 -08:00
Leonardo de Moura
6c1c6cbbdd fix(util/lp,tests/util/lp): warning msgs on OSX 2016-02-05 11:51:20 -08:00
Leonardo de Moura
e785827688 fix(tests/util/lp/CMakeFiles): disable lp test that fails when executing ctest
This test need input parameters.
2016-02-05 10:17:48 -08:00
Leonardo de Moura
1c8d8da9cf chore(util/lp/lp_primal_core_solver): fix warning 2016-02-05 10:08:32 -08:00
Lev Nachmanson
0e4f98dc47 dev(lp): remove a warning
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:08:24 -08:00
Lev Nachmanson
a7e3befd21 dev(lp): speed up primal with sorted list
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:36 -08:00
Lev Nachmanson
ff8213a6a9 dev(lp): diminish the number of pivots of primal by sorting the columns
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
61eaef0183 dev(lp): improve the dual perormance
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
9482d508df dev(lp): fix bugs in the dual simplex high loop
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
fbe4f56aea chore(lp): remove warnings
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Leonardo de Moura
739f9e5486 fix(tests/util/lp/lp): use regular C arrays 2016-02-05 10:04:35 -08:00
Leonardo de Moura
40d4623219 fix(util/lp/lp_settings): replace fabs with std::abs 2016-02-05 10:04:35 -08:00
Leonardo de Moura
971ec72157 fix(util/lp/numeric_pair): include cmath 2016-02-05 10:04:35 -08:00
Lev Nachmanson
504c603af4 chore(lp): use std::ostream for printing routines
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
fc858d98c0 chore(lp): improve formatting
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
e9cd621855 chore(lp): improve formatting
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
28bf891b7f dev(lp): port to windows (msys2)
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
Lev Nachmanson
99dcad0dda dev(lp): performance tuning in find_leaving_on_harris_theta
Signed-off-by: Lev Nachmanson <levnach@microsoft.com>
2016-02-05 10:04:35 -08:00
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
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
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
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