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
Leonardo de Moura
4bdb2da1b6
fix(library/equations_compiler): improve pull_nested_rec_fn, and make sure it communicates local propositions to the well founded recursion module
...
The bin_tree and num_consts examples can now be encoded more naturally.
2017-05-26 10:45:39 -07:00
Leonardo de Moura
7ffd7fea3d
feat(kernel): store depth of composite terms and use it in the hash code computation
...
closes #1589
2017-05-25 16:51:02 -07:00
Sebastian Ullrich
491802409a
chore(*): remove unused macro_definition_cell::pp method
2017-05-24 09:51:23 +02:00
Leonardo de Moura
544d5c67f4
feat(CMakeLists,kernel): add TRACK_LIVE_EXPRS=ON compilation option
2017-02-28 10:56:14 -08:00
Leonardo de Moura
715f0bdd8c
fix(kernel/expr): typo
...
closes #1350
2017-02-07 10:11:47 -08:00
Leonardo de Moura
9065cf0350
feat(library/tactic/congruence/theory_ac): add internalization, interface with congruence closure module, and trivial/simp/orient transitions
...
Still missing: superpose, collapse and compose transitions.
2016-12-28 21:35:16 -08:00
Leonardo de Moura
caf92bbcc0
feat(kernel/expr): compress expr_macro representation
2016-12-28 09:01:21 -08:00
Leonardo de Moura
5572d7f3ec
perf(kernel,library/module): enable expr caching when deserializing .olean files
2016-12-16 18:33:46 -08:00
Leonardo de Moura
487a1e7f89
refactor(kernel): remove extension_context
...
We replaced it with abstract_type_context
2016-03-19 15:15:39 -07:00
Leonardo de Moura
e7f1f409c4
refactor(kernel): simplify kernel type_checker
...
TODO: cleanup, move justification/metavar/constraints to library
2016-03-18 16:28:42 -07:00
Leonardo de Moura
3c878ecd01
feat(kernel): add let-expressions to the kernel
...
The frontend is still using the old "let-expression macros".
We will use the new let-expressions to implement the new tactic framework.
2016-02-29 16:40:17 -08:00
Leonardo de Moura
2b1d734544
feat(kernel/expr): remove 'contextual' flag from binder_info
2016-02-29 12:41:43 -08:00
Leonardo de Moura
c9e9fee76a
refactor(*): remove name_generator and use simpler mk_fresh_name
2016-02-11 18:05:57 -08:00
Leonardo de Moura
f67181baf3
chore(*): remove support for Lua
2016-02-11 17:17:55 -08:00
Leonardo de Moura
930fcddace
feat(kernel/expr): add get_app_args_at_most
2016-01-06 17:29:28 -08:00
Leonardo de Moura
ba392f504f
feat(kernel/expr,library/blast/blast,frontends/lean/decl_cmds): add workaround for allowing users to use blast inside of recursive equations
2016-01-03 21:53:31 -08:00
Daniel Selsam
413989afd6
feat(library/blast/backward): backward chaining strategy
2015-11-18 17:48:39 -08:00
Leonardo de Moura
92a7c38260
feat(kernel/expr): add mk_app that takes a list of arguments
2015-11-13 14:01:15 -08:00
Leonardo de Moura
57035d3162
feat(kernel/level,library/blast/expr): add universe level hash consing support in the kernel, simplify blast/expr even more
2015-09-30 13:31:42 -07:00
Leonardo de Moura
c5603e456a
feat(kernel/expr): replace "opportunistic" caching with precise caching
...
We also removed compilation option LEAN_CACHE_EXPRS
2015-09-30 12:29:43 -07:00
Leonardo de Moura
9c09b0750b
chore(kernel/expr): remove dead code
2015-09-21 15:43:51 -07:00
Leonardo de Moura
25cbc5c154
fix(kernel/expr): remove 'cast_binder_info'
...
We should put it back when we decide to implement it.
We also fix the bogus comment at src/frontends/lean/parser.cpp.
see issue #667
2015-06-11 18:11:22 -07:00
Leonardo de Moura
f830bf54c2
refactor(*): clarify name_generator ownership
2015-05-21 14:32:36 -07:00
Leonardo de Moura
061e26157e
fix(kernel,library): make sure macros check relevant arguments when kernel is performing full type checking
2015-05-08 12:41:23 -07:00
Leonardo de Moura
7516fcad97
feat(kernel/type_checker): add is_stuck method, and improve ensure_pi method, closes #261
2014-10-27 13:16:50 -07:00
Leonardo de Moura
6a31a79265
refactor(frontends/lean/inductive_cmd): move auxiliary method to expr.h
2014-10-18 15:11:26 -07:00
Leonardo de Moura
6d64da2981
perf(kernel/expr_eq_fn): use thread local cache, and avoid memory allocation/deallocation
2014-10-17 16:44:20 -07:00
Leonardo de Moura
fe484b26f3
refactor(kernel/expr): remove dead code
2014-10-16 13:45:36 -07:00
Leonardo de Moura
3b6b23c921
refactor(kernel/expr): remove silly overloads
2014-10-16 13:37:55 -07:00
Leonardo de Moura
c4f02bd16a
refactor(kernel/expr): remove dead code
2014-10-16 13:09:26 -07:00
Leonardo de Moura
97a7dae12a
refactor(kernel/expr): remove code duplication
2014-10-16 12:48:49 -07:00
Leonardo de Moura
814778abb1
refactor(kernel/expr): tag expressions at "creation" time
2014-10-15 13:12:09 -07:00
Leonardo de Moura
a26618e0f2
feat(frontends/lean): add '[]' notation for marking arguments where class-instance resolution should be applied
2014-10-12 13:06:00 -07:00
Leonardo de Moura
92c424936a
refactor(kernel/macro_definition_cell): improve macro get_type API
2014-10-07 16:38:31 -07:00
Leonardo de Moura
a0c37b231f
feat(kernel/expr): add hash_bi function that takes binder information into account
2014-09-29 16:44:55 -07:00
Leonardo de Moura
da481c3274
refactor(kernel): explicit initialization/finalization
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-24 10:12:28 -07:00
Leonardo de Moura
4a4de27a6c
refactor(frontends/lean/elaborator): move local_context to separate file
2014-09-10 11:20:16 -07:00
Leonardo de Moura
3310eb3dfc
feat(frontends/lean): remove restriction on implict arguments, add new test that demonstrates the new feature
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-07 12:29:32 -07:00
Leonardo de Moura
9588336c15
refactor(kernel/type_checker): remove "global" constraint buffer from type_checker, and use constraint_seq instead
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-20 16:46:19 -07:00
Leonardo de Moura
4cf3d32e0c
chore(*): create alias for std::pair
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-20 16:46:19 -07:00
Leonardo de Moura
0d5e346143
fix(library/expr_lt): make sure the builtin order is AC-compatible
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-04 15:51:10 -07:00
Leonardo de Moura
5c5dea7c8e
feat(kernel/expr): add has_expr_metavar_strict
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-26 19:54:04 -07:00
Leonardo de Moura
022a151cf7
feat(kernel): add general purpose 'annotations', they are just a generalization of the 'let'-annotations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-25 09:33:31 -07:00
Leonardo de Moura
5eaf04518b
refactor(*): rename Bool to Prop
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-22 09:43:18 -07:00
Leonardo de Moura
79ea7c5910
perf(kernel/expr): minimize access to system memory allocator by recycling expr_cells
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-21 18:46:47 -07:00
Leonardo de Moura
9289717169
perf(kernel/expr): inline get_free_var_range, and cache its value for local and metavars
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-17 08:51:46 +01:00
Leonardo de Moura
405e57eb2d
refactor(kernel/formatter): add formatter_factory, and simplify formatter interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-10 18:32:00 +01:00
Leonardo de Moura
fc4df6a430
feat(kernel/expr): add O(1) predicates has_expr_metavar and has_univ_metavar
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 13:11:30 -07:00
Leonardo de Moura
a66a08c89e
feat(frontends/lean): parse strings as expressions of type 'string.string'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:00:55 -07:00