Commit graph

871 commits

Author SHA1 Message Date
Leonardo de Moura
efbf3a434d Highlight assignment keyword
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 20:00:12 -07:00
Leonardo de Moura
5ec2780321 Extend formatter with support for definitions and postulates.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:26:58 -07:00
Leonardo de Moura
790d4a4447 Move pretty printer to frontend. Add support for mixfix pretty printing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
5395ced0e5 Improve comments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
d6d221b992 Move auxiliary files away from kernel
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
99219f998b Rename files sets.h and maps.h to expr_sets.h and expr_maps.h
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
013fa866fa Add iterator for traversing local objects (i.e., ignores objects defined in ancestor environments)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
2b7834c5fc Add methods for creating infix, prefix, postfix operators in the frontend object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
577256fedc Add highlight_keyword, highlight_builtin, highlight_command for consistent formatting
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-15 19:02:28 -07:00
Leonardo de Moura
2d74ff5fe0 Cache results of the normalizer. Add example that demonstrates the exponential performance improvement.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 23:18:50 -07:00
Leonardo de Moura
984c4149fa Add helper functions for creating Let expressions. Add simple type checking test for Let expressions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 22:30:12 -07:00
Leonardo de Moura
b0f2ee6de0 Add notation support to frontend object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:18 -07:00
Leonardo de Moura
5bfb074eaf Create objects for universe variable declarations.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:18 -07:00
Leonardo de Moura
285c8dafdc Display context_entry body when pretty printing contexts.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:18 -07:00
Leonardo de Moura
23d245bb2e Sanitize context names before generating error messages. Add [[ noreturn ]] attribute to functions that always throw exceptions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:18 -07:00
Leonardo de Moura
a6f0a69186 Avoid head and tail when manipulating contexts
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:18 -07:00
Leonardo de Moura
56305e4672 Add sanitize_names for (local) contexts
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:17 -07:00
Leonardo de Moura
e5b8c45b3f Rename type to domain in contexts (aka telescopes). Reason: make name convention consistent with the one used for abstractions (lambdas and pis).
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:17 -07:00
Leonardo de Moura
338ce88ea0 Add occurs function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-14 18:17:17 -07:00
Leonardo de Moura
2dad1e0e33 Fix type mismatch error message
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 19:24:11 -07:00
Leonardo de Moura
392b347f53 Add expr_formatter and expr_locator. Add better error messages. Improve simple printer.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 19:16:40 -07:00
Leonardo de Moura
3bcbdf7c7b Add options to customize formatter
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 16:19:30 -07:00
Leonardo de Moura
11a9cac5d6 Refactor kernel objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 15:13:54 -07:00
Leonardo de Moura
0a4e03efc5 Remove option name::separator, it can't be configured during runtime
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 08:18:01 -07:00
Leonardo de Moura
2ea7479ee9 Move sexpr/format/options to util/sexpr (reason: circular dependency between util and numerics lib), now numerics depend on util, and sexpr depends on numerics and util. Add scanner to frontend.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-13 03:40:51 -07:00
Leonardo de Moura
4eeb72b0ee Fix performance problem in has_free_var. Add new test at src/tests/kernel/free_vars.cpp that exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-11 11:19:59 -07:00
Leonardo de Moura
5c6ee647a9 Fix bug in has_free_vars_fn. Add optimization to type_checker.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 22:05:04 -07:00
Leonardo de Moura
3a1514982f Add small optimization.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 21:02:45 -07:00
Leonardo de Moura
7ebaac62a8 Add scoped_map. Cache type checker results.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 19:27:56 -07:00
Leonardo de Moura
f79c0d3546 Add support for cygwin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 14:21:13 -07:00
Leonardo de Moura
9fbe99bf58 Rename define_uv -> add_uvar
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 14:21:13 -07:00
Leonardo de Moura
3d9f9a12d1 Enable automatic coercion from 'char const *' to hierachical name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-10 14:21:13 -07:00
Soonho Kong
a1229692b0 Add static_asserts for higher-order functions in kernel/for_each.h and kernel/pp.cpp 2013-08-09 22:41:07 -07:00
Leonardo de Moura
ecf9506abe Add object iterator for environment objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-08 18:38:18 -07:00
Leonardo de Moura
2d4caa7450 Mark 'implicit' parameters, and move them to the beginning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 21:53:19 -07:00
Leonardo de Moura
e558edcd52 Use ',' as separator for lambda
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 21:53:19 -07:00
Leonardo de Moura
3fbc506271 Rename Truth to Trivial, and delete Trivial macro
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 21:53:19 -07:00
Leonardo de Moura
2670e94398 Add pretty printer for Lean environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 19:10:12 -07:00
Leonardo de Moura
84de625ee4 Rename pp functions (that do not use format lib) to print
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 12:10:10 -07:00
Leonardo de Moura
dd21cdcc95 Add more theorems.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 11:23:04 -07:00
Leonardo de Moura
5acedcddbb Remove useless is_* functions. We can use equality for that (more readable and similar performance).
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 08:34:50 -07:00
Leonardo de Moura
2d27573e0c Add ImpAntisym axiom
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 08:29:20 -07:00
Leonardo de Moura
722e2b0ed4 Reformat code (make formating more consistent)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 08:17:33 -07:00
Leonardo de Moura
58fef282c3 Refactor theorems. Add new theorems.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-07 01:16:37 -07:00
Leonardo de Moura
345894d4ed Add => as a primitive. Define Not, And and Or using =>. Add MP and Discharge as axioms.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 20:22:09 -07:00
Leonardo de Moura
d88ff6f8e1 Add more theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 19:10:38 -07:00
Leonardo de Moura
d1388f5e3c Define Lean forall. Prove forall elimination.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 16:44:58 -07:00
Leonardo de Moura
4c28cb933b Fix bug in is_convertible
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 16:44:22 -07:00
Leonardo de Moura
3ff3eb6444 Add Eta axiom
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 14:47:13 -07:00
Leonardo de Moura
68d092f5ef Prove congr1, congr2 and congr theorems. Add xtrans theorem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 14:37:30 -07:00
Leonardo de Moura
ab915fb3f0 Add add_theorem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 12:24:20 -07:00
Leonardo de Moura
9d6b421be9 Add theorems Truth, EqMP and EqTElim
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 12:17:55 -07:00
Leonardo de Moura
84f4a32c0e Change name convention for creating Lean expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 11:27:14 -07:00
Leonardo de Moura
33d2dd2d8b Add subst proof rule. Define symm and trans using subst.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-06 02:03:22 -07:00
Leonardo de Moura
30513398bb Add basic definitions and axioms
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-05 20:06:42 -07:00
Leonardo de Moura
2986f0543e Simplify how universe variable constraints are represented in the kernel. Allow universe variable to be created without an environment.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-05 20:06:42 -07:00
Leonardo de Moura
7e2d7dcf3d Add more builtin constants
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-05 20:06:42 -07:00
Leonardo de Moura
0c610e0a77 Fix bug in type checker
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-05 20:06:42 -07:00
Leonardo de Moura
70de591934 Add definitions and facts
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 20:52:14 -07:00
Leonardo de Moura
5f77a2367f Allow Boolean expressions (aka propositions) to be used as types.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 18:26:01 -07:00
Leonardo de Moura
4b5d60f2b2 Add get_uvar method
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 17:47:54 -07:00
Leonardo de Moura
c97db1f0cf Add children environments
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 16:07:37 -07:00
Leonardo de Moura
95447deea3 Add normalization a = b for values (aka semantic attachments)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 14:54:33 -07:00
Leonardo de Moura
f0ccb2a03e Rename eqp --> is_eqp. The name is too similar to heterogeneous equality constructor eq.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 09:41:49 -07:00
Leonardo de Moura
3f789ce2b7 Add let and heterogeneous equality. Add bool_type and bool_value.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-04 09:37:52 -07:00
Leonardo de Moura
b979436c40 Add basic semantic attachments for arithmetic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 19:57:06 -07:00
Leonardo de Moura
15a4152ce8 Fix merge problem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:13:56 -07:00
Leonardo de Moura
0a679074f0 Add support for semantic attachments. Remove expr_numeral
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:15 -07:00
Leonardo de Moura
1fec8b0d5b Rename (stack) value to svalue
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:15 -07:00
Leonardo de Moura
0b8fa3b167 Remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:15 -07:00
Leonardo de Moura
cce469119f Flip order of the arguments for instance and abstract. Simplify type_checker.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:15 -07:00
Leonardo de Moura
190855ad1b Add (relaxed) version of instantiate that can substitute terms containing free variables
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:15 -07:00
Leonardo de Moura
2972bdfec3 Rename abst_type to abst_domain
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-03 16:12:12 -07:00
Soonho Kong
bac75541dc Add static_asserts to template funcs in expr.h & replace.h 2013-08-02 20:00:40 -07:00
Leonardo de Moura
a8c77ff40e Disable eta-reduction for now.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-01 23:19:34 -07:00
Leonardo de Moura
3ef9d21875 Fix bugs in type checker
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-01 21:40:39 -07:00
Leonardo de Moura
7b00561a94 Normalize level expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-01 21:40:39 -07:00
Leonardo de Moura
e220d7c525 Add type checker. Fix normalization with non-empty context
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-01 21:40:36 -07:00
Leonardo de Moura
bed5f09907 Rename normalize context to local_context. Create context. Fix bug in name.cpp
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-01 21:39:02 -07:00
Soonho Kong
322c2b472d Add more to expr pretty-print 2013-08-01 18:54:06 -07:00
Soonho Kong
5a89bffe83 Add pp to expr 2013-08-01 15:42:06 -07:00
Soonho Kong
0f98ee03b5 Use 'nullptr' instead of '0' 2013-08-01 13:57:43 -07:00
Leonardo de Moura
10def5cabe Remove duplicate code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-29 21:34:16 -07:00
Leonardo de Moura
4efa9a92df Fix performance issue
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-29 21:33:43 -07:00
Leonardo de Moura
08b750c825 Remove Prop from kernel
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-29 19:49:34 -07:00
Leonardo de Moura
6452c69b96 Use level at kernel expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-29 19:44:26 -07:00
Leonardo de Moura
537e2c101c Add more tests. Fix bug in universe implication test.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-29 19:05:43 -07:00
Leonardo de Moura
299ec9c254 Fix space
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-28 23:14:27 -07:00
Leonardo de Moura
279e524c9e Fix bug in universe levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-28 23:11:35 -07:00
Leonardo de Moura
a4f456c99e Universe levels
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-28 22:34:39 -07:00
Leonardo de Moura
a241d5f4b1 Add eta-reduction
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-26 12:37:13 -07:00
Leonardo de Moura
ed13132c12 Add has_free_var, lower_free_vars
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-26 12:27:55 -07:00
Leonardo de Moura
09708209a7 Improve documentation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-26 11:43:53 -07:00
Leonardo de Moura
f7138b6ecf Fix normalize
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-25 19:13:45 -07:00
Leonardo de Moura
14c899e7ca Add normalize
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 19:36:54 -07:00
Leonardo de Moura
1f7011353b Add (temporary) buffer class
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:57:51 -07:00
Leonardo de Moura
0fb93ad6ef Expose max_sharing_fn object
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
59592ed36b Add deep copy for kernel expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
ceb6537e3a Fix race condition when updating expression flags: max_shared and closed
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
1398c927cd Fix compilation error with clang++
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
4b61639f4d Use consistent naming for functional objects
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
4ae0c4c445 Remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
9b3c47a521 Refactor instantiate/abstract code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
c7b12a2815 Add abstract/instantiate for kernel expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
ed6d6483fe Rename abst_expr -> abst_body
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
9fd88e6e27 Add small demo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:32 -07:00
Leonardo de Moura
576726bf58 Use operator() for creating applications
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
54a02b4fc7 Simplify expr accessor names
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
2c3fc09e3c Add has_free_vars/closed function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
17e69e32d7 Add expression offset pair
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
6a2c9ef076 Rename/Reorg some kernel files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
90f498994a Add some overloads
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-24 14:56:31 -07:00
Leonardo de Moura
f00d8c4683 Fix bug in max_sharing
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-23 09:18:18 -07:00
Leonardo de Moura
dd74284fdc Cleanup eq_functor
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-23 09:12:15 -07:00
Leonardo de Moura
79d00f4d78 Rename max_sharing files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-23 09:01:54 -07:00
Leonardo de Moura
5aa25a635f Add max_shared flag to expr_cell. Improve app constructor.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-23 08:59:39 -07:00
Leonardo de Moura
2a9d0de57b Add max_shared: function for computing maximally shared expressions. 2013-07-22 19:31:27 -07:00
Leonardo de Moura
aed8a07c1b Add sexpr test
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-22 19:02:11 -07:00
Leonardo de Moura
06320c8615 Replace expr == with recursive function. Add goodies for traversing expressions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-22 16:40:17 -07:00
Leonardo de Moura
c4cd6c4f84 Add tests for kernel expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-22 13:04:27 -07:00
Leonardo de Moura
c32dfe22b6 Add expressions (dependent type theory)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-07-22 12:46:11 -07:00