Commit graph

78 commits

Author SHA1 Message Date
Sebastian Ullrich
b9424975b3 refactor(init/meta): replace dynamically-checked quotes where possible 2017-02-17 19:59:57 -08:00
Leonardo de Moura
c51d9ad4f4 feat(library/init/meta): add simph: a shorter simp_using_hs 2017-02-17 13:45:03 -08:00
Leonardo de Moura
d3c340a30c feat(library/init/meta): improve induction tactic interface
It uses .rec recursor when it is not specified
2017-02-17 10:58:51 -08:00
Sebastian Ullrich
84f3e2a492 refacotr(init/meta/interactive): clean up parameter gadgets 2017-02-17 15:41:58 +01:00
Sebastian Ullrich
69ed7b940f refactor(init/meta/interactive): query position information dynamically 2017-02-17 15:41:58 +01:00
Sebastian Ullrich
d15591a2d8 feat(library,frontends/lean): expose parser to Lean and use for parsing tactic parameters 2017-02-17 13:45:56 +01:00
Leonardo de Moura
1ab2bb7714 feat(frontends/lean/elaborator): eta-expand function applications until we consume all optional and auto parameters 2017-02-14 17:38:08 -08:00
Leonardo de Moura
1b412b6cc0 feat(library/init/meta): new cases that reverts also composite terms
The previous `cases` tactic would only use the revert/intro idiom
for `cases h` when `h` is a hypothesis
2017-02-14 13:30:36 -08:00
Leonardo de Moura
f650a1b873 refactor(library/init/meta): avoid '_core' idiom using default parameters
I kept a few core methods (e.g., exact_core and apply_core). Reason:
if we use default parameters

    meta constant exact (e : expr) (md := semireducible) : tactic unit

then, we will not be able to write

    to_expr p >>= exact

The workaround is

    do t <- to_expr p, exact t

or
    to_expr p >>= (fun x, exact x)

One alternative is to change how we handle default parameters, and
eta-expand applications that involve default parameters.
We may also have an attribute [eta_expand]. Then

    attribute [eta_expand] foo

instructs the elaborator to automatically eta-expand foo-applications.
The attribute would give users more control, and avoid potential
performance problems. Without the attribute, then for every function
application the elaborator has to check the type and decide whether it
must be eta-expanded or not.

