spot/doc/org/tut.org
Alexandre Duret-Lutz 74ec9c54c4 show how to implement product in Python
* wrap/python/tests/product.ipynb: New file.
* wrap/python/tests/Makefile.am, doc/org/tut.org: Add it.
* wrap/python/tests/ipnbdoctest.py: Ignore %timeit results.
* wrap/python/spot_impl.i: Add bindings for
set_state_names()/get_state_names().
* spot/twaalgos/product.cc: Fix computation of properties.
* doc/org/hoa.org: Name.
* NEWS: Update.
2015-12-24 19:47:15 +01:00

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 only

In directory wrap/python/tests, the 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.ipynb covers the basics of LTL/PSL formula parsing and printing, with some light operations
  • automata.ipynb covers translation from formulas to automata, automata printing, and some lights transformations
  • automata-io.ipynb shows how to save and read automata from files
  • piperead.ipynb shows how to save and read automata output from other commands, using pipes
  • randaut.ipynb shows a simple case where the randaut commands generated random automata, which are displayed in a table before and after acceptance simplification
  • accparse.ipynb exercises the acceptance condition parser
  • acc_cond.ipynb documents the interface for manipulating acceptance conditions
  • product.ipynb shows how to re-implement the product of two automata in Python
  • randltl.ipynb demonstrates a Python-version of randltl
  • decompose.ipynb illustrates the decompose_strength() function
  • testingaut.ipynb shows the step necessary to build a testing automaton