* tests/: Rename as... * tests/core/: ... this. * python/tests/: Rename as... * tests/python/: ... this. * python/tests/run.in: Move as... * tests/run.in: This, and adjust. * tests/Makefile.am: Adjust to run both core and python tests. * configure.ac, README, debian/python3-spot.examples, debian/rules, doc/org/tut.org, python/Makefile.am, spot/ltsmin/Makefile.am, spot/ltsmin/kripke.test, spot/sanity/ipynb.test: Adjust.
3.1 KiB
Code Examples
This section contains code examples for using Spot. This is a work in progress. Feel free to send suggestions of small tasks you would like to see illustrated here.
If you have difficulties compiling the C++ examples, check out these instructions.
Examples with Shell, Python, and C++
All the following pages show how to perform the same task using the three interfaces supported by Spot: shell commands, Python, or C++.
Examples in Python and C++
Examples in Python only
In directory the, python/tests Spot tarball contains a small
collection of IPython notebooks. As the name of the directory implies,
these are part of the test suite for the Python bindings, however they
can be interesting to look at if you want to see more code examples.
For convenience, the following links offer static HTML renderings of these notebooks, but we strongly suggest interactively evaluating the real notebooks instead.
formulas.ipynbcovers the basics of LTL/PSL formula parsing and printing, with some light operationsautomata.ipynbcovers translation from formulas to automata, automata printing, and some lights transformationsautomata-io.ipynbshows how to save and read automata from filespiperead.ipynbshows how to save and read automata output from other commands, using pipesrandaut.ipynbshows a simple case where therandautcommands generated random automata, which are displayed in a table before and after acceptance simplificationaccparse.ipynbexercises the acceptance condition parseracc_cond.ipynbdocuments the interface for manipulating acceptance conditionsproduct.ipynbshows how to re-implement the product of two automata in Pythonrandltl.ipynbdemonstrates a Python-version ofrandltldecompose.ipynbillustrates thedecompose_strength()functiontestingaut.ipynbshows the step necessary to build a testing automaton