Commit graph

2708 commits

Author SHA1 Message Date
Leonardo de Moura
f1d8d8dcf9 chore(library/tactic): update goal objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
ad70044ae1 chore(library/tactic): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
e55b4bf86d fix(library/unifier): bug in flex_rigid case: binding imitation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 20:43:49 -07:00
Leonardo de Moura
50e21586b0 feat(library/unifier): do not create a case-split for choice constraints that produce only one alternative
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:52:13 -07:00
Leonardo de Moura
443022d840 feat(util/lazy_list): add is_nil predicate
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:51:35 -07:00
Leonardo de Moura
ccce9d90a4 feat(frontends/lean/elaborator): add 'delayed coercions', add example demonstrating why the new feature is useful
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:39:23 -07:00
Leonardo de Moura
ed299c0914 feat(library/coercion): add has_coercions_to function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:38:27 -07:00
Leonardo de Moura
b11e1a5f34 feat(kernel/type_checker): add mk_app_justification auxiliary function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 18:38:09 -07:00
Leonardo de Moura
e769121c2a fix(frontends/lean/elaborator): memory leaks that only occur when compiling with clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 16:02:54 -07:00
Leonardo de Moura
340dc622c6 fix(kernel/formatter): make sure simple formatter output is not sensitive to internal names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 14:58:59 -07:00
Leonardo de Moura
150d285b39 fix (library/unifier): occurs_context_check
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 14:45:36 -07:00
Leonardo de Moura
16bdc51fc4 refactor(kernel/type_checker): simplify type checker API, and remove add_cnstr_fn
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 13:36:31 -07:00
Leonardo de Moura
ac03b3204a fix(kernel/formatter): add missing parentheses
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 12:07:28 -07:00
Leonardo de Moura
a70f8dd98e feat(kernel/inductive): mark parameters, type formers and indices as implicit parameters in the elimination rule
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 11:05:14 -07:00
Leonardo de Moura
5e0e737213 feat(library/scoped_ext): do not import 'children' namespace objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 10:32:34 -07:00
Leonardo de Moura
930960c54d fix(frontends/lean/builtin_cmds): abstract section parameters in the 'check' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 10:06:50 -07:00
Leonardo de Moura
0480dab986 feat(frontends/lean/parse_table): avoid duplicates in the parse table
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 09:32:19 -07:00
Leonardo de Moura
ab2bbaef3f feat(util/list_fn): add remove function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 09:32:19 -07:00
Leonardo de Moura
2d2f23cda6 feat(library/lean/lean): improve overload error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:52:40 -07:00
Leonardo de Moura
656bcd55ed fix(frontends/lean): save 'choice' position
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:50:44 -07:00
Leonardo de Moura
6085a54416 feat(library/error_handling): improve unifier_exception error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:49:50 -07:00
Leonardo de Moura
e735a8e5ff fix(library/unifier): bug in conflict resolution
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:42:40 -07:00
Leonardo de Moura
cdc41244ae fix(kernel/justification): missing 'const'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:18:18 -07:00
Leonardo de Moura
52ff29a6f7 feat(frontends/lean): add 'coercion' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-26 08:08:39 -07:00
Leonardo de Moura
06f9e7bfdd fix(build): add missing file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 18:12:23 -07:00
Leonardo de Moura
acf8c13619 feat(kernel): add strict implicit arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 17:50:49 -07:00
Leonardo de Moura
9f83ef8f6c chore(frontends/lean/elaborator): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 17:13:03 -07:00
Leonardo de Moura
a42a80407a fix(library/unifier): when imitating (f a), abstract local constants occurring in f
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 16:11:31 -07:00
Leonardo de Moura
1d4352aeb4 fix(kernel/converter): missing case: two constants c.{l1} and c.{l2} where l1 and l2 are structurally different but equivalent (or can be made equivalent)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 16:05:41 -07:00
Leonardo de Moura
543b1003a6 fix(frontends/lean/elaborator): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 13:11:35 -07:00
Leonardo de Moura
c9133f33dd feat(kernel/expr): add flat_app auxiliary function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 12:51:22 -07:00
Leonardo de Moura
f2b41312fb feat(frontends/lean): add '@' explicit notation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 12:50:47 -07:00
Leonardo de Moura
905209df1c fix(frontends/lean/elaborator): to cache values, we must push/pop whenever we update the m_ctx
Thus, we are disabling the cache for now.
It is also unclear whether it is useful or not.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 11:05:14 -07:00
Leonardo de Moura
5c40b466cc fix(kernel/type_checker): use the application to provide error location
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 10:42:58 -07:00
Leonardo de Moura
0791c83731 fix(frontends/lean/parser): add missing save_pos
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 10:32:43 -07:00
Leonardo de Moura
6ec5d768d0 fix(kernel/type_checker): bug in the app_delayed_justification object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 10:09:45 -07:00
Leonardo de Moura
f981a4c1fe fix(library/unifier): bug in lambda_abstract_locals auxiliary function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:59:08 -07:00
Leonardo de Moura
6db6048bf8 feat(library/error_handling): pretty print unifier exceptions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:41:25 -07:00
Leonardo de Moura
18a883ab1b fix(library/unifier): set conflict if type mismatch during metavariable assignment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:33:34 -07:00
Leonardo de Moura
5b6589709c fix(frontends/lean/decl_cmds): allow binders but no type in definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 09:00:57 -07:00
Leonardo de Moura
c427c5bdc9 feat(kernel/type_checker): improve 'declaration still has metavars' error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 08:51:33 -07:00
Leonardo de Moura
3e7dfa6212 fix(frontends/lean): infer type of definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 08:39:14 -07:00
Leonardo de Moura
d055c4880f feat(frontends/lean): connect new elaborator to frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-25 08:31:00 -07:00
Leonardo de Moura
fe0cee7536 feat(frontends/lean): add frontend elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 18:25:56 -07:00
Leonardo de Moura
d7436e600b fix(library/resolve_macro): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 17:40:58 -07:00
Leonardo de Moura
603dafbaf7 refactor(kernel): remove 'let'-expressions
We simulate it in the following way:
1- An opaque 'let'-expressions (let x : t := v in b) is encoded as
      ((fun (x : t), b) v)
   We also use a macro (let-macro) to mark this pattern.
   Thus, the pretty-printer knows how to display it correctly.

