Leonardo de Moura
4b4b5e3345
fix(frontends/lean): import explicit versions when using the command 'using'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 17:33:58 -08:00
Leonardo de Moura
ea06bb2885
feat(frontends/lean/pp): change how lift local entries are pretty printed
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 17:26:38 -08:00
Leonardo de Moura
a51139e63b
feat(frontends/lean): position information in error messages
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 17:26:38 -08:00
Leonardo de Moura
e85b1f1ac0
feat(library/elaborator): expose elaborator configuration options
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 17:26:38 -08:00
Leonardo de Moura
e4579b93e4
fix(library/elaborator): try first projection before imitation in the higher-order unifier
...
Projections build more general solutions. This commit also adds a test that demonstrates the issue. Before this commit, the elaborator would produce the "constant" predicate (fun x, a + b = b + a).
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 13:35:05 -08:00
Leonardo de Moura
ef321e730f
feat(builtin/tactic): add the 'skip' (bogus) tactic for ignoring a proof hole in a big proof
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 12:47:23 -08:00
Leonardo de Moura
581ae0c83b
chore(build): fix build dependencies
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 09:30:33 -08:00
Leonardo de Moura
db3bcdba55
refactor(builtin): move pair definition and theorems to pair.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 09:20:52 -08:00
Leonardo de Moura
daf7075ce4
refactor(builtin/sum): use new 'have' expression to formalize optional-types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 09:15:12 -08:00
Leonardo de Moura
5d698a60a7
refactor(builtin/sum): use new 'have' expression to formalize sum-types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 08:59:05 -08:00
Leonardo de Moura
1d23d93e60
feat(frontends/lean): new 'have' expression
...
Add 'have' notation suggested by Jeremy Avigad.
Add his example to the test suite.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 08:03:59 -08:00
Leonardo de Moura
ba9a8f9d98
feat(frontends/lean): add 'show' expression syntax sugar
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 07:50:22 -08:00
Leonardo de Moura
90f5a4f813
feat(builtin/sum): cleanup, and avoid unicode character that is not available in some platforms
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-06 00:20:49 -08:00
Leonardo de Moura
c01f82aeb7
feat(builtin): add sum types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-05 23:04:44 -08:00
Leonardo de Moura
87da23649b
feat(builtin/optional): prove dichotomy and induction theorems for optional types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-05 19:49:50 -08:00
Leonardo de Moura
30570c843f
feat(builtin): add optional type
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-05 17:33:06 -08:00
Leonardo de Moura
aec9c84d0d
fix(util/lua): deadlock
...
Errors in the Lua library produce longjmps.
The longjmp will not unwind the C++ stack.
In the new test, the lock was not being released, and the system was deadlocking in the next call that tried to lock the environment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 15:16:29 -08:00
Leonardo de Moura
f4ec874c6e
refactor(builtin): remove dead module heq
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 14:42:28 -08:00
Leonardo de Moura
0283887ee9
refactor(builtin/kernel): move the heq axioms into kernel.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 14:17:34 -08:00
Leonardo de Moura
493007b7bc
fix(frontends/lean/pp): bug in tuple/pair pretty printing
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 13:58:01 -08:00
Leonardo de Moura
f03c09c10b
feat(library/elaborator): add support for proj/pair/sigma in the the higher-order unification procedure
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 13:53:30 -08:00
Leonardo de Moura
c9b72df34b
fix(frontends/lean/parser): bug when applying tactics to synthesize remaining meta-variables
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 11:36:26 -08:00
Leonardo de Moura
9dc86e3cf5
fix(builtin/kernel): rename generalized proof_irrel axiom to hproof_irrel, and derive the restricted one
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 10:06:29 -08:00
Leonardo de Moura
9a677331da
feat(builtin): simulate subtypes using sigma types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-04 01:46:50 -08:00
Leonardo de Moura
61d0c792ff
fix(frontends/lean/parser): bug in tuple/proj1/proj2
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 22:46:29 -08:00
Leonardo de Moura
4fcc292332
feat(frontends/lean): parse and pretty print pair/tuple projection operators proj1 and proj2, fix bug in the type checker
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 22:10:01 -08:00
Leonardo de Moura
cc96b50644
feat(frontends/lean): support for nary-tuples, improve notation for non-dependent tuples, add support in the elaborator for sigma types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 20:53:11 -08:00
Leonardo de Moura
5c991f8fbf
feat(frontends/lean): parse and pretty print tuples/pairs
...
This commit also fixes a bug in the type checker when processing dependent pairs.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 20:10:30 -08:00
Leonardo de Moura
5e5ab1429d
feat(frontends/lean): parse and pretty print sigma types
...
This commit also fixes some bugs in the implementation of Sigma types.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 18:16:00 -08:00
Leonardo de Moura
8eec289ce1
feat(kernel): add dependent pairs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-03 16:52:49 -08:00
Leonardo de Moura
6be50f0133
refactor(builtin/heq): merge cast and heq modules
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-02 15:01:48 -08:00
Leonardo de Moura
c56df132b8
refactor(kernel): remove semantic attachments from the kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-02 14:48:27 -08:00
Leonardo de Moura
e3dc552c39
fix(library/simplifier): nontermination
...
The example tests/lua/simp1.lua demonstrates the issue.
The higher-order matcher matches closed terms that are definitionally equal.
So, given a definition
definition a := 1
it will match 'a' with '1' since they are definitionally equal.
Then, if we have a theorem
theorem a_eq_1 : a = 1
as a rewrite rule, it was triggering the following infinite loop when simplifying the expression "a"
a --> 1 --> 1 --> 1 ...
The first simplification is expected. The other ones are not.
The problem is that "1" is definitionally equal to "a", and they match.
The rewrite_rule_set manager accepts the rule a --> 1 since the left-hand-side does not occur in the right-hand-side.
To avoid this loop, we test if the new expression is not equal to the previous one.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-31 15:55:21 -08:00
Leonardo de Moura
1d85267d26
fix(library/simplifier): assumptions/context may contain equations where the left-hand-side is a metavariable or semantic attachment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-31 15:38:22 -08:00
Leonardo de Moura
110ca84984
feat(library/simplifier): allow the user to associate a simplifier monitor with the lua_State object
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-31 13:49:24 -08:00
Leonardo de Moura
0ed35e2133
fix(build): kernel.lean depends on tactic.lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 23:15:44 -08:00
Leonardo de Moura
2aaded261e
fix(kernel/environment): imported predicate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 23:02:19 -08:00
Leonardo de Moura
bc2d504ccc
feat(builtin/kernel): add rewrite rules for if-then-else
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 22:38:35 -08:00
Leonardo de Moura
b444756d20
fix(library/simplifier): missing condition in implication simplification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 22:14:01 -08:00
Leonardo de Moura
4d533c6a25
feat(builtin/kernel): add nonempty_range theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 22:13:34 -08:00
Leonardo de Moura
ddaf948c72
feat(builtin/kernel): add nonempty_fun theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 19:38:51 -08:00
Leonardo de Moura
759aa61f70
refactor(builtin/kernel): define if-then-else using Hilbert's operator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 19:28:42 -08:00
Leonardo de Moura
b45ab9dc30
feat(library/elaborator): use equality constraints instead of convertability constraints on definitions
...
Convertability constraints are harder to solve than equality constraints, and it seems they don't buy us anything definitions. They are just increasing the search space for the elaborator.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 14:13:21 -08:00
Leonardo de Moura
8c1f6b9055
fix(kernel/typechecker): allow elaborator to infer (Type U+1)
...
In the new test elab8.lean, the parameter B is in (Type U+1).
Before, this commit, the type checker was forcing all metavariables that must be types to be <= (Type U). This restriction was preventing the elaborator from succeeding in reasonable cases.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-30 14:00:01 -08:00
Leonardo de Moura
41f5e2a067
feat(library/simplifier): statically check (conditional) equations (aka rewrite rules) to verify whether we can skip type checking when using them in the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 18:32:40 -08:00
Leonardo de Moura
01259b1e84
feat(kernel): make sure U is the maximal universe
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 16:31:00 -08:00
Leonardo de Moura
ea6bf224e5
feat(frontends/lean): make the parser accept (Type -> ...)
...
Before this commit, the parser would accept only a universe level or a ')' after '(' 'Type'
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 15:23:20 -08:00
Leonardo de Moura
4f3127d3d5
fix(library/simplifier): check if the given types are convertible to ceq expected types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 15:15:55 -08:00
Leonardo de Moura
a19f9d4846
feat(library/simplifier): discard conditional equations that are clearly non-terminating
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 13:56:45 -08:00
Leonardo de Moura
dd6aae378f
fix(library/simplifier): must use metavar_env in is_ceq, otherwise it may ceqs that contain metavariables
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 13:29:20 -08:00
Leonardo de Moura
4dc3aa46c3
feat(frontends/lean): allow tactics to be used in axiom/variable declarations and in the type of definitions/theorems; add a new test showing the need for this feature
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 12:02:12 -08:00
Leonardo de Moura
069e5edf6b
fix(library/simplifier): include flag indicating if the proof generated by simplifier is a homogenous or heterogenous equality, use flag to fix bug in the simp_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 12:01:01 -08:00
Leonardo de Moura
f0a2d3627e
refactor(frontends/lean): use ascii prefix for auxiliary let-declarations
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 11:58:09 -08:00
Leonardo de Moura
92ba4e8b2d
feat(library/simplifier): add support for metavariables in conditional rewrite rules
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 08:34:04 -08:00
Leonardo de Moura
f101554e93
fix(util/script_exception): make sure a script_nested_exception may have a nested script_nested_exception, use LEAN_THREAD_LOCAL macro instead of thread_local
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-29 08:07:52 -08:00
Leonardo de Moura
24452289dd
feat(library/simplifier): make sure the simplifier can handle meta-variables
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 20:30:47 -08:00
Leonardo de Moura
ee4344076e
feat(library/simplifier): improve error message when simplifier is looping
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 19:36:31 -08:00
Leonardo de Moura
b6985bd713
feat(builtin/kernel): add another rewrite rule
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 15:56:26 -08:00
Leonardo de Moura
e2540b68db
fix(src/builtin/tactic): add default rule set if none is provided
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 15:56:01 -08:00
Leonardo de Moura
7f53cb9601
feat(frontends/lean/parser): add_rewrite take the 'using' command into account
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 01:15:28 -08:00
Leonardo de Moura
b31ef34787
feat(library/simplifier): preserve binder names when applying higher-order rewrite rules
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 00:50:27 -08:00
Leonardo de Moura
6da1b447f0
fix(library/hop_match): do not match iff with =
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-28 00:21:05 -08:00
Leonardo de Moura
dbdbd211e3
fix(library/simplifier): compilation warning
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 23:29:53 -08:00
Leonardo de Moura
55fde28954
feat(kernel/type_checker): optionally provide metavariable environment in the methods: is_definitionally_equal, is_convertible and ensure_pi
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 17:47:03 -08:00
Leonardo de Moura
160dc71cb5
refactor(kernel/type_checker): use read-only metavariable environment in methods that do not require write access to the metavariable environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 17:38:06 -08:00
Leonardo de Moura
05b4d8411b
refactor(kernel/normalizer): normalizer only needs read access to metavariable environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 17:03:36 -08:00
Leonardo de Moura
3b152d1a9e
refactor(kernel): use ro_metavar_env instead of metavar_env in places where we only need to read the metavariable environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 16:44:43 -08:00
Leonardo de Moura
8bccfb947a
feat(library/simplifier): expose simplier and simplifier_monitor objects in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 15:02:05 -08:00
Leonardo de Moura
c088825ef0
feat(library/simplifier): add simplifier_monitor interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 11:46:28 -08:00
Leonardo de Moura
b26035fcf6
feat(kernel/type_checker): improve application type mismatch error messages
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-27 09:45:17 -08:00
Leonardo de Moura
579b751e01
fix(library/simplifier): compilation warning
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 23:16:24 -08:00
Leonardo de Moura
ceff335bb8
doc(doc/lean/tutorial): update tutorial
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 22:58:44 -08:00
Leonardo de Moura
4d25cb7f47
feat(library/tactic): add simplify_tactic based on the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 18:53:18 -08:00
Leonardo de Moura
5e6c1d4904
refactor(builtin/heq): remove axiom hpiext since we don't use it anymore
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 13:11:17 -08:00
Leonardo de Moura
50df761d90
refactor(library/simplifier): remove the is_typem hack, it is not needed anymore now that we don't use hpiext anymore
...
Now, we are again using the following invariant for simplifier_fn::result
The type of in the equality of the result is definitionally equal to the
type of the resultant expression.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 12:21:23 -08:00
Leonardo de Moura
29e448f034
fix(library/simplifier): remove support in the simplifier for (forall x : A, B x) when it is not a proposition, the problem is that hpiext axiom produces an equality in a too big universe
...
For example, in the hpiext axiom, the resultant equality if for (Type M+1)
axiom hpiext {A A' : TypeM} {B : A -> TypeM} {B' : A' -> TypeM} :
A = A' -> (∀ x x', x == x' -> B x = B' x') -> (∀ x, B x) = (∀ x, B' x)
even if the actual arguments A, A’, B, B’ "live" in a much smaller universe (e.g., Type).
So, it would be great if we could move the resultant equality back to the right universe.
I don't see how to do it right now.
The other solution would require a major rewrite of the code base.
We would have to support universe level arguments like Agda, and write the axiom hpiext as:
axiom hpiext {l : level} {A A' : (Type l)} {B : A -> (Type l)} {B' : A' -> (Type l)} :
A = A' -> (∀ x x', x == x' -> B x = B' x') -> (∀ x, B x) = (∀ x, B' x)
This is the first instance I found where it is really handy to have this feature.
I think this would be a super clean solution, but it would require a big rewrite in the code base.
Another problem is that the actual semantics that Agda has for this kind of construction is not clear to me.
For instance, sometimes Agda reports that the type of an expression is (Set omega).
An easier to implement hack is to support "axiom templates".
We create instances of hipext "on-demand" for different universe levels.
This is essentially what Coq does, since the universe levels are implicit in Coq.
This is not as clean as the Agda approach, but it is much easier to implement.
A super dirty trick is to include some instances of hpiext for commonly used universes
(e.g., Type and (Type 1)).
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 12:10:34 -08:00
Leonardo de Moura
52ee9b35dd
feat(library/simplifier): add support for simplifying even when heq module is not available
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 11:29:36 -08:00
Leonardo de Moura
fafaa7e78e
fix(library/simplifier): remove hack for handling some constants that expect an argument of type TypeU, the new approach is general
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 10:10:57 -08:00
Leonardo de Moura
89bb5fbf19
chore(library/simplifier): fix style
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 00:36:17 -08:00
Leonardo de Moura
844572c382
feat(library/simplifier): support for dependent simplification in Pi/forall expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-26 00:32:05 -08:00
Leonardo de Moura
e8bba1ebf3
fix(frontends/lean/frontend): the definition of the explicit version @f must be definitionally equal to f
...
Before this commit, the explicit version @f of a constant f with implicit arguments as not definitionally equal to f.
For example, if we had
variable f {A : Type} : A -> Bool
Then, the definition of @f was
definition @f (A : Type) (a : A) : Bool := f A a
This definition is equivalent to
fun A a, f A a
which is not definitionally equal to
f
since definitionally equality in Lean ignores Eta conversion.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-25 20:34:28 -08:00
Leonardo de Moura
6bc1537e25
feat(frontends/lean/parser): allow the user to write (Type) without providing a level
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-25 20:17:36 -08:00
Leonardo de Moura
9fb3ccb4c0
feat(library/simplifier): support for dependent simplification in lambda expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-25 16:54:42 -08:00
Leonardo de Moura
7015089734
fix(library/simplifier): move to locally nameless approach in the simplifier. Contextual simplification may add rewriting rules with free variables, and it is a mess to manage them when using de Bruijn indices
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-25 10:49:44 -08:00
Leonardo de Moura
df3129e80d
fix(library/hop_match): typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-25 10:08:53 -08:00
Leonardo de Moura
7a4eb4b8ed
feat(library/simplifier): contextual simplification for A -> B
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 22:32:55 -08:00
Leonardo de Moura
c2381e43f1
fix(library/simplifier): bug in cast elimination
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 21:25:09 -08:00
Leonardo de Moura
2bb33c55fe
feat(builtin/kernel): add more theorems useful for simplification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 18:52:50 -08:00
Leonardo de Moura
8f455f5965
fix(frontends/lean): bug in scope construct
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 17:23:29 -08:00
Leonardo de Moura
7f3e2b3ef4
fix(frontends/lean/parser): bug in 'using' construct
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 17:09:46 -08:00
Leonardo de Moura
8e0888828d
fix(library/simplifier): missing check in mk_hcongr_th
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 17:09:46 -08:00
Leonardo de Moura
26bea77721
fix(library/simplifier): bug in heterogeneous equality support, and universe commutativity support in the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 17:09:46 -08:00
Leonardo de Moura
009217b499
feat(builtin/hep): replace hallext axiom with theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-24 17:09:20 -08:00
Leonardo de Moura
dbc100cc2e
feat(library/simplifier): cast elimination in the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-23 17:28:14 -08:00
Leonardo de Moura
180be5c4a2
feat(library/simplifier): improve contextual simplifications
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-23 13:11:58 -08:00
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
d6692264e8
feat(library/simplifier): contextual simplifications
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-23 12:23:22 -08:00
Leonardo de Moura
1638a7bb02
fix(frontends/lean/pp): compute local shared nodes, and avoid unnecessary let's
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 21:44:24 -08:00
Leonardo de Moura
17cce340f6
fix(library/elaborator): in optimization for metavariable free terms
...
The optimization was incorrect if the term indirectly contained a metavariable.
It could happen if the term contained a free variable that was assigned in the context to a term containing a metavariable.
This commit also adds a new test that exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 18:06:00 -08:00
Leonardo de Moura
8214c7add4
feat(library/elaborator): compensate the lack of eta-reduction (and eta-expanded normal forms) in the kernel normalizer
...
Before this commit, the elaborator was solving constraints of the form
ctx |- (?m x) == (f x)
as
?m <- (fun x : A, f x) where A is the domain of f.
In our kernel, the terms f and (fun x, f x) are not definitionally equal.
So, the solution above is not the only one. Another possible solution is
?m <- f
Depending of the circumstances we want ?m <- (fun x : A, f x) OR ?m <- f.
For example, when Lean is elaborating the eta-theorem in kernel.lean, the first solution should be used:
?m <- (fun x : A, f x)
When we are elaborating the axiom_of_choice theorem, we need to use the second one:
?m <- f
Of course, we can always provide the parameters explicitly and bypass the elaborator.
However, this goes against the idea that the elaborator can do mechanical steps for us.
This commit addresses this issue by creating a case-split
?m <- (fun x : A, f x)
OR
?m <- f
Another solution is to implement eta-expanded normal forms in the Kernel.
With this change, we were able to cleanup the following "hacks" in kernel.lean:
@eps_ax A (nonempty_ex_intro H) P w Hw
@axiom_of_choice A B P H
where we had to explicitly provided the implicit arguments
This commit also improves the imitation step for Pi-terms that are actually arrows.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 13:28:54 -08:00
Leonardo de Moura
6cb4d165c9
feat(builtin/kernel): dependent version of axiom of choice
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 11:04:27 -08:00
Leonardo de Moura
88b6778a1f
fix(emacs): syntax highlight
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 09:44:12 -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
bcf60db23b
fix(builtin/kernel): Hilbert operator only for non-empty types
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-22 08:52:31 -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
425d31f513
chore(library/simplifier): fix style warning
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 21:45:55 -08:00
Leonardo de Moura
cca15f1390
feat(library/simplifier): congruence theorem compilation
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 21:16:23 -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
fbaf6e887f
refactor(builtin/kernel): put the congruence theorems in a format that is easier for the simplifier to process
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 14:03:51 -08:00
Leonardo de Moura
ead54bbf57
feat(library/simplifier): enforce max_steps option
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-21 12:12:17 -08:00
Leonardo de Moura
1ccfac5873
feat(library/simplifier): conditional rewriting
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 21:15:46 -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
cd19d4da01
feat(library/simplifier): memoize intermediate results
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 17:03:44 -08:00
Leonardo de Moura
97ead50a3e
feat(builtin/Nat): flip orientation of associativity axioms for + and *
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 15:38:00 -08:00
Leonardo de Moura
ad219d43d9
refactor(*): semantic attachment parsing and simplification
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 14:44:45 -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
abfeacb8f0
fix(tests/library/expr_lt): adjust is_lt unit tests to reflect recent modifications
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 13:44:44 -08:00
Leonardo de Moura
56f5657ee7
fix(library/simplifier): ordered rewriting
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 13:13:16 -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
6a63ef3bc5
feat(library/expr_lt): make sure the total order on terms is monotonic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 13:07:18 -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
913d893204
feat(library/simplifier): add support for 'permutation' rewrite rules
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-20 08:29:31 -08:00
Leonardo de Moura
8e90d17a0b
fix(library/hop_match): style
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 23:28:12 -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
08053c1172
feat(library/hop_match): make the higher order pattern matcher slightly stronger
...
It now can handle (?m t) where t is not a locally bound variable, but ?m and all free variables in t are assigned.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 20:35:50 -08:00
Leonardo de Moura
90ffb9d5ec
fix(frontends/lean/pp): bug in pp_abstraction_core
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 19:47:40 -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
d322f63113
feat(frontends/lea): add commands for creating and managing rewrite rule sets
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 12:03:59 -08:00
Leonardo de Moura
bbf6e6a256
feat(builtin/kernel): create default rule set in the kernel, and adjust unit tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 11:24:20 -08:00
Leonardo de Moura
3bbadddc94
chore(library/simplifier): cleanup and add comments
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 10:54:09 -08:00
Leonardo de Moura
7492fd5a2c
feat(library/simplifier): add support for simplification by evaluation
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 10:34:55 -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
e512241c8f
fix(emacs): missing keyword
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 10:32:45 -08:00
Leonardo de Moura
11719713ec
feat(library/hop_match): optionally unfold constants when performing higher order matching
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 10:32:06 -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
ed009f4c88
feat(kernel/simplifier): add support for Beta-reduction in the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-19 00:40:20 -08:00
Leonardo de Moura
7a3aab60c6
chore(builtin/kernel): remove \bowtie as notation for transitivity
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 21:11:12 -08:00
Leonardo de Moura
2753a0ffc0
fix(builtin/kernel): add ascii notation for transitivity
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 20:56:35 -08:00
Leonardo de Moura
32c5bc25e3
refactor(library/simplifier): cleanup rewrite_rule_set, and use it in the simplifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 20:52:33 -08:00
Leonardo de Moura
466285c577
refactor(library/simplifier): rewriter_rule_set
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 17:26:01 -08:00
Leonardo de Moura
feea96e84d
feat(library/simplifier): add rewrite_rule_set extension for managing rewrite rules in an environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 15:43:24 -08:00
Leonardo de Moura
eae79877ae
feat(library/simplifier): add rewrite_rule_set
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-18 12:50:46 -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
40b7ed13c2
fix(tests/lean): adjust tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-17 19:27:32 -08:00
Leonardo de Moura
534838a36c
chore(build): update automatically generated files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-17 18:30:45 -08:00
Leonardo de Moura
d711ca4d1b
feat(builtin/heq): add heq C++/Lean interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-17 18:30:21 -08:00