Commit graph

9020 commits

Author SHA1 Message Date
Leonardo de Moura
b05c4e09ed feat(library/init/meta): add memoize field to simp_config and dsimp_config
We use `memoize := ff` when implementing `conv.interactive.for` and
`conv.interactive.find`.
2017-07-01 10:37:09 -07:00
Leonardo de Moura
36cc27fa0f feat(library/init/meta/converter/interactive): add for tactic to conv mode 2017-06-30 21:27:17 -07:00
Leonardo de Moura
b1bdc4690f feat(library/init/meta/simp_tactic): cleanup dunfold
Here are modifications:
- It fails if no definition is unfolded.
  See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
  at issue #1694

- Users can provide configuration parameters.

- `dunfold_occs` was deleted.
2017-06-30 20:49:20 -07:00
Leonardo de Moura
52d4189805 feat(library/tactic): add dsimp_config configuration object for the dsimp tactic family
Now, `dsimp` fails if the goal did not change.
We can use the config object to obtain the previous behavior:
```
dsimp {fail_if_unchaged := ff}
```
See comment https://github.com/leanprover/lean/issues/1694#issuecomment-310956315
at issue #1694
2017-06-30 17:15:10 -07:00
Leonardo de Moura
f7fe2a775c feat(library/init/meta/rewrite_tactic): improve rewrite tactic
`rewrite` tactic improvements
- Add support for `auto_param` and `opt_param`
- Order new goals using the same strategies available for `apply`
- Allow user to set configuration object in interactive mode.

@Armael This commit should address the issue you raised about the order
of new goals in the `rewrite` tactic.
See new test tests/lean/run/rw1.lean for examples.
2017-06-30 12:03:27 -07:00
Gabriel Ebner
c5af2a6f4c fix(library/module): unfold macros in inductive types 2017-06-30 17:49:50 +02:00
Gabriel Ebner
ade83128f0 fix(frontends/lean/interactive): go-to-definition for relative imports
Fixes leanprover/vscode-lean#58.
2017-06-30 09:20:33 +02:00
Gabriel Ebner
89c828d630 fix(library/library_task_builder): prevent uninitialized task results when cancelled 2017-06-30 08:32:34 +02:00
Leonardo de Moura
fe51bebab3 refactor(library/init/meta/converter): new conv monad implementation 2017-06-29 16:37:22 -07:00
Leonardo de Moura
5dee3415a4 feat(library/init/meta/simp_tactic): add flag for controlling whether simp-tactics fail when input input expression is not modified 2017-06-29 16:03:20 -07:00
Leonardo de Moura
99d55811e4 feat(library/tactic/match_tactic): automatically convert metavariables occurring in patterns into temporary metavariables (i.e., which are considered during matching) 2017-06-29 11:39:18 -07:00
Gabriel Ebner
08eceb6d85 fix(shell/server): fix sequence number in async responses 2017-06-29 16:43:12 +02:00
Gabriel Ebner
ee94f7688c fix(shell/lean): do not repeat progress messages
This should fix the problem with the 4MB log limit on Travis.
2017-06-29 13:04:27 +02:00
Gabriel Ebner
bfed11a6f7 fix(util/memory): fix jemalloc support 2017-06-29 11:26:41 +02:00
Leonardo de Moura
a7b895525b feat(library/tactic/simp_lemmas): simp lemmas may contain metavariables
@dselsam `simp` now supports lemmas containing metavariables.
The metavariables are automatically converted into tmp metavars.
The new test contains a few examples.
2017-06-28 18:17:21 -07:00
Leonardo de Moura
1dc3f85e26 feat(library/idx_metavar): add helper function for converting metavariables occurring in an expression into temporary metavariables 2017-06-28 18:06:33 -07:00
Leonardo de Moura
103b5d09b3 feat(library/init/meta/tactic): add option for not creating new subgoals at to_expr 2017-06-28 16:46:29 -07:00
Leonardo de Moura
adcb95626e feat(frontends/lean/tactic_notation): allow interactive tactics to take itactic arguments from a different tac_class 2017-06-28 14:51:42 -07:00
Leonardo de Moura
0b19ef82e1 feat(frontends/lean/structure_cmd): default parameter for structure/class declarations
Remark: we support them at inductive declarations.
2017-06-28 12:20:56 -07:00
Sebastian Ullrich
08495eef27 refactor(init/meta,frontends/lean/tactic_notation): assume_tac -> «assume» etc.
Fixes the eldoc display.

