Flatten the formula ltl::formula hiearchy into a single ltl::vnode that has an enumerator to distinguish the types of node, and a common interface to access children, update reference counts, etc. The ltl::formula class is now a thin wrapper around an ltl::vnode pointer to keep track of reference counts automatically. Visitor are not used anymore; we now have map() and traversor() methods that are more concise. This basically fixes #43, but should be followed by some fine tuning that should now be localized to the formula.hh and formula.cc files. Some statistics about this patch. I started working on it on Sep 9, had a first compiling version two weeks later on Sep 22, and it then took 5 days to fixes the ~70 distincts bugs that were introduced during the conversion. About 13200 lines were modified, and one third of those were removed. * src/ltlast/formula.cc, src/ltlast/formula.hh: Complete rewrite, including what was in separate nearby files. * src/ltlast/allnodes.hh, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/bunop.cc, src/ltlast/bunop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlast/predecl.hh: Delete these files. Their feature have been merged in formula.hh and formula.cc. * src/ltlast/visitor.hh, src/ltlvisit/clone.cc, src/ltlvisit/clone.hh, src/ltlvisit/dump.hh, src/ltlvisit/postfix.cc, src/ltlvisit/postfix.hh: Delete these files, as we do not use visitors anymore. * bench/stutter/stutter_invariance_formulas.cc, bench/stutter/stutter_invariance_randomgraph.cc, doc/org/tut01.org, doc/org/tut02.org, doc/org/tut10.org, doc/org/tut22.org, iface/ltsmin/ltsmin.cc, iface/ltsmin/ltsmin.hh, iface/ltsmin/modelcheck.cc, src/bin/autfilt.cc, src/bin/common_aoutput.cc, src/bin/common_aoutput.hh, src/bin/common_finput.cc, src/bin/common_finput.hh, src/bin/common_output.cc, src/bin/common_output.hh, src/bin/common_trans.cc, src/bin/common_trans.hh, src/bin/dstar2tgba.cc, src/bin/genltl.cc, src/bin/ltl2tgba.cc, src/bin/ltl2tgta.cc, src/bin/ltlcross.cc, src/bin/ltldo.cc, src/bin/ltlfilt.cc, src/bin/ltlgrind.cc, src/bin/randaut.cc, src/bin/randltl.cc, src/kripke/kripkeexplicit.cc, src/kripke/kripkeexplicit.hh, src/kripkeparse/kripkeparse.yy, src/ltlast/Makefile.am, src/ltlenv/declenv.cc, src/ltlenv/declenv.hh, src/ltlenv/defaultenv.cc, src/ltlenv/defaultenv.hh, src/ltlenv/environment.hh, src/ltlparse/ltlparse.yy, src/ltlparse/public.hh, src/ltlvisit/Makefile.am, src/ltlvisit/apcollect.cc, src/ltlvisit/apcollect.hh, src/ltlvisit/contain.cc, src/ltlvisit/contain.hh, src/ltlvisit/dot.cc, src/ltlvisit/dot.hh, src/ltlvisit/exclusive.cc, src/ltlvisit/exclusive.hh, src/ltlvisit/length.cc, src/ltlvisit/length.hh, src/ltlvisit/mark.cc, src/ltlvisit/mark.hh, src/ltlvisit/mutation.cc, src/ltlvisit/mutation.hh, src/ltlvisit/nenoform.cc, src/ltlvisit/nenoform.hh, src/ltlvisit/print.cc, src/ltlvisit/print.hh, src/ltlvisit/randomltl.cc, src/ltlvisit/randomltl.hh, src/ltlvisit/relabel.cc, src/ltlvisit/relabel.hh, src/ltlvisit/remove_x.cc, src/ltlvisit/remove_x.hh, src/ltlvisit/simpfg.cc, src/ltlvisit/simpfg.hh, src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh, src/ltlvisit/snf.cc, src/ltlvisit/snf.hh, src/ltlvisit/unabbrev.cc, src/ltlvisit/unabbrev.hh, src/parseaut/parseaut.yy, src/ta/taexplicit.cc, src/ta/tgtaexplicit.cc, src/taalgos/minimize.cc, src/taalgos/tgba2ta.cc, src/tests/bare.test, src/tests/checkpsl.cc, src/tests/checkta.cc, src/tests/complementation.cc, src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc, src/tests/ikwiad.cc, src/tests/isop.test, src/tests/kind.cc, src/tests/length.cc, src/tests/ltldo.test, src/tests/ltlfilt.test, src/tests/ltlgrind.test, src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/parse_print_test.cc, src/tests/parseaut.test, src/tests/parseerr.test, src/tests/randtgba.cc, src/tests/readltl.cc, src/tests/reduc.cc, src/tests/syntimpl.cc, src/tests/taatgba.cc, src/tests/tostring.cc, src/tests/twagraph.cc, src/tests/utf8.test, src/twa/acc.cc, src/twa/bdddict.cc, src/twa/bdddict.hh, src/twa/bddprint.cc, src/twa/formula2bdd.cc, src/twa/formula2bdd.hh, src/twa/taatgba.cc, src/twa/taatgba.hh, src/twa/twa.cc, src/twa/twa.hh src/twa/twagraph.cc, src/twa/twagraph.hh, src/twa/twasafracomplement.cc, src/twaalgos/compsusp.cc, src/twaalgos/compsusp.hh, src/twaalgos/dtgbasat.cc, src/twaalgos/hoa.cc, src/twaalgos/lbtt.cc, src/twaalgos/ltl2taa.cc, src/twaalgos/ltl2taa.hh, src/twaalgos/ltl2tgba_fm.cc, src/twaalgos/ltl2tgba_fm.hh, src/twaalgos/minimize.cc, src/twaalgos/minimize.hh, src/twaalgos/neverclaim.cc, src/twaalgos/postproc.cc, src/twaalgos/postproc.hh, src/twaalgos/powerset.cc, src/twaalgos/powerset.hh, src/twaalgos/randomgraph.cc, src/twaalgos/remprop.cc, src/twaalgos/remprop.hh, src/twaalgos/stats.cc, src/twaalgos/stats.hh, src/twaalgos/stutter.cc, src/twaalgos/stutter.hh, src/twaalgos/translate.cc, src/twaalgos/translate.hh, wrap/python/ajax/spotcgi.in, wrap/python/spot.py, wrap/python/spot_impl.i, wrap/python/Makefile.am, wrap/python/tests/automata-io.ipynb, wrap/python/tests/formulas.ipynb, wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py, wrap/python/tests/ltlsimple.py, wrap/python/tests/randltl.ipynb: Adjust to use the new interface. * src/sanity/style.test: Accept more C++11 patterns. * NEWS: Mention the change.
624 lines
No EOL
13 KiB
Text
624 lines
No EOL
13 KiB
Text
{
|
|
"metadata": {
|
|
"name": "",
|
|
"signature": "sha256:54b0c9570ca91322c466f914d622a3723cd3e450612a055a188927bf50dfdaf8"
|
|
},
|
|
"nbformat": 3,
|
|
"nbformat_minor": 0,
|
|
"worksheets": [
|
|
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 1,
|
|
"metadata": {},
|
|
"source": [
|
|
"Documentation for spot's randltl python binding"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": true,
|
|
"input": [
|
|
"import spot"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"prompt_number": 1
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 2,
|
|
"metadata": {},
|
|
"source": [
|
|
"Basic usage"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Generate random formulas from specified atomic propositions:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(['a', 'b', 'c'])\n",
|
|
"for i in range(3):\n",
|
|
" print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"0 R b\n",
|
|
"F(XG(F!b M Fb) W (b R a))\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 2
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Generate random formulas using 3 atomic propositions:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3)\n",
|
|
"for i in range(3):\n",
|
|
" print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"0 R p1\n",
|
|
"F(XG(F!p1 M Fp1) W (p1 R p0))\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 3
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"By default, there is no limit to the number of formulas generated.<br/>\n",
|
|
"To specify a number of formulas:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, 4)\n",
|
|
"for formula in f:\n",
|
|
" print(formula)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"0 R p1\n",
|
|
"F(XG(F!p1 M Fp1) W (p1 R p0))\n",
|
|
"F(p0 R !p2)\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 4
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 2,
|
|
"metadata": {},
|
|
"source": [
|
|
"Keyword arguments"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 2,
|
|
"metadata": {},
|
|
"source": [
|
|
"seed"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Seed for the pseudo random number generator (default: 0)."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, seed=11)\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"G(p2 U Gp0)\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 5
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 3,
|
|
"metadata": {},
|
|
"source": [
|
|
"output"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Type of formulas to output: 'ltl', 'psl', 'bool' or 'sere' (default: 'ltl')."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, output='psl', seed=332)\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"{{p0 && p1}[*]}<>-> (Fp1 & Fp0)\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 6
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 3,
|
|
"metadata": {},
|
|
"source": [
|
|
"allow_dups"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Allow duplicate formulas (default: False)."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(1, allow_dups=True)\n",
|
|
"print(next(f))\n",
|
|
"print(next(f))\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"0\n",
|
|
"Fp0\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 7
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 3,
|
|
"metadata": {},
|
|
"source": [
|
|
"tree_size"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"Tree size of the formulas generated, before mandatory simplifications (default: 15)."
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, tree_size=30, seed=11)\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"G(((p0 U !Xp1) M Gp1) U Gp0)\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 8
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"A range can be specified as a tuple:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, tree_size=(1, 40))\n",
|
|
"print(next(f))\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"X!(Gp1 M p2) R (!p2 M Xp1)\n",
|
|
"F(G(F(Gp0 R (1 U Fp2)) M (p2 -> Gp0)) M F((p0 | Fp0) W Gp2))\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 9
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 3,
|
|
"metadata": {},
|
|
"source": [
|
|
"boolean_priorities, ltl_priorities, sere_priorities, dump_priorities"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, output='bool', boolean_priorities='and=10,or=0')\n",
|
|
"for i in range(5):\n",
|
|
" print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"!p2 & (p1 <-> p2)\n",
|
|
"p2\n",
|
|
"p0 & ((p1 & p2) <-> !(!p0 & p1 & p2))\n",
|
|
"1\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 10
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"To see which operators are available along with their default priorities:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"spot.randltl(3, output='psl', dump_priorities=True)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"Use argument ltl_priorities=STRING to set the following LTL priorities:\n",
|
|
"\n",
|
|
"ap\t3\n",
|
|
"false\t1\n",
|
|
"true\t1\n",
|
|
"not\t1\n",
|
|
"F\t1\n",
|
|
"G\t1\n",
|
|
"X\t1\n",
|
|
"Closure\t1\n",
|
|
"equiv\t1\n",
|
|
"implies\t1\n",
|
|
"xor\t1\n",
|
|
"R\t1\n",
|
|
"U\t1\n",
|
|
"W\t1\n",
|
|
"M\t1\n",
|
|
"and\t1\n",
|
|
"or\t1\n",
|
|
"EConcat\t1\n",
|
|
"UConcat\t1\n",
|
|
"\n",
|
|
"Use argument sere_priorities=STRING to set the following SERE priorities:\n",
|
|
"\n",
|
|
"ap\t3\n",
|
|
"false\t1\n",
|
|
"true\t1\n",
|
|
"not\t1\n",
|
|
"F\t1\n",
|
|
"G\t1\n",
|
|
"X\t1\n",
|
|
"Closure\t1\n",
|
|
"equiv\t1\n",
|
|
"implies\t1\n",
|
|
"xor\t1\n",
|
|
"R\t1\n",
|
|
"U\t1\n",
|
|
"W\t1\n",
|
|
"M\t1\n",
|
|
"and\t1\n",
|
|
"or\t1\n",
|
|
"EConcat\t1\n",
|
|
"UConcat\t1\n",
|
|
"eword\t1\n",
|
|
"boolform\t1\n",
|
|
"star\t1\n",
|
|
"star_b\t1\n",
|
|
"fstar\t1\n",
|
|
"fstar_b\t1\n",
|
|
"and\t1\n",
|
|
"andNLM\t1\n",
|
|
"or\t1\n",
|
|
"concat\t1\n",
|
|
"fusion\t1\n",
|
|
"\n",
|
|
"Use argument boolean_priorities=STRING to set the following Boolean formula priorities:\n",
|
|
"\n",
|
|
"ap\t3\n",
|
|
"false\t1\n",
|
|
"true\t1\n",
|
|
"not\t1\n",
|
|
"F\t1\n",
|
|
"G\t1\n",
|
|
"X\t1\n",
|
|
"Closure\t1\n",
|
|
"equiv\t1\n",
|
|
"implies\t1\n",
|
|
"xor\t1\n",
|
|
"R\t1\n",
|
|
"U\t1\n",
|
|
"W\t1\n",
|
|
"M\t1\n",
|
|
"and\t1\n",
|
|
"or\t1\n",
|
|
"EConcat\t1\n",
|
|
"UConcat\t1\n",
|
|
"eword\t1\n",
|
|
"boolform\t1\n",
|
|
"star\t1\n",
|
|
"star_b\t1\n",
|
|
"fstar\t1\n",
|
|
"fstar_b\t1\n",
|
|
"and\t1\n",
|
|
"andNLM\t1\n",
|
|
"or\t1\n",
|
|
"concat\t1\n",
|
|
"fusion\t1\n",
|
|
"ap\t3\n",
|
|
"false\t1\n",
|
|
"true\t1\n",
|
|
"not\t1\n",
|
|
"equiv\t1\n",
|
|
"implies\t1\n",
|
|
"xor\t1\n",
|
|
"and\t1\n",
|
|
"or\t1\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 11
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 3,
|
|
"metadata": {},
|
|
"source": [
|
|
"simplify"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"0 No rewriting<br/>\n",
|
|
"1 basic rewritings and eventual/universal rules<br/>\n",
|
|
"2 additional syntactic implication rules<br/>\n",
|
|
"3 better implications using containment<br/>\n",
|
|
"default: 3"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, simplify=0, seed=5)\n",
|
|
"print(next(f))\n",
|
|
"f = spot.randltl(3, simplify=3, seed=5)\n",
|
|
"print(next(f))"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"G!(!p1 & (Xp2 | F(p0 R Xp2)))\n",
|
|
"G(p1 | (X!p2 & G(!p0 U X!p2)))\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 12
|
|
},
|
|
{
|
|
"cell_type": "heading",
|
|
"level": 2,
|
|
"metadata": {},
|
|
"source": [
|
|
"Filters and maps"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"most boolean functions found in the class formula can be used to filter the random formula generator like this:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, 20).is_syntactic_stutter_invariant()\n",
|
|
"for formula in f:\n",
|
|
" print(formula)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"0 R p2\n",
|
|
"F(p0 R !p1)\n",
|
|
"G(p0 | Fp2) W (FGp2 R !p2)\n",
|
|
"(p2 R G!p1) | G(p2 U !p0)\n",
|
|
"(p2 W p0) U p2\n",
|
|
"F!G(!Gp1 W p1)\n",
|
|
"G!p1 & (!((p2 & Fp1) M p1) U p1)\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 13
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"likewise, functions from formula to formula can be applied to map the iterator:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(2, 6).remove_x()\n",
|
|
"for formula in f:\n",
|
|
" print(formula)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"!(F!p0 M 1)\n",
|
|
"(Gp1 | Fp0) M 1\n",
|
|
"F!(!p0 <-> FGp0)\n",
|
|
"Gp0 U (p0 U GFp0)\n",
|
|
"(!p0 U p0) U ((p1 & (p1 U (!p1 & (!p1 -> Fp0))) & ((!p0 U !p1) | (p0 U !p1))) | (!p1 & (!p1 U (p1 & (!p1 -> Fp0))) & ((!p0 U p1) | (p0 U p1))) | (p0 & (p0 U (!p0 & (!p1 -> Fp0))) & ((!p1 U !p0) | (p1 U !p0))) | (!p0 & (!p0 U (p0 & (!p1 -> Fp0))) & ((!p1 U p0) | (p1 U p0))) | ((!p1 -> Fp0) & (Gp1 | G!p1) & (Gp0 | G!p0)))\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 14
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"You may have noticed that the return type of randltl is 'formulaiterator'.<br/>\n",
|
|
"Since the boolean functions and the 'mapping' functions return an iterator of the same type, this means these operations can be chained like this:"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"collapsed": false,
|
|
"input": [
|
|
"f = spot.randltl(3, 20).is_syntactic_stutter_invariant().relabel(spot.Abc).simplify()\n",
|
|
"for formula in f:\n",
|
|
" print(formula)"
|
|
],
|
|
"language": "python",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"output_type": "stream",
|
|
"stream": "stdout",
|
|
"text": [
|
|
"0\n",
|
|
"Ga\n",
|
|
"F(a R !b)\n",
|
|
"G(a | Fb) | (FGb R !b)\n",
|
|
"G!b | G(a U !c)\n",
|
|
"b U a\n",
|
|
"0\n",
|
|
"0\n"
|
|
]
|
|
}
|
|
],
|
|
"prompt_number": 15
|
|
}
|
|
],
|
|
"metadata": {}
|
|
}
|
|
]
|
|
} |