UP | HOME

Code Examples

Table of Contents

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.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

Author: root

Created: 2016-01-15 Fri 13:03

Emacs 24.5.1 (Org mode 8.2.10)

Validate