Also allow arbitrary keywords as tactics
2017-06-28 10:43:19 -07:00
Sebastian Ullrich
426f1afb4e feat(util/name): accept more subscripts in identifiers 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
a04a402f54 feat(emacs): highlight escaped identifiers 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
f53fa97c4a feat(frontends/lean): escape identifiers when pretty-printing 2017-06-28 10:43:19 -07:00
Sebastian Ullrich
16fe494736 feat(frontends/lean/scanner): accept arbitrary escaped identifiers 2017-06-28 10:43:19 -07:00
Gabriel Ebner
d6041e3228 fix(library/library_task_builder): fix segfault in cancellation 2017-06-28 17:26:47 +02:00
Mario Carneiro
e705d89490 feat(init/data/int): bitwise ops for integers 2017-06-27 18:55:52 -07:00
Mario Carneiro
ebf15e34cb feat(library/vm/vm_nat): implementation of new bitwise ops 2017-06-27 18:55:52 -07:00
Sebastian Ullrich
9033cba7d3 feat(frontends/lean,init/meta/interactive): assume and suppose tactics 2017-06-27 18:50:10 -07:00
Leonardo de Moura
e971acabb0 feat(library/init/meta): handle auto_params and opt_params at apply tactic 2017-06-27 18:17:48 -07:00
Leonardo de Moura
ac19b15169 fix(library/tactic/apply_tactic): remove unnecessary code from apply_tactic, and add tests for #1342
See issue #1342
2017-06-27 16:07:59 -07:00
Leonardo de Moura
9b03309d83 fix(library/equations_compiler): performance problem reported by @dselsam 2017-06-27 15:24:12 -07:00
Leonardo de Moura
070a888f80 chore(library/constants): remove unnecessary constant 2017-06-27 14:56:28 -07:00
Leonardo de Moura
3300eafd39 fix(frontends/lean/parser): fixes #1705
This is a temporary fix.
We will be able to implement a better solution after #1674.
2017-06-27 13:20:37 -07:00
Leonardo de Moura
5a2b7348f9 feat(library/tactic/apply_tactic): make apply tactic more robust
See issue #1342

