Commit graph

12483 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
Leonardo de Moura
84260544d5 feat(library/init/meta/well_founded_tactics): improve trivial_nat_lt 2017-06-07 15:47:56 -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
Mario Carneiro
e8e57dcb15 feat(init/meta/interactive): change at tactic
addresses #1641
2017-06-07 10:17:00 -07:00
Sebastian Ullrich
b60899138e fix(library/vm/vm_parser): header worries after rebase 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
dd91630a83 feat(frontends/lean/user_notation): more error checking 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
db08f3f139 fix(frontends/lean/user_notation): check for closedness before evaluating term 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
01c430cd62 fix(frontends/lean/{parser_config,user_notation): persisting user notations 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
38aa99e7a5 fix(init/meta/has_reflect): reflect 1 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
79f29a693e refactor(init/meta/interactive): split file 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
2bb93aa4f9 feat(init/meta): tactic -> parser coercion 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
be6f2eada7 chore(*): typos 2017-06-07 10:09:38 -07:00
Sebastian Ullrich
59184e888f feat(init/meta/pexpr): has_to_pexpr (reflected a) 2017-06-07 10:09:38 -07:00
Mario Carneiro
77264a6074 fix(init/meta/interactive): get rhs using relation_lhs_rhs 2017-06-07 10:03:35 -07:00
Mario Carneiro
1354514c80 feat(init/meta/interactive): specify intermediate goal in transitivity
As suggested by @Armael on gitter
2017-06-07 10:03:23 -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
b9a22155da perf(util/stackinfo): optimize check_stack 2017-06-06 16:35:20 -07:00
Leonardo de Moura
9b60e25ca4 fix(library/init/meta/level): make level as meta 2017-06-06 16:12:35 -07:00
Leonardo de Moura
3bc414efff perf(library/tactic): add unsafe_change tactic
The `unsafe_change e` tactic is similar to the `change e` tactic, but it
does not check whether `e` is definitionally equal to the current
tactic. It is useful when implementing tactics such as:

```
meta def dunfold : list name → tactic unit :=
λ cs, target >>= dunfold_core transparency.instances default_max_steps cs >>= unsafe_change
```

The tactic `dunfold_core` guarantees that the resultant expression is
definitionally equal to the input one.

This was one of the performance problems at issue #1646.
Here are the runtimes for size 7 in the example described at issue #1646.

Before this commit:

   tactic execution took 4.96s
   elaboration of some_lifted_lets took 7.6s
   type checking time of some_lifted_lets took 31.1ms (aka QED time)
   total execution time: 12.785s

After this commit:

   tactic execution took 3.78s
   elaboration of some_lifted_lets took 5.71s
   type checking time of some_lifted_lets took 35.2ms
   total execution time: 10.693s
2017-06-06 14:55:25 -07:00
Leonardo de Moura
aac7777beb perf(library/tactic/unfold_tactic): implement dunfold_core and dunfold_occs_core in C++
Before this commit they were implemented using C++ and Lean.
A Lean procedure was being invoked for each subterm of the input term.

This is one of the performance problems at issue #1646.
Here are the runtimes for size 7 in the example described at issue #1646.

Before this commit:

   tactic execution took 7.48s
   elaboration of some_lifted_lets took 11.5s
   type checking time of some_lifted_lets took 33.4ms (aka QED time)
   total execution time: 16.841s

After this commit:

   tactic execution took 4.96s
   elaboration of some_lifted_lets took 7.6s
   type checking time of some_lifted_lets took 31.1ms (aka QED time)
   total execution time: 12.785s
2017-06-06 14:35:05 -07:00
Gabriel Ebner
34d5c0f769 fix(library/mt_task_queue): work around non-recursive lock 2017-06-06 19:57:04 +02:00
Leonardo de Moura
559211d284 perf(library/local_context): fix performance bottleneck at local_const
This is one of the performance problems at issue #1646.
The method `local_context::erase_user_name(local_decl const & d)` was
inefficient when there are many locals with the same user facing name.
For size 7 in the example described at issue #1646, the average size of the
declaration list was 400. Here are the runtimes for size 7

Before: 19.021 secs
After:  16.433 secs

There are more performance issues.
2017-06-06 10:01:08 -07:00
Johannes Hölzl
d7fc571e36 fix(library/init/meta): show_goal also changes the goal 2017-06-05 20:07:44 -07:00
Leonardo de Moura
544817cf15 fix(library/vm/interaction_state_imp): add scope_vm_state
This is needed when the expression to be compiled is too simple.
2017-06-05 19:22:13 -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
3140243bad chore(library/init/meta/interactive): reduce code duplication 2017-06-05 15:36:44 -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
ea8ecfd390 fix(library/init/meta/interactive): use replace_target at simp_goal
replace_target uses id_locked.
The id_locked solution is more robust because simp may build a proof
using refl lemmas, but type_context may not be able to establish that
the previous and new target are definitionally equal.

@Armael This commit fixes the issue in the KreMLin proof you showed me.
Now, the following tactic succeeds (as expected)
```
        simp [lowstar_semantics.apply_ectx],
```
and the resulting goal is
```
...
|- exp.subbuf (exp.loc (b, n, list.nil field)) a_1 = exp.subbuf ↑?m_1 ?m_2
```
2017-06-05 15:21:20 -07:00
Gabriel Ebner
1e7e440951 fix(library/module_mgr): actually cancel invalidated tasks 2017-06-05 19:36:09 +02:00
Gabriel Ebner
2355d48a8c feat(.travis.yml): add z3 for leanpkg test 2017-06-05 09:54:11 +02:00
Gabriel Ebner
d03b61635c fix(frontends/lean/module_parser): end-of-file position 2017-06-05 09:08:38 +02:00
Leonardo de Moura
e204a30685 fix(kernel/replace_fn): check if running out of stack space at replace_rec_fn
See #1646
2017-06-04 15:57:11 -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
Gabriel Ebner
86f4c9a794 fix(util/thread): disable thread finalizer manager finalization due to race condition 2017-06-04 23:29:34 +02:00
Leonardo de Moura
02c82ac41a fix(library/tactic/tactic_state): make sure mk_unify_exception is not compiler implementation dependent 2017-06-04 13:29:59 -07:00
Jeremy Avigad
4592210e10 fix(tests/lean/*): fix and expand tests 2017-06-04 13:23:26 -07:00
Jeremy Avigad
c68326ac14 feat(library/init/meta/interactive): update simp docstring 2017-06-04 13:23:26 -07:00
Jeremy Avigad
dedc87fa7e refactor(library/init/meta/simp_tactic): include defaults for 'simp with' 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
d045042ae7 refactor(library/init/meta/interactive): remove special printing of loc, style fixes 2017-06-04 13:23:26 -07:00
Jeremy Avigad
c09aa24977 refactor(library/init/meta/interactive): make mk_simp_set public 2017-06-04 13:23:26 -07:00
Jeremy Avigad
ee5f00d3d0 feat(library/init/meta/simp_tactic): make simp_at return new hypothesis 2017-06-04 13:23:26 -07:00