Commit graph

1625 commits

Author SHA1 Message Date
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
662fb71d59 chore(tests/lua/threads): fix type in file name
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 13:12:54 -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
1eeec07713 doc(lua): add options documentation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 11:02:34 -08:00
Leonardo de Moura
6cb8300076 doc(lua): add S-expression documentation
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-28 10:33:32 -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
55f86f79a8 fix(util/optional): typo
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 16:57:29 -08:00
Leonardo de Moura
a2aa90ae66 refactor(util/script_state): replace std::recursive_mutex with std::mutex, and use unlock_guard
The unlock_guard and exec_unprotected will be useful also for implementing the Lua tactic API.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 15:40:41 -08:00
Leonardo de Moura
b038636ff5 refactor(util/script_state): remove unsafe unguarded_apply
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 15:14:26 -08:00
Leonardo de Moura
75b4a96d0e chore(tests/lua/threads): break lua thread tests into individual tests
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 15:06:07 -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
0934d7b2f4 fix(frontends/lua): make sure Lua 'sleep' function support interruption
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 13:25:06 -08:00
Leonardo de Moura
3a93212d5e chore(kernel/expr): fix cpplint warning
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:59:16 -08:00
Leonardo de Moura
e737f501e4 fix(frontends/lua): remove unnecessary function reference
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:58:35 -08:00
Leonardo de Moura
262670abd6 fix(frontends/lua/leanlua_thread): propagate C++ thread over Lua thread boundaries
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:49:12 -08:00
Leonardo de Moura
d87ad9eb7e refactor(util/lua): propagate C++ Lean exceptions in Lua
The following call sequence is possible:
C++ -> Lua -> C++ -> Lua -> C++

The first block of C++ is the Lean main function.
The main function invokes the Lua interpreter.
The Lua interpreter invokes a C++ Lean API.
Then the Lean API invokes a callback implemented in Lua.
The Lua callback invokes another Lean API.
Now, suppose the Lean API throws an exception.
We want the C++ exception to propagate over the mixed C++/Lua call stack.
We use the clone/rethrow exception idiom to achieve this goal.

Before this commit, the C++ exceptions were converted into strings
using the method what(), and then they were propagated over the Lua
stack using lua_error. A lua_error was then converted into a lua_exception when going back to C++.
This solution was very unsatisfactory, since all C++ exceptions were being converted into a lua_exception, and consequently the structure of the exception was being lost.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 12:25:29 -08:00
Leonardo de Moura
a6f6f49b5f refactor(frontends/lua): add lua_migrate_fn, and make copy_values modular
copy_values is not a big if-then-else anymore.
Before this change, whenever we added a new kind of userdata, we would have to update copy_values.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 10:32:19 -08:00
Leonardo de Moura
4c323093ac refactor(frontends/lua/leanlua_state): minimize the use of 'friend' directive
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-27 09:25:56 -08:00
Leonardo de Moura
4c5ec53a44 chore(util/lua): remove dead code
I removed lua_module helper class because it does not work.
The problem is that the linker may eliminate ignore a object file that contains a lua_module global object used for initialization. When this happens, the associated Lua bindings will not be exposed in the Lua API.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 19:36:32 -08:00
Leonardo de Moura
feca9dbdf8 refactor(bindings/lua): move to frontends/lua
Lua API is an integral part of Lean. It does *not* have the same status
of external APIs (e.g., Python) we will add in the future.

We will reserve the directory bindings for external APIs for using Lean
as a library.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 19:30:07 -08:00
Leonardo de Moura
fb06a2b1df refactor(bindings/lua/leanlua_state): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 19:24:18 -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
99a811a586 feat(bindings/lua): expose io_state object in the Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 12:54:47 -08:00
Leonardo de Moura
861be072d8 feat(bindings/lua): add proof_state to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 11:34:58 -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
b41789d085 feat(kernel): add is_bool predicate
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 11:34:50 -08:00
Leonardo de Moura
fd3b9e39f6 feat(bindings/lua): add cex_builder to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 09:17:57 -08:00
Leonardo de Moura
4d9075bdfd feat(bindings/lua): add proof_map, assignment and proof_builder to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-26 08:37:37 -08:00
Leonardo de Moura
3ebc099ec5 feat(bindings/lua/options): improve options Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 21:05:05 -08:00
Leonardo de Moura
feeb6d9105 feat(bindings/lua): add goal object to Lua API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 20:51:47 -08:00
Leonardo de Moura
e29a2f4d11 chore(util/interrupt): improve comment
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 17:23:36 -08:00
Leonardo de Moura
4eb62fef91 fix(util/interrupt): fix nasty bug on interruptible_thread, it seems to occur only on cygwin
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 17:14:22 -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
Leonardo de Moura
9a8ea0c735 feat(library/tactic): add precision and counterexample builder to proof state
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 11:43:16 -08:00
Leonardo de Moura
ccaa272f9a refactor(library/tactic): simplify proof_builder API
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 10:50:33 -08:00
Leonardo de Moura
500ed7a05b refactor(library/tactic): remove dead code, make proof_state a smart pointer, cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 10:39:40 -08:00
Leonardo de Moura
5af648030d chore(memcheck.supp): hide another false positive at luajit
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 10:07:40 -08:00
Leonardo de Moura
2c65fdb346 refactor(library/tactic): cleanup
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-25 01:06:34 -08:00
Soonho Kong
03791b099c chore(ctest): fix typo in CTEST_DROP_LOCATION 2013-11-25 03:14:35 -05:00
Soonho Kong
ac5a061f2a chore(ctest): use CDash server located at borel.modck.cs.cmu.edu 2013-11-25 02:48:04 -05:00
Leonardo de Moura
9dcfa03dd2 feat(library/tactic): add conj_hyp_tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 21:00:38 -08:00
Leonardo de Moura
d75bd2ae98 feat(library/tactic/proof_state): remove goal name when pretty printing the proof state
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 20:22:47 -08:00
Leonardo de Moura
48d7afb0e8 feat(library/tactic): add trace_state_tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 16:44:02 -08:00
Leonardo de Moura
6f05276acd refactor(library/tactic): remove unnecessary tactic_exception
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 16:31:49 -08:00
Leonardo de Moura
9c42a05b08 feat(library/tactic): add conj_tactic and imp_tactic
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 16:29:04 -08:00
Leonardo de Moura
1c607f3350 feat(library/tactic): add cond and when tacticals.
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2013-11-24 12:04:32 -08:00