Support for auto_param and opt_param have not been implemented yet.
2017-06-27 10:42:26 -07:00
Leonardo de Moura
8f4e3f911d fix(src/emacs/lean-syntax): instances is not a keyword anymore 2017-06-27 10:38:59 -07:00
Gabriel Ebner
33679a11b9 feat(shell/lean,util/log_tree): show currently executing task in lean --make
@dselsam @johoelzl This should make it easier to diagnose which proofs
time out or take a very long time.
2017-06-27 18:48:25 +02:00
Gabriel Ebner
11be4e5faf fix(CMakeLists): increase node stack size for emscripten 2017-06-27 08:44:01 +02:00
Leonardo de Moura
68afd4194b fix(library/tactic/simplify): fixes #1659
@dselsam The method `try_user_congr` was leaking a temporary
meta-variable into the formula. The problem in the congruence lemma
```
dif_ctx_simp_congr :
  ∀ {α : Sort u_1} {b c : Prop} [dec_b : decidable b] {x : b → α} {u : c → α} {y : ¬b → α} {v : ¬c → α}
  (h_c : b ↔ c),
    (∀ (h : c), x (h_c.mpr h) = u h) →
    (∀ (h : ¬c), y ((not_iff_not_of_iff h_c).mpr h) = v h) → dite b x y = dite c u v
```
when the hypothesis `(∀ (h : c), x (h_c.mpr h) = u h)` is processed,
`h_c` is still unassigned. `h_c` was being assigned in a second
loop (the one that I deleted). Do you see any reason for having this
second pass? I think it is an optimization, we can skip the potentially
expensive
```
   expr hyp = finalize(m_ctx, rel, r_congr_hyp).get_proof();
   expr pf = local_factory.mk_lambda(hyp);
```
if the expression has not been simplified.
Anyway, I removed this code and merged both loops.
I don't think it should impact performance since we barely use custom
congruence lemmas.
2017-06-26 15:25:58 -07:00
Leonardo de Moura
f339f97975 fix(frontends/lean/brackets): fixes #1703 2017-06-26 12:52:52 -07:00
Leonardo de Moura
ce5ca79edf feat(library/init/meta): add type_check tactic
closes #1697
2017-06-25 15:26:32 -07:00
Leonardo de Moura
00092c293a fix(library/check): improve ensure_type 2017-06-25 14:51:09 -07:00
Leonardo de Moura
41a1faa131 fix(frontends/lean/elaborator): check resulting type at visit_convoy 2017-06-25 10:50:40 -07:00
Leonardo de Moura
2075ec8d61 fix(library/equations_compiler/elim_match): bad trace message 2017-06-25 10:50:40 -07:00
Gabriel Ebner
af3f6fd181 fix(util/hash): add missing cast to unsigned 2017-06-25 14:58:18 +02:00
Gabriel Ebner
ed27334557 refactor(frontends/lean/scanner): use uchar for scanning 2017-06-25 10:06:29 +02:00
Leonardo de Moura
04dfd55f94 perf(kernel/expr): fix hash consing performance problem
The kernel support opportunistic hash consing.
At commit e63c79c81e we have enabled this feature during
tactic execution, and fixed performance problems in the Certigrad
project (by @dselsam).
However, this change produced unexpected performance problems in
other Lean files (example: @JasonGross example at issue #1646 was 10x
slower after the commit above).
After analyzing the performance logs, I conjecture the hash_consing
may produce a substantial performance overhead if the following property
doesn't hold.

- Let `cache` be the hash_consing cache, then for each `e` in `cache`,
all children of `e` are also in the `cache`.

If the property above is not true, we may have problem whenever
we add an expression `t` containing multiple copies of a big term `T`.
For example, support we insert `f T_1 T_2`, where `T_1` and `T_2` are
structurally equal but are not pointer equal. Then, if we try to insert
`f T_2 T_1`, we will have to compare the huge terms twice, and the
comparison will be proportional to the size of `T_i`.

This commit tries to address this performance problem by enforcing
the property above. This is not a perfect solution since we may keep
trying to create terms using big terms created before hash_consing
has been enabled. After this commit, the example at issue #1646
is only 1.4x slower. It didn't impact the standard library
compilation (memory nor time).

I'm using this commit is a temporary workaround. We should probably
remove the hash_consing support from the kernel, and implement it
in key places. For example, for Certigrad, we can control memory
consumption by using hash_consing only during `simp`,
`instantiate_mvars` and `elaborator` finalization procedure.

@gebner @kha Any ideas/suggestions for this hash_consing issue?
2017-06-23 12:41:35 -07:00
Gabriel Ebner
16fb5ade58 fix(library/string): correctly escape non-printable characters
This also fixes a compiler warning on ARM, where `0 <= c` is always
true.
2017-06-23 20:39:41 +02:00
Gabriel Ebner
7342741263 fix(CMakeLists): do not use -fsigned-char 2017-06-23 18:21:30 +02:00
Gabriel Ebner
4a6513e5f5 refactor(util/serializer,library/module): use basic_ostream::write for the olean code 2017-06-23 15:13:40 +02:00
Gabriel Ebner
31162df650 fix(frontends/lean/structure_instance): compiler warning 2017-06-23 08:31:04 +02:00