@gebner @kha What do you think?
2017-02-14 09:46:55 -08:00
Johannes Hölzl
bb136d63ab feat(src/library/tactic): tactic.cases_core returns for each new goal the used constructor, a list of introduced hypotheses, and substitutions for dependent hypotheses 2017-02-10 16:07:33 -08:00
Johannes Hölzl
d7af5515d2 feat(src/library/tactic): tactic.induction_core returns for each new goal the list of introduced hypotheses and substitutions for dependent hypotheses
Also add to_obj(buffer<vm_obj>) to construct a vm-list of vm objects.
2017-02-10 16:07:33 -08:00
Leonardo de Moura
c0e6314f14 fix(library/init/meta,library/tactic/elaborate): bad error position when to_expr is used outside of interactive mode 2017-02-09 18:44:50 -08:00
Leonardo de Moura
5e397795cf fix(library/init/meta): focus tactic
This commit also add the interactive tactic 'focus'
2017-02-09 10:02:19 -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
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
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
Gabriel Ebner
95068e4e79 feat(library/sorry): make sorry a macro 2017-02-05 14:01:03 +01:00
Leonardo de Moura
2640d3085b fix(library/init/meta/interactive): name resolution problems in parametric sections 2017-02-03 14:04:59 -08:00
Leonardo de Moura
bb9a0c79f4 feat(frontends/lean/builtin_exprs): better syntax for quoted terms with type ascription 2017-02-01 12:49:38 -08:00
Leonardo de Moura
b1d097e63a feat(library/init/meta): add 'delta' tactic for applying delta reduction
closes #1331
2017-01-26 19:04: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
4b11afcb46 feat(library/init/meta/interactive): add doc strings 2017-01-22 16:41:27 -08:00
Leonardo de Moura
3516773644 chore(library/init): minor fixes 2017-01-22 14:20:48 -08:00
Leonardo de Moura
ac1db6a199 feat(library/init/meta/interactive): add some doc strings 2017-01-22 12:45:39 -08:00
Leonardo de Moura
b913ba3336 feat(library/init/meta): add type information for the arguments of the smt tactics: ematch_using and add_lemmas 2017-01-22 12:12:31 -08:00
Leonardo de Moura
a61cf4d08b feat(library/init/meta/interactive): show type information for simp, dsimp arguments 2017-01-22 12:05:51 -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
7a6b9e193c feat(library/vm, frontends/lean/info_manager): add thread safe vm_obj wrapper, and use it to store arbitrary vm thunks in the info_manager 2017-01-21 22:38:33 -08:00
Leonardo de Moura
4de71cadfa feat(library/init/meta): expose additional app_builder tactics 2017-01-20 20:27:07 -08:00
Leonardo de Moura
b1c1d2dfa4 feat(library/init/meta): improve dsimp tactic notation 2017-01-09 17:31:35 -08:00
Leonardo de Moura
0c4c41ae54 feat(library/init/meta): produce nicer error message for overloaded simp/ematch lemma 2017-01-07 14:13:46 -08:00
Leonardo de Moura
13a11b4374 feat(library/init/meta/interactive): add get_eqn_lemmas_for tactic, allow user to provide definition name as an argument to simp 2017-01-06 11:45:09 -08:00
Leonardo de Moura
7ba889b5cf feat(frontends/lean/tactic_notation): try/repeat for smt_tactic in interactive mode 2017-01-05 18:31:57 -08:00
Leonardo de Moura
384e8bc795 refactor(library/init/meta/smt): move ematch stuff to new file, and remove priority from hinst_lemma 2017-01-04 17:23:06 -08:00
Leonardo de Moura
3a62ca0581 refactor(library/init/meta): move smt tactics to library/init/meta/smt, and add interactive definitions 2017-01-04 09:36:50 -08:00
Scott Morrison
548ca37c47 fix(library/init/meta/interactive): correcting a typo in a comment 2017-01-01 09:34:32 -08:00
Leonardo de Moura
5d825483c4 refactor(library/init/meta/interactive): tactic.interactive.types ==> interactive.types
Motivation: we will use auto-quotation for other tactic monads
2016-12-30 18:06:41 -08:00
Leonardo de Moura
b86494f0d4 feat(library/tactic): add destruct tactic that is similar to cases, but does not use revert/intro/clear
This tactic is useful for building more complex tactics using ematch and
cc because it does not invalidate cc_state nor ematch_state.
2016-12-30 17:05:24 -08:00
Leonardo de Moura
cc6d4a6ef8 chore(library/init/meta/interactive): typo 2016-12-30 09:04:27 -08:00
Leonardo de Moura
d573704657 feat(library/init/meta): add ac_refl tactic
It is basically cc without taking the hypotheses into account.
2016-12-29 19:22:40 -08:00
Leonardo de Moura
b65c774f5b chore(library/init/meta): opened_namespaces ==> open_namespaces 2016-12-18 23:55:45 -08:00
Leonardo de Moura
d41c403442 feat(library/init/meta/simp_tactic, library/init/meta/interactive): add simp_using_hs 2016-12-17 12:54:04 -08:00
Leonardo de Moura
9f6e71b374 feat(library/tactic): add "approximate" parameter to apply_core and rewrite_core
If this parameter is set to true, then approximate unification is
used.

closes #1208
2016-12-10 10:24:05 -08:00
Jeremy Avigad
0950b7a49f feat(library/init/meta/interactive): allow cases on an arbitrary expression 2016-12-10 09:54:03 -08:00
Jeremy Avigad
1dd91c6e6a feat(library/init/meta/interactive): add fapply 2016-12-10 09:53:53 -08:00
Jeremy Avigad
1ba55e5cda feat(library/init/meta/interactive): allow metavariable in change tactic 2016-12-10 09:53:36 -08:00
Leonardo de Moura
692701c5ef feat(library/init/meta): use cheap "reflexivity" after simp and rewrite
The idea is to make sure lean doesn't timeout (at reflexivity) when we apply simp or
rewrite in goals such as

    (x y : nat) |- x + y + 10000000000 = x + y + 200000000000000

This commit also addresses an issue raised at #1218
2016-12-08 14:41:26 -08:00
Leonardo de Moura
25639f0b72 feat(library/init/meta): add 'pose' tactic 2016-11-24 13:48:16 -08:00
Leonardo de Moura
0554fd5997 fix(frontends/lean): name resolution at tactic execution time
This commit also adds a new tactic: tactic.resolve_name

closes #1201
2016-11-24 10:55:39 -08:00