Leonardo de Moura
69be5f6c94
feat(kernel/environment): track which modules were already imported
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-17 18:15:44 -08:00
Leonardo de Moura
926ed0a02d
feat(lua): add type_inferer object to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 19:18:15 -08:00
Leonardo de Moura
4ebb3c572a
feat(kernel/environment): make the environment throw an exception when weak-ref has expired
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 18:35:17 -08:00
Leonardo de Moura
516c5c8fea
feat(lua): add metavar_env objects to Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-16 14:44:33 -08:00
Leonardo de Moura
8525e8534b
feat(lua): expose parse_expr and parse_commands from frontends/lean in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-15 16:11:26 -08:00
Leonardo de Moura
691893258d
feat(kernel/expr): add hash code based on allocation time
...
The new hash code has the property that given expr_cell * c1 and expr_cell * c2,
if c1 != c2 then there is a high propbability that c1->hash_alloc() != c2->hash_alloc().
The structural hash code hash() does not have this property because we may have
c1 != c2, but c1 and c2 are structurally equal.
The new hash code is only compatible with pointer equality.
By compatible we mean, if c1 == c2, then c1->hash_alloc() == c2->hash_alloc().
This property is obvious because hash_alloc() does not have side-effects.
The test tests/lua/big.lua exposes the problem fixed by this commit.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-14 02:43:11 -08:00
Leonardo de Moura
ad1180c5b4
fix(kernel/occurs): typos
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 17:04:56 -08:00
Leonardo de Moura
9a22702383
feat(lua): make objects() and localobjects() methods return iterators in the environment LUA API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 14:26:01 -08:00
Leonardo de Moura
ba0889265e
refactor(lua): cleanup Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-13 13:55:05 -08:00
Leonardo de Moura
c4c548dc5d
feat(*): simplify interrupt propagation
...
Instead of having m_interrupted flags in several components. We use a thread_local global variable.
The new approach is much simpler to get right since there is no risk of "forgetting" to propagate
the set_interrupt method to sub-components.
The plan is to support set_interrupt methods and m_interrupted flags only in tactic objects.
We need to support them in tactics and tacticals because we want to implement combinators/tacticals such as (try_for T M) that fails if tactic T does not finish in M ms.
For example, consider the tactic:
try-for (T1 ORELSE T2) 5
It tries the tactic (T1 ORELSE T2) for 5ms.
Thus, if T1 does not finish after 5ms an interrupt request is sent, and T1 is interrupted.
Now, if you do not have a m_interrupted flag marking each tactic, the ORELSE combinator will try T2.
The set_interrupt method for ORELSE tactical should turn on the m_interrupted flag.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-12 21:45:48 -08:00
Leonardo de Moura
ac6c18321a
fix(lua): make sure environment objects can be safely accessed/updated from current threads
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 20:29:53 -08:00
Leonardo de Moura
31abc00db8
chore(*): add LCOV_EXCL_LINE to lean_unreachable statements
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-11 09:19:38 -08:00
Leonardo de Moura
7683188ab0
chore(emplace_back): use emplace_back when appropriate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
3078923ea4
fix(kernel/type_checker): add missing test, and kernel_exception has_no_type_exception
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-10 11:14:04 -08:00
Leonardo de Moura
ff16ffaea3
fix(kernel/environment): warning produced by clang
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 11:36:08 -08:00
Leonardo de Moura
8012c4f644
fix(kernel/environment): add weak reference to environment objects
...
We need weak references to environment objects because the environment has a reference to the type_checker and the type_checker has a reference back to the environment. Before, we were breaking the cycle using an "environment const &". This was a dangerous hack because the environment smart pointer passed to the type_checker could be on the stack. The weak_ref is much safer.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 11:29:08 -08:00
Leonardo de Moura
9c60eed93c
refactor(kernel/metavar): avoid using unique names for default metavariable prefix
...
The problem is that unique names depend on the order compilation units are initialized. The order of initialization is not specified by the C++ standard. Then, different compilers (or even the same compiler) may produce different initialization orders, and consequently the metavariable prefix is going to be different for different builds. This is not a bug, but it makes unit tests to fail since the output produced by different builds is different for the same input file.
Avoiding unique name feature in the default metavariable prefix avoids this problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-07 10:16:25 -08:00
Leonardo de Moura
80e23f98c7
feat(kernel/environment): add environment extension objects, the environment can be extended with frontend specific objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-06 19:22:30 -08:00
Soonho Kong
044813615e
fix: add '#include <tuple>'
2013-11-03 13:00:42 -05:00
Leonardo de Moura
aa99ac6618
feat(kernel/value): allow semantic attachments to use coercions when being pretty printed
...
For example, this feature is useful when displaying the integer value 10 with coercions enabled. In this case, we want to display "nat_to_int 10" instead of "10".
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-30 11:42:26 -07:00
Leonardo de Moura
7fc87faa8f
feat(kernel): heterogeneous transitivity axiom, we need this axiom to be able to generate modular proofs in the rewriting engine module
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 17:07:30 -07:00
Leonardo de Moura
4dd6cead83
refactor(equality): make homogeneous equality the default equality
...
It was not a good idea to use heterogeneous equality as the default equality in Lean.
It creates the following problems.
- Heterogeneous equality does not propagate constraints in the elaborator.
For example, suppose that l has type (List Int), then the expression
l = nil
will not propagate the type (List Int) to nil.
- It is easy to write false. For example, suppose x has type Real, and the user
writes x = 0. This is equivalent to false, since 0 has type Nat. The elaborator cannot introduce
the coercion since x = 0 is a type correct expression.
Homogeneous equality does not suffer from the problems above.
We keep heterogeneous equality because it is useful for generating proof terms.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 16:20:06 -07:00
Leonardo de Moura
521fa1ddb8
style(kernel/metavar): add missing includes
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 03:00:43 -07:00
Leonardo de Moura
7c8daf8974
fix(kernel/metavar): make sure the justification and substitution are always matching each other
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 02:39:52 -07:00
Leonardo de Moura
2c6d4d2225
fix(kernel/normalizer): do not apply substitutions in the normalizer
...
It is incorrect to apply substitutions during normalization.
The problem is that we do not have support for tracking justifications in the normalizer. So, substitutions were being silently applied during normalization. Thus, the correctness of the conflict resolution in the elaboration was being affected.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-29 02:14:48 -07:00
Leonardo de Moura
dbefc91151
fix(kernel/metavar): add normalize assignment justification
...
We need that when we normalize the assignment in a metavariable environment.
That is, we replace metavariable in a substitution with other assignments.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-27 11:02:34 -07:00
Leonardo de Moura
92f5a31976
feat(kernel/expr): add new mk_app template for creating applications using a collection
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-27 08:53:58 -07:00
Leonardo de Moura
eaccdcb558
refactor(assumption_justification): move to the kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-26 14:21:29 -07:00
Leonardo de Moura
4bed9f85b0
feat(kernel/for_each): add option for disabling cache of atomic expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 15:25:17 -07:00
Leonardo de Moura
ce10bfeaf6
perf(kernel/metavar): improve performance of has_assigned_metavar by avoiding for_each+exception
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 15:19:59 -07:00
Leonardo de Moura
57d9d23bd4
feat(kernel/for_each): allow function F to interrupt for_each search
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 14:58:02 -07:00
Leonardo de Moura
2dd44bdf1a
perf(kernel/for_each): delay initialization of visited set
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 14:52:08 -07:00
Leonardo de Moura
c3c66b6c90
feat(make): add THREAD_SAFE build option
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 11:50:35 -07:00
Leonardo de Moura
471bbd4040
refactor(kernel/metavar): combine several splay_trees (at metavar_env) into a single one
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 11:02:19 -07:00
Leonardo de Moura
5e34f410b3
refactor(splay_map): modify splay_find signature
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 10:47:15 -07:00
Leonardo de Moura
5812dfcf44
perf(kernel/justification): remove cache from depends_on
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 10:26:05 -07:00
Leonardo de Moura
2b5c951de3
perf(name): add quick_cmp for hierarchical names
...
It first compare names using hash codes.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 09:58:06 -07:00
Leonardo de Moura
66f4834dbc
perf(kernel/metavar): add quick test that catches many cases
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 09:24:01 -07:00
Leonardo de Moura
f38178311c
perf(kernel/expr_eq): delay hashtable initialization
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 09:21:47 -07:00
Leonardo de Moura
412bc792c9
fix(style): missing include
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 08:10:28 -07:00
Leonardo de Moura
0c21f45292
fix(kernel/unification_constraint): memory leak
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-25 08:06:21 -07:00
Leonardo de Moura
a5c3829d1b
feat(kernel): add unexpected_metavar_occurrence exception
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 19:56:44 -07:00
Leonardo de Moura
ca6a6d71e5
fix(kernel/printer): bug when printing let expression
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 18:05:23 -07:00
Leonardo de Moura
872b698bc3
feat(elaborator): add option m_assume_injectivity for getting more concise solutions
...
We may miss solutions, but the solutions found are much more readable.
For example, without this option, for elaboration problem
Theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a c) = (h c a) :=
DisjCases H
(fun H1 : _,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1))
in CongrH AeqC (Symm AeqC))
(fun H1 : _,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1)
in CongrH AeqC (Symm AeqC))
the elaborator generates
Theorem Example4 (a b c d e : N) (H : a = b ∧ b = e ∧ b = c ∨ a = d ∧ d = c) : (h a c) = (h c a) :=
DisjCases
H
(λ H1 : if
Bool
(if Bool (a = b) (if Bool (if Bool (if Bool (b = e) (if Bool (b = c) ⊥ ⊤) ⊤) ⊥ ⊤) ⊥ ⊤) ⊤)
⊥
⊤,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 (Conjunct2 H1)) in CongrH AeqC (Symm AeqC))
(λ H1 : if Bool (if Bool (a = d) (if Bool (d = c) ⊥ ⊤) ⊤) ⊥ ⊤,
let AeqC := Trans (Conjunct1 H1) (Conjunct2 H1) in CongrH AeqC (Symm AeqC))
The solution is correct, but it is not very readable. The problem is that the elaborator expands the definitions of \/ and /\.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 16:47:50 -07:00
Leonardo de Moura
bbc265ded4
feat(frontends/lean): hook new elaborator in the default frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-24 15:14:29 -07:00
Leonardo de Moura
434c33f225
feat(metavar): automatically apply beta-reduction when instantiating metavariable applications (i.e., expressions of the form (?m a)), when the metavariable is a lambda
...
This feature is useful for problems that require higher-order matching and/or unification.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 16:35:50 -07:00
Leonardo de Moura
873e56844a
refactor(beta_reduction): add function apply_beta
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 16:03:52 -07:00
Leonardo de Moura
f1e0d6ec29
refactor(beta_reduction): move beta reduction functions to the kernel, delete reduce.cpp file and tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 15:44:26 -07:00
Leonardo de Moura
c1e451151a
feat(replace_visitor): add an abstract class for applying transformations on expressions
...
I also removed replace_using_ctx since it is subsumed by the new class.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 15:01:37 -07:00
Leonardo de Moura
13531b7d3e
refactor(kernel): rename trace to justification
...
Motivations:
- We have been writing several comments of the form "... trace/justification..." and "this trace object justify ...".
- Avoid confusion with util/trace.h
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 13:42:17 -07:00
Leonardo de Moura
17b48010b7
fix(unification_constraint): fix printer for max constraints
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 12:00:29 -07:00
Leonardo de Moura
274b11530f
feat(metavar): improve apply_local_context
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 11:59:36 -07:00
Leonardo de Moura
b57f492e2d
fix(kernel/printer): improve printer for Type expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-23 11:58:49 -07:00
Leonardo de Moura
891d22b3de
feat(kernel/context): add method for remove context entries at positions [s, s+n).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 15:52:24 -07:00
Leonardo de Moura
874f67c605
feat(normalizer): remove normalization rule t == t ==> true
...
This normalization rule is not really a computational rule.
It is essentially encoding the reflexivity axiom as computation.
It can also be abaused. For example, with this rule,
the following definition is valid:
Theorem Th : a = a := Refl b
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 14:02:48 -07:00
Leonardo de Moura
c3e87f106f
fix(kernel/trace): fix typo in depends_on
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:37 -07:00
Leonardo de Moura
183f5a1ccf
feat(elaborator): solve unification constraints
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
a1710aeeb9
feat(elaborator): add trace objects for elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
dc0e7a4472
feat(pos_info_provider): add position information provider for expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
8663ac550f
feat(kernel/trace): add function depends_on for trace objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
b1b49e86e7
test(elaborator): add simple test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
1548ffabb1
feat(elaborator): add new elaborator interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
827c65b5e9
feat(kernel): add static_assert for update_metavar
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
61ccaf741c
fix(frontend/lean): minor modification to be able to execute lean frontend while refactoring elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
7cf83800c0
refactor(metavar): implement metavar_env, and use unification_constraint and trace objects in the type_checker, light_checker
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
1f0eab7a14
test(type_checker): add new tests for type_checker trace objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
fc288929a2
feat(type_checker): add trace objects to justify constraints created by the type checker
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
5b1b03bafd
refactor(is_convertible): move from normalizer to type_checker class
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
85bfa45e6a
refactor(kernel_exception): delete kernel_exception_formatter, and implement kernel_exception pretty printer as a virtual method
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
d843d432d3
refactor(kernel): move printer and formatter objects to the kernel
...
The printer and formatter objects are not trusted code.
We moved them to the kernel to be able to provide them as an argument to the trace objects.
Another motivation is to eliminate the kernel_exception_formatter hack.
With the formatter in the kernel, we can implement the pretty printer for kernel exceptions as a virtual method.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
ddb90d3038
feat(kernel): add unification_constraint and trace objects to the kernel
...
Trace objects will be used to justify steps performed by engines such as the elaborator. We use them to implement non-chronological backtracking in the elaborator. They are also use to justify to the user why something did not work.
The unification constraints are in the kernel because the type checker may create them when type checking a term containing metavariables.
Remark: a minimalistic kernel does not need to include metavariables, unification constraints, nor trace objects. We include these objects in our kernel to minimize code duplication.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
59914a36f3
refactor(metavar): reorganize and simplify metavariables
...
- Use hierarchical names instead of unsigned integers to identify metavariables.
- Associate type with metavariable.
- Replace metavar_env with substitution.
- Rename meta_ctx --> local_ctx
- Rename meta_entry --> local_entry
- Disable old elaborator
- Rename unification_problems to unification_constraints
- Add metavar_generator
- Fix metavar unit tests
- Modify type checker to use metavar_generator
- Fix placeholder module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-22 08:15:36 -07:00
Leonardo de Moura
0783805671
feat(kernel): add weight to kernel definitions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-15 14:50:08 -07:00
Leonardo de Moura
aa5be3262f
fix(type_checker): fix inconsistent cache bug in type_checker, add tests that expose the problem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-10-01 19:23:55 -07:00
Soonho Kong
e3b762e909
feat(kernel): add static_assert to expr,expr_eq,replace
2013-10-01 16:47:36 -07:00
Soonho Kong
a832173f5f
feat(kernel/expr): add expr::operator() which takes 8 args
2013-10-01 00:19:30 -07:00
Leonardo de Moura
e5d312dc18
fix(kernel): the hash code of expressions was not being used to compare them
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-26 08:41:20 -07:00
Leonardo de Moura
98b4e09063
refactor(kernel): simplify expr_eq
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 22:09:08 -07:00
Leonardo de Moura
6477708d78
refactor(debug): improve lean_unreachable(), now we can avoid 'fake' return statements
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-25 21:27:20 -07:00
Leonardo de Moura
9f0dab1add
fix(kernel): add declarations for operator<<(std::ostream&, expr const&) and operator<<(std::ostream&, context const&) in the kernel
...
The actual implementation of these two operators is outside of the
kernel. They are implemented in the file 'library/printer.cpp'.
We declare them in the kernel to prevent the following problem.
Suppose there is a file 'foo.cpp' that does not include
'library/printer.h', but contains
expr a;
...
std::cout << a << "\n";
...
The compiler does not generate an error message. It silently uses the
operator bool() to coerce the expression into a Boolean. This produces
counter-intuitive behavior, and may confuse developers.
2013-09-25 17:45:54 -07:00
Leonardo de Moura
ba0528c298
Implement total order on expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-24 12:16:32 -07:00
Leonardo de Moura
46d6c41835
Fix bug in the type checker (when type checking terms with meta-variables).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 19:12:19 -07:00
Leonardo de Moura
1647e44510
Fix memory corruption bug
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 18:53:58 -07:00
Leonardo de Moura
16a6a54df1
Fix abuse of operator-> overload
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-22 16:41:51 -07:00
Leonardo de Moura
c847d27763
Improve higher order unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-21 00:41:49 -07:00
Leonardo de Moura
651c5d6751
Fix warnings and bugs related to unused variables.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 22:41:07 -07:00
Soonho Kong
ab6ca82e6f
Update to suppress unused-parameter warnings
2013-09-19 22:40:34 -07:00
Leonardo de Moura
80a1b96925
Remove duplicate solutions in the higher order matching module. Simplify solutions when higher-order matching is used, and we don't have a residue.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-19 18:59:28 -07:00
Leonardo de Moura
2f29ff70d7
Implement higher-order unification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-18 20:46:00 -07:00
Leonardo de Moura
ad901ce087
Use consistent naming conventions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 14:43:07 -07:00
Leonardo de Moura
3df6149daa
Add support for metavariables in the type checker.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 11:09:59 -07:00
Leonardo de Moura
9f9dcf9a29
Fix bug in the creation of children environments. Remove unnecessary function.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 07:37:33 -07:00
Leonardo de Moura
30b19c314a
Add basic support for metavariables at is_convertible. Swap is_convertible arguments to make it more intuitive.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 07:15:47 -07:00
Leonardo de Moura
a26c7d47f2
Add simplification to add_lift
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 03:14:02 -07:00
Leonardo de Moura
99e8d2feae
Add simplification rule to add_inst
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 02:57:28 -07:00
Leonardo de Moura
21c7a45f67
Relax definition of identity_stack. Fix printer for metavariable contexts.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 02:09:45 -07:00
Leonardo de Moura
d3bce584f4
Add support for new metavariable representation in the normalizer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-17 01:57:21 -07:00
Leonardo de Moura
da09e7217a
Cleanup meta_entry code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
99a163f11d
Simplify metavariable context. Now, we have only 'lift' and 'inst' instead of 'subst', 'lift' and 'lower'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
cad562a448
Add support for metavariables in the normalizer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
1be2a30c8c
Fix bug in normalizer. We must create a scope whenever we extend the value stack.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-16 19:32:28 -07:00
Leonardo de Moura
f79f046294
Add partial support for metavariables in the normalizer
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 21:23:50 -07:00
Leonardo de Moura
2800292947
Add timestamp to metavar_env
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 19:50:48 -07:00
Leonardo de Moura
5a4bc331d2
Make unification_problems a virtual class. Associate a 'standard' context with each metavariable in metavar_env
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 19:38:36 -07:00
Leonardo de Moura
63e102055e
Move metavariables to the kernel. This is the first step for implementing the new elaborator.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-15 12:09:01 -07:00
Soonho Kong
bc60b47295
Apply coding style
2013-09-13 18:48:09 -07:00
Leonardo de Moura
bcc3827a99
Modify Doxygen file to extract all elements even the undocumented ones. Disable warnings for undocumented entities. Add extra comments.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 13:46:22 -07:00
Leonardo de Moura
d54834279e
Use consistent coding style for if-then-else
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:57:40 -07:00
Leonardo de Moura
8c735f1daa
Use consistent coding style for spaces after ','
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:49:03 -07:00
Leonardo de Moura
2c68117adf
Tag TODOs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 12:25:21 -07:00
Leonardo de Moura
0c09e4524a
Use consistent names for import functions, and library files.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-13 08:58:34 -07:00
Soonho Kong
5c3866cd71
Use fullpath in #include directives, add missing STL headers
2013-09-13 03:35:29 -07:00
Leonardo de Moura
26097475fd
Use fullpath in #include directives.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-12 20:04:10 -07:00
Leonardo de Moura
572c7ced2a
Add #include<atomic> to expr.h. We need it when #define LEAN_THREAD_UNSAFE_REF_COUNT is used
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-11 19:48:55 -07:00
Leonardo de Moura
33c4b44b2b
Encapsulate context implementation. The current implementantion based on lists may be a performance problem in the future, and we should be able to change it without affecting the whole code base.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-07 11:15:11 -07:00
Leonardo de Moura
bab11b57ad
Move Symm and Trans back to basic_thms.cpp
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 23:49:35 -07:00
Leonardo de Moura
c674bb3790
Add castlib as an independent library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 23:40:47 -07:00
Leonardo de Moura
7a9d53d0d7
Refactor arith libraries
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 23:19:47 -07:00
Leonardo de Moura
b92bbeb83b
Add casting propagation and normalization
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 20:45:26 -07:00
Leonardo de Moura
c0c2f52087
Add Cast, DomInj and RanInj. Improve operator << for lean_frontend objects.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 18:32:15 -07:00
Leonardo de Moura
8840b37258
Fix type checker and elaborator for let expressions. Fix get_coercions (we need to pass the context). Fix pretty printer for def_type_mismatch_exception.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 11:02:00 -07:00
Leonardo de Moura
2459c4ae7c
Add (optional) type to let declarations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-06 10:06:26 -07:00
Leonardo de Moura
87d3961158
Improve elaborator error messages
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-04 16:36:58 -07:00
Leonardo de Moura
be7fa0932a
Add unicode name for the types: Nat, Int and Real
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-04 09:03:41 -07:00
Leonardo de Moura
d41160f8a5
Modify environment. Now, when a builtin value is declared, if it has a unicode alternative representation, then we add it as a definition. Now, everything that occurs in the environment has been 'declared'.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-04 08:53:00 -07:00
Leonardo de Moura
e955c054ca
Modify type checker. Now, it only accepts builtin values that have been declared in the environment. The idea is to be able to track which classes of builtin values have been used in a given environment. We want to be able to quantify the size of the trusted code base for a particular development.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-04 08:30:04 -07:00
Leonardo de Moura
887f696f66
Factor duplicate code. Add more comments
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-03 23:27:58 -07:00
Leonardo de Moura
fc9e395818
Define absolute value function and notation for it. Add new example.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-03 20:39:54 -07:00
Leonardo de Moura
3992c4b8f9
Define divides, and add examples
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-03 20:18:20 -07:00
Leonardo de Moura
544229e5d3
Create pp::unicode option. The idea is to be able to disable unicode characters, but still be able to use mixfix notation.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-03 10:11:45 -07:00
Leonardo de Moura
e031d7bc10
Improve error messages when overloads+coercions do not work
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 20:05:47 -07:00
Leonardo de Moura
fd44ec8d79
Improve application type mismatch error messages
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 18:28:12 -07:00
Leonardo de Moura
72188691de
Add hyperbolic functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 17:28:43 -07:00
Leonardo de Moura
4eaba93591
Add trigonometric functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 17:03:02 -07:00
Leonardo de Moura
395513258e
Define mod and unary minus
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 16:31:44 -07:00
Leonardo de Moura
b483d0dc45
Replace Int::sub and Real::sub with definitions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 16:31:30 -07:00
Leonardo de Moura
abc939382b
Add Real arithmetic. Fix elaborator for coercions. Now, two overloads are considered ambiguous if they need the same number of coercions. Improve pretty printer for nest infix operators with same precedence and associativity.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 13:20:00 -07:00
Leonardo de Moura
0a67679afb
Add natural numbers. Fix how coercions and overloads interact (switch to approach used in C++). Add notation for natural and integer arithmetic. Rename m and u universe variables to M and U.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 12:24:29 -07:00
Leonardo de Moura
7acf438bf4
Metavariables will not be part of the kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 09:36:04 -07:00
Leonardo de Moura
990f428a81
Remove virtual method kind from value class and subclasses. We can use dynamic_cast to achieve the same goal
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 09:35:10 -07:00
Leonardo de Moura
81d0203ee0
Replace macros TypeM, TypeU, Int, Bool, True and False with constant global expressions. The macros were producing counterintuitive behavior. For example, we had an enumeration type with an element called Int.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 09:11:53 -07:00
Leonardo de Moura
db88920f81
Rename normalize and type_check to normalizer and type_checker (using a consistent naming convention)
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-02 08:43:38 -07:00
Leonardo de Moura
42be7a4989
Add coercion declarations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-09-01 18:11:28 -07:00
Leonardo de Moura
51640ecff8
Move files in examples directory to tests directory. They are not real examples
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-31 19:16:30 -07:00
Leonardo de Moura
4a28a64685
Fix type checker for let expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-31 14:19:24 -07:00
Leonardo de Moura
4ef4655183
Add homogeneous equality
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-30 14:26:12 -07:00
Leonardo de Moura
682df7699d
Fix is_convertible propositions => type
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-30 01:24:06 -07:00
Leonardo de Moura
01e4b4b7fe
Add postprocessor functional object to the replace_fn template. Add unit-test that demonstrates how to build a replacer that builds a trace. The trace associates new expressions with the old ones that were used to create it.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-28 10:47:19 -07:00
Leonardo de Moura
7003f85213
Add implicit argument management to lean frontend.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-26 10:16:29 -07:00
Leonardo de Moura
25e47a8a2f
Add check_interrupted 'macro'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-25 11:03:09 -07:00
Leonardo de Moura
dc91a7adb8
Add Ctrl-C support for interrupting Lean shell.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-24 16:11:35 -07:00
Leonardo de Moura
f0edf2b4a3
Pretty print kernel exceptions. Improve default lean frontend error messages.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-24 13:16:43 -07:00
Leonardo de Moura
18a195029b
Refactor expression equality
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-23 09:42:49 -07:00
Leonardo de Moura
670dc5ad55
Add option to control maximum recursion depth in the expression normalizer
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
Conflicts:
src/tests/kernel/normalize.cpp
2013-08-23 09:42:49 -07:00
Leonardo de Moura
198fd46fc2
Track recursion depth at normalizer. Add fluid let template.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-23 09:42:49 -07:00
Leonardo de Moura
218b6ac8b7
Fix typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-23 09:42:49 -07:00
Leonardo de Moura
ce470f57db
Add set options to lean_parser. Add support for disabling unicode output. Use channels in lean_parser.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-21 12:42:55 -07:00
Leonardo de Moura
6f36611010
Fix clang++ error
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-20 20:16:02 -07:00
Leonardo de Moura
b2ba0618c9
Use normalizer object in type checker. The idea is to make sure the interruption is propagated to normalizer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-19 20:05:56 -07:00
Leonardo de Moura
88cc3dc20d
Add interrupt to normalizer. Fix tests (they were not using the basic printer).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-19 20:05:56 -07:00
Leonardo de Moura
b964edfb3e
Add interrupt method to type checker.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-19 20:05:56 -07:00
Leonardo de Moura
ce43c1cbae
Fix cup symbol. In Emacs, the unicode characters cup and cap are assigned incorrectly.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 18:43:31 -07:00
Leonardo de Moura
a46bf357b0
Fix bug in level.cpp. Add new example
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 18:37:47 -07:00
Leonardo de Moura
95cfac426d
Add parse_level. Fix bug at environment::is_ge
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 18:25:34 -07:00
Leonardo de Moura
676ebcca3d
Add parse_arrow
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 15:44:39 -07:00
Leonardo de Moura
afd62ced87
Add parse_let
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 15:25:20 -07:00
Leonardo de Moura
cdccca9316
Rename builtin operator if-then-else
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-18 11:02:29 -07:00
Leonardo de Moura
a6f36ba546
Improve formatter usage. Fix bug in object printer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-17 11:29:43 -07:00
Leonardo de Moura
b633c866e6
Expose environment API in the frontend object. Add support for formatting objects.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-17 10:55:42 -07:00
Leonardo de Moura
15c1c97873
Refactor frontend pretty printer
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
0fbfef8eb0
Remove sanitize_names from kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
e792e079e2
Add formatter API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
cbff5ea856
Cleanup
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
111cdd4e62
Remove pretty printer from kernel. Add basic printing capability to exprlib module.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
519a290f32
Refactor kernel objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 20:40:39 -07:00
Leonardo de Moura
c41b3dc4d8
Add kernel_exceptions. The idea is to avoid expression formatting in the kernel. It also allows different frontends to display the error messages is a different way.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 12:51:12 -07:00
Leonardo de Moura
1038f7346e
Refine initialization order. Polish Universe command pretty printer.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 09:30:08 -07:00
Leonardo de Moura
abab4b667a
Define implies using ite operator. Rename mk_bin_op to mk_bin_rop (it is using right associativity). Add mk_bin_lop (for left assoc).
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-08-16 09:04:59 -07:00
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