Skip to main content

A tool for formal verification of behavior trees

Project description

BehaVerify

BehaVerify is a tool for turning specifications of Behavior Trees into nuXmv models for verification as well as generating Python and Haskell implementations of the specified trees.

To recreate tests, see REPRODUCIBILITY.

References

Serena S. Serbinowska, Diego Manzanas Lopez, Dung Thuy Nguyen and Taylor T. Johnson, Neuro-Symbolic Behavior Trees and Their Verification, 2nd International Conference on Neuro-symbolic Systems (NeuS2025), Philadelphia, Pennsylvania, May 2025. https://proceedings.mlr.press/v288/serbinowska25a.html and https://neus-2025.github.io/files/papers/paper_56.pdf

Serena S. Serbinowska, Preston Robinette, Gabor Karsai, Taylor T. Johnson, Formalizing Stateful Behavior Trees, Proceedings Sixth International Workshop on Formal Methods for Autonomous Systems (FMAS2024), Manchester, UK, 11th and 12th of November 2024, Electronic Proceedings in Theoretical Computer Science 411, pp. 201–218. https://dx.doi.org/10.4204/EPTCS.411.14

Serena S. Serbinowska, Nicholas Potteiger, Anne M. Tumlin, Taylor T. Johnson, Verification of Behavior Trees with Contingency Monitors, Proceedings Sixth International Workshop on Formal Methods for Autonomous Systems (FMAS2024), Manchester, UK, 11th and 12th of November 2024, Electronic Proceedings in Theoretical Computer Science 411, pp. 56–72. https://dx.doi.org/10.4204/EPTCS.411.4

Serbinowska, S.S., Johnson, T.T. (2022). BehaVerify: Verifying Temporal Logic Specifications for Behavior Trees. In: Schlingloff, BH., Chai, M. (eds) Software Engineering and Formal Methods. SEFM 2022. Lecture Notes in Computer Science, vol 13550. Springer, Cham. https://doi.org/10.1007/978-3-031-17108-6_19

Installation

The following commands will download and install BehaVerify. A breakdown of the commands is provided below, in case something goes wrong. While the installation commands are formatted for Linux, we believe that BehaVerify will work on other operating systems.

wget https://nuxmv.fbk.eu/theme/download.php?file=nuXmv-2.1.0-linux64.tar.xz -O ./nuXmv_DL.tar.xz
tar -xf ./nuXmv_DL.tar.xz --one-top-level=nuXmv_DL --strip-components 1
mv ./nuXmv_DL/bin/nuXmv ./nuXmv
chmod +x nuXmv
git clone https://github.com/verivital/behaverify
cd behaverify
python3 -m venv ../behaverify_venv
source ../behaverify_venv/bin/activate
python3 -m pip install .

Explanation of installation

