Simba(Synthesis from Inductive specification eMpowered by Bidirectional Abstract interpretation) is an inductive program synthesizer using forward and backward abstract interpretation for pruning search spaces.
If you want to build and run this tool on macOS, you should install these tools first.
opam
(https://opam.ocaml.org/): for ocaml compiler
$ sudo apt-get install -y opam # for linux
$ brew install opam # for mac
$
$ opam init --auto-setup --disable-sandboxing --yes
libgmp-dev
(https://gmplib.org/): for z3 solver
$ sudo apt-get install -y libgmp-dev # for linux
$ brew install gmp # for mac
TL;DR
, do it in one-line commannd
$ ./first_build.sh
- Make proper ocaml environment and get dependency packages
opam switch create simba 4.12.0
opam switch simba
opam install --yes dune merlin ocaml-lsp-server dune-build-info batteries ocamlgraph core_kernel yojson z3
dune
: build systemdune-build_info
: insert version information(commit id) to binarymerlin
: IntelliSense systemocaml-lsp-server
: for merlin in visual studio codebatteries
: extended standard librariesocamlgraph
: ordering grammar rulescore-kernel
: sexp utilitiesyojson
: report by json formatz3
: SMT solver
- Build by dune
dune build
dune install --prefix=_install
The compiled executable file can be found at _install/bin/simba
.
Since the executable is self-contained, it can be easily moved or copied to any location for your convenience and executed.
Just run the executable with target sl file.
$ ./simba.exe <options> [a SyGuS input file]
You may find the options available by:
$ ./simba.exe -help
For example, to solve the problem described in testcases/bitvec/hd/hd-17-d5-prog.sl
,
$ simba/simba.exe testcases/bitvec/hd/hd-17-d5-prog.sl
You will get the following output:
(define-fun f ( (x (BitVec 64))) (BitVec 64) (bvand (bvneg (bvand (bvnot x) (bvneg x))) x))
****************** statistics *******************
size : 8
time : 1.24 sec
final max component size : 6
final component pool size : 4617
**************************************************
The first line shows a desirable solution (f is the target synthesis function), and the other lines show some useful statistics.
For more detailed progress log and statistics, use option -log
as follows:
$ simba/simba.exe -log stdout bench/bitvec/hd/hd-17-d5-prog.sl
$ simba/simba.exe -log solving-hd-17-d5.log bench/bitvec/hd/hd-17-d5-prog.sl