import spot
Generate random formulas from specified atomic propositions:
f = spot.randltl(['a', 'b', 'c'])
for i in range(3):
print(next(f))
Generate random formulas using 3 atomic propositions:
f = spot.randltl(3)
for i in range(3):
print(next(f))
By default, there is no limit to the number of formulas generated.
To specify a number of formulas:
f = spot.randltl(3, 4)
for formula in f:
print(formula)
Seed for the pseudo random number generator (default: 0).
f = spot.randltl(3, seed=11)
print(next(f))
Type of formulas to output: 'ltl', 'psl', 'bool' or 'sere' (default: 'ltl').
f = spot.randltl(3, output='psl', seed=26)
print(next(f))
Allow duplicate formulas (default: False).
f = spot.randltl(1, allow_dups=True)
print(next(f))
print(next(f))
print(next(f))
Tree size of the formulas generated, before mandatory simplifications (default: 15).
f = spot.randltl(3, tree_size=30, seed=11)
print(next(f))
A range can be specified as a tuple:
f = spot.randltl(3, tree_size=(1, 40))
print(next(f))
print(next(f))
f = spot.randltl(3, output='bool', boolean_priorities='and=10,or=0')
for i in range(5):
print(next(f))
To see which operators are available along with their default priorities:
spot.randltl(3, output='psl', dump_priorities=True)
0 No rewriting
1 basic rewritings and eventual/universal rules
2 additional syntactic implication rules
3 better implications using containment
default: 3
f = spot.randltl(3, simplify=0, seed=5)
print(next(f))
f = spot.randltl(3, simplify=3, seed=5)
print(next(f))
most Boolean functions found in the class formula can be used to filter the random formula generator like this:
f = spot.randltl(3, 20).is_syntactic_stutter_invariant()
for formula in f:
print(formula)
likewise, functions from formula to formula can be applied to map the iterator:
f = spot.randltl(2, 6).remove_x()
for formula in f:
print(formula)
Since the Boolean filters and mapping functions return an iterator of the same type, these operations can be chained like this:
f = spot.randltl(3, 20).is_syntactic_stutter_invariant().relabel(spot.Abc).simplify()
for formula in f:
print(formula)
for formula in spot.randltl(3, 10).simplify().unabbreviate("WMGFR"): print(formula)