2- Transparent 'let'-expressions are eagerly expanded by the parser.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 16:27:27 -07:00
Leonardo de Moura
609aeae390 feat(kernel/type_checker): expose app_delayed_justification
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 14:54:37 -07:00
Leonardo de Moura
2c0f596665 fix(library/choice): avoid assertion violation when Lua API is misused
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 12:14:38 -07:00
Leonardo de Moura
3169f8c126 feat(library): add mk_explicit/is_explicit procedures for '@'-expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 12:11:27 -07:00
Leonardo de Moura
d915f0cc32 refactor(kernel/converter): converter should fail instead of relying on unification hints for solving a constraint, the hints must be applied by the frontend
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-24 09:00:14 -07:00
Leonardo de Moura
d8a8300a4f fix(kernel/expr): initialization problem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:55:51 -07:00
Leonardo de Moura
61595f516c fix(frontends/lean/notation_cmd): initialization bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:20:28 -07:00
Leonardo de Moura
aa8b5655dd feat(frontends/lean): add notation overwrite
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 16:10:36 -07:00
Leonardo de Moura
60f230a206 doc(library/unifier): ignore flex-flex constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 14:33:09 -07:00
Leonardo de Moura
7df397fe63 test(lua): add universe constraint unifier test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 14:19:02 -07:00
Leonardo de Moura
a0e4dccdac refactor(kernel/constraint): rename choice constraint fields
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 13:52:03 -07:00
Leonardo de Moura
60c60c6cf5 feat(library/kernel_bindings): add mk_choice_cnstr to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 13:39:21 -07:00
Leonardo de Moura
6d14de76f3 feat(kernel/constraint): add 'delayed' flag to choice constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:56:06 -07:00
Leonardo de Moura
66016df0ad feat(library/unifier): add imitation step for macros
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:44:22 -07:00
Leonardo de Moura
2fa5b17592 feat(library/unifier): add unifier.max_steps unifier.use_exceptions options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 12:38:57 -07:00
Leonardo de Moura
7b188ea37e feat(library/unifier): implement flex-rigid case
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 11:00:35 -07:00
Leonardo de Moura
68d55ef398 doc(library/unifier): document some of the unifier_fn methods
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-23 08:22:38 -07:00
Leonardo de Moura
9f7b92a410 refactor(library/unifier): combine active and delayed constraint sets
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 21:10:59 -07:00
Leonardo de Moura
4da9c2a2cb fix(emacs): modify emacs mode to reflect recent changes
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:56:53 -07:00
Leonardo de Moura
5bd86754af feat(frontends/lean/builtin_cmds): change notation for marking implicit/cast parameter in sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:51:00 -07:00
Leonardo de Moura
228f51dcfa feat(library/unifier): add support for choice constraint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 17:21:24 -07:00
Leonardo de Moura
611f29a954 chore(library/elaborator): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 16:35:00 -07:00
Leonardo de Moura
c8a07dee53 feat(library/unifier): add unifier_plugin support, and unit test with plugin implemented using Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 16:27:04 -07:00
Leonardo de Moura
238a0dbfba fix(library/unifier): memory violation, and missing set_conflict
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 14:09:06 -07:00
Leonardo de Moura
25cb1bf6a1 fix(kernel/converter): use type_checker::scope to make sure we restore the cache, and remove constraints when is_def_eq fails in the converter
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 14:08:54 -07:00
Leonardo de Moura
a1d94d71ec refactor(kernel/converter): eliminate converter::context, use type_checker directly
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 13:52:47 -07:00
Leonardo de Moura
edb2e85898 refactor(kernel/type_checker): remove type_checker::imp
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 13:39:58 -07:00
Leonardo de Moura
29a00c46d0 feat(library/unifier): add main loop and resolve_conflict
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 11:57:10 -07:00
Leonardo de Moura
644c387cfe refactor(kernel/constraint): rename: level constraints are also equality constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:50:47 -07:00
Leonardo de Moura
1c47bd4847 fix(kernel/converter): remove temporary workaround, and temporarily disable unit test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:39:22 -07:00
Leonardo de Moura
73666af4a4 fix(library/register_module): missing open_unifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 10:01:51 -07:00
Leonardo de Moura
c7c5e41653 fix(frontends/lean/parser): warning when compiling in release mode
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:58:05 -07:00
Leonardo de Moura
3953d4d122 feat(kernel/type_checker): add push/pop methods to type_checker, they control the cache, and allow the type checker to reuse results even when it is used inside of a backtracking search
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:58:05 -07:00
Leonardo de Moura
eca22edda3 fix(kernel/type_checker): restore type checker cache when a failure occurs, do not send constraints to add_cnstr_fn when a type checker failure occurrs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-22 09:00:32 -07:00
Leonardo de Moura
9c745057b4 feat(library/unifier): add unify_fn skeleton
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
aac3830e31 fix(kernel/converter): add temporary fix, we need to be able to backtrack constraints
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
f9a21166f0 feat(kernel/type_checker): add type_checker::is_def_eq method that takes a justification as argument
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 20:08:39 -07:00
Leonardo de Moura
fedbf8595b feat(kernel/metavar): collect unassigned metavariables while instantiating
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 16:58:09 -07:00
Leonardo de Moura
bf8f3318d8 feat(library): add unifier module skeleton
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 13:38:17 -07:00
Leonardo de Moura
37bee8c852 refactor(kernel/type_checker): simplify replace constraint_handler with closure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
86a56fbd2d feat(library/kernel_bindings): expose methods substitution::for_each_expr and substitution::for_each_level in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
2c3e3cb544 refactor(kernel/abstract): add abstract_locals, and remove abstract_p
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
67088b130e refactor(kernel/constraint): simplify constraint interface, and add choice constraint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
9e50d5a1b8 test(util/lazy_list): add simple lazy_list example
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-21 12:25:54 -07:00
Leonardo de Moura
2589d60bfd feat(frontends/lean): add nameless 'have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 17:18:18 -07:00
Leonardo de Moura
4b227409bf feat(frontends/lean): add 'then have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 14:27:21 -07:00
Leonardo de Moura
4560413a92 feat(frontends/lean): add '[fact]' modifier for 'have' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 11:58:05 -07:00
Leonardo de Moura
39177ec10a feat(frontends/lean): flip definition modifiers position, now they must occur after the identifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 11:58:05 -07:00
Leonardo de Moura
16412daf39 feat(frontends/lean): add 'using' syntax sugar for adding expressions to the goal's context
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 11:58:05 -07:00
Leonardo de Moura
5c17411a86 fix(kernel/converter): relax is_def_eq test, for example is_def_eq(f(?m1), a) should generate a constraint instead of returning an error
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-20 09:46:58 -07:00
Leonardo de Moura
2cc8172d61 refactor(frontends/lean): remove m_pos field from parameter object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-19 23:06:49 -07:00
Leonardo de Moura
2954d10df5 refactor(kernel/converter): remove unnecessary exception
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-19 23:06:49 -07:00
Leonardo de Moura
05d1832425 refactor(kernel/type_checker): improve ensure_pi and ensure_sort APIs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-19 22:33:58 -07:00
Leonardo de Moura
0cc8117fb4 fix(frontends/lean): add missing file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-19 06:10:15 -07:00
Leonardo de Moura
bdab979e09 feat(frontends/lean): add inductive_cmd
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 16:00:59 -07:00
Leonardo de Moura
461689f758 refactor(frontends/lean/builtin_cmds): move declaration commands to new file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 15:55:52 -07:00
Leonardo de Moura
08845be2fc feat(frontends/lean/notation_cmd): improve 'notation' cmd
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 09:28:01 -07:00
Leonardo de Moura
3e3c4ee5ed feat(frontends/lean/parser): add local_scope object to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 08:38:23 -07:00
Leonardo de Moura
6259d20218 feat(frontends/lean/parser): expand Lua parser API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 08:03:17 -07:00
Leonardo de Moura
77c5319c4a chore(*): remove Lua 'migrate'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 07:01:34 -07:00
Leonardo de Moura
3ea24c0f32 fix(library/kernel_bindings): set_environment and set_io_state objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 22:36:47 -07:00
Leonardo de Moura
06002c5312 feat(frontends/lean/parser): use system_import when processing Lean import command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 22:09:42 -07:00
Leonardo de Moura
b9a7cc41ef feat(shell): use system_import for lua files provided in the command line (i.e., their code will be available for all threads)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 22:04:09 -07:00
Leonardo de Moura
1378fa5cbb refactor(util/script_state): remove support for threads and communication channels from the Lua API, the goal is to keep is simple, and use one Lua state object per thread
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 21:56:45 -07:00
Leonardo de Moura
f17e8a853a feat(frontends/lean): allow parser actions to be implemented using Lua
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 21:56:16 -07:00
Leonardo de Moura
4cbc429192 feat(frontends/lean/calc): add parse_calc function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 17:16:15 -07:00
Leonardo de Moura
037cfcf622 refactor(frontends/lean/notation_cmd): add register_notation_cmds procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 13:39:44 -07:00
Leonardo de Moura
f6dc6e6504 feat(emacs): add new calc commands to lean emacs mode
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 13:36:35 -07:00
Leonardo de Moura
e178979061 feat(frontends/lean): add calc_subst, calc_refl, calc_trans commands for configuring calc-expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 13:35:31 -07:00
Leonardo de Moura
ddba6b222a feat(frontends/lean): add calculational proof environment extension, it stores transitivity, reflexivity (and substitution) rules
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 13:13:13 -07:00
Leonardo de Moura
50806314d4 feat(util/name): add name_pair, and lex order
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 13:09:29 -07:00
Leonardo de Moura
f9d81c24d3 feat(library/expr_lt): add lex comparison for expression pairs
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 12:14:22 -07:00
Leonardo de Moura
28c904abea feat(frontends/lean/parser): add 'flag' for disabling 'unknown identifier' errors
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 10:30:03 -07:00
Leonardo de Moura
4be05e1d8c refactor(frontends/lean): expose notation_entry and token_entry structures, and add functions for parsing notation without affecting the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 10:12:04 -07:00
Leonardo de Moura
819c8276f2 feat(frontends/lean/builtin_cmds): add 'variables' command family
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-17 08:25:00 -07:00
Leonardo de Moura
ea49176043 feat(frontends/lean/builtin_cmds): add 'using' command, and 'hiding/renaming' directives
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 18:42:39 -07:00
Leonardo de Moura
639d58f4c7 feat(frontends/lean/builtin_cmds): add 'print options' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 17:31:28 -07:00
Leonardo de Moura
3e377a9732 feat(frontends/lean/builtin_cmds): add 'set_option' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 17:27:43 -07:00
Leonardo de Moura
0779db7ae9 fix(kernel): set module_idx on theorems, otherwise we are not able to import theorems that use opaque definitions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 16:56:11 -07:00
Leonardo de Moura
73b7a44c84 fix(shell/CMakeFiles): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 16:55:16 -07:00
Leonardo de Moura
82e79d9c78 fix(frontends/lean/parser): style
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 16:54:44 -07:00
Leonardo de Moura
a964ceb0e2 feat(frontends/lean): add 'import' command, add command line option for setting number of threads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 16:37:46 -07:00
Leonardo de Moura
79d32b768d feat(shell): add '--hott' command line option
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 15:50:27 -07:00
Leonardo de Moura
4f3da90443 feat(frontends/lean/builtin_exprs): add 'have' and 'show' expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 15:04:29 -07:00
Leonardo de Moura
2c4175341c feat(library/placeholder): allow types to be attached to placeholders
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 14:35:55 -07:00
Leonardo de Moura
07f2379dec refactor(kernel): add mk_local function that has only two arguments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 14:27:26 -07:00
Leonardo de Moura
21c54755a9 fix(kernel/converter): bug in is_def_eq
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 14:09:12 -07:00
Leonardo de Moura
f1e3449aae fix(frontends/lean): propagate position information
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 13:20:10 -07:00
Leonardo de Moura
2312f43443 fix(kernel/abstract): propagate tags when abstracting
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 13:00:13 -07:00
Leonardo de Moura
f70b1b028a feat(frontends/lean): provide position to parse_fn external function, add 'by' expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 12:28:58 -07:00
Leonardo de Moura
77b0e9d05d feat(emacs): add 'abbreviation' in the list of keywords
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 10:54:04 -07:00
Leonardo de Moura
34dfacc10e refactor(frontends/lean): Bool does not need to be a reserved keyword
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 10:52:12 -07:00
Leonardo de Moura
6db265e7ab feat(frontends/lean/builtin_exprs): parse '_' placeholder
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 10:41:08 -07:00
Leonardo de Moura
249168ce0b feat(emacs): add 'postfix' in the list of keywords
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 10:03:36 -07:00
Leonardo de Moura
5ce0502a36 feat(frontends/lean/builtin_exprs): add parser for 'let' expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 09:50:34 -07:00
Leonardo de Moura
775e10186d refactor(parser): use 'scope objects' for creating local scopes and setting m_type_use_placeholder flag
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 09:24:41 -07:00
Leonardo de Moura
cb49e3719e fix(util/optional): bug in emplace method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-16 09:24:15 -07:00
Leonardo de Moura
27130c9499 feat(frontends/lean): local notation 'shadows' global one
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 11:50:41 -07:00
Leonardo de Moura
28047a33ae feat(frontends/lean): add local notation support
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 11:30:52 -07:00
Leonardo de Moura
9931033554 feat(shell/lean): remove --olean option
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 10:50:35 -07:00
Leonardo de Moura
64cafd6875 feat(frontends/lean/notation_cmd): add 'notation' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 10:49:05 -07:00
Leonardo de Moura
961b0bfacf feat(kernel/type_checker): use argument position when reporting application type mismatch errors
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 10:06:53 -07:00
Leonardo de Moura
9b389a96d5 feat(frontends/lean/notation_cmd): modify infixl/infixr/postfix command syntax
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-15 08:28:49 -07:00
Leonardo de Moura
e7019ec840 feat(frontends/lean): add infixl/infixr/postfix/precedence commands, add support for storing notation in .olean files, add support for organizing notation into namespaces
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 22:13:25 -07:00
Leonardo de Moura
891a3fb48b feat(frontends/lean): add command block reader with snapshot and resume
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 14:13:32 -07:00
Leonardo de Moura
6b99a29c2c refactor(frontends/lean): add local_decls template that is cheap to copy
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 09:56:05 -07:00
Leonardo de Moura
5fee6fd140 feat(shell/lean): add '-o' command line option
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 08:10:43 -07:00
Leonardo de Moura
282a35bd1b feat(frontends/lean): add '#setline' directive
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-14 07:28:56 -07:00
Leonardo de Moura
48c58af9b5 feat(frontends/lean/parser): allow explicit universe level to be provided to aliases and locals
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 18:00:52 -07:00
Leonardo de Moura
a65c43c0db feat(frontends/lean/builtin_cmds): add definition command family
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 17:30:35 -07:00
Leonardo de Moura
01cecb76db feat(frontends/lean/builtin_cmds): add 'variable' command family
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 15:13:50 -07:00
Leonardo de Moura
ce259e6265 feat(frontends/lean/parser): add namespace/section/end commands, add support for explicit universe levels, fix Type notation'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 11:34:43 -07:00
Leonardo de Moura
378b691ea7 feat(emacs): update keywords
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 11:25:24 -07:00
Leonardo de Moura
b347117cf3 feat(util/scoped_map): add 'keep' method for closing a scope without undoing operations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 11:25:14 -07:00
Leonardo de Moura
5aca452439 feat(library/aliases): add 'exceptions' and support for universes to add_aliases procedure, add for_each_universe method to environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-13 08:26:05 -07:00
Leonardo de Moura
a914345d29 feat(library): new scoping framework
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-12 19:33:02 -07:00
Leonardo de Moura
d50376249f feat(library/aliases): add level aliases
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-12 12:35:02 -07:00
Leonardo de Moura
3bde699fbe feat(frontends/lean/parser): add parse_level
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-12 12:34:55 -07:00
Leonardo de Moura
cffbae3667 test(tests/lean/run): add new test group, where we just execute Lean (and don't check output)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 21:07:23 -07:00
Leonardo de Moura
5a008717a4 feat(frontends/lean/parser): add parse_notation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 21:00:34 -07:00
Leonardo de Moura
e7d7996fa9 feat(frontends/lean/parser): add parser_binder(s) and abstract methods
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 18:51:12 -07:00
Leonardo de Moura
959c3ffc68 feat(frontends/lean/parser): add parse_id method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 15:09:16 -07:00
Leonardo de Moura
1a67cc7293 fix(kernel/for_each_fn): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 15:06:11 -07:00
Leonardo de Moura
05edbe00ad chore(shell): re-activate .lean tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:36:42 -07:00
Leonardo de Moura
1c5d3295cc refactor(library/deep_copy): use replace to implement deep_copy
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
4f83b1a50b feat(library): add choice expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
c8e272d20b feat(util/lua): add check_atleast_num_args helper function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
1972a09021 feat(frontends/lean/builtin_cmds): add simple 'print' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
7fd502993b refactor(frontends/lean/cmd_table): remove register_builtin_cmd procedures, they would cause initialization problems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:35:34 -07:00
Leonardo de Moura
2e8ebb6d9e feat(frontends/lean/parser): add 'parse_commands' and 'parse_script'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 14:32:07 -07:00
Leonardo de Moura
431b47377d feat(library/kernel_bindings): add 'set_env/set_environment' commands for updating the global environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 11:03:12 -07:00
Leonardo de Moura
8fcc25d55a fix(frontends/lean/token_table): static initialization problem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-11 10:56:04 -07:00
Leonardo de Moura
3dc26666b9 feat(frontends/lean): add parser interface
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 18:20:59 -07:00
Leonardo de Moura
d3e3301208 refactor(frontends/lean/scanner): use the parser configuration in the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 10:59:12 -07:00
Leonardo de Moura
e2adb101d5 feat(frontends/lean): add parser_config environment extension
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 10:39:22 -07:00
Leonardo de Moura
637eae40ad feat(library/aliases): add support for alias overloading
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 10:05:51 -07:00
Leonardo de Moura
d81df2efe2 feat(frontends/lean/parse_table): add use_lambda_abstraction flag to scoped_expr_actions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 09:39:01 -07:00
Leonardo de Moura
546f9dc00b chore(frontends/lean): use consistent name conventions, rename token_set to token_table
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-10 09:18:57 -07:00
Leonardo de Moura
00e0cc15ba feat(frontends/lean/token_set): add token_set Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 16:49:22 -07:00
Leonardo de Moura
25640faaeb fix(util/trie): bug in for_each method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 16:43:01 -07:00
Leonardo de Moura
af0c93e0eb feat(frontends/lean/parse_table): add typedef for notation::parse_table
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 15:54:56 -07:00
Leonardo de Moura
439b6c1e96 feat(frontends/lean/parse_table): add parse_table Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 15:33:39 -07:00
Leonardo de Moura
722ea7273e feat(frontends/lean): add parse_table datastructure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-09 13:20:33 -07:00
Leonardo de Moura
fe6ab51c12 feat(kernel/inductive): add APIs for retrieving information about declared inductive datatypes, intro rules, and elimination rules
The new API is important for implementing environment transformation procedures, and export Lean environment to different systems (e.g., Coq).

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-08 17:15:21 -07:00
Leonardo de Moura
1c49b4d85f chore(*): replace unique_lock with lock_guard when we do not need to use conditional variables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 20:55:25 -07:00
Leonardo de Moura
fb5c7c8e92 fix(util/stackinfo): on OSX Boost does not seem to be based on pthread library
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 20:47:46 -07:00
Leonardo de Moura
7124866a4f fix(library/module): potential deadlock when child thread threw an exception
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 20:34:18 -07:00
Leonardo de Moura
25b822b1c7 fix(tests/util/memory): remove reference to deleted function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 13:29:45 -07:00
Leonardo de Moura
a04af30d85 fix(CMakeLists): remove -pthread flag when compiling using Boost on OSX
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 13:21:00 -07:00
Leonardo de Moura
7847f8a0ca fix(tests/util): disable some tests that do not compile on OSX + Boost + MULTI_THREAD 2014-06-07 13:14:17 -07:00
Leonardo de Moura
d827b56777 fix(util/memory): remove get_thread_allocated_memory, it used thread_local
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 13:05:03 -07:00
Leonardo de Moura
a42856c1d2 refactor(*): minimize dependency on thread local storage, simplify MK_THREAD_LOCAL_GET
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 12:16:01 -07:00
Leonardo de Moura
d9794d8ea4 feat(CMakeLists): hide compilation warnings due to Boost when using g++ on OSX
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 11:59:31 -07:00
Leonardo de Moura
482f5b01e9 feat(util/thread): add simpler MK_THREAD_LOCAL_GET macro for when BOOST=OFF and MULTI_THREAD=ON
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 11:34:50 -07:00
Leonardo de Moura
8d1ec69599 fix(CMakeLists): use Boost_LIBRARIES
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 11:31:56 -07:00
Leonardo de Moura
5bf4138a4f feat(util/thread): add custom MK_THREAD_LOCAL_GET macros for when LEAN_MULTI_THREAD is not defined
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 10:41:17 -07:00
Leonardo de Moura
15f0899efb refactor(*): replace LEAN_THREAD_LOCAL with MK_THREAD_LOCAL_GET, the new macro uses the Boost thread_local_ptr instead of 'thread_local' directive
Motivation: clang++ on OSX does not support 'thread_local'.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 10:18:36 -07:00
Leonardo de Moura
91df9a5550 feat(util/thread): add LEAN_THREAD_PTR macro, it uses boost::thread_specific_ptr instead of thread_local keyword when we compile with Boost
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 08:16:20 -07:00
Leonardo de Moura
6700cf1f73 fix(util/thread): add missing declaration when compiling with Boost
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-07 08:05:19 -07:00
Leonardo de Moura
af0b02f521 fix(util/thread_script_state): add a better workaround for clang++ bug
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:54:10 -07:00
Leonardo de Moura
89a7898054 fix(*): static variable initialization problems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:44:12 -07:00
Leonardo de Moura
3562c76161 fix(util/sexpr/options): add workaround for clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:14:39 -07:00
Leonardo de Moura
db36d465dc chore(util/sexpr): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:01:43 -07:00
Leonardo de Moura
4a43016735 fix(kernel/expr): expr_cache initialization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 18:00:26 -07:00
Leonardo de Moura
8d4312d9d8 fix(util/thread): warning messages 2014-06-06 17:50:46 -07:00
Leonardo de Moura
06d2ff021b feat(util/thread_script_state): add system_import procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 16:23:24 -07:00
Leonardo de Moura
e9ef59ab3e feat(util): add global (thread local) script_state objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 15:46:16 -07:00
Leonardo de Moura
c1796d0ce4 chore(*): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-06 10:35:17 -07:00
Leonardo de Moura
d10d70423a feat(frontends/lean): add new scanner
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 18:57:26 -07:00
Leonardo de Moura
4cf1b05831 refactor(library/token_set): move to frontends/lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 13:10:50 -07:00
Leonardo de Moura
70c3ae8692 feat(library/token_set): register builtin commands
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 13:05:40 -07:00
Leonardo de Moura
5b898aa3ed refactor(util/trie): modify interface to avoid the creation of many temporary optional values and inc/dec reference counters
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-05 12:40:51 -07:00
Leonardo de Moura
220f94d36e feat(library/kernel_bindings): expose instantiate_levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-04 16:26:26 -07:00
Leonardo de Moura
1c96373c1a feat(library/kernel_bindings): expose replace_fn in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-04 15:26:55 -07:00
Leonardo de Moura
bab430af43 chore(kernel/expr): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-04 14:51:36 -07:00
Leonardo de Moura
3354832c21 perf(kernel/expr_eq_fn): delay cache allocation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 17:03:09 -07:00
Leonardo de Moura
4a25e7442a feat(kernel/expr): add optional expression caching (aka "partial" hash-consing)
We do not enforce full hash-consing because we would need to synchronize
the access to the hashtable/cache.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 15:35:47 -07:00
Leonardo de Moura
45a3ab5141 refactor(library/aliases): it is bad design to instantiate parameter using the parameter name, the parameter names have no semantic value
Moreover, we could create type incorrect aliases by "accident".

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 15:20:14 -07:00
Leonardo de Moura
1f6cfce05c refactor(library/placeholder): use different names for different placeholders, it is bad design to assume that two structurally identical expressions are different when they are allocated twice (this design is not compatible with any form of hash-consing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:59:00 -07:00
Leonardo de Moura
fc4b6a92cc fix(util/lru_cache): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:59:00 -07:00
Leonardo de Moura
b81d536946 fix(util/stackinfo): make sure check_stack can be invoked before 'main' (i.e., during initialization)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 14:57:32 -07:00
Leonardo de Moura
df3280e86e feat(util): add lru cache
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 13:26:02 -07:00
Leonardo de Moura
02df63b85e fix(kernel/level): add workaround for clang++ bug: memory leak at thread_local
The fix has an advantage. There is only one copy of level Zero in the system even when multiple threads are used.
Moreover, it does no require any form of synchronization, and modules can be initialized in any order.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 10:37:50 -07:00
Leonardo de Moura
076414693a feat(library/kernel_bindings): improve argument validation in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 10:17:12 -07:00
Leonardo de Moura
a9a38675cb feat(util/lua): add helper functions for checking expected number of arguments in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 10:16:27 -07:00
Leonardo de Moura
7dba2c29d2 feat(library): add token set
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 02:34:12 -07:00
Leonardo de Moura
5a5d66edc8 feat(util/trie): add value() method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 01:19:23 -07:00
Leonardo de Moura
ab5f570924 refactor(kernel/constraint): remove choice constraints from the kernel, the kernel does not use them, we will implement them in elaborator
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 00:46:28 -07:00
Leonardo de Moura
931ebf9637 chore(util/rb_tree): cleanup code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 00:40:52 -07:00
Leonardo de Moura
536b7539c6 chore(kernel/inductive): cleanup code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-03 00:38:45 -07:00
Leonardo de Moura
7b28419260 chore(*): disable multi thread support for OSX, remove the !defined(APPLE) directives
We should re-enable multi thread support for OSX as soon as the bug in clang is fixed.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:23:26 -07:00
Leonardo de Moura
f816487f4b fix(kernel/level): add (trivial) case for is_geq predicate: l >= 0 for any l
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:13:50 -07:00
Leonardo de Moura
045fa911d1 fix(library/kernel_bindings): missing kind in lean_kind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:12:02 -07:00
Leonardo de Moura
ab7469c175 fix(library/scope): warning message, and old comment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 18:08:46 -07:00
Leonardo de Moura
1467bb256e chore(library): remove unnecessary code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:22:38 -07:00
Leonardo de Moura
33bbcd9526 chore(kernel/declaration): rename declaration::get_params to declaration::get_univ_params
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:20:34 -07:00
Leonardo de Moura
82e1f87e08 feat(kernel): add function param_names_to_levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 16:17:04 -07:00
Leonardo de Moura
96f639811c chore(kernel/level): remove unnecessary code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 15:42:37 -07:00
Leonardo de Moura
712c10f818 fix(library/scope): make sure the local universe names do not conflict with universe parameter names when close a section, add declaration parameter name sanitizers
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 15:39:57 -07:00
Leonardo de Moura
f82658f213 feat(library): add helper functions for 'updating' declarations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 15:13:38 -07:00
Leonardo de Moura
e155708dda feat(util): add (functional) name_map
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:46:13 -07:00
Leonardo de Moura
dcacf6fbca refactor(util): rename name_map to name_hash_map
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:34:22 -07:00
Leonardo de Moura
b6d2328c1d fix(library/scope): make sure local levels are added in the beginning of the universe parameter list
The idea is to make sure it is consistent with the behavior used for regular local parameters.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 14:06:31 -07:00
Leonardo de Moura
e9664cb042 fix(kernel/type_checker): check if the declaration contains duplicate universe level parameters
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 13:57:43 -07:00
Leonardo de Moura
9b6b162a7c fix(library/scope): bug when abstracting inductive declaration in the end of a section
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 13:46:16 -07:00
Leonardo de Moura
6ee272477a fix(library/private): bug when preserving private names at end_section
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 11:32:14 -07:00
Leonardo de Moura
936ca80b9b fix(library/scope): bug in add_definition
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 11:04:34 -07:00
Leonardo de Moura
e56307f006 fix(library/scope): bug in end_scope procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 10:43:28 -07:00
Leonardo de Moura
6e113206b6 feat(library/scope): add support for inductive datatypes in sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-02 10:28:07 -07:00
Leonardo de Moura
d36ef5dcbe feat(library/private): preserve 'hidden/private name => user name' map when section is closed
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-01 18:09:11 -07:00
Leonardo de Moura
585f3adde1 feat(library/scope): add sections
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-01 17:55:11 -07:00
Leonardo de Moura
286d7f0e64 feat(library): add namespace management
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:41:01 -07:00
Leonardo de Moura
3145cee51f refactor(library/aliases): move replace_prefix to util/name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 15:11:22 -07:00
Leonardo de Moura
f7b3061a66 feat(library/module): improve 'import module' error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:52:06 -07:00
Leonardo de Moura
75abcea83f fix(library/kernel_bindings): Lua API consistency, environment:add method also register declaration in the export table
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:20:57 -07:00
Leonardo de Moura
7bd10c2d2d feat(library/module): export global universe level declarations
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-31 12:12:41 -07:00
Leonardo de Moura
1b5366cfb7 feat(library): add module for implementing aliases and 'using' command
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 21:42:40 -07:00
Leonardo de Moura
6902d8cb05 feat(library): add simple placeholder module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 20:28:28 -07:00
Leonardo de Moura
72f9e26dab refactor(library/private): add hidden_to_user_name and user_to_hidden_name functions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-30 17:52:01 -07:00
Leonardo de Moura
128d668f03 feat(library): add support for creating 'private/hidden' names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 18:37:09 -07:00
Leonardo de Moura
13f9db26b7 refactor(library): add module namespace
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:58:47 -07:00
Leonardo de Moura
fc7d5461b1 feat(library/kernel_bindings): add to_io_state_ext helper function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:35:11 -07:00
Leonardo de Moura
f8e71f711f feat(library/expr_lt): add expr_quick_cmp functional object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:34:16 -07:00
Leonardo de Moura
88440cbb3e feat(util/name): add optional<name> helper functions for implementing Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 13:33:42 -07:00
Leonardo de Moura
bfa9b90af0 feat(library/kernel_bindings): used 'named' parameters in import_modules API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 11:03:44 -07:00
Leonardo de Moura
ade5d99023 feat(library/modules): add option for discarding the proof of imported theorems (after checking them)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-29 10:56:28 -07:00
Leonardo de Moura
28b9d17a14 perf(library/module): do not use multiple threads when skipping type checking, add flag to disable/enable type checking theorems asynchronously
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-28 10:04:42 -07:00
Leonardo de Moura
e206fcc1af perf(kernel/type_checker): reduce the overhead of creating delayed_justification objects, a huge number of them is created when type checking applications
We reduce the cost by avoiding the allocation of std::functional objects, and the unnecessary increment/decrement of reference counters.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 23:16:52 -07:00
Leonardo de Moura
1b4c9f63ce perf(kernel/environment): improve is_descendant performance, optimize for the common case: the is_descendant tree is huge but has few deep branches
This is an important optimization for module.cpp. The benchmark tests/lua/slow/mod2.lua is a good example where the cost of is_descendant was neutralizing the benefit of the replace method.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 22:29:03 -07:00
Leonardo de Moura
0f894f4618 chore(*): tag 'slow' tests as 'expensive', and exclude 'expensive' tests when testing under valgrind
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 17:47:53 -07:00
Leonardo de Moura
4cbcc73bb6 feat(build): add GPROF compilation mode for using gprof
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 10:21:03 -07:00
Leonardo de Moura
6129cccc66 perf(library/shared_environment): replace shared_mutex with simple mutex, the shared_mutex is just overhead and impacts negatively on performance tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 08:34:44 -07:00
Leonardo de Moura
045a83153c doc(lua): update Lua API documentation, and reactivate doc tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-27 08:09:54 -07:00
Leonardo de Moura
75117bede8 fix(library/kernel_bindings): use standard environment in import_modules
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:54:08 -07:00
Leonardo de Moura
eca906b074 feat(library/module): add inductive decls to .olean files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:38:09 -07:00
Leonardo de Moura
49e1f78a33 feat(library/kernel_serializer): add serializer/deserializer for inductive decls
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 15:37:53 -07:00
Leonardo de Moura
bb9830f10c test(shell): add command line tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-26 04:53:04 -07:00
Leonardo de Moura
2d31c6c0b2 feat(library/coercion): improve get_user_coercions API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 11:35:47 -07:00
Leonardo de Moura
e058839d24 fix(library/coercion): allow cycles in the coercion graph
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 11:08:49 -07:00
Leonardo de Moura
71b555ab15 test(lua): coercion module error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 10:01:04 -07:00
Leonardo de Moura
ef14c3d67e fix(library/coercion): coercion replacement
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 09:49:26 -07:00
Leonardo de Moura
eb6d72a20c fix(library/coercion): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:55:20 -07:00
Leonardo de Moura
fc1819aadd test(lua): coercion serialization
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:38:50 -07:00
Leonardo de Moura
f598c6a110 fix(library/coercion): bug in coercion to function-class
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 08:21:53 -07:00
Leonardo de Moura
118eae2733 fix(library/coercion): bug add_coercion
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
e9e61fec51 feat(library/coercion): add for_each_coercion procedure
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
a408883c92 fix(library/coercion): bug in de-Bruijn indices
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:49 -07:00
Leonardo de Moura
f050308df7 feat(kernel/instantiate): relax apply_beta pre-conditions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 07:45:41 -07:00
Leonardo de Moura
1ee6bb48fc fix(library/coercion): bug in add_coercion_trans
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 06:25:31 -07:00
Leonardo de Moura
6536232107 feat(library/coercion): expose coercion module in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-25 06:05:31 -07:00
Leonardo de Moura
2be9bcef78 feat(library/coercion): add coercion management implementation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 19:28:42 -07:00
Leonardo de Moura
1cff37a084 feat(library/module): use io_state to report warning messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 14:08:15 -07:00
Leonardo de Moura
5df2331159 feat(library/io_state): add constructor for copying io_state, but replacing channels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 13:51:39 -07:00
Leonardo de Moura
49b2bb209d refactor(kernel/formatter): formatter_cell object should not perform destructive updates
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-24 13:51:39 -07:00
Leonardo de Moura
f8255ddac6 fix(library/module): deadlock
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-05-23 16:46:53 -07:00