Commit graph

11436 commits

Author SHA1 Message Date
Leonardo de Moura
3d603ec28e feat(kernel,library,frontends/lean,api): remove global universe levels from kernel and APIs 2017-02-08 17:41:44 -08:00
Leonardo de Moura
32e6442d0a feat(frontends/lean): no global universes in the frontend 2017-02-08 17:23:04 -08:00
Leonardo de Moura
c5dc8e651a chore(library/init/meta): cleanup 2017-02-08 15:33:25 -08:00
Leonardo de Moura
297f989b71 feat(frontends/lean/parser_state): expand scope management API 2017-02-08 12:46:19 -08:00
Leonardo de Moura
7df64e6e7b feat(library/data): add lazy_list 2017-02-08 12:01:46 -08:00
Leonardo de Moura
aa5eea6416 feat(frontends/lean): add scope management to parser_state, remove unnecessary undef_ids 2017-02-08 11:58:14 -08:00
Leonardo de Moura
1fb49baaaa feat(shell/server): add sleep commands for creating repros 2017-02-08 10:12:00 -08:00
Leonardo de Moura
2c0a5a5120 fix(library/compiler/erase_irrelevant): remove broken io monad optimization
It doesn't work when combined with inlining and common-subexpression-elimination
2017-02-07 21:24:31 -08:00
Leonardo de Moura
a8c91aa6fc fix(library/compiler/preprocess): expand eq.cases_on
The code generator was failing to erase eq.cases_on.
2017-02-07 21:19:01 -08:00
Leonardo de Moura
54f7bf9391 fix(frontends/lean, library/tactic): remove redundant error messages, and fix position of error messages
Summary:

We minimize the number of "'sorry' used warning messages".  We also
re-target the error to the main declaration. Example: foo._main ==> foo
We do not report for auxiliary declarations such as "_example" and
"foo.equations._eqn_1"

Get rid of the redundant error message "error : failed" for tactics.
We added "silent failures" in the tactic framework.

We do not store line/col information for tactics nested in notation
declarations.  Before this commit, we would have tactics such
as (tactic.save_info line col) nested inside of notation declarations.
2017-02-07 20:25:28 -08:00
Leonardo de Moura
38557b5d6c feat(library/init/data/nat/basic): missing lemma 2017-02-07 17:21:26 -08:00
Leonardo de Moura
e06d6aa6d4 feat(frontends/lean/elaborator): relax condition on match-convoy 2017-02-07 16:11:43 -08:00
Leonardo de Moura
01eb27d4a4 feat(util): "deterministic timeout" option
closes #1134

see #1362

This feature is implemented using a "hearbeat" thread local counter.
We reset the counter whenever we start a new task.
The counter is incremented when:

  1- An object is allocated using small_object_allocator (e.g., VM object)
  2- An object is allocated using memory_pool (e.g., expr, level, rb_tree nodes, list cons-cells, etc)
  3- check_system(...) invocations

We check if the threshold was reached at check_system.
The option --timeout=num can be used to set the limit (in thousands).
The default is unbounded in batch mode.
In server mode, the default is 100000. We can compile the standard library with --timeout=12000

I did not perform many experiments to check how precise this counter is.
I added a new Emacs configuration setting to change the server default.

Here is the wall clock time for different values of --timeout for the
command used on issue #1134

time ../../bin/lean -j 0 --timeout=20000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.070s
user	0m1.032s
sys	0m0.036s

time ../../bin/lean -j 0 --timeout=40000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.777s
user	0m1.676s
sys	0m0.044s

time ../../bin/lean -j 0 --timeout=50000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.985s
user	0m1.920s
sys	0m0.056s

time ../../bin/lean -j 0 --timeout=100000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m3.587s
user	0m3.564s
sys	0m0.020s
2017-02-07 13:56:12 -08:00
Gabriel Ebner
c58a440775 feat(emacs): add options to set memory limit and extra command-line arguments 2017-02-07 11:37:07 -08:00
Gabriel Ebner
ea1e6bf3de feat(shell/lean): add default memory limit in server mode 2017-02-07 11:37:07 -08:00
Leonardo de Moura
c7b407cfd0 fix(frontends/lean/elaborator): remove dirty trick used when generating type mismatch error messages, the trick was incompatible with the new error recovery code
closes #1363
2017-02-07 11:25:10 -08:00
Leonardo de Moura
715f0bdd8c fix(kernel/expr): typo
closes #1350
2017-02-07 10:11:47 -08:00
Leonardo de Moura
53667dd602 fix(library): change API and make sure we don't crash when searching for a non existing local decl
Fixes #1363

After error recovery has been implemented in the elaborator, a few
assumptions made in the type context are not valid anymore since we may
be recovering from errors, and the local and metavariable contexts may
be invalid.

I used the approach used in the class environment.

- find* methods return optional<...>
- get* methods throw exception for unknown elements

Remarks:

I preserved code patterns such as

     optional<local_decl> d = lctx.find_local_decl(...)
     lean_assert(d)

and did not convert them into

     local_decl d = lctx.get_local_decl(...)

Reason: the intention is clear that the local must be defined there.
If it is not we should analyze the problem and decide whether we should
throw an exception or not.

However, I converted code patterns such as

    local_decl d = *lctx.find_local_decl(...)

into

    local_decl d = lctx.get_local_decl(...)

