Documentation for Spot's randltl Python binding

Basic usage

Generate random formulas from specified atomic propositions:

Generate random formulas using 3 atomic propositions:

By default, there is no limit to the number of formulas generated.
To specify a number of formulas:

Keyword arguments

seed

Seed for the pseudo random number generator (default: 0).

output

Type of formulas to output: 'ltl', 'psl', 'bool' or 'sere' (default: 'ltl').

allow_dups

Allow duplicate formulas (default: False).

tree_size

Tree size of the formulas generated, before mandatory simplifications (default: 15).

A range can be specified as a tuple:

boolean_priorities, ltl_priorities, sere_priorities, dump_priorities

To see which operators are available along with their default priorities:

simplify

0 No rewriting
1 basic rewritings and eventual/universal rules
2 additional syntactic implication rules
3 better implications using containment
default: 3

Filters and maps

most Boolean functions found in the class formula can be used to filter the random formula generator like this:

likewise, functions from formula to formula can be applied to map the iterator:

Since the Boolean filters and mapping functions return an iterator of the same type, these operations can be chained like this: