Commit graph

493 commits

Author SHA1 Message Date
Leonardo de Moura
33193e1ab3 feat(library/simplifier): improve contextual simplifications
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-23 12:54:29 -08:00
Leonardo de Moura
66553268d0 feat(builtin/kernel): add skolem_th, we need it to justify skolemization preprocessing step
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 09:41:07 -08:00
Leonardo de Moura
d9b5ebc738 refactor(builtin/kernel): cleanup Hilbert operator definition
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 09:18:40 -08:00
Leonardo de Moura
94a3136904 feat(builtin/kernel): add Hilbert's operator, and derive axiom of choice using it
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 08:21:11 -08:00
Leonardo de Moura
029d74ec11 chore(kernel): remove comment, we decided to have Eta as a simplification rule
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 14:35:05 -08:00
Leonardo de Moura
95b6e61738 feat(kernel/max_sharing): check for imminent stack overflows and interruptions in the expression sharing maximizer
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 14:33:49 -08:00
Leonardo de Moura
2089b85532 refactor(kernel/instantiate): remove code duplication
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 14:30:38 -08:00
Leonardo de Moura
7299b2d5d6 chore(kernel): remove dead file
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 14:21:13 -08:00
Leonardo de Moura
6bcd8e3ee5 fix(library/expr_lt): use expression depth instead of size to obtain a monotonic total order on terms
It is not incorrect to use size, but it can easily overflow due to sharing.
The following script demonstrates the problem:

local f = Const("f")
local a = Const("a")
function mk_shared(d)
   if d == 0 then
      return a
   else
      local c = mk_shared(d-1)
      return f(c, c)
   end
end
print(mk_shared(33):size())

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 17:40:49 -08:00
Leonardo de Moura
217e56ea03 feat(kernel/expr): make sure semantic attachments are smaller than other kinds of expression
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 14:10:44 -08:00
Leonardo de Moura
5060bdbf14 fix(kernel/expr): compilation warning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 13:12:49 -08:00
Leonardo de Moura
ac9f8f340d feat(kernel/expr): add efficient get_size() function for expressions
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 12:28:37 -08:00
Leonardo de Moura
69d7ee316f feat(library/simplifier): improve simplification by evaluation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 23:26:34 -08:00
Leonardo de Moura
6db10c577b feat(builtin/kernel): add proof irrelevance axiom
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 12:20:09 -08:00
Leonardo de Moura
475df3d94e chore(builtin/kernel): add theorem for rewriter/simplifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 10:34:18 -08:00
Leonardo de Moura
39c3b17eb7 feat(library/simplifier): add support for Eta-reduction in the simplifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 00:40:35 -08:00
Leonardo de Moura
27ab49ae9d feat(library/simplifier): bottom-up simplifier skeleton
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 12:49:41 -08:00
Leonardo de Moura
5bee259a00 refactor(kernel): remove unnecessary universe
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-16 18:06:25 -08:00
Leonardo de Moura
a43020b31b refactor(kernel): remove heterogeneous equality
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-16 17:39:12 -08:00
Leonardo de Moura
1da4294793 refactor(builtin): more theorems, fix iff notation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-16 09:26:50 -08:00
Leonardo de Moura
4dc98bc73b refactor(builtin/kernel): use iff instead of = for Booleans
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-16 02:05:09 -08:00
Leonardo de Moura
14c6218bdc chore(kernel): file name convention
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 20:06:29 -08:00
Leonardo de Moura
7fb0aa4800 chore(kernel/expr): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 17:24:31 -08:00
Leonardo de Moura
c096eec1d6 chore(kernel/expr): remove dead code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 17:09:04 -08:00
Leonardo de Moura
8c2f78a756 feat(builtin): minimize use of heterogenous equality in the kernel, add simpler version of congruence theorems for non-dependent types
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 16:34:23 -08:00
Leonardo de Moura
3daac17ea8 feat(library/simplifier): convert disequalities (a ≠ b) into equations '(a = b) = false'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 15:30:16 -08:00
Leonardo de Moura
94fa987814 fix(kernel/type_checker): is_proposition method was still assuming that a Pi never has type Bool
The method is_proposition was using an optimization that became incorrect after  we identified Pi and forall.
It was assuming that any Pi expression is not a proposition.
This is not true anymore. Now, (Pi x : A, B) is a proposition if B is a proposition.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-15 11:02:52 -08:00
Leonardo de Moura
7c2a4211a8 feat(kernel): expose imported predicate
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-14 16:41:40 -08:00
Leonardo de Moura
07059b0531 feat(library): add if_then_else Lean/C++ interface
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-14 16:10:49 -08:00
Leonardo de Moura
acfb11e290 fix(kernel/instantiate): relax apply_beta pre-condition
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-14 14:36:51 -08:00
Leonardo de Moura
a968a43487 fix(kernel/free_vars): make sure has_free_var does not return incorrect result due to arithmetic overflows
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-14 14:36:14 -08:00
Leonardo de Moura
f8eaae7218 feat(builtin/kernel): add new useful theorems for the simplifier
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-13 18:21:22 -08:00
Leonardo de Moura
ccb9faf065 refactor(*): error messages
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-13 16:54:21 -08:00
Leonardo de Moura
e6c322d97f feat(kernel/free_vars): make free_vars module functions more robust
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-12 17:44:28 -08:00
Leonardo de Moura
5d9a95addd refactor(kernel/free_vars): replace max_free_var with relaxed free_var_range
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-12 17:06:57 -08:00
Leonardo de Moura
4d9eb4ac6c feat(kernel): add max_free_var function
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-12 16:45:34 -08:00
Leonardo de Moura
781720a26a feat(builtin/kernel): add left_comm theorem
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-11 18:08:08 -08:00
Leonardo de Moura
a1a467a65f refactor(builtin): move congruence theorems to kernel/if_then_else modules
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-11 13:48:28 -08:00
Leonardo de Moura
53537d0684 feat(builtin/kernel): 'implication' simplification theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-11 13:35:20 -08:00
Leonardo de Moura
50f281b430 feat(builtin/kernel): add eqf_intro and eqf_elim theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-11 11:13:54 -08:00
Leonardo de Moura
d4a7d796a5 feat(builtin): prove strong induction theorem, add < theorems
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-10 18:46:33 -08:00
Leonardo de Moura
411f14415d feat(builtin): automatically generate Lean/C++ interface for builtin theories
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 18:09:53 -08:00
Leonardo de Moura
2179e57db3 refactor(builtin): move if_then_else to its own module
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 14:08:39 -08:00
Leonardo de Moura
fdeb457a81 feat(kernel/pos_info_provider): add support for file names in pos_info_provider
The idea is to include the file name when displaying justification objects.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 12:19:30 -08:00
Leonardo de Moura
57c0006916 chore(*): cleanup lean builtin symbols, replace :: with _
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-09 08:33:52 -08:00
Leonardo de Moura
e42b616438 fix(kernel/normalizer): equality between semantic attachments
Given a heterogenous equality:  a == b
The normalizer will only reduce it if a and b are objects of the same kind.
Now, 1 == true is not reduced to false anymore.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 19:10:30 -08:00
Leonardo de Moura
8e9d88c2cf refactor(builtin/kernel): prove iff::intro, and add a new name for it boolext (Boolean extensionality)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 18:31:45 -08:00
Leonardo de Moura
a4b3d6d6c8 refactor(builtin/kernel): prove eta using function extensionality, and rename abst and abstpi to funext and allext
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 17:25:14 -08:00
Leonardo de Moura
2b2aa228e3 refactor(builtin/kernel): start with small universes
The universe constraint manager is more flexible now.
We don't need to start with a huge universe  U >= 512.
We can start small, and increase it on demand.

If module mod1 needs it, it can always add

   universe U >= 3

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 12:35:00 -08:00
Leonardo de Moura
85de05e5cf chore(kernel/unification_constraint): update max_constraint comment to reflect its new semantics
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 01:09:47 -08:00