Commit graph

224 commits

Author SHA1 Message Date
Leonardo de Moura
e4a27a2328 chore(tests/lean/interactive): fix test output 2017-02-04 15:53:01 -08:00
Leonardo de Moura
aff5a2dd37 fix(library/init/meta): bug introduced 9bee8ce36d 2017-02-03 17:01:46 -08:00
Leonardo de Moura
6e7929252f feat(frontends/lean, library/init): add 'thunk' gadget
We can now write
   trace "hello" t
instead of
   trace "hello" (fun _, t)
2017-01-31 18:41:59 -08:00
Leonardo de Moura
5da8b205b9 feat(library/type_context, frontends/lean/elaborator): type classes with output parameters 2017-01-30 18:32:54 -08:00
Leonardo de Moura
e21afb045f chore(tests/lean): fix tests
see #1341
2017-01-30 11:54:00 -08:00
Leonardo de Moura
3b38f71f11 fix(library,tests/lean): fix run/interactive tests, and problems in the standard library due to the new interpretation for Type
We had to change subtype to use Sort since the axiom
strong_indefinite_description uses it.

see #1341
2017-01-30 11:54:00 -08:00
Gabriel Ebner
5fdc737dfc feat(library/tactic): store name of current declaration in tactic_state 2017-01-28 08:27:19 +01:00
Leonardo de Moura
6c0ee899ad chore(tests/lean/interactive): fix tests 2017-01-27 16:32:22 -08:00
Leonardo de Moura
6f502b9afd fix(library/vm): make sure vm_rb_map objects can be stored in ts_vm_obj
See discussion at #1337
2017-01-26 15:58:11 -08:00
Leonardo de Moura
0ba60e62d7 feat(kernel/quotient/quotient): make quotient module robust against users that define their own prelude's
Before this commit, an user could define their own prelude and change
the types of quot, quot.mk, quot.lift or quot.ind.
By doing that, they could prove false.

This commit prevents this kind of abuse.
It also modifies the definition of `quot` and avoids the `setoid`
dependency.
The previous `quot` type is now called `quotient`, and it is defined
using the new `quot` type provided by the kernel.

See discussion at #1330
2017-01-24 15:59:38 -08:00
Jeremy Avigad
3c65c64e0e fix(tests/lean/interactive/complete_field): fix test 2017-01-22 14:19:31 -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
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
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
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
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
Leonardo de Moura
df91ae3738 fix(library/string,library/init/data/to_string): handle ASCII control characters 2017-01-11 23:44:33 -08:00
Sebastian Ullrich
83bddce900 feat(frontends/lean/info_manager,shell/server,emacs/lean-type): info: provide more metadata
* docs: attributes, options, identifiers
* location: attributes, imports
2017-01-11 15:29:14 +01:00
Leonardo de Moura
e256022746 chore(library/init/meta/tactic): avoid the weird 'command' type when auto completing tactics 2017-01-10 14:59:10 -08:00
Sebastian Ullrich
ed4275ae17 fix(frontends/lean/builtin_cmds): do not complete after namespace
Most identifiers used with the command are not namespaces yet
2017-01-10 14:42:48 -08:00
Sebastian Ullrich
8eb39bb982 fix(frontends/lean/parser): catch exceptions thrown by sync_command 2017-01-10 14:42:48 -08:00
Leonardo de Moura
4f0f989e6f fix(tests/lean/interactive): expected output
@kha The following three tests were broken on my machine. The new
produced output looked correct. So, I updated the expected output files.
Is this ok?

see #1296
2017-01-10 09:05:44 -08:00
Sebastian Ullrich
cc3126e944 feat(frontends/lean,library/scoped_ext,shell): complete namespaces 2017-01-10 12:25:33 +01:00
Sebastian Ullrich
b04df04120 feat(frontends/lean): rework and simplify completion parsing, enabling completion of empty prefixes 2017-01-10 12:25:33 +01:00
Sebastian Ullrich
7ef1bd1a15 chore(tests/lean/interactive): simplify input format and test full completion output 2017-01-10 12:25:33 +01:00
Sebastian Ullrich
7040844f9a feat(frontends/lean/parser,shell): complete imports 2017-01-06 14:02:31 -08:00
Sebastian Ullrich
3136f36ed6 fix(frontends/lean/parser): complete after periods trailing identifiers 2017-01-06 14:02:31 -08:00
Sebastian Ullrich
4552fc13f2 chore(tests): add tests for goal at pos 2016-12-27 21:41:02 -08:00
Sebastian Ullrich
b10ebade8c chore(tests/lean/interactive/test_single): ignore progress responses 2016-12-27 10:07:34 -08:00
Sebastian Ullrich
c9a8c02fdc feat(emacs,frontends/lean/parser,shell/server): more accurate info command using server-side parsing 2016-12-27 10:07:34 -08:00
Leonardo de Moura
a358ea32ac fix(tests/lean/interactive): remove local paths 2016-12-20 12:46:10 -08:00
Leonardo de Moura
c9e0727ac0 fix(tests/lean/interactive/info1): fix test 2016-12-20 12:32:21 -08:00
Gabriel Ebner
f9a61b2b29 fix(tests/lean/interactive): fix test 2016-12-20 10:15:19 -08:00
Sebastian Ullrich
00b8c2ca81 feat(frontends/lean/elaborator): save info on field of field expression 2016-12-18 23:48:50 -08:00
Leonardo de Moura
1cfef1c6d9 fix(frontends/lean/parser): save next_inst_idx in the parser snapshot
This fixes issues with anonymous instances in sections.
In Emacs, we would get spurious error messages such as:

   invalid parameter/variable declaration, '_inst_1' has already been declared

This commit also adds a regression test for the problem.
2016-12-18 23:39:28 -08:00
Gabriel Ebner
45d0525e52 feat(shell,emacs): new lean server protocol 2016-12-06 17:14:29 -08:00
Gabriel Ebner
3b2bb854be fix(tests/lean/interactive/test_single): do not use deprecated realpath command
The realpath executable is not installed by default on ubuntu.  Also
contains a fix for macOS where the default readlink executable does not
understand -f.  The ./readlinkf.sh script does not work for directories
either.
2016-12-02 17:01:58 -08:00
Leonardo de Moura
ffcb9f240e fix(tests/lean/interactive/test_single): MSYS2 compatibility 2016-12-01 11:55:55 -08:00
Gabriel Ebner
a8df381d20 feat(*): parallel compilation 2016-11-29 11:12:40 -08:00
Leonardo de Moura
922d48524b fix(frontends/lean): fixes #1188
This commit also adds support for recording the type of local variables
in the info_manager
2016-11-10 15:08:25 -08:00
Sebastian Ullrich
ef633abec7 chore(*): fix test and style 2016-11-08 08:37:41 -08:00
Sebastian Ullrich
1f9554a014 refactor(frontends/lean/info_manager): always pass column in requests 2016-11-08 08:37:41 -08:00
Sebastian Ullrich
ba1b6165e3 feat(frontends, shell): implement basic server 'info' command 2016-11-08 08:37:41 -08:00
Leonardo de Moura
e98340ddae chore(tests/lean/interactive): remove "interactive" tests
In Lean3, we will not use the --server option anymore
2016-09-19 17:20:44 -07:00
Leonardo de Moura
928d567a3f chore(tests/lean): providing universes 2016-09-17 12:54:20 -07:00