These four commands are used to download nuXmv ( https://nuxmv.fbk.eu/ ), extract the file, retrieve the executable, and ensure it is runnable.

wget https://nuxmv.fbk.eu/theme/download.php?file=nuXmv-2.1.0-linux64.tar.xz -O ./nuXmv_DL.tar.xz
tar -xf ./nuXmv_DL.tar.xz --one-top-level=nuXmv_DL --strip-components 1
mv ./nuXmv_DL/bin/nuXmv ./nuXmv
chmod +x nuXmv

We provide some additional details about nuXmv.


These two commands are used to clone the repository and move into it.

git clone https://github.com/verivital/behaverify
cd behaverify

These three commands are used to create a Python virtual environment, activate it, and then install BehaVerify

python3 -m venv ../behaverify_venv
source ../behaverify_venv/bin/activate
python3 -m pip install .

Assuming all of the commands have been executed, BehaVerify has now been installed within the virtual environment and is ready for use. See test run to test your installation.

Running BehaVerify

Using the Virtual Environment

To run BehaVerify, we will need to use the virtual environment we created during the installation process. This can be done in one of two ways.

  1. Activate the virtual environment.
  2. Explicitly call the virtual environment.

For method 1, run the following

source /path/to/behaverify_venv/bin/activate

Now, the terminal you are using should have (behaverify_venv) listed prior to your username. The virtual environment has been activated within this terminal. You can now use BehaVerify within this terminal. Assuming you are in the top level of the repository and followed the installation instructions, this will be

source ../behaverify_venv/bin/activate

For method 2, you will need to modify each command that follows in the following manner:

python3 ...

becomes

/path/to/behaverify_venv/bin/python3 ...

Assuming you are in the top level of the repository and followed the installation instructions, this will be

../behaverify_venv/bin/python3 ...

Test Run

Assuming you are in the top level of the BehaVerify repository, please test your installation by running the following command.

python3 -m behaverify nuxmv examples/DrunkenDrone/DrunkenDrone.tree ../behaverify_test --generate --invar --ctl --ltl --simulate 10 --nuxmv_path ../nuXmv 

Then use

cat ../test/nuxmv/DrunkenDrone.smv

and

cat ../test/nuxmv/DrunkenDrone_output.txt

to view the nuXmv model and verification results, respectively.

Examples

Please refer to https://github.com/verivital/behaverify/tree/main/tutorial_examples .

Options

The first argument to BehaVerify is the mode. Currently available modes (not case sensitive) are (in alphabetical order)

Each of these is explained in a subsection below, and each features an example of how it could be run. Each example assumes you are at the top level of the repository and that the virtual environment is activated. Note that BehaVerify will do its best to not overwrite any existing files.

grid mode

This mode is used to render a trace from a nuXmv or python execution of a grid world. It is still being developed and functionality is currently limited. Right now, it assumes variables are named in a very specific way, and as such only works with very specific examples. This will be improved in the future.

python3 -m behaverify nuxmv examples/NetworkExample/using9995.tree ../behaverify_example_grid/ --generate --ctl --nuxmv_path ../nuXmv
python3 -m behaverify grid nuxmv ../behaverify_example/nuxmv/using9995_output.txt ../behaverify_example_grid/ 10 10

The first command generates a nuXmv model and tries to verify the CTL specification. Since the specification is false, nuXmv produces a countertrace. This countertrace is then fed into the second command to produce images of the counterexample.

Haskell mode

This mode is used to generate a Haskell implementation of the behavior tree.

python3 -m behaverify haskell ./examples/Collatz/collatz.tree ../behaverify_example_haskell/

LaTeX mode

This mode is used to generate a tikz diagram of the behavior tree.

python3 -m behaverify latex ./examples/Collatz/collatz_small.tree ../behaverify_example_latex/collatz_small.tex

nuXmv mode

This mode is used to generate or run a nuXmv model for verification purposes.

python3 -m behaverify nuxmv examples/NetworkExample/using1000.tree ../behaverify_example_nuxmv/ --generate --ctl --nuxmv_path ../nuXmv

Python mode

This mode is used to generate a Python implemention of the behavior tree.

python3 -m behaverify python ./examples/Collatz/collatz.tree ../behaverify_example_python/

trace mode

This mode is used to generate a series of images illustrating a trace from nuXmv.

python3 -m behaverify nuxmv examples/Collatz/collatz.tree ../behaverify_example_trace/ --generate --invar --nuxmv_path ../nuXmv
python3 -m behaverify trace examples/Collatz/collatz.tree ../behaverify_example_trace/nuxmv/collatz_output.txt ../behaverify_example/

nuXmv

Per the licensing agreement of nuXmv (see https://nuxmv.fbk.eu/downloads/LICENSE.txt ), we may not re-distribute the software in any form for any purpose. Thank you for understanding. The installation section above, however, does provide you with commandline options for downloading, extracting, and moving the software.

To aquire nuXmv, see https://nuxmv.fbk.eu/download.html or https://nuxmv.fbk.eu/theme/download.php?file=nuXmv-2.1.0-linux64.tar.xz . You only need to download nuXmv. There should be no installation. Please make sure you download the appropriate version for your Operating System.

For the Linux version, please ensure you download the Linux 64-bit x86 version 2.1.0 (November 29, 2024). The executable will be located in nuXmv-2.1.0-linux64/bin/nuXmv. There should be NO FILE EXTENSION.

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

behaverify-0.0.1.tar.gz (414.3 kB view details)

Uploaded Source

Built Distribution

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

behaverify-0.0.1-py3-none-any.whl (454.9 kB view details)

Uploaded Python 3

File details

Details for the file behaverify-0.0.1.tar.gz.

File metadata

  • Download URL: behaverify-0.0.1.tar.gz
  • Upload date:
  • Size: 414.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for behaverify-0.0.1.tar.gz
Algorithm Hash digest
SHA256 94fb7ca0c70a292640d418a79f8729c1e32aab02635aace1b991df07c9853031
MD5 7cdc4e76d97c77e0d141365790dde4d6
BLAKE2b-256 b2f5409b82797e43b79a3f9a506ad209b021617275883715bdb6e08844462c1f

See more details on using hashes here.

File details

Details for the file behaverify-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: behaverify-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 454.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for behaverify-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7bdf60db19aa706cfe1f8263e123a20e2ce8bb3036cdaaf26d363357361dda13
MD5 3eb66ab560004070e4f7bf2a87c5d858
BLAKE2b-256 2c80eec24491b3b823e15c1c2b9f8ddb4016b9349735529970b717f6afd88a60

See more details on using hashes here.

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