Leonardo de Moura
a8bc9fb4e0
refactor(builtin/kernel): mark exists as opaque after proving key theorems
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 11:00:32 -08:00
Leonardo de Moura
cbd1f98365
fix(library/elaborator): bug at method process_metavar_inst, add new test that exposed the bug
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-01 03:02:41 -08:00
Leonardo de Moura
cd3bbb1ebf
fix(kernel/builtin): enforcing design decision: semantic attachments are NOT simplifiers, they should do only evaluation
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-31 10:14:17 -08:00
Leonardo de Moura
390a78a8d2
chore(frontends/lean/parser): remove 'Skipped' message
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 15:35:12 -08:00
Leonardo de Moura
08718e33dc
refactor(builtin): only load the kernel and natural numbers by default
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 13:35:37 -08:00
Leonardo de Moura
ecd62a1783
refactor(builtin/basic): rename basic.lean to kernel.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:46:03 -08:00
Leonardo de Moura
4401b390fe
refactor(library/arith): do not load specialfn by default
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:25:43 -08:00
Leonardo de Moura
46a8300a2d
refactor(library/arith): move real and special function declarations to .lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:02:22 -08:00
Leonardo de Moura
c3bc6afb12
refactor(library/arith): move int and nat declarations to .lean files.
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 10:32:14 -08:00
Leonardo de Moura
15621610e9
refactor(library/arith): replace Nat, Int, Real with simple variable decls instead of semantic attachments
...
This commit also fixes bugs in the Alias command.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 17:04:36 -08:00
Leonardo de Moura
a1a5fb101d
feat(frontends/lean): add Alias command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 16:25:45 -08:00
Leonardo de Moura
dfe46b9d25
refactor(kernel/builtin): move definition and axioms to basic.lean
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 14:01:30 -08:00
Leonardo de Moura
f8b82d854e
feat(builtin/basic): add TypeM alias
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 13:03:32 -08:00
Leonardo de Moura
411ebbc3c1
refactor(library/basic_thms): move the proof of all basic theorems to a .Lean file
...
This commit also adds several new theorems that are useful for implementing the simplifier.
TODO: perhaps we should remove the declarations at basic_thms.h?
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 03:04:49 -08:00
Leonardo de Moura
41c1010043
feat(frontends/lean/parser): make Import command use binary Lean files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 19:20:04 -08:00
Leonardo de Moura
1fd81dd3a1
feat(frontends/lean/parser): disable verbose messages when importing files
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:24:13 -08:00
Leonardo de Moura
44a31dd8fb
feat(frontends/lean/parser): improve Import command
...
- The extension does not have to be provided.
- It can also import Lua files.
- Hierachical names can be used instead of strings.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-28 12:05:01 -08:00
Leonardo de Moura
8e86d6578c
fix(tests/lean): adjust tests to reflect modifications in the pp
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-27 18:38:45 -08:00
Leonardo de Moura
3f0279b88c
refactor(frontends/lua): replace lean.lua.h with util.lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 19:49:26 -08:00
Leonardo de Moura
275f022d79
fix(tests/lean): ignore lines containing 'executing external script' in test scripts, these lines contain references to the path where Lean was built
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 18:41:01 -08:00
Leonardo de Moura
f1b97b18b4
refactor(frontends/lean/parser): tactic macros, and tactic Lua bindings
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 15:54:53 -08:00
Leonardo de Moura
ef18cc4a92
fix(frontends/lean/parser): add existing command macros when creating parser object
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:38:14 -08:00
Leonardo de Moura
8e4560a866
feat(frontends/lean/parser): protect imported modules from Lua definitions and macros in the file importing the module
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:21:36 -08:00
Leonardo de Moura
ba02132a90
feat(frontends/lean/parser): add command macros
...
The idea is to allow users to define their own commands using Lua.
The builtin command Find is now written in Lua.
This commit also fixes a bug in the get_formatter() Lua API.
It also adds String arguments to macros.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 13:00:28 -08:00
Leonardo de Moura
480781d13e
feat(frontends/lean/parser): provide environment as an argument to macros, allow macros to parse tactics
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-26 11:15:45 -08:00
Leonardo de Moura
3673f2ac1d
feat(frontends/lean/parser): add Find command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 18:31:52 -08:00
Leonardo de Moura
a3dde29f3c
feat(frontends/lua/parser): allow users to specify the precedence of macros
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 12:27:56 -08:00
Leonardo de Moura
88235d2922
feat(library/tactic/apply_tactic): try other solutions produced by the elaborator
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-25 11:51:27 -08:00
Leonardo de Moura
8e45064f25
feat(library/tactic/apply_tactic): improved parametric apply_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 22:40:34 -08:00
Leonardo de Moura
c87e965f86
fix(tests/lean/tactic14.lean): typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 21:36:49 -08:00
Leonardo de Moura
cb95b14332
feat(library/tactic/apply_tactic): improve apply_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 14:23:06 -08:00
Leonardo de Moura
879ab6924a
tests(test/lean): remove 'Importing...' message, the tests using the Import command fail when running on a different machine
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 12:26:53 -08:00
Leonardo de Moura
00e89190c2
refactor(library/cast): use .lean file instead of .cpp file to define casting library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 22:04:19 -08:00
Leonardo de Moura
8c8cefcb0c
feat(frontends/lean/parser): compact definitions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 21:24:50 -08:00
Leonardo de Moura
5043cc75f6
fix(frontends/lean/parser): allow parenthesis in level expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 13:31:55 -08:00
Leonardo de Moura
2c30b87f30
test(tests/lean): ExistsElim test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-23 12:57:25 -08:00
Leonardo de Moura
baf99779dc
feat(frontends/lean/frontend_elaborator): use is_convertible to minimize number of coercions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 17:57:51 -08:00
Leonardo de Moura
65f7217935
fix(tests/lean/norm_tac): display implicit parameters to make sure output can be parsed
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 17:11:36 -08:00
Leonardo de Moura
3e32d9bef2
feat(library/tactic): add support for Pi's at to_proof_state
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 16:40:55 -08:00
Leonardo de Moura
104bd990e1
feat(library/tactic): add normalize_tac, eval_tac and trivial_tac
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 14:10:42 -08:00
Leonardo de Moura
4229e498d2
refactor(kernel/type_checker): combine type_checker and type_inferer into a single class, and avoid code duplication
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-22 11:51:38 -08:00
Leonardo de Moura
9128a437b8
refactor(library/cast): replace cast semantic attachment with axioms, add heterogeneous symmetry axiom
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 18:23:37 -08:00
Leonardo de Moura
df58eb132e
feat(frontends/lean): simplify explicit version names
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 17:05:25 -08:00
Leonardo de Moura
36b2ec9abb
fix(library/cast): bugs in Cast semantic attachment
...
TODO: revise cast semantic attachment.
It should be axioms instead of semantic attachments.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 16:16:54 -08:00
Leonardo de Moura
aebff0b4d3
fix(library/type_inferer): bug in get_range method
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 14:55:07 -08:00
Leonardo de Moura
55d46b2f88
test(tests/lean): add new normalizer/elaborator test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 06:43:25 -08:00
Leonardo de Moura
9444c1f47f
test(tests/lean): add example that cannot be elaborated
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 04:19:53 -08:00
Leonardo de Moura
fddcdb8f40
fix(library/elaborator): bug in process_lower
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 04:13:14 -08:00
Leonardo de Moura
66f106da8c
test(tests/lean): new error msg test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-21 03:20:04 -08:00
Leonardo de Moura
ce84fe5d33
feat(frontends/lean): improve error messages when elaborator cannot instantiate all metavariables
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 22:00:50 -08:00
Leonardo de Moura
bb81311e0a
feat(frontends/lean/parser): include proof state in exception for tactic failure
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 17:15:12 -08:00
Leonardo de Moura
7772c16033
refactor(kernel): add unfold_opaque flag to normalizer, modify how type checker uses the opaque flag, remove hidden_defs, and mark most builtin definitions as opaque
...
After this commit, in the type checker, when checking convertability, we first compute a normal form without expanding opaque terms.
If the terms are convertible, then we are done, and saved a lot of time by not expanding unnecessary definitions.
If they are not, instead of throwing an error, we try again expanding the opaque terms.
This seems to be the best of both worlds.
The opaque flag is a hint for the type checker, but it would never prevent us from type checking a valid term.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 12:47:47 -08:00
Leonardo de Moura
812c1a2960
feat(library/elaborator): only expand definitions that are not marked as hidden
...
The elaborator produces better proof terms. This is particularly important when we have to prove the remaining holes using tactics.
For example, in one of the tests, the elaborator was producing the sub-expression
(λ x : N, if ((λ x::1 : N, if (P a x x::1) ⊥ ⊤) == (λ x : N, ⊤)) ⊥ ⊤)
After, this commit it produces
(λ x : N, ¬ ∀ x::1 : N, ¬ P a x x::1)
The expressions above are definitionally equal, but the second is easier to work with.
Question: do we really need hidden definitions?
Perhaps, we can use only the opaque flag.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 02:16:49 -08:00
Leonardo de Moura
c77464703f
feat(frontends/lean): macro definition using Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 19:08:10 -08:00
Leonardo de Moura
b08c606696
fix(library/io_state): bug in the io_state Lua bindings
...
This commit also includes a new test that exposes the problem.
The options in the io_state object were being lost.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 16:39:42 -08:00
Leonardo de Moura
2648f41eaa
test(tests/lean): add new test script that checks if Lean can parse the output produced by its pretty printer
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 16:16:56 -08:00
Leonardo de Moura
d9e692f506
feat(frontends/lean): improve coercion manangement
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:45:46 -08:00
Leonardo de Moura
f43db96e1f
fix(frontends/lean/pp): pretty printer for Type
...
Add parenthesis around Type when it has a universe.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:24:45 -08:00
Leonardo de Moura
ae01d3818d
fix(frontends/lean/parser): parse_type method
...
The parser had a nasty ambiguity. For example,
f Type 1
had two possible interpretations
(f (Type) (1))
or
(f (Type 1))
To fix this issue, whenever we want to specify a particular universe, we have to precede 'Type' with a parenthesis.
Examples:
(Type 1)
(Type U)
(Type M + 1)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 15:24:34 -08:00
Leonardo de Moura
46627289b8
fix(kernel/expr): avoid '_' as a binder name, we use '_' as a placeholder in the Lean frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 14:47:53 -08:00
Leonardo de Moura
d3d24696f4
feat(frontends/lean): hide builtin object in the 'Show Environment' command
...
The user can still display builtin objects by using
Show Environment all
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 14:00:58 -08:00
Leonardo de Moura
ad3f771b1d
feat(frontends/lean): hide 'explicit' version of objects with implicit arguments
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 13:12:39 -08:00
Leonardo de Moura
bff5a6bfb2
fix(frontends/lean/pp): make sure pp and parser are using the same precedences
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-19 12:46:14 -08:00
Leonardo de Moura
dd72269b13
feat(frontends/lean): rename command Set to SetOption
...
It is not nice to have Set as a reserved keyword. See example examples/lean/set.lean
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 21:18:48 -08:00
Leonardo de Moura
42cb5d1d3c
fix(tests/lean): typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 20:11:49 -08:00
Leonardo de Moura
79fa6e4940
feat(frontends/lean): Scopes in the default Lean frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 17:40:21 -08:00
Leonardo de Moura
2aaa9a5273
feat(frontends/lean/parser): change function application precedence
...
Now, we can write
Pi (x y : A), R x y -> R y x
instead of
Pi (x y : A), (R x y) -> (R y x)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-18 12:44:15 -08:00
Leonardo de Moura
10f28c7bec
feat(kernel/replace_fn): non-recursive replace_fn
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-17 16:35:39 -08:00
Leonardo de Moura
c53233ea26
fix(kernel/normalizer): avoid svalue hack, use 'semantic attachments' for implementing closures, include context in the closure
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-17 14:33:42 -08:00
Leonardo de Moura
09b51a0fb7
fix(library/elaborator): missing condition
...
The elaborator was missing solutions because of the missing condition at is_simple_ho_match.
This commit also adds a new test that exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 17:13:36 -08:00
Leonardo de Moura
5b29fd8d93
test(tests/lean): add ExistsElim test
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 15:43:09 -08:00
Leonardo de Moura
8f5c2b7d9f
feat(library/basic_thms): add Refute theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 12:03:31 -08:00
Leonardo de Moura
8f9405c8b3
fix(library/elaborator): tag meta_app constraints of the form 'ctx |- m?[inst:i v] t1 =:= t2' as expensive
...
This commits also adds a new unit test that demonstrates non-termination due to this kind of constraint.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-16 09:39:02 -08:00
Leonardo de Moura
2972fb9d8c
test(tests/lean): new elaborator tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 22:00:26 -08:00
Leonardo de Moura
61bd27ff06
fix(library/elaborator): bug in simple_ho_match
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 21:48:55 -08:00
Leonardo de Moura
19ad39159e
feat(library/basic_thms): add ForallIntro theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 17:35:31 -08:00
Leonardo de Moura
82dfb553d5
feat(library/basic_thms): add ExistsIntro theorem
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-15 16:26:23 -08:00
Leonardo de Moura
993bea8206
refactor(library/elaborator): improve elaborator state data-structure
...
The "quota" hack used before this commit was inefficient, and too hackish.
This commit uses two lists of constraints: active and delayed.
The delayed constraints are only processed when there are no active constraints.
We use a simple index to quickly find which delayed constraints have assigned metavariables.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
checkpoint
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 23:27:08 -08:00
Leonardo de Moura
3d30664611
feat(kernel/type_checker): provide the metavar_env to instantiate, it will minimize the number of local_entries needed
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 15:13:56 -08:00
Leonardo de Moura
4357c9196e
feat(kernel/metavar): make sure that a metavariable 'm' can only be assigned to a term that contains free variables available in the context associated with 'm'
...
This commit also simplifies the method check_pi in the type_checker and type_inferer.
It also fixes process_meta_app in the elaborator.
The problem was in the method process_meta_app and process_meta_inst.
They were processing convertability constrains as equality constraints.
For example, process_meta_app would handle
ctx |- Type << ?f b
as
ctx |- Type =:= ?f b
This is not correct because a ?f that returns (Type U) for b satisfies the first but not the second.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-14 12:25:00 -08:00
Leonardo de Moura
bbaa83e16a
feat(frontends/lean): implement relaxed operator compatibility in the parser
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 15:42:43 -08:00
Leonardo de Moura
6b1b6c7bd1
feat(tests/lean): include standard error in the expected output
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:52:57 -08:00
Leonardo de Moura
90f88acf42
feat(frontends/lean): relax compatible_denotation predicate
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:42:29 -08:00
Leonardo de Moura
abe2cf2fb5
feat(frontends/lean): simplify how implicit parameters are marked
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 12:11:04 -08:00
Leonardo de Moura
78ec4b152b
feat(frontends/lean): relax restricitions on parsing applications of functions containing implicit arguments
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 09:48:24 -08:00
Leonardo de Moura
0cd8e3e76b
feat(split-stack): add support for split-stacks (no more stackoverflows)
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 22:30:54 -08:00
Leonardo de Moura
0eaa98221b
fix(shell/lean): Lua repl missing, incorrect exit code in interactive mode, missing tests
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 12:25:19 -08:00
Leonardo de Moura
68c2e5cc7d
fix(frontends/lean/parser): reachable code
...
The new test nbug1.lean exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 15:22:21 -08:00
Leonardo de Moura
04b67f8b14
refactor(kernel/object): remove 'null' object, and operator bool for kernel objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 14:37:38 -08:00
Leonardo de Moura
1ff6013594
fix(frontends/lean/frontend_elaborator): must elaborate type attached to placeholder, it may also contain holes
...
The test tactic14.lean exposes the problem.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:37:59 -08:00
Leonardo de Moura
e2999d3ff6
feat(*): add component name to check_stack and check_system
...
I also reduced the stack size to 8 Mb in the tests at tests/lean and tests/lean/slow. The idea is to simulate stackoverflow conditions.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 15:11:55 -08:00
Leonardo de Moura
33b72f1dd0
feat(frontends/lean/parser): apply type inference elaborator to fill remaining metavariables/holes (these are holes produced by tactics such as apply_tac)
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 13:09:39 -08:00
Leonardo de Moura
a75d05fdb4
fix(tests/lean/interactive): test driver (to avoid discrepancy between Win and Linux version)
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 17:03:12 -08:00
Leonardo de Moura
daadff548e
fix(tests/lean): update expected result to reflect recent changes
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 16:31:13 -08:00
Leonardo de Moura
015bff8283
fix(library/tactic/goal): to_goal way of handling context_entries of the form (name, domain, body) where domain is null, and body is a proof term
...
This commit fixes a problem exposed by t13.lean.
It has a theorem of the form:
Theorem T1 (A B : Bool) : A /\ B -> B /\ A :=
fun assumption : A /\ B,
let lemma1 := (show A by auto),
lemma2 := (show B by auto)
in (show B /\ A by auto)
When to_goal creates a goal for the metavariable associated with (show B /\ A by auto) it receives a context and proposition of the form
[ A : Bool, B : Bool, assumption : A /\ B, lemma1 := Conjunct1 assumption, lemma2 := Conjunct2 assumption ] |- B /\ A
The context_entries "lemma1 := Conjunct1 assumption" and "lemma2 := Conjunct2 assumption" do not have a domain (aka type).
Before this commit, to_goal would simply replace and references to "lemma1" and "lemma2" in "B /\ A" with their definitions.
Note that, "B /\ A" does not contain references to "lemma1" and "lemma2". Then, the following goal is created
A : Bool, B : Bool, assumption : A /\ B |- B /\ A
That is, the lemmas are not available when solving B /\ A.
Thus, the tactic auto produced the following (weird) proof for T1, where the lemmas are computed but not used.
Theorem T1 (A B : Bool) (assumption : A ∧ B) : B ∧ A :=
let lemma1 := Conjunct1 assumption,
lemma2 := Conjunct2 assumption
in Conj (Conjunct2 assumption) (Conjunct1 assumption)
This commit fixed that. It computes the types of "Conjunct1 assumption" and "Conjunct2 assumption", and creates the goal
A : Bool, B : Bool, assumption : A /\ B, lemma1 : A, lemma2 : B |- B /\ A
After this commit, the proof for theorem T1 is
Theorem T1 (A B : Bool) (assumption : A ∧ B) : B ∧ A :=
let lemma1 := Conjunct1 assumption,
lemma2 := Conjunct2 assumption
in Conj lemma2 lemma1
as expected.
Finally, this example suggests that the encoding
Theorem T1 (A B : Bool) : A /\ B -> B /\ A :=
fun assumption : A /\ B,
let lemma1 : A := (by auto),
lemma2 : B := (by auto)
in (show B /\ A by auto)
is more efficient than
Theorem T1 (A B : Bool) : A /\ B -> B /\ A :=
fun assumption : A /\ B,
let lemma1 := (show A by auto),
lemma2 := (show B by auto)
in (show B /\ A by auto)
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 16:14:25 -08:00
Leonardo de Moura
0390f3c39b
feat(library/tactic/boolean_tactics): avoid unnecessary Let expression in proof terms
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 15:01:54 -08:00
Leonardo de Moura
1df9d18891
feat(frontends/lean): allow 'tactic hints' to be associated with 'holes'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 14:49:39 -08:00
Leonardo de Moura
2ddcc32c1d
fix(frontends/lean/notation): change the precedence of '->'
...
It should match the precedence of the implication '=>'.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 13:23:24 -08:00
Leonardo de Moura
fa03ae2a26
fix(library/elaborator): strength elaborator procedure for handling equality and convertability constraints
...
This commit improves the condition for showing that an equality(and convertability) constraint cannot be solved. A nice consequence is that Lean produces nicer error messages. For example, the error message for unit test elab1.lean is more informative.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 13:04:34 -08:00
Leonardo de Moura
d46cf5fdd5
fix(frontends/lean/parser): display failed state in noninteractive mode, stop processing tactic commands when a Lean command is found
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 05:13:29 -08:00