Commit graph

2760 commits

Author SHA1 Message Date
Leonardo de Moura
418d62ff48 fix(library/tactic/rewrite_tactic): fixes #1277 2017-01-23 16:34:07 -08:00
Leonardo de Moura
6d12de6339 refactor(library/init/meta/smt): use default value for config structures 2017-01-23 14:18:06 -08:00
Leonardo de Moura
0048d0490b fix(frontends/lean/parser): structure followed by doc string 2017-01-23 10:35:07 -08:00
Leonardo de Moura
778d5382f6 refactor(library/init/meta/simp_tactic): use default field values at simplify_config 2017-01-23 10:22:48 -08:00
Leonardo de Moura
2ca2920284 fix(library/tactic/simplify): relax test
We only need to check whether the resulting expression does not contain
temporary metavariables introduced by the simplifier.
It is ok if it contains regular metavariables that were already in the goal.

This fixes the issue reported at
https://groups.google.com/forum/#!topic/lean-user/3qzchWkut0g
2017-01-23 09:59:06 -08:00
Leonardo de Moura
71a7a7f466 feat(frontends/lean): add default field values 2017-01-22 21:25:49 -08:00
Leonardo de Moura
f7edf601c8 fix(library/init/data/nat/lemmas): avoid bad patterns in nat sub ematch lemmas
The attribute [ematch_lhs] instructs Lean to use the left-hand-side of
the conclusion as a pattern.
2017-01-22 19:48:01 -08:00
Jeremy Avigad
3c65c64e0e fix(tests/lean/interactive/complete_field): fix test 2017-01-22 14:19:31 -08:00
Gabriel Ebner
b0c67abb2f feat(library/vm/vm_aux): add vm code for sorry 2017-01-22 14:18:38 -08:00
Leonardo de Moura
3617440d30 chore(tests/lean/interactive/info_goal): fix expected output 2017-01-22 13:03:39 -08:00
Leonardo de Moura
75525a1120 fix(frontends/lean/definition_cmds): allow '.' after equations 2017-01-22 12:51:23 -08:00
Leonardo de Moura
cce88c6190 refactor(frontends/lean): interactive tactic support
After this commit, new interactice tactic classes can be added without
writing C++ code (see example: tests/lean/run/my_tac_class.lean).

The tactic_evaluator was simplified, and all the complexity has been
moved to tactic_notation, and lean code.

We can now inspect the intermediate states produced by the rewrite
tactic.

The function (@scope_trace _ line col thunk) can be used to position trace
messages produced by thunk. If line/col are not provided (i.e., we
just write (scope_trace thunk)), then line/col are filled with the
position of this term by the elaborator.

We can visualize the intermediate tactic states inside nested blocks
such as (try { ... })

The new infrastructure can be used to implement custom tactic_state
pretty printers.
2017-01-21 22:38:47 -08:00
Leonardo de Moura
37bc2133ec fix(library/tactic/dsimplify): make sure dsimp only unfold reducible constants when matching
fixes #1327
2017-01-21 22:38:17 -08:00
Gabriel Ebner
d4879b74cd chore(tests/lean/run/destruct): fix test 2017-01-21 10:28:46 +01:00
Leonardo de Moura
9c9cad6ae8 test(tests/lean/interactive): add regression test for #1313 2017-01-20 21:48:19 -08:00
Leonardo de Moura
e2bf4fcddb fix(frontends/lean/tactic_notation): add skip tactic to save intermediate result
@kha, this commit fixes the issue: comma before a `{}` block will show the state inside the block.
2017-01-20 20:58:05 -08:00
Leonardo de Moura
a357c0cab2 chore(tests/lean): fix tests 2017-01-20 20:35:18 -08:00
Leonardo de Moura
c359eba509 feat(tests/lean): add test to make sure simplifier did not introduce unwanted propext 2017-01-20 20:28:49 -08:00
Leonardo de Moura
f079d05fc2 chore(tests/lean): adjust tests to recent changes 2017-01-20 19:08:41 -08:00
Leonardo de Moura
4e6ad1d34d fix(library/init/meta/contradiction_tactic): make sure contradiction uses whnf for constructor-eq-constructor case 2017-01-20 18:42:27 -08:00
Leonardo de Moura
b309ef66d7 fix(library/equations_compiler/elim_match): fix #1318 2017-01-18 08:21:53 -08:00
Leonardo de Moura
694e6f47dc fix(library/init/meta/smt/ematch,library/tactic/simp_lemmas): trick for adding equations of a definition to a simp/hinst lemma set
Before this commit, if we declared an equational lemma using 'def',
then it would not be correctly added to the simp/hinst lemma set.
The new test exposes the problem.
2017-01-18 02:05:04 -08:00
Leonardo de Moura
c52be7e8c5 feat(frontends/lean,shell): autocompletion for ^.
@kha, I added autocompletion for ^. I try to elaborate the expression
before ^. using the local context provided by the parser.

The autocompletion only works if the type for the expression before ^. can be
inferred. This is a big limitation because this information cannot be
obtained in many cases. Here are examples that do not work:

  meta def proof_for (e : expr) : smt_tactic expr :=
  do cc ← to_cc_state, cc^.proof_for e
                         --^ does not work here

If we annotate cc with its type, it works:

  meta def proof_for (e : expr) : smt_tactic expr :=
  do cc : cc_state ← to_cc_state, cc^.proof_for e
                                    --^ works

We don't have typing information on the equation lhs at
autocompletion time. So, the following will not work

   private meta def mk_smt_goals_for (cfg : smt_config)
        : list expr → list smt_goal → list expr → tactic (list smt_goal × list expr)
   | []        sr tr := return (sr^.reverse, tr^.reverse)
                                  --^ does not work since
   | (tg::tgs) sr tr := ...
2017-01-17 19:27:59 -08:00
Sebastian Ullrich
484bb67d44 fix(frontends/lean/tactic_notation): report state after tactic execution on , 2017-01-17 16:38:00 -08:00
Sebastian Ullrich
7b049e7d55 fix(shell/server): prevent empty prefix completion for declarations 2017-01-17 16:38:00 -08:00
Leonardo de Moura
3178f41cce fix(library/compiler/inliner): applications of definitions marked as [inline] are inlined even if they are not fully applied
see #1316
2017-01-17 16:33:19 -08:00
Gabriel Ebner
b4774e9ed1 fix(library/vm/vm): fix segfault in call_stack_fn 2017-01-17 16:00:01 -08:00
Leonardo de Moura
8e76d079d3 chore(tests/lean/run): fix tests 2017-01-17 15:50:54 -08:00
Gabriel Ebner
1a6629ce3b feat(frontends/lean/parser): keep list of tasks that have to succeed 2017-01-17 15:31:17 -08:00
Leonardo de Moura
e19e5ae212 test(tests/lean/run): test inductive datatypes with non-recursive arguments after recursive ones 2017-01-16 22:59:17 -08:00
Leonardo de Moura
29b7001bff fix(library/equations_compiler/elim_match): avoid nasty inferred types in auxiliary declarations produced by the equation compiler 2017-01-16 22:55:12 -08:00
Leonardo de Moura
cce6e4d58c fix(library/equations_compiler/compiler): fix #1315 2017-01-16 20:01:25 -08:00
Leonardo de Moura
0ad6dec5fd fix(tests/lean/run/converter): fix test 2017-01-16 19:04:52 -08:00
Leonardo de Moura
bfa48ff0c7 fix(frontends/lean/parser): position info when error is inside notation 2017-01-16 10:29:00 -08:00
Leonardo de Moura
67226269b4 feat(library/tactic/simp_lemmas): convenient way of adding equational lemmas of a definition to a simp set 2017-01-14 22:16:16 -08:00
Leonardo de Moura
a6ef7f52a9 chore(tests/lean/run): repair SMT tests 2017-01-13 13:36:19 -08:00
Gabriel Ebner
5f790d82cd fix(test/lean/run/super_tests): fix try_sup API change 2017-01-13 11:33:35 -08:00
Leonardo de Moura
69fd35f068 feat(library/init/meta/smt): add helper tactics and doc-strings 2017-01-13 11:21:20 -08:00
Leonardo de Moura
6f4bcbab20 feat(library/init/meta/smt/ematch): convenient way of marking all equational lemmas of a giving definition as ematch lemmas 2017-01-13 10:35:09 -08:00
Leonardo de Moura
c1ecaf4edd feat(library/tactic/smt/smt_state): do not apply intros automatically in begin[smt]...end blocks 2017-01-12 21:49:17 -08:00
Leonardo de Moura
30cea2dceb fix(frontends/lean): auxiliary bind-application in do-notation was not allowing us to obtain type information for the monadic actions.
The new test exposes the problem.
2017-01-12 18:38:31 -08:00
Gabriel Ebner
b5ac381a5e chore(frontends/lean/print_cmd): update print command to keyword changes 2017-01-12 12:04:37 -08:00
Leonardo de Moura
3967cd28fa fix(library/vm/vm): curr_fn() may not be available 2017-01-12 11:47:45 -08:00
Leonardo de Moura
cdfa9e655c test(tests/lean/vm_let_expr): add regression test for bugs fixed in the previous two commits 2017-01-12 11:18:16 -08:00
Leonardo de Moura
7e1db95c79 fix(frontends/lean): doc strings after constants and axioms 2017-01-12 00:22:37 -08:00
Gabriel Ebner
db81e4b5b8 feat(frontends/lean/parser): gracefully handle scanner exceptions in imports 2017-01-11 23:49:44 -08:00
Leonardo de Moura
df91ae3738 fix(library/string,library/init/data/to_string): handle ASCII control characters 2017-01-11 23:44:33 -08:00
Leonardo de Moura
acef1efb86 fix(frontends/lean/pp,library/equations_compiler,library/tactic/smt/congruence_closure): bug at to_char function 2017-01-11 23:44:25 -08:00
Leonardo de Moura
d0c86f13bb chore(library/init/data/nat): rename nat.less_than to nat.less_than_or_equal as suggested by Rob 2017-01-11 17:47:49 -08:00
Leonardo de Moura
ae56c6d322 feat(frontends/lean/builtin_cmds): improve error message when import is used in the middle of the file 2017-01-11 11:15:29 -08:00