Leonardo de Moura
461fd45efc
feat(frontends/lean): allow a different location for each rewrite element
2015-02-04 11:51:39 -08:00
Leonardo de Moura
c845e44777
feat(frontends/lean): parse rewrite tactic
2015-02-04 11:51:39 -08:00
Leonardo de Moura
180cda304e
feat(library/tactic): add rewrite tactic skeleton
...
The tactic has not been implemented yet, but this commit adds all the
support for storing arguments, serializing and deserializing them.
2015-02-04 11:51:39 -08:00
Leonardo de Moura
8a78adc9af
feat(library/tactic): add auxiliary object "location"
...
This object will used to specify the scope of application of tactics
2015-02-04 11:51:39 -08:00
Leonardo de Moura
4c7a17cc4a
refactor(library/tactic/class_instance_synth): move has_expr_metavar_relaxed to util
2015-02-01 10:59:27 -08:00
Leonardo de Moura
c311e0aba6
chore(library/tactic/inversion_tactic): cleanup
2015-02-01 10:47:32 -08:00
Leonardo de Moura
143143e94c
fix(library/tactic/inversion_tactic): missing normalization step in the inversion_tactic
2015-02-01 10:38:30 -08:00
Leonardo de Moura
dbc8e9e13a
refactor(*): add method get_num_univ_params
2015-01-28 17:22:18 -08:00
Leonardo de Moura
27f6bfd3f0
refactor(*): add file constants.txt with all constants used by the Lean binary
2015-01-23 16:50:32 -08:00
Leonardo de Moura
41935906a8
chore(frontends/lean): use update_if_undef
2015-01-13 13:02:14 -08:00
Leonardo de Moura
1fbfe59a9a
feat(library/tactic/goal): when listing context/goal variables, collect vars of same type in one line
...
closes #391
2015-01-13 11:14:44 -08:00
Leonardo de Moura
576c053c25
fix(library/tactic/inversion_tactic): bug at implementation_list update
2015-01-04 19:56:10 -08:00
Leonardo de Moura
762a515a5b
feat(library/tactic/inversion_tactic): mark new arguments that have been "unified" into terms
2015-01-02 22:02:15 -08:00
Leonardo de Moura
3fb2d8bbc0
feat(library/tactic/inversion_tactic): use the "simpler" compilation approach in more cases
...
The approach implemented in the commit 8974d70c11ef7b9b2c5d can be
extended to indexed inductive families. See comments in the code.
2015-01-01 19:33:15 -08:00
Leonardo de Moura
be9e2500ce
feat(library/tactic/inversion_tactic): add more efficient "compilation" for non-indexed inductive datatypes
2015-01-01 19:33:14 -08:00
Leonardo de Moura
57490a6431
feat(library/tactic/inversion_tactic): avoid unnecessary eq.rec's
2015-01-01 19:33:14 -08:00
Leonardo de Moura
761810f350
feat(library/tactic/inversion_tactic): generate auxiliary information
2015-01-01 19:33:14 -08:00
Leonardo de Moura
1f13bfa4f7
feat(library/tactic/inversion_tactic): add inversion::apply procedure
...
The new procedure is essentially a "customized" version of the
inversion (aka cases) tactic for the equations package
2015-01-01 19:33:14 -08:00
Leonardo de Moura
1d79cb9c07
fix(library/tactic/inversion_tactic): fix bug in 'cases' tactic for HoTT library
2014-12-22 09:40:15 -08:00
Leonardo de Moura
d2958044fd
feat(frontends/lean): add multiple_instances command
...
After this commit, Lean "cuts" the search after the first instance is
computed. To obtain the previous behavior, we must use the new command
multiple_instances <class-name>
closes #370
2014-12-21 17:28:44 -08:00
Leonardo de Moura
5efadb09cc
feat(library/tactic/inversion_tactic): improve 'cases' tactic for HoTT library
...
This commit adds support for hypotheses (h : C As idxs) where the indices idxs
are just local constants. Before this commit the indices idxs had to be hsets.
Now, they can be hsets or local constants.
The new tests demonstrate new examples that can be handled by the
improved tactic in the HoTT library
2014-12-21 15:19:25 -08:00
Leonardo de Moura
677ec2a2fe
feat(library/tactic/inversion_tactic): adjust inversion tactic to HoTT lib
2014-12-20 11:32:27 -08:00
Leonardo de Moura
d9d822baa7
feat(library/tactic/class_instance_synth): add mk_hset_instance procedure
2014-12-19 22:00:25 -08:00
Leonardo de Moura
d6f79423e9
feat(library/tactic/class_instance_synth): add mk_class_instance procedures
2014-12-19 20:09:09 -08:00
Leonardo de Moura
4421069e34
refactor(library/tactic): rename placeholder_elaborator to class_instance_synth
2014-12-19 19:57:38 -08:00
Leonardo de Moura
ded869b7e0
refactor(frontends/lean): move placeholder_elaborator to library/tactic
2014-12-19 15:23:22 -08:00
Leonardo de Moura
a22dc773b7
refactor(frontends/lean): move some auxiliary procedures to library/tactic
2014-12-19 15:19:45 -08:00
Leonardo de Moura
ebda057499
fix(library/tactic/intros_tactic): seg fault at intros tactic, fixes #366
2014-12-04 09:26:10 -08:00
Leonardo de Moura
59d403f7d8
fix(library/tactic/inversion_tactic): warning on clang++
2014-12-03 21:14:10 -08:00
Leonardo de Moura
e6672b958f
fix(library/tactic/inversion_tactic): add missing case
2014-12-01 19:11:44 -08:00
Leonardo de Moura
bc7ee2958f
fix(library/tactic/inversion_tactic): bug in mutually recursive case
2014-12-01 18:32:38 -08:00
Leonardo de Moura
193fed7061
fix(library/tactic/inversion_tactic): uninitialized variable
2014-11-30 22:41:22 -08:00
Leonardo de Moura
c08f4672e4
feat(library/tactic): add 'assert' tactic, closes #349
2014-11-29 21:34:49 -08:00
Leonardo de Moura
f51fa93292
feat(library/tactic): add 'fapply' tactic, closes #356
2014-11-29 19:20:41 -08:00
Leonardo de Moura
a0d650d9cc
fix(library/tactic/inversion_tactic): complete 'deletion' transition
2014-11-29 09:36:41 -08:00
Leonardo de Moura
e0debca771
feat(library/tactic/inversion_tactic): add 'case ... with ...' variant that allows user to specify names for new hypotheses
2014-11-28 22:25:37 -08:00
Leonardo de Moura
22b2f3c78c
fix(library/tactic/inversion_tactic): bug in injectivity transition
2014-11-28 22:07:35 -08:00
Leonardo de Moura
a6be460166
feat(library/tactic/inversion_tactic): basic 'inversion' tactic
2014-11-28 21:56:13 -08:00
Leonardo de Moura
6768c76b52
feat(library/tactic): refine 'get_unused_name'
2014-11-28 19:39:07 -08:00
Leonardo de Moura
9516cd9ee3
feat(library/tactic): 'exact' tactic report unsolved placeholders in nested expression
...
Actually, the elaborator is the one reporting the unassigned
placeholders. The 'exact' tactic just makes the request.
To implement this feature we had to extend the elaboration interface
expected by the tactic framework.
2014-11-28 14:59:35 -08:00
Leonardo de Moura
04dfda99ab
fix(library/tactic/inversion_tactic): bug in name generation
2014-11-28 14:51:12 -08:00
Leonardo de Moura
13405b2bb0
fix(library/tactic/inversion_tactic): inversion tactic for datatypes with dependent elimination
2014-11-27 10:37:22 -08:00
Leonardo de Moura
db9fd53b80
fix(library/tactic): pretty printer for proof states
2014-11-27 09:43:58 -08:00
Leonardo de Moura
976e907c8a
chore(library/tactic/tactic.h): cleanup
2014-11-27 09:15:49 -08:00
Leonardo de Moura
5fff3113a9
refactor(library/tactic/inversion_tactic): add 'cases_on' step to inversion_tactic
2014-11-27 00:06:26 -08:00
Leonardo de Moura
ebd320a6b3
feat(library/tactic): add first step of 'inversion' tactic
2014-11-26 21:28:00 -08:00
Leonardo de Moura
c2f32cd953
refactor(library/tactic/intros_tactic): change approach for generating fresh names for nameless 'intros'
2014-11-26 21:27:09 -08:00
Leonardo de Moura
a311f05add
refactor(library/tactic): move 'get_unused_name' to goal
2014-11-26 18:46:08 -08:00
Leonardo de Moura
2a00647089
refactor(library/tactic): cleanup 'revert' and 'clear' tactics
2014-11-26 17:08:14 -08:00
Leonardo de Moura
e55397d422
feat(library/tactic): add 'clears' and 'reverts' variants
2014-11-26 14:49:48 -08:00
Leonardo de Moura
2bd8f969d5
feat(library/tactic): add 'revert' tactic, closes #346
2014-11-26 14:23:42 -08:00
Leonardo de Moura
c28e9b9234
feat(library/tactic): add 'clear' tactic, closes #341
2014-11-26 13:11:36 -08:00
Leonardo de Moura
13fba433b0
feat(library/tactic/generalize): add 'generalizes' syntax sugar, closes #327
2014-11-23 17:30:22 -08:00
Leonardo de Moura
84b516994c
fix(library/tactic): type check generalization result, fixes #273
2014-10-29 20:34:01 -07:00
Leonardo de Moura
61f333d2c2
chore(library/tactic/expr_to_tactic): fix compilation warning
2014-10-29 19:47:47 -07:00
Leonardo de Moura
9547e2d077
feat(library/tactic): add rotate_left/rotate_right tactics, closes #278
2014-10-29 19:13:55 -07:00
Leonardo de Moura
8e9f97e95e
fix(frontends/lean): do not save identifier info
2014-10-29 17:38:59 -07:00
Leonardo de Moura
95e843e8ed
feat(library/tactic/proof_state): add empty line between goals, closes #281
2014-10-29 16:51:06 -07:00
Leonardo de Moura
0c185fc4ab
fix(library/tactic): add relax_main_opaque flag to proof_state objects, closes #274
2014-10-29 08:57:34 -07:00
Leonardo de Moura
e22eb3543c
feat(library/tactic): add whnf tactic, closes #270
2014-10-28 23:18:49 -07:00
Leonardo de Moura
83e4c0fcec
feat(frontends/lean): hide tactic "types"
...
it is not very useful to display the type of tactics (e.g., apply,
intros, ...)
2014-10-28 22:38:10 -07:00
Leonardo de Moura
1c2bbcfebc
feat(frontends/lean/info_manager): add separator --
when displaying PROOF_STATE info
...
This feature was implemented to address issue #259
2014-10-28 16:39:21 -07:00
Leonardo de Moura
186e598bf8
feat(library/tactic/goal): add option pp.compact_goals
2014-10-28 16:30:37 -07:00
Leonardo de Moura
a3801e84d4
fix(library/tactic/goal): avoid unnecessary line break when possible
2014-10-28 16:17:33 -07:00
Leonardo de Moura
fd60cf6a79
feat(library/tactic/exact_tactic): modify 'exact' tactic semantics, use higher-order unification
...
See new node.inj4 theorem, we need the extra power to be able to avoid type information at
exact (assume e₁ e₂, e₁)
2014-10-26 10:27:33 -07:00
Leonardo de Moura
aaad9633fb
fix(library/tactic/expr_to_tactic): memory leak
2014-10-24 14:40:36 -07:00
Leonardo de Moura
79d0347721
feat(library/tactic): add generalize tactic, closes #34
...
Remark: the intros tactic has been added in a different commit: 7d0100a340
2014-10-23 22:40:15 -07:00
Leonardo de Moura
b83b065d00
feat(library/tactic/apply_tactic): modify heuristic for adding arguments to apply tactic.
2014-10-23 22:36:32 -07:00
Leonardo de Moura
f9aa1a1b84
refactor(library/tactic/goal): remove unnecessary parameter
2014-10-23 21:22:52 -07:00
Leonardo de Moura
43cfd5c26a
fix(library/tactic): add missing file
2014-10-23 14:04:12 -07:00
Leonardo de Moura
e750c9b67a
feat(frontends/lean): add 'info' tactic for producing PROOF_STATE info for emacs mode
2014-10-23 13:18:30 -07:00
Leonardo de Moura
38a9aa2a98
feat(frontends/lean): automatically open 'tactic' namespace (if it is not already open) in 'by' and 'begin-end' expressions
2014-10-23 10:26:19 -07:00
Leonardo de Moura
00f9a10e82
refactor(library/tactic/unfold_tactic): use new 'tactic.expr' to implement 'unfold' tactic
...
This change also enabled us to remove hacks used in the tests modified
by this commit.
2014-10-23 10:26:19 -07:00
Leonardo de Moura
6fcba192b2
refactor(library/tactic): move 'unfold' tactic to separate module
2014-10-23 10:26:19 -07:00
Leonardo de Moura
96d7d9c8d9
feat(library/tactic/elaborate): do not invoke unifier if no constraints were generated during elaboration
2014-10-23 10:26:19 -07:00
Leonardo de Moura
f3fdc70400
refactor(library/tactic): add auxiliary module 'library/tactic/elaborate'
2014-10-23 10:26:11 -07:00
Leonardo de Moura
3aec70b92c
feat(library/tactic): elaborate 'exact' tactic argument at tactic execution time
2014-10-22 22:13:37 -07:00
Leonardo de Moura
c50227ea6e
feat(library/tactic): change apply tactic semantics: goals are not reversed; and dependent arguments are not included
...
This commit also adds the tactic rapply that corresponds to the previous
semantics we have been using.
2014-10-22 18:11:09 -07:00
Leonardo de Moura
60132912a4
refactor(library/tactic): remove unnecessary hack
...
It is not needed anymore.
We had to use this hack when we had tactic_macro_definition_cell.
2014-10-22 17:41:19 -07:00
Leonardo de Moura
7c62446023
refactor(frontends/lean): remove dead code
2014-10-22 17:39:06 -07:00
Leonardo de Moura
e95c7c5f70
refactor(library/tactic/rename_tactic): use new 'tactic.expr' to implement 'intro/intros' tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-10-22 17:29:50 -07:00
Leonardo de Moura
9a316092d1
refactor(library/tactic/rename_tactic): use new 'tactic.expr' to implement rename tactic
2014-10-22 17:29:50 -07:00
Leonardo de Moura
5e15ac0c92
feat(library/tactic): add new approach for embedding non-elaborated expressions into tactics
2014-10-22 17:29:50 -07:00
Leonardo de Moura
7c617955d0
refactor(library/tactic): move 'exact' tactic to separate module
2014-10-22 17:29:44 -07:00
Leonardo de Moura
323715e951
refactor(library/tactic): move 'tracing' tactics to separate module
2014-10-22 14:12:45 -07:00
Leonardo de Moura
815dc9b63d
chore(library/tactic/expr_to_tactic): remove dead code
2014-10-20 18:59:57 -07:00
Leonardo de Moura
53a64ac767
refactor(library/tactic): move intros_tactic initialization to intros_tactic module
2014-10-20 17:47:52 -07:00
Leonardo de Moura
3c4419ff23
refactor(library/tactic): move rename_tactic to separate module
2014-10-20 17:41:40 -07:00
Leonardo de Moura
ac9397816f
refactor(library/tactic): move apply_tactic initialization to apply_tactic module
2014-10-20 17:32:32 -07:00
Leonardo de Moura
7d0100a340
feat(library/tactic): add 'intros' tactic
2014-10-20 15:26:16 -07:00
Leonardo de Moura
5cba7244ce
fix(library/tactic/expr_to_tactic): argument evaluation order is not part of the standard
2014-10-20 15:16:38 -07:00
Leonardo de Moura
d2cbd25985
refactor(kernel): replace_visitor doesn't need to be in the kernel anymore
2014-10-17 10:23:35 -07:00
Leonardo de Moura
d960c1994e
refactor(library/tactic/apply_tactic): reuse type_checker object
2014-10-15 09:28:01 -07:00
Leonardo de Moura
bbe4017790
refactor(library/tactic/apply_tactic): remove dead code
2014-10-15 09:15:11 -07:00
Leonardo de Moura
e6606ef2ac
feat(library/tactic): add 'rename' hypothesis tactic
2014-10-14 18:19:34 -07:00
Leonardo de Moura
90dba868e3
feat(library/tactic/proof_state): apply substitutions when pretty printing state
2014-10-14 17:37:20 -07:00
Leonardo de Moura
58c9421bab
refactor(library/tactic): elaborate expressions nested in tactics with respect to current goal, save postponed constraints (e.g., flex-flex constraints) closes #44 , fixes #70
2014-10-14 17:18:40 -07:00
Leonardo de Moura
86410d392b
feat(util/list_fn): generalize map_filter template
2014-10-08 22:23:20 -07:00
Leonardo de Moura
516c0c73b9
refactor(*): remove dependency to thread_local C++11 keyword, the
...
current compilers have several bugs associated with it
We use the simpler __thread (gcc and clang) and
__declspec(thread) (visual studio).
2014-09-24 12:51:04 -07:00
Leonardo de Moura
83b22823a6
refactor(library/tactic): explicit initialization/finalization
2014-09-23 10:06:15 -07:00
Leonardo de Moura
b6781711b1
refactor(*): explicit initialization/finalization for serialization
...
modules, expression annotations, and tactics
2014-09-22 15:26:41 -07:00
Leonardo de Moura
b1ee888aae
refactor(*): start move to explicit initialization/finalization,
...
explicitly initialize/finalize options
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-22 10:41:07 -07:00
Leonardo de Moura
baf4c01de8
feat(frontends/lean): definitions are opaque by default
2014-09-19 15:54:32 -07:00
Leonardo de Moura
03902d4b45
refactor(library/unifier): add option m_discard too unifier, if m_discard == false, then unsolved flex-flex constraints are returned, the unifier also does not apply "last resource" techniques that may miss many solutions.
2014-09-11 14:49:35 -07:00
Leonardo de Moura
b4793df653
feat(frontends/lean): rename '[fact]' to '[visible]'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-08 07:47:42 -07:00
Leonardo de Moura
364bba2129
feat(frontends/lean/inductive_cmd): prefix introduction rules with the name of the inductive datatype
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-04 17:26:36 -07:00
Leonardo de Moura
060093cbab
refactor(library): add type_util module, and move get_expect_num_args to it
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-03 08:40:03 -07:00
Leonardo de Moura
fbf13994d8
refactor(*): use + for concatenating format objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-24 09:35:25 -07:00
Leonardo de Moura
d4ac482d76
refactor(kernel): move annotation to library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-22 10:38:10 -07:00
Leonardo de Moura
f5987b7bda
refactor(library/unifier): make it easier to add new options to the unifier
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-20 17:30:08 -07:00
Leonardo de Moura
9588336c15
refactor(kernel/type_checker): remove "global" constraint buffer from type_checker, and use constraint_seq instead
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-20 16:46:19 -07:00
Leonardo de Moura
4cf3d32e0c
chore(*): create alias for std::pair
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-20 16:46:19 -07:00
Leonardo de Moura
2869d9059f
feat(frontends/lean): change 'proof-qed' semantics: no backtracking
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-12 17:40:30 -07:00
Leonardo de Moura
562926e7ad
refactor(kernel/instantiate): add functions instantiate_value_univ_params and instantiate_type_univ_params
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-12 17:40:30 -07:00
Leonardo de Moura
f896771987
refactor(library/tactic/expr_to_tactic): use annotations for implementing 'by'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-10 11:16:46 -07:00
Leonardo de Moura
8bd36dabce
refactor(kernel/pos_info_provider): get_pos_info return none if position is not available
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-08-01 20:17:26 -07:00
Leonardo de Moura
faee08591f
fix(*): make sure elaborator and type_checker use the same "rules" for treating opaque definitions
...
This is a big change because we have to store in constraints whether we can use the "relaxed" rules or not.
The "relaxed" case says that when type checking the value of an opaque definition we can treat other opaque definitions in the same module as transparent.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-27 12:12:54 -07:00
Leonardo de Moura
13fe28dd1c
perf(library/unifier): delay the instantiation of metavariables occurring in the types of local constants
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 14:31:30 -07:00
Leonardo de Moura
61661478ad
refactor(kernel/metavar): simplify substitution class, and remove dead code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-23 10:03:03 -07:00
Leonardo de Moura
d69db172a1
chore(kernel/replace_fn): add syntax sugar for replace function
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-19 12:53:37 +01:00
Leonardo de Moura
b62abf0f06
refactor(library/tactic/goal): remove redundance, goal pp method was duplicating some of the functionality provided by the pretty printer
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-10 18:59:03 +01:00
Leonardo de Moura
405e57eb2d
refactor(kernel/formatter): add formatter_factory, and simplify formatter interface
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-10 18:32:00 +01:00
Leonardo de Moura
91b0dcad0f
fix(library/tactic): avoid 'unknown' message in trace_tac when position information is not available
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 17:48:41 -07:00
Leonardo de Moura
a1601e7a5f
feat(library/tactic/apply_tactic): add option for 'refreshing' universe metavariables in the 'apply' tactic
...
The new test ../../tests/lean/run/tactic27.lean demonstrates why we need this feature. The tactic 'apply @refl' is actually 'apply @refl.{?l}'. It is used inside of a repeat tactical. Each iteration of the 'repeat' may need to use a different value for ?l. Before this commit, there was not way to say we want a fresh ?l each iteration.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 16:55:23 -07:00
Leonardo de Moura
a3be63af73
feat(frontends/lean): add tactic_hint command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-08 15:08:13 -07:00
Leonardo de Moura
ab929d7201
refactor(library/unifier): store the unifier_plugin in the environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-05 10:25:58 -07:00
Leonardo de Moura
e0501104e2
feat(library/tactic): add 'fixpoint' tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-04 01:30:28 -07:00
Leonardo de Moura
abbd054b51
feat(library/tactic): add eassumption tactic, and remove redundant 'subgoals' from apply tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 13:04:46 -07:00
Leonardo de Moura
dd96bb151b
refactor(library/unifier): reduce the number unify procedure 'flavors'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 11:15:43 -07:00
Leonardo de Moura
0ff145e59b
feat(library/tactic): add apply tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 09:20:01 -07:00
Leonardo de Moura
e3ab0a1d10
feat(frontends/lean): improve error messages when users forget to import 'tactic'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 08:33:29 -07:00
Leonardo de Moura
6b8b5f3dd8
feat(library/tactic): expose more builtin tactics, cleanup expr_to_tactic procedure
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-03 08:06:28 -07:00
Leonardo de Moura
a7d660f875
feat(frontends/lean): add command for customizing the behavior of proof-qed blocks: we can automatically register tactics to be automatically applied before each component
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 20:45:10 -07:00
Leonardo de Moura
5527955ba8
feat(frontends/lean): add 'proof-qed' notation
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 19:30:48 -07:00
Leonardo de Moura
138267b53a
feat(frontends/lean/elaborator) add trick for improving error messages when mixing tactics, elaboration and exact tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:58:32 -07:00
Leonardo de Moura
60c637fb9d
feat(library/tactic): add 'exact' tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:37:32 -07:00
Leonardo de Moura
37b5b7c4c2
feat(library/tactic): rename 'exact' to 'assumption', 'exact' is a different tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 18:10:42 -07:00
Leonardo de Moura
6a6ebd5c2d
refactor(kernel/metavar): add method instantiate as alias for instantiate_metavars_wo_jst
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 15:39:25 -07:00
Leonardo de Moura
3e1bb96935
feat(library/tactic/goal): propagate tag (for position information) from goal to subgoal
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 14:47:18 -07:00
Leonardo de Moura
ee531ec0e2
feat(frontends/parser): improve error message when an apply tactic refers a local constant that is not marked as [fact]
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 14:09:01 -07:00
Leonardo de Moura
0f27856e4a
feat(library/tactic): new apply tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 13:14:50 -07:00
Leonardo de Moura
6ab46396d8
feat(library/tactic): expose 'trace' tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:52:45 -07:00
Leonardo de Moura
e1d909455c
refactor(library/tactic): add namespace 'tactic', improve expr_to_tactic failure error message
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 10:45:09 -07:00
Leonardo de Moura
7593ee1468
refactor(library/standard): remove parameter from 'tactic' inductive type
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-02 08:09:24 -07:00
Leonardo de Moura
b2b76b078f
feat(frontends/lean): remove build_tactic_cmds, and use expressions for representing tactics
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 20:43:53 -07:00
Leonardo de Moura
cbac21ec7f
feat(library/tactic): add trick for 'embedding' tactics inside Lean expressions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 19:05:22 -07:00
Leonardo de Moura
2df92b0701
refactor(library/tactic): simplify proof_state
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 18:02:17 -07:00
Leonardo de Moura
4cb5f97038
refactor(library/tactic): simplify tactic framework, no more proof builders
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-07-01 16:11:19 -07:00
Leonardo de Moura
cb000eda13
refactor(kernel): store binder_infor in local constants
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 11:37:46 -07:00
Leonardo de Moura
c2ab31113f
refactor(library/tactic): remove cex_builder and 'precision' for proof_state's
...
These two features make sense for solvers, but not in a general purpose tactic framework for building proofs like the one in Lean.
In most cases, we cannot build a counterexample anyway. These two features should be added in a custom framework for combining preprocessing techniques like in Z3.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 08:48:07 -07:00
Leonardo de Moura
8d584e54da
feat(frontends/lean): add exact_apply
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-30 00:51:11 -07:00
Leonardo de Moura
360e9b9486
feat(library/tactic): add apply tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 18:33:53 -07:00
Leonardo de Moura
a8f9594046
refactor(kernel/instantiate): rename instantiate_params to instantiate_univ_params
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 12:09:55 -07:00
Leonardo de Moura
937d7b2813
fix(library/tactic): unfold tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 12:04:58 -07:00
Leonardo de Moura
6d09d82a7c
feat(frontends/lean): add notation for orelse tactic, add show and now tactics
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:39:18 -07:00
Leonardo de Moura
a1bbb09de4
feat(frontends/lean): add notation for then tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:24:56 -07:00
Leonardo de Moura
15f270d9f3
fix(library/tactic): memory leak that only happens when compiling with clang++
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-29 11:07:06 -07:00
Leonardo de Moura
e408998e06
fix(library/tactic): name convention
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 18:42:59 -07:00
Leonardo de Moura
fa72e7b874
refactor(library/tactic): simplify tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 18:35:59 -07:00
Leonardo de Moura
5524c6c3d8
refactor(library/tactic/proof_state): simplify proof state
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 14:49:48 -07:00
Leonardo de Moura
c6ac89d967
refactor(library/tactic/proof_builder): simplify proof builder
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 12:25:04 -07:00
Leonardo de Moura
aaa7960b75
refactor(library/tactic/goal): use local names for hypotheses
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 11:11:12 -07:00
Leonardo de Moura
d84b745241
refactor(library/tactic/cex_builder): simplify cex_builder
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:14:33 -07:00
Leonardo de Moura
b4e4c4d610
chore(library/tactic): remove unnecessary file
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:02:13 -07:00
Leonardo de Moura
f1d8d8dcf9
chore(library/tactic): update goal objects
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
ad70044ae1
chore(library/tactic): remove dead code
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-27 07:00:12 -07:00
Leonardo de Moura
77c5319c4a
chore(*): remove Lua 'migrate'
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-06-18 07:01:34 -07:00
Leonardo de Moura
2d70e2f4f2
fix(library/tactic/goal): bug in the proof builder
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-09 15:02:36 -08:00
Leonardo de Moura
1c43020fc9
fix(library/tactic/goal): bug creating main proof builder
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-02-08 09:11:07 -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
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
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
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
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
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
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
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
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
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
abf61be8f6
chore(library/tactic): remove imp_tac, it is not needed anymore
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-08 00:57:04 -08:00
Leonardo de Moura
0592261847
refactor(kernel/io_state): move io_state_stream to library
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-01-02 13:14:21 -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
72761f14e4
refactor(library/io_state): move to the kernel
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-30 11:20:23 -08:00
Leonardo de Moura
df3686634d
refactor(kernel/builtin): remove unnecessary predicates
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-29 12:20:29 -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
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
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
75cf751959
feat(library/tactic/apply_tactic): allow apply_tac Lua binding to take expressions as argument
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 16:03:16 -08:00
Leonardo de Moura
6cc57cc4b5
fix(library/tactic/apply_tactic): bug in apply_tac
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-24 15:54:56 -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
Soonho Kong
de018220e1
feat(*): use std::make_shared to create shared_ptr
2013-12-24 14:32:50 -05: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
4d05a8b65b
fix(library/tactic/apply_tactic): provide the metavar_env to instantiate, the goal is to avoid add_lift and add_inst local entries
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-20 14:17:04 -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
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
51aee83b70
refactor(kernel/metavar_env): use the same approach used in the class environment in the class metavar_env
...
This modification was motivated by a bug exposed by tst17 at tests/kernel/type_checker.
metavar_env is now a smart point to metavar_env_cell.
ro_metavar_env is a read-only smart pointer. It is useful to make sure we are using proof_state correctly.
example showing that the approach for caching metavar_env is broken in the type_checker
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 18:59:15 -08:00
Leonardo de Moura
2e5e5e187f
chore(util/rc): remove unnecessary argument from LEAN_COPY_REF and LEAN_MOVE_REF macros
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-13 15:01:24 -08:00
Leonardo de Moura
450d6a4b1e
refactor(util/splay_tree): replace find with splay_find
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 17:27:30 -08:00
Leonardo de Moura
f97c260b0b
refactor(kernel/environment): add ro_environment
...
The environment object is a "smart-pointer".
Before this commit, the use of "const &" for environment objects was broken.
For example, suppose we have a function f that should not modify the input environment.
Before this commit, its signature would be
void f(environment const & env)
This is broken, f's implementation can easilty convert it to a read-write pointer by using
the copy constructor.
environment rw_env(env);
Now, f can use rw_env to update env.
To fix this issue, we now have ro_environment. It is a shared *const* pointer.
We can convert an environment into a ro_environment, but not the other way around.
ro_environment can also be seen as a form of documentation.
For example, now it is clear that type_inferer is not updating the environment, since its constructor takes a ro_environment.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 16:48:34 -08:00
Leonardo de Moura
3457fe5935
chore(kernel): rename read_only_environment and read_write_environment
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-12 16:48:33 -08:00
Leonardo de Moura
c0b9c7ffc4
refactor(library/io_state): simplify regular/diagnostic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-10 13:09:35 -08:00
Leonardo de Moura
8f2fe273ea
refactor(*): isolate std::thread dependency
...
This commit allows us to build Lean without the pthread dependency.
It is also useful if we want to implement multi-threading on top of Boost.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-09 15:20:26 -08:00
Leonardo de Moura
8add5571f1
refactor(library/tactic): remove 'null' tactic, and operator bool tactics
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 15:00:16 -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
2f88d6710c
feat(kernel/expr): add some_expr and none_expr for building values of type optional<expr>
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-08 10:34:38 -08:00
Leonardo de Moura
3e1fd06903
refactor(kernel/expr): remove 'null' expression, and operator bool for expression
...
After this commit, a value of type 'expr' cannot be a reference to nullptr.
This commit also fixes several bugs due to the use of 'null' expressions.
TODO: do the same for kernel objects, sexprs, etc.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 23:21:10 -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
195ea24d71
refactor(kernel/type_checker): pass buffer<unification_constraint> as a pointer
...
The idea is to make it an optional parameter independent of metavar_env.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-07 10:27:11 -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
bd9df3b08f
fix(library/tactic/goal): null hypothesis being added by to_goal
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-06 16:03:06 -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
13f9454fe1
feat(library/tactic/proof_state): add option tactic::proof_state::goal_names
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 21:18:22 -08:00
Leonardo de Moura
0c059a9917
feat(library/tactic): use _tac suffix instead of _tactic like Isabelle
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 20:06:32 -08:00
Leonardo de Moura
a1b5a8e50f
fix(frontends/lean): check wheter the synthesized proof term has metavars or not
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 14:22:19 -08:00
Leonardo de Moura
43ef8b9a4b
refactor(library/tactic): rename boolean.* to boolean_tactics.*
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 05:03:18 -08:00
Leonardo de Moura
fa98c1358f
feat(library/tactic): add disj_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 04:49:06 -08:00
Leonardo de Moura
029ef57abd
feat(library/tactic): add apply_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-05 03:22:12 -08:00
Leonardo de Moura
ef069e39b0
chore(*): replace to_expr with to_nonnull_expr (when appropriate)
...
The goal is to make the Lua API more robust.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-03 12:53:53 -08:00
Leonardo de Moura
bcc8b67592
chore(*): consistent file name convention
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-03 12:40:52 -08:00
Leonardo de Moura
f80106a895
chore(*): use 'explicit operator bool' everywhere.
...
operator bool() may produce unwanted conversions.
For example, we had the following bug in the code base.
...
object const & obj = find_object(const_name(n));
if (obj && obj.is_builtin() && obj.get_name() == n)
...
obj.get_name() has type lean::name
n has type lean::expr
Both have 'operator bool()', then the compiler uses the operator to
convert them to Boolean, and then compare the result.
Of course, this is not our intention.
After this commit, the compiler correctly signs the error.
The correct code is
...
object const & obj = find_object(const_name(n));
if (obj && obj.is_builtin() && obj.get_name() == const_name(n))
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 23:02:45 -08:00
Leonardo de Moura
25978118df
feat(library/tactic): add beta-reduction tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-02 08:10:51 -08:00
Leonardo de Moura
09f98ecddc
feat(library/tactic): add unfold_tactic() that unfolds every non-hidden definition
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 10:41:05 -08:00
Leonardo de Moura
ca53a5a1cc
feat(library/tactic): add unfold tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 08:51:56 -08:00
Leonardo de Moura
568931ccb1
refactor(library/tactic): remove duplicate code, add add_proofs
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 07:55:01 -08:00
Leonardo de Moura
f91c4901e8
feat(library/tactic): add absurd_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 07:55:00 -08:00
Leonardo de Moura
bf2adb20e7
feat(library/tactic): add disj_hyp_tactic
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-12-01 07:55:00 -08:00
Leonardo de Moura
1a221d8bbe
feat(library/tactic): add focus tactical
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 11:28:38 -08:00
Leonardo de Moura
83aaf64318
fix(library/tactic): memory leaks
...
Proof/Cex builders and tactics implemented in Lua had a "strong reference" to script_state. If they are stored in the Lua state, then we get a cyclic reference.
That is, script_state points to these objects, and they point back to script_state.
To avoid this memory leak, this commit defines a weak reference for script_state objects. The Proof/Cex builders and tactics now store a weak reference to the Lua state.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 00:44:39 -08:00
Leonardo de Moura
a7027a1d00
feat(library/tactic): polish tactic API, and add new example showing how to implement tactics using Lua
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-30 00:16:39 -08:00
Leonardo de Moura
a9eb2a9307
feat(kernel/builtin): add is_* functions
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 11:35:58 -08:00
Leonardo de Moura
18eb9e427f
fix(library/tactic): compilation warning
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 10:35:14 -08:00
Leonardo de Moura
f9874cd675
feat(library/tactic): add to_tactic_ext, it allows functions that return tactics to be used where a tactic is expected
...
For example, after this commit, we can write
simple_tac = REPEAT(ORELSE(imp_tactic, conj_tactic)) .. assumption_tactic
instead of
simple_tac = REPEAT(ORELSE(imp_tactic(), conj_tactic())) .. assumption_tactic()
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 09:40:21 -08:00
Leonardo de Moura
066dacea31
feat(library/tactic): add show_tactic, and optional '.' in the end of tactic command
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-29 01:33:26 -08:00
Leonardo de Moura
b3f87e2e4f
feat(library/tactic): make THEN, ORELSE, APPEND, PAR and INTERLEAVE nary combinators
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 22:11:07 -08:00
Leonardo de Moura
dae86c2ffa
feat(frontends/lean/parser): add basic tactic support in the frontend
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 21:08:12 -08:00
Leonardo de Moura
c6b05bcfcb
feat(library/tactic): modify assumption_tactic, it should fail if not applicable, and TRY tactical
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 18:23:38 -08:00
Leonardo de Moura
e3f3ec5553
feat(library/tactic): expose conj_tactic, imp_tactic, conj_hyp_tactic in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 18:17:15 -08:00
Leonardo de Moura
d36a91e145
feat(library/tactic): expose COND and WHEN tacticals in Lua, add HOL-like tactical names
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 17:57:24 -08:00
Leonardo de Moura
ff052d41ee
chore(*): fix cygwin compilation errors
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 13:49:18 -08:00
Leonardo de Moura
ce674d2d43
feat(library/tactic): execute Lua tactics using coroutines
...
This is very important when several Lua tactics are implemented in the
same Lua State object. In this case, even if we use the par
combinator, a Lua tactic will block the other Lua tactics running in
the same Lua State object.
With this commit, a Lua tactic can use yield to allow other tactics
in the same State object to execute.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 13:09:33 -08:00
Leonardo de Moura
09bc7ddf91
feat(library/tactic): add support for migratic tactic framework object between Lua states
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 08:03:05 -08:00
Leonardo de Moura
3dc7a856f0
refactor(library/tactic): use unprotect/protect idiom for callbacks in the tactic API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 18:11:46 -08:00
Leonardo de Moura
b4a8418d38
feat(library/tactic): expose tactics in the Lua API
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 17:47:29 -08:00
Leonardo de Moura
f7e8545e97
refactor(frontends/lua): rename leanlua_state to script_state, and move it to util
...
This commit also minimizes the dependencies of script_state.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 14:57:36 -08:00
Leonardo de Moura
956f203a55
refactor(bindings/lua): move Lua bindings to the file associated with them
...
The directory bindings/lua was getting too big and had too many dependencies.
Moreover, it was getting too painful to edit/maintain two different places.
Now, the bindings for module X are in the directory that defines X.
For example, the bindings for util/name.cpp are located at util/name.cpp.
The only exception is the kernel. We do not want to inflate the kernel
with Lua bindings. The bindings for the kernel classes are located
at bindings/kernel_bindings.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 19:15:56 -08:00
Leonardo de Moura
4e66a2e14a
fix(library/tactic/goal): typo
...
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 11:34:58 -08:00
Leonardo de Moura
c22f863114
refactor(library/tactic): improve solve method
...
Now, it produces the following outcomes:
1- A proof
2- A counterexample
3- A list of (unsolved) final states
Remark: the solve method does not check whether the proof or counterexample is correct.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 13:04:12 -08:00