In [1]:
import spot
import spot.gen as sg
spot.setup()
from IPython.display import display
In [2]:
sg.ltl_pattern(sg.LTL_AND_GF, 3)
Out[2]:
In [3]:
sg.ltl_pattern(sg.LTL_CCJ_BETA_PRIME, 4)
Out[3]:
To see the list of supported patterns, the easiest way is to look at the --help
output of genltl
. The above pattern for instance is attached to option --ccj-beta-prime
. The name of the pattern identifier is the same using capital letters, underscores, and an LTL_
prefix. If a pattern has multiple aliased options in genltl
, the first one used for the identifier (e.g., genltl
accept both --dac-patterns
and --spec-patterns
as synonyms to denote the patterns of spot.gen.LTL_DAC_PATTERNS
).
Multiple patterns can be generated using the ltl_patterns()
function. It's arguments should be either can be:
(id, n)
: in this case the pattern id
with size/index n
is returned,(id, min, max)
: in this case the patterns are output for all n
between min
and max
included,id
: then this is equivalent to (id, 1, 10)
if the pattern has now upper bound, or (id, 1, upper)
if the patter id
has an upper bound upper
. This is mostly used when the pattern id correspond to a hard-coded list of formulas.Here is an example showing these three types of arguments:
In [4]:
for f in sg.ltl_patterns((sg.LTL_GH_R, 3), (sg.LTL_AND_FG, 1, 3), sg.LTL_EH_PATTERNS):
display(f)
In [5]:
display(sg.aut_pattern(sg.AUT_KS_NCA, 3).show('.a'),
sg.aut_pattern(sg.AUT_L_DSA, 3).show('.a'),
sg.aut_pattern(sg.AUT_L_NBA, 3).show('.a'))
Multiple automata can be generated using the aut_patterns()
function, which works similarly to ltl_patterns()
.
In [6]:
for aut in sg.aut_patterns(sg.AUT_KS_NCA):
print(aut.num_states())