Disclaimer: this change fixes issue #1363, but it may obfuscate other bugs.
2017-02-07 09:38:19 -08:00
Leonardo de Moura
96ccb148b1 feat(library/init/meta/simp_tactic): add top_down simplifier combinator 2017-02-06 20:06:13 -08:00
Leonardo de Moura
c262bd3e7f feat(library/type_context): add temporary workaround for solving unification problems coming from bitvector theory 2017-02-06 19:19:38 -08:00
Leonardo de Moura
2684a77093 fix(library/type_context): fix problem with offset constraints, then adjust simplify 2017-02-06 18:21:14 -08:00
Leonardo de Moura
a28d6a94fd feat(library/init/meta): add any_goals tactic 2017-02-06 16:23:29 -08:00
Leonardo de Moura
28cd022486 feat(library/data/vector): add to_list lemmas 2017-02-06 14:57:04 -08:00
diakopter
55b9f3e690 chore(library): clang warnings - missing override 2017-02-06 13:44:20 -08:00
Gabriel Ebner
d4541ce2cc chore(frontends/lean/elaborator): fix clang-3.4 build error 2017-02-06 20:44:28 +01:00
Gabriel Ebner
572c9a0de0 chore(tests/lean): fix tests after error-recovery 2017-02-06 15:15:47 +01:00
Gabriel Ebner
7946b15511 feat(frontends/lean/elaborator): recover from most errors using sorry 2017-02-06 15:15:44 +01:00
Gabriel Ebner
98f41d9b15 feat(interactive/test_single): colorized diff 2017-02-06 15:08:45 +01:00
Leonardo de Moura
ae06844f57 chore(library/init/meta): remove unnecessarily '| failed' annotations
tactic and smt_tactic are instaces of monad_fail
2017-02-05 20:12:42 -08:00
Leonardo de Moura
55aa2023f4 feat(frontends/lean): add support for monad_fail type class in 'do' blocks 2017-02-05 20:09:08 -08:00
Leonardo de Moura
e8f2f2ed3c feat(library/equations_compiler): add flag for marking equations that we should not report an error if they are not used 2017-02-05 19:26:45 -08:00
Leonardo de Moura
3ef463ccc9 chore(frontends/lean/builtin_exprs): update error messages for do-blocks 2017-02-05 19:07:23 -08:00
Leonardo de Moura
4283fe9bb7 fix(frontends/lean/builtin_exprs): missing pattern when lhs is a constant constructor 2017-02-05 19:03:00 -08:00
Leonardo de Moura
8b662d19ac feat(library/init/category/monad_fail): add monad_fail type class 2017-02-05 18:46:29 -08:00
Leonardo de Moura
797b26f402 fix(frontends/lean/tactic_notation): trace messages in nested blocks were not being displayed in the correct place 2017-02-05 18:20:10 -08:00
Leonardo de Moura
30a1876fc8 feat(library/init/meta): add add_aux_decl and abstract tactics 2017-02-05 16:00:47 -08:00
Leonardo de Moura
1eb771f5a1 chore(library/init/meta/async_tactic): missing copyright 2017-02-05 14:47:43 -08:00
Leonardo de Moura
1fc9cc37f7 chore(frontends/lean): remove dead field 2017-02-05 14:25:49 -08:00
diakopter
91b526fdd1 chore(frontends/lean): clang warnings 2017-02-05 14:03:15 -08:00
Leonardo de Moura
323db5a530 feat(frontends/lean/pp): pretty print structure instances and field projections 2017-02-05 14:01:53 -08:00
Gabriel Ebner
cbc0bb1f7c feat(library/module): store whether we used sorry in olean 2017-02-05 16:35:32 +01:00
Gabriel Ebner
c2d95c4cb6 fix(library/mt_task_queue): handle lazy depdendencies of tasks without priority inversion 2017-02-05 16:34:46 +01:00
Gabriel Ebner
6910f3f2b9 feat(frontends/lean/print_cmd): show sorry macro as axiom 2017-02-05 14:01:08 +01:00
Gabriel Ebner
95068e4e79 feat(library/sorry): make sorry a macro 2017-02-05 14:01:03 +01:00
Gabriel Ebner
252931a470 feat(tests/lean/test_single): show unified diffs with color 2017-02-05 13:44:21 +01:00
Gabriel Ebner
98c2998a7b feat(frontends/lean/definition_cmds): make noncomputability check non-fatal 2017-02-05 13:42:52 +01:00
Leonardo de Moura
84188c5aa1 feat(frontends/lean/elaborator): add pattern validator in the elaborator
@johoelzl We now produce a better message for your example:

   inductive R : ℕ → Prop
   | pos : ∀p n, R (p + n)

   lemma R_id : ∀n, R n → R n
   | (.p + .n) (R.pos p n) := R.pos p n

The new error is:

file.lean:5:2: error: invalid function application in pattern, it cannot be reduced to a constructor (possible solution, mark term as inaccessible using '.( )')
  .p + .n
2017-02-04 19:00:20 -08:00
Leonardo de Moura
6f95f4668f fix(library/inductive_compiler/ginductive): constructors of mutually inductive datatypes were not being registered
Actually, the constructors of the first inductive datatype in a mutually
recursive definitions were being registered.
2017-02-04 18:51:17 -08:00
Leonardo de Moura
9869ed1026 feat(library/equations_compiler/util): make sure "inaccessible annotations" do not leak into the type of automatically generated equational lemmas 2017-02-04 17:19:42 -08:00
Leonardo de Moura
dbb36f5412 feat(library/type_context): improve offset trick in the unifier 2017-02-04 17:15:05 -08:00