python: implicit str->formula conversion

* python/spot/impl.i, python/spot/__init__.py: Implement it.
* NEWS: Mention it.
* tests/python/atva16-fig2a.ipynb, tests/python/atva16-fig2b.ipynb,
tests/python/formulas.ipynb, tests/python/ltsmin-dve.ipynb,
tests/python/ltsmin-pml.ipynb, tests/python/stutter-inv.ipynb,
doc/org/tut02.org: Modernize.
This commit is contained in:
Alexandre Duret-Lutz 2018-05-15 16:07:14 +02:00
parent 5c1d9c492c
commit 6a808492c1
10 changed files with 168 additions and 210 deletions

View file

@ -436,7 +436,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7f77f84535a0> >"
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7f2214652270> >"
]
},
"execution_count": 9,
@ -1194,6 +1194,13 @@
"k.show('.<0') # unlimited output"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If we have an LTL proposition to check, we can convert it into an automaton using `spot.translate()`, and synchronize that automaton with the Kripke structure using `spot.otf_product()`. This `otf_product()` function returns product automaton that builds itself on-the-fly, as needed by whatever algorithm \"consumes\" it (here the display routine). "
]
},
{
"cell_type": "code",
"execution_count": 12,
@ -1258,7 +1265,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f77f83e2ae0> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f22145bdb40> >"
]
},
"execution_count": 12,
@ -1446,7 +1453,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7f77f84536f0> >"
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7f221462dae0> >"
]
},
"execution_count": 13,
@ -1495,10 +1502,9 @@
"outputs": [],
"source": [
"def model_check(f, m):\n",
" f = spot.formula(f)\n",
" ss = m.kripke(spot.atomic_prop_collect(f))\n",
" nf = spot.formula_Not(f).translate()\n",
" return spot.otf_product(ss, nf).is_empty() "
" nf = spot.formula.Not(f)\n",
" ss = m.kripke(spot.atomic_prop_collect(nf))\n",
" return spot.otf_product(ss, nf.translate()).is_empty() "
]
},
{
@ -1535,10 +1541,9 @@
"outputs": [],
"source": [
"def model_debug(f, m):\n",
" f = spot.formula(f)\n",
" ss = m.kripke(spot.atomic_prop_collect(f))\n",
" nf = spot.formula_Not(f).translate()\n",
" return ss.intersecting_run(nf)"
" nf = spot.formula.Not(f)\n",
" ss = m.kripke(spot.atomic_prop_collect(nf))\n",
" return ss.intersecting_run(nf.translate())"
]
},
{
@ -1660,7 +1665,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f77f83ee270> >"
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f221464a870> >"
]
},
"execution_count": 19,