Commit graph

12668 commits

Author SHA1 Message Date
Mario Carneiro
bae50f8ce6 fix(tests/lean): fix tests 2017-06-27 18:55:52 -07:00
Mario Carneiro
9f2980a524 feat(init/data/int): int lemmas, more bitwise theorems 2017-06-27 18:55:52 -07:00
Mario Carneiro
9f4f93e931 feat(init/data/int): prove int bitwise ops 2017-06-27 18:55:52 -07: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
Mario Carneiro
a63bafcc5c refactor(init/data/nat/bitwise): change definitions to avoid WF
The type-correctness of binary_rec_eq (the statement, not the proof) depends on unfolding the embedded well-founded definition of mod. This definition avoids it by using two simpler functions bodd and div2 that reduce well in the kernel.
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
98ba6666dc doc(changes): apply tactic
closes #1342
2017-06-27 18:44:54 -07:00
Leonardo de Moura
6ba425da6a feat(library/init/meta/interactive): add apply_with interactive tactic
The new tactic allows us to set apply_cfg in interactive mode.
2017-06-27 18:37:13 -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
cdec07fc81 feat(library/init/meta/interactive): address issue raised in comment at #1374
The example at
https://github.com/leanprover/lean/issues/1342#issuecomment-307912291
2017-06-27 16:45:21 -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
9fdb1c4a4d chore(library/init/meta/tactic): mark id_locked as [inline] 2017-06-27 13:43:24 -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
Sebastian Ullrich
46873d32ae chore(doc/changes): update changelog 2017-06-27 22:08:45 +02: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
Daniel Selsam
8ccdf350de fix(data/hash_map.lean): rm unused argument to contains_iff 2017-06-26 12:43:36 -07:00
Mario Carneiro
b9c2659b5d fix(init/meta/interactive): generalize2 rollback if typecheck fails 2017-06-26 12:35:27 -07:00
Daniel Selsam
d95b003c0b feat(init/meta/congr_tactic.lean): tactic to apply congruence rules 2017-06-26 09:17:53 -04:00
Leonardo de Moura
ce5ca79edf feat(library/init/meta): add type_check tactic
closes #1697
2017-06-25 15:26:32 -07:00
Mario Carneiro
d3d5982544 fix(init/meta/mk_dec_eq_instance): bug for dependent structures 2017-06-25 14:55:47 -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
19e83d413d fix(.codecov.yml): do not fail github ci if coverage drops by 0.01% 2017-06-25 10:35:02 +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
Leonardo de Moura
e63c79c81e feat(frontends/lean): enable hash_consing during tactic execution
This commit is trying to address a memory consumption problem in
@dselsam project.
2017-06-22 17:24:27 -07:00
Leonardo de Moura
9cb94847cb fix(library/equations_compiler): propagate m_ignore_if_unused flag 2017-06-22 17:01:31 -07:00
Leonardo de Moura
58f0561f41 fix(library/equations_compiler/equations): is_equation 2017-06-22 17:01:08 -07:00
Leonardo de Moura
e905e83e9e chore(library, frontends/lean): use override 2017-06-22 16:15:21 -07:00
Leonardo de Moura
096b437c11 fix(library/equations_compiler, frontends/lean): missing operator== for macro_definition_cell subclasses 2017-06-22 16:13:29 -07:00
Gabriel Ebner
30a9217a78 feat(library/type_context): unfold lemmas in major premise of acc.rec 2017-06-22 08:33:11 -07:00
Sebastian Ullrich
4d5d2abcba fix(init/meta): fix build 2017-06-22 08:24:36 -07:00
Mario Carneiro
47c3c0ba84 fix(tests/*): fix tests 2017-06-22 08:24:19 -07:00
Mario Carneiro
09af93186a fix(frontends/lean/elaborator): @applications don't make thunks 2017-06-22 08:24:11 -07:00
Leonardo de Moura
d666742219 doc(changes): update 2017-06-22 08:07:25 -07:00
Sebastian Ullrich
0a48809469 refactor(frontends/lean/tactic_notation): rename note/define tactics to have/let 2017-06-22 08:03:23 -07:00