Commit graph

3519 commits

Author SHA1 Message Date
Leonardo de Moura
4eefc41b6e refactor(*): wrap string in a structure
We want to make sure string users do not depend on the string
implementation. This is the first step.

We need this refactoring *now* to make sure it will not be
super painful to address issue #1175
2017-06-07 17:30:49 -07:00
Mario Carneiro
c13472a8b8 feat(init/meta/interactive): change-with tactic
Conflicts:

	library/init/meta/interactive.lean
2017-06-07 10:33:14 -07:00
Sebastian Ullrich
dd91630a83 feat(frontends/lean/user_notation): more error checking 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
3f717c586e feat(init/meta/interactive): declare format! and sformat! macros and start putting them to use 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
56995348d3 hack(frontends/lean/parser): allow input to be substituted and use it to implement interpolating format macro 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
c49f6f7873 refactor(frontends/lean/user_notation): use parser instead of tactic monad 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
20ab8feeae feat(init/meta/lean/parser): pexpr parser that does not use quoted mode 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
18063fa9ba feat(frontends/lean): user-defined notation parsers 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
283d8ade1a fix(library/quote): use opaque macro for elaborated expr quotations 2017-06-07 10:00:17 -07:00
Leonardo de Moura
82db0f874a fix(kernel/type_checker,library/type_context): add support for macros that cannot be expanded
Fixes #1650
2017-06-07 08:25:21 -07:00
Sebastian Ullrich
a72687661b fix(util/stackinfo): avoid and guard against negative overflow in g_stack_threshold computation 2017-06-07 13:22:11 +02:00
Leonardo de Moura
748eb856c3 fix(frontends/lean): fixes #1649
This issue is yet another reason for refactoring how parameters are
represented in Lean.
2017-06-06 21:33:24 -07:00
Leonardo de Moura
f5ec29ab1a feat(library/init/meta/interactive): add add_interactive command.
@Armael: the new file `tests/lean/run/add_interactive.lean` contains a
small example. Note that we don't have auto quotation for commands yet.
So, I have to use the backtick in the example.

@Kha: this is a good candidate for the future command parser extensions.
2017-06-05 16:43:15 -07:00
Leonardo de Moura
f2ee88aecf test(tests/lean/run/simp_rfl_proof_issue): add simp refl proof test 2017-06-05 15:36:26 -07:00
Leonardo de Moura
cd624dda75 fix(library/tactic/exact_tactic): make sure exact/refine tactics check for cycles when assigning metavariables
fixes #1638
2017-06-04 15:10:42 -07:00
Jeremy Avigad
4592210e10 fix(tests/lean/*): fix and expand tests 2017-06-04 13:23:26 -07:00
Jeremy Avigad
650870fd0e fix(tests/lean/interactive/*): fix tests 2017-06-04 13:23:26 -07:00
Jeremy Avigad
4f2cd6d2c7 fix(tests/lean/run/simp_options): move test 2017-06-04 13:23:26 -07:00
Jeremy Avigad
7fe0fff91d feat(library/init/meta/interactive): add 'only' option for simp, dimph, dimp_intros, and dsimp 2017-06-04 13:23:26 -07:00
Jeremy Avigad
862d23f6b6 fix(library/init/meta/interactive): disallow wildcard in rewrite 2017-06-04 13:23:26 -07:00
Jeremy Avigad
e1c024d4d9 fix(library/init/meta/simp_tactic): fix relabeling of hypotheses in simp_intro_aux 2017-06-04 13:23:26 -07:00
Jeremy Avigad
4160f23847 fix(library/init/meta/interactive): fix printing of description string for locations 2017-06-04 13:23:26 -07:00
Jared Roesch
e63f202aed chore(tests/lean): add tests for rw and simp 2017-06-04 13:23:26 -07:00
Leonardo de Moura
e22ccb4d1f feat(library/tactic/tactic_state): improve error message for unify and is_def_eq tactics
closes #1639
2017-06-03 19:52:22 -07:00
Leonardo de Moura
92a72b238b feat(library/tactic): add tactic::ref
They can be used to store user state in the tactic_state object.

@Armael @jroesch: The new file tests/lean/run/tactic_ref.lean contains a few examples.
2017-06-02 15:19:03 -07:00
Leonardo de Moura
ca5439c698 feat(frontends/lean/tactic_notation): add support for tac ; [tac_1, ..., tac_n] notation in interactive tactic mode
closes #1634

This commit also changes the semantic of `tactic.focus [tac_1, ..., tac_n]`.
It now fails if the number of goals is not `n`.
Before it would only fail if there were more tactics than goals.

@Armael: See tests/lean/run/handthen.lean for examples of the new notation.
2017-06-02 11:38:04 -07:00
Leonardo de Moura
a8173c8194 feat(library/init): heterogeneous andthen type class, and tactic.seq_focus implementation 2017-06-02 10:38:27 -07:00
Leonardo de Moura
81e97de463 feat(library/init/meta/interactive): allow metavars in the show_goal tactic 2017-06-01 19:46:38 -07:00
Leonardo de Moura
d7ab5cd8a1 feat(frontends/lean/tactic_notation): allow show keyword to be used as syntax sugar for the show_goal tactic
@kha @gebner I added the `show_goal` tactic for selecting arbitrary
subgoals. This feature is similar to the one available in Isabelle.
This commit allows us to use the `show` keyword as syntax sugar for
`show_goal`. The test `show_goal.lean` has a small example.
What do you think?

@Armael: you can use `show` to structure your proofs in tactic mode.
See `tests/lean/run/show_goal.lean` for a small example.
2017-06-01 18:52:54 -07:00
Leonardo de Moura
18467bd302 feat(library/init/meta/interactive): add show_goal tactic for structuring proofs in interactive tactic mode 2017-06-01 18:36:50 -07:00
Leonardo de Moura
00aef04b81 feat(library/init/meta/rec_util): add mk_constructors_fresh_names
@Armael @jroesch this commit implements the
`mk_constructors_fresh_names` tactic.
The new test file has a few examples.
2017-06-01 17:04:21 -07:00
Leonardo de Moura
190d792225 feat(library/init/meta/tactic): add default parameter value 2017-06-01 16:24:36 -07:00
Sebastian Ullrich
25152bc80d fix(frontends/lean/structure_cmd): use collect_implicit_locals to catch more context locals
Fixes #1623
2017-06-01 07:38:30 -07:00
Gabriel Ebner
04f9eb0b4f refactor(library/init/meta/expr): pure Lean implementation of reflected 2017-06-01 10:17:51 +02:00
Leonardo de Moura
e90bb65c7a fix(frontends/lean/elaborator): make sure coercions from (reflected t) to expr fire when t contains metavariables that can be synthesized by type class resolution 2017-05-31 23:33:48 -07:00
Leonardo de Moura
8b0cca57d1 fix(library/noncomputable): fixes #1631
This commit fixes issue #1631. However, it is not a perfect solution.
This commit improves the predicate that checks whether a definition is
noncomputable or not. This predicate was implemented before we had
a code generator.
We should refactor the code and use the code generator to check
whether a definition is noncomputable or not. Otherwise, we will
keep finding mismatches between the predicate at noncomputable.cpp
and what the code generator implements.
2017-05-31 23:16:37 -07:00
Leonardo de Moura
42eeb445d4 fix(library): make sure `(t) does not evaluate t
See #1631
2017-05-31 22:03:15 -07:00
Leonardo de Moura
d8fa93b4a2 feat(library/init/meta/tactic): add dependent parameters for empty introv 2017-05-31 15:10:07 -07:00
Leonardo de Moura
1c6e70d170 feat(library/init/meta): introv tactic
@Armael: this commit implements the `introv` tactic.
The implementation uses an auxiliary `intros_dep` that introduces new
hypotheses with forward dependencies.

The `tactic.introv` tactic implemented at library/init/meta/tactic.lean
is the main implementation, but it is not nice for interactive use since
users would have to write
```
tactic.introv [`h1, `h2]
```
To make it more conveninent to use, we define another
```
meta def introv (ns : parse ident_*) : tactic unit :=
tactic.introv ns >> return ()
```
This one is in the namespace `tactic.interactive`, and
uses parser extensions. The argument `parse ident_*` instructs
the parser to parse 0 or more identifiers and create a term
of type `list name` containing these identifiers.
2017-05-31 14:09:25 -07:00
Leonardo de Moura
71ef240817 feat(library/init/meta/interactive): add nary existsi
@Armael, this commit implements the nary existsi.
We can now write
a) existsi t
b) existsi [t_1, t_2, t_3]
2017-05-31 13:41:25 -07:00
Jared Roesch
0a6a6d8676 chore(*): remove mini_crush 2017-05-31 10:10:47 -07:00
Jared Roesch
b33af82bc9 chore(*): remove super 2017-05-31 10:10:47 -07:00
Leonardo de Moura
d3298d518c fix(library/equations_compiler/elim_match): whnf_pattern 2017-05-31 10:02:59 -07:00
Gabriel Ebner
b1e417805e fix(frontends/lean/scanner): do not treat 0xFF as end-of-file
Fixes #1624.  We just replace 0xFF by 0x00 when reading a new input
byte.  This shows up as an unexpected token error.
2017-05-31 16:54:04 +02:00
Sebastian Ullrich
834375a042 fix(library/eval_helper): evaluating tactics 2017-05-31 16:18:15 +02:00
Leonardo de Moura
00b4d4bdf6 test(tests/lean/run/psum_wf_rec): add example used on Slack to test suite 2017-05-30 16:59:35 -07:00
Leonardo de Moura
72134a7bbd feat(library/equations_compiler/wf_rec): provide recursive equations to rel_tac
rel_tac is a tactic used for synthesizing a well founded relation.
The default implementation just uses type class resolution.
More sophisticated strategies may need to access the set of recursive
equations. This commit addresses this need.
2017-05-30 16:55:37 -07:00
Leonardo de Moura
d0eb7d2ed3 chore(tests/lean/run/252): fix test 2017-05-30 13:11:59 -07:00
Sebastian Ullrich
4eab11ec3d fix(frontends/lean/structure_cmd): even less error recovery 2017-05-30 19:02:25 +02:00
Gabriel Ebner
b14a248dcd fix(frontends/lean/structure_cmd): segfault 2017-05-29 07:37:50 +02:00