Skip to main content

Python bindings for Acacia-Bonsai, an antichain-based LTL synthesis and safety-game solver

Project description

Acacia-Bonsai

This is a modern implementation of universal co-Buchi reactive synthesis algorithms using antichain data structures. The theory and practice is described in:

https://arxiv.org/abs/2204.06079

Docker images

Two pre-built images are published on the GitHub Container Registry. The Jupyter image is the easiest entry point for exploring acacia-bonsai interactively; the CLI image is what you want for benchmarking or scripting synthesis runs.

Boomslang image

This image comes with Spot (built with Python bindings), the Acacia Boomslang Python interface (acacia_boomslang), and a Jupyter notebook server already wired together. It is the quickest way to play with the tool — no compilation required on your end.

Pull the image:

docker pull ghcr.io/gaperez64/acacia-boomslang:latest

Start the notebook server, exposing port 8888 on the host:

docker run --rm -p 8888:8888 ghcr.io/gaperez64/acacia-boomslang:latest

The container prints a URL with an access token (e.g. http://127.0.0.1:8888/tree?token=...) — open it in your browser. The working directory contains python_examples/ with example scripts that import both spot and acacia_boomslang.

To mount a host directory of your own notebooks instead of the bundled examples:

docker run --rm -p 8888:8888 \
    -v "$PWD/my_notebooks:/work" \
    -e NOTEBOOK_DIR=/work \
    ghcr.io/gaperez64/acacia-boomslang:latest

CLI image

A pre-built Docker image with all dependencies and sources is available from the GitHub Container Registry. It ships sources only — compilation happens inside the container so that -march=native picks up the host's SIMD instruction set.

Pull the image:

docker pull ghcr.io/gaperez64/acacia-bonsai:latest

Create a named container and start it interactively (note: we deliberately do not pass --rm — compilation happens inside the container, so removing it on exit would throw away the binaries you are about to build):

docker run --name acacia -it ghcr.io/gaperez64/acacia-bonsai:latest

Inside the container, compile Spot and a number of optimized acacia-bonsai configurations:

./scripts/compile.sh

This builds Spot from source and then compiles all configurations. Now, you can run acacia-bonsai using the wrapper script:

./scripts/acacia-bonsai.sh best_decomp_mona \
      -f '((G (F (req))) -> (G (F (grant))))' -i req -o grant
REALIZABLE

The wrapper also accepts TLSF specs piped on stdin (translated to LTL via the bundled syfco). The image ships example specs in examples/:

cat examples/realizable.tlsf | ./scripts/acacia-bonsai.sh best_decomp_mona --tlsf
REALIZABLE
cat examples/unrealizable.tlsf | ./scripts/acacia-bonsai.sh best_decomp_mona --tlsf
UNREALIZABLE

When you exit the shell the container stops but is preserved. To re-enter it later with your compiled binaries intact:

docker start -ai acacia

From outside the container you can also pipe a TLSF spec into the running (or stopped-then-started) container via docker exec / docker start:

docker start acacia   # if it is stopped
cat examples/realizable.tlsf | docker exec -i acacia \
      /opt/acacia-bonsai/scripts/acacia-bonsai.sh best_decomp_mona --tlsf

To synthesize a controller (AIGER/AAG format) and have it printed on stdout when the spec is realizable, use acacia-synthesis.sh. It accepts the same options as acacia-bonsai.sh; the REALIZABLE/UNREALIZABLE verdict goes to stderr so stdout carries only the AAG:

cat examples/realizable.tlsf | docker exec -i acacia \
      /opt/acacia-bonsai/scripts/acacia-synthesis.sh \
      best_decomp_mona --tlsf > controller.aag

To see available configurations:

./scripts/acacia-bonsai.sh

If you would rather not keep the acacia container around but still want to reuse the compiled binaries later, snapshot the container into a new image (we suggest the compiled tag to distinguish it from the source-only latest):

docker commit acacia ghcr.io/gaperez64/acacia-bonsai:compiled

From then on you can spin up fresh, throwaway containers that already have Spot and the acacia-bonsai configurations built in — --rm is fine here because there is nothing left to compile:

docker run --rm -it ghcr.io/gaperez64/acacia-bonsai:compiled
cat examples/realizable.tlsf | docker run --rm -i \
      ghcr.io/gaperez64/acacia-bonsai:compiled \
      /opt/acacia-bonsai/scripts/acacia-bonsai.sh best_decomp_mona --tlsf

Once you are done with the original container for good, remove it explicitly:

docker rm acacia

Dependencies

This program depends on:

Some of the tests also depend on:

  • Valgrind

Installing dependencies on macOS

Note that on macOS the compilation has to happen via GCC. GCC can be installed using Homebrew: brew install gcc. Once installed, meson needs to be told to use GCC instead of built-in Clang. This can be done using the meson-native file, or by setting the CXX and CC environment variables. For instance, do export CXX=$(brew --prefix)/bin/g++-XX before starting with meson.

Spot has to be manually compiled using GCC and installed. After compiling it and installing it, you still need to ensure that meson can find Spot using pkgconfig. This can be done, for example, by setting the pkg_config_path in a meson-native file or by issuing export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig before starting with meson (this works if you installed spot in the default location).

Compiling, running, benchmarking

To compile and run, use Meson:

meson setup build
cd build
meson compile
src/acacia-bonsai -h
  [...]
src/acacia-bonsai -f '((G (F (req))) -> (G (F (grant))))' -i req -o grant
REALIZABLE

Another usage:

src/acacia-bonsai -f '((G (F (req))) <-> (G(!grant) ))' -i req -o grant
UNREALIZABLE

Note that this will compile a debug version of Acacia-Bonsai. A benchmarking script is available at the root:

./self-benchmark.sh -h

In particular, it can be used to build an optimized version of Acacia-Bonsai:

./self-benchmark.sh -c best -B
  [...]
cd build_best
src/acacia-bonsai -h
src/acacia-bonsai -f '((G (F (req))) -> (G (F (grant))))' -i req -o grant
REALIZABLE

The -c option selects a configuration and the -B option deactivates actual benchmarking, so that only compilation is done.

Documentation

This project comes with a doxygen configuration file. Execute the following command to generate documentation:

doxygen Doxyfile

Citing

If you use this tool for your academic work, please make sure to cite the paper we wrote about it.

@inproceedings{DBLP:conf/tacas/CadilhacP23,
  author       = {Micha{\"{e}}l Cadilhac and
                  Guillermo A. P{\'{e}}rez},
  editor       = {Sriram Sankaranarayanan and
                  Natasha Sharygina},
  title        = {Acacia-Bonsai: {A} Modern Implementation of Downset-Based {LTL} Realizability},
  booktitle    = {Tools and Algorithms for the Construction and Analysis of Systems
                  - 29th International Conference, {TACAS} 2023, Held as Part of the
                  European Joint Conferences on Theory and Practice of Software, {ETAPS}
                  2022, Paris, France, April 22-27, 2023, Proceedings, Part {II}},
  series       = {Lecture Notes in Computer Science},
  volume       = {13994},
  pages        = {192--207},
  publisher    = {Springer},
  year         = {2023},
  url          = {https://doi.org/10.1007/978-3-031-30820-8\_14},
  doi          = {10.1007/978-3-031-30820-8\_14},
  timestamp    = {Sat, 29 Apr 2023 19:25:03 +0200},
  biburl       = {https://dblp.org/rec/conf/tacas/CadilhacP23.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acacia_boomslang-2.0.17.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (53.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (52.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

acacia_boomslang-2.0.17-cp314-cp314-macosx_15_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.14macOS 15.0+ ARM64

acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (53.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (52.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

acacia_boomslang-2.0.17-cp313-cp313-macosx_15_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 15.0+ ARM64

File details

Details for the file acacia_boomslang-2.0.17.tar.gz.

File metadata

  • Download URL: acacia_boomslang-2.0.17.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for acacia_boomslang-2.0.17.tar.gz
Algorithm Hash digest
SHA256 961f6a1df055d193ab206ce2e7fad9d47e61da64d508fe96bdbb4ec1e6354c8c
MD5 56f22457c195b58b900a792f597503d6
BLAKE2b-256 0d80379dda6b9a1a29ac0ad3f788f2d8b26778f0a29930ce183f504a04dfc05e

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17.tar.gz:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 46d303920b16b08c96e6c690d2a2a1fc0f7f2cc9be1287e1a7d4b1c72612e525
MD5 0fdc105c63075850ae702259814cba98
BLAKE2b-256 ab9fc30a1dfb1795c81fbc02a94f69f53a7a40de3622a96dd149f945c60c30cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 32aec8984a2c6e043123cebb721295bef2caed99c896b1da393e4051dbb20955
MD5 afa191db0c58b05517cd909dd4b52344
BLAKE2b-256 0cddedef8947660731465fadefcbee5019e0e011321fd76273d4df265749079b

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp314-cp314-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp314-cp314-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 f0f9fc12562370808c45b21c5ab6a1bfd31a0cca44d373aa486646b0318d46b1
MD5 ce6e7762a8f6b91713321582fce5dc29
BLAKE2b-256 9c6d87f7fe8c6851af0d827d4a7dd56c555ce73ec84d2b8a727d81bafa3798fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp314-cp314-macosx_15_0_arm64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2b8239a304ef69e7243d3f79aa7bda7f7dd0d0f9c48202f0628e3a5880b09270
MD5 669bfd51cce2f9db9c1a9e28efd1f284
BLAKE2b-256 dab8bc4f71f4e648e5869c579c62a8008360dbf4d6715c461adc2f1442ee6929

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b306bdefa2db6cc0e7a9789bd469aec4c506d0ab1ff898d412a91031f92928d8
MD5 a45b09742fd17e15c9e579d0ac04fe9a
BLAKE2b-256 8d9b5ae272781cc07335b7c5756d33e481db8a68ebe759e844f9b9e78c6ad98a

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file acacia_boomslang-2.0.17-cp313-cp313-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for acacia_boomslang-2.0.17-cp313-cp313-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 e508ed11b6c4e382e47ef0a14ea8e40de265c17b13ee74920842020e118a3710
MD5 b6c5a74903b84f8c34b3df3c8caddb96
BLAKE2b-256 58ec25799198be9776867b2e2ec8a8cf26da995d2792674ae37b36b768468bc4

See more details on using hashes here.

Provenance

The following attestation bundles were made for acacia_boomslang-2.0.17-cp313-cp313-macosx_15_0_arm64.whl:

Publisher: wheels.yml on gaperez64/acacia-bonsai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page