python: upgrade notebook format to v4

Fixes #311.

* tests/python/ipnbdoctest.py: Adjust to process the new format,
with a lot of inspiration from Vcsn's copy of this file.
* tests/python/_altscc.ipynb, tests/python/_aux.ipynb,
tests/python/acc_cond.ipynb, tests/python/accparse.ipynb,
tests/python/alternation.ipynb, tests/python/atva16-fig2a.ipynb,
tests/python/atva16-fig2b.ipynb, tests/python/automata-io.ipynb,
tests/python/automata.ipynb, tests/python/decompose.ipynb,
tests/python/formulas.ipynb, tests/python/gen.ipynb,
tests/python/highlighting.ipynb, tests/python/ltsmin-dve.ipynb,
tests/python/ltsmin-pml.ipynb, tests/python/parity.ipynb,
tests/python/piperead.ipynb, tests/python/product.ipynb,
tests/python/randaut.ipynb, tests/python/randltl.ipynb,
tests/python/stutter-inv.ipynb, tests/python/testingaut.ipynb,
tests/python/word.ipynb: Upgrade to the new format.
* NEWS: Mention the change.
This commit is contained in:
Alexandre Duret-Lutz 2018-01-07 10:33:38 +01:00
parent 020c981188
commit 58e64e752c
25 changed files with 33431 additions and 33104 deletions

2
NEWS
View file

@ -234,6 +234,8 @@ New in spot 2.4.4.dev (net yet released)
signal per atomic proposition. For some examples, see the use of
the show() method in https://spot.lrde.epita.fr/ipynb/word.html
- The test suite is now using v4 of the Jupyter Notebook format.
Deprecation notices:
(These functions still work but compilers emit warnings.)

View file

@ -1,27 +1,3 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -33,45 +9,27 @@
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from IPython.display import display\n",
"import spot\n",
"spot.setup(show_default='.bas')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
"Start: 0&1\n",
"AP: 2 \"a\" \"b\"\n",
"acc-name: Buchi\n",
"Acceptance: 1 Inf(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0\n",
"[!0] 1\n",
"State: 1\n",
"[1] 1 {0}\n",
"--END--\n",
"''')"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -84,9 +42,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-215 217.6,-215 217.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"85.8\" y=\"-196.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"107.8\" y=\"-196.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"107.8\" y=\"-196.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"123.8\" y=\"-196.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"83.8\" y=\"-182.8\" font-family=\"Lato\" font-size=\"14.00\">[B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"83.8\" y=\"-182.8\" font-family=\"Lato\" font-size=\"14.00\">[Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"153.6,-67 153.6,-167 205.6,-167 205.6,-67 153.6,-67\"/>\n",
"</g>\n",
@ -128,7 +86,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M172.569,-109.664C171.006,-119.625 173.35,-129 179.6,-129 184.288,-129 186.778,-123.727 187.071,-116.888\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"186.631,-109.664 190.201,-116.46 186.844,-113.158 187.056,-116.651 187.056,-116.651 187.056,-116.651 186.844,-113.158 183.912,-116.842 186.631,-109.664 186.631,-109.664\"/>\n",
"<text text-anchor=\"start\" x=\"175.1\" y=\"-147.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"171.6\" y=\"-132.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"171.6\" y=\"-132.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;1</title>\n",
@ -145,12 +103,32 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e84e9810> >"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
"Start: 0&1\n",
"AP: 2 \"a\" \"b\"\n",
"acc-name: Buchi\n",
"Acceptance: 1 Inf(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0\n",
"[!0] 1\n",
"State: 1\n",
"[1] 1 {0}\n",
"--END--\n",
"''')"
]
},
{
"cell_type": "markdown",
@ -161,30 +139,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
"Start: 0&1\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0&1 {0}\n",
"State: 1\n",
"[1] 1\n",
"--END--\n",
"''')"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -197,9 +159,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-220 149.6,-220 149.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"50.3\" y=\"-201.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"75.3\" y=\"-201.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"75.3\" y=\"-201.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"91.3\" y=\"-201.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"40.3\" y=\"-187.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"40.3\" y=\"-187.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"85.6,-8 85.6,-93 137.6,-93 137.6,-8 85.6,-8\"/>\n",
"</g>\n",
@ -247,22 +209,21 @@
"<path fill=\"none\" stroke=\"black\" d=\"M94.0998,-125.509C79.778,-121.61 59.6666,-116.136 48.6975,-113.15\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"49.1845,-110.743 41.7867,-111.269 47.8974,-115.471 49.1845,-110.743\"/>\n",
"<text text-anchor=\"start\" x=\"64.1\" y=\"-138.8\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"59.6\" y=\"-123.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"59.6\" y=\"-123.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e8571900> >"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"source": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
@ -271,23 +232,24 @@
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0 {0}\n",
"[!0] 1\n",
"[0] 0&1 {0}\n",
"State: 1\n",
"[1] 1&0\n",
"[1] 1\n",
"--END--\n",
"''')"
],
"language": "python",
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false,
"scrolled": true
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -300,9 +262,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-227 217.6,-227 217.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"84.3\" y=\"-208.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"109.3\" y=\"-208.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"109.3\" y=\"-208.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"125.3\" y=\"-208.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"74.3\" y=\"-194.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"74.3\" y=\"-194.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"30,-8 30,-179 205.6,-179 205.6,-8 30,-8\"/>\n",
"</g>\n",
@ -341,7 +303,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M90.2208,-51.0373C88.9189,-60.8579 91.0453,-70 96.6,-70 100.766,-70 103.004,-64.8576 103.313,-58.1433\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"102.979,-51.0373 106.454,-57.8818 103.143,-54.5335 103.308,-58.0296 103.308,-58.0296 103.308,-58.0296 103.143,-54.5335 100.161,-58.1774 102.979,-51.0373 102.979,-51.0373\"/>\n",
"<text text-anchor=\"start\" x=\"93.1\" y=\"-88.8\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"88.6\" y=\"-73.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"88.6\" y=\"-73.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>0&#45;&gt;1</title>\n",
@ -358,40 +320,42 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e85070f0> >"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"source": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
"Start: 0\n",
"Start: 0&1\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0\n",
"[!0] 1 {0}\n",
"[0] 0 {0}\n",
"[!0] 1\n",
"State: 1\n",
"[1] 1&0\n",
"--END--\n",
"''')"
],
"language": "python",
"metadata": {},
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -404,9 +368,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-141 230.6,-141 230.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"90.8\" y=\"-122.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"115.8\" y=\"-122.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"115.8\" y=\"-122.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"131.8\" y=\"-122.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"80.8\" y=\"-108.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"80.8\" y=\"-108.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"30,-8 30,-93 218.6,-93 218.6,-8 30,-8\"/>\n",
"</g>\n",
@ -437,7 +401,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M74.4034,-34C87.1928,-34 104.732,-34 118.874,-34\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.916,-34 118.916,-37.1501 122.416,-34 118.916,-34.0001 118.916,-34.0001 118.916,-34.0001 122.416,-34 118.916,-30.8501 125.916,-34 125.916,-34\"/>\n",
"<text text-anchor=\"start\" x=\"94.5\" y=\"-52.8\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-37.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-37.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- &#45;1 -->\n",
"<g id=\"node4\" class=\"node\"><title>&#45;1</title>\n",
@ -462,17 +426,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e8507120> >"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"source": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
@ -481,21 +444,24 @@
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0 {0}\n",
"[!0] 1 \n",
"[0] 0\n",
"[!0] 1 {0}\n",
"State: 1\n",
"[1] 1&0 {0}\n",
"[1] 1&0\n",
"--END--\n",
"''')"
],
"language": "python",
"metadata": {},
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -508,9 +474,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-156 232.6,-156 232.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"91.8\" y=\"-137.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"116.8\" y=\"-137.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"116.8\" y=\"-137.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"132.8\" y=\"-137.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"81.8\" y=\"-123.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"81.8\" y=\"-123.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"orange\" points=\"30,-8 30,-108 220.6,-108 220.6,-8 30,-8\"/>\n",
"</g>\n",
@ -530,7 +496,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-51.0373C48.3189,-60.8579 50.4453,-70 56,-70 60.166,-70 62.4036,-64.8576 62.7128,-58.1433\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-51.0373 65.8541,-57.8818 62.5434,-54.5335 62.7076,-58.0296 62.7076,-58.0296 62.7076,-58.0296 62.5434,-54.5335 59.561,-58.1774 62.3792,-51.0373 62.3792,-51.0373\"/>\n",
"<text text-anchor=\"start\" x=\"52.5\" y=\"-88.8\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-73.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-73.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</title>\n",
@ -552,7 +518,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M156.81,-30.2475C167.377,-28.8262 180.875,-28.8101 191,-35 200.508,-40.8127 205.503,-53.2288 207.894,-61.5983\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"205.553,-62.3452 209.557,-68.5878 210.32,-61.2108 205.553,-62.3452\"/>\n",
"<text text-anchor=\"start\" x=\"178.5\" y=\"-53.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"175\" y=\"-38.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"175\" y=\"-38.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- &#45;1&#45;&gt;0 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>&#45;1&#45;&gt;0</title>\n",
@ -567,12 +533,31 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e8507150> >"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 6
"source": [
"spot.automaton('''\n",
"HOA: v1\n",
"States: 2\n",
"Start: 0\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 0 {0}\n",
"[!0] 1 \n",
"State: 1\n",
"[1] 1&0 {0}\n",
"--END--\n",
"''')"
]
},
{
"cell_type": "markdown",
@ -583,63 +568,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata('''\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1&2 {0}\n",
"State: 2\n",
"[1] 2\n",
"--END--\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1 {0}\n",
"State: 2\n",
"[1] 2\n",
"--END--\n",
"'''):\n",
" display(a)\n",
"\n",
"a = spot.automaton('''\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0&2\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"spot.highlight.edges: 2 2\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1&2 {0}\n",
"State: 2\n",
"[1] 1&2\n",
"--END--\n",
"''')\n",
"display(a, a.show('.basy'))"
],
"language": "python",
"metadata": {},
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -652,9 +588,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-187 222.6,-187 222.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"86.8\" y=\"-168.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"111.8\" y=\"-168.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"111.8\" y=\"-168.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"127.8\" y=\"-168.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"76.8\" y=\"-154.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"76.8\" y=\"-154.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"158.6,-43 158.6,-128 210.6,-128 210.6,-43 158.6,-43\"/>\n",
"</g>\n",
@ -706,7 +642,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M71.8052,-33.9269C82.5357,-28.6237 97.0271,-24.1864 108,-31 118.317,-37.4067 123.145,-51.3407 125.273,-60.4374\"/>\n",
"<polygon fill=\"none\" stroke=\"black\" points=\"122.894,-61.0426 126.605,-67.4637 127.709,-60.1299 122.894,-61.0426\"/>\n",
"<text text-anchor=\"start\" x=\"95.5\" y=\"-49.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-34.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-34.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- &#45;1&#45;&gt;2 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>&#45;1&#45;&gt;2</title>\n",
@ -721,14 +657,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e8507630> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -741,9 +679,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-249 213.6,-249 213.6,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"82.3\" y=\"-230.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"107.3\" y=\"-230.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"107.3\" y=\"-230.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"123.3\" y=\"-230.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"72.3\" y=\"-216.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"72.3\" y=\"-216.8\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"grey\" points=\"149.6,-101 149.6,-201 201.6,-201 201.6,-101 149.6,-101\"/>\n",
"</g>\n",
@ -784,7 +722,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M169.221,-144.037C167.919,-153.858 170.045,-163 175.6,-163 179.766,-163 182.004,-157.858 182.313,-151.143\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"181.979,-144.037 185.454,-150.882 182.143,-147.533 182.308,-151.03 182.308,-151.03 182.308,-151.03 182.143,-147.533 179.161,-151.177 181.979,-144.037 181.979,-144.037\"/>\n",
"<text text-anchor=\"start\" x=\"171.1\" y=\"-181.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"167.6\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"167.6\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\"><title>2</title>\n",
@ -810,14 +748,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e84e98a0> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -830,9 +770,9 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-188.511 271.2,-188.511 271.2,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"111.1\" y=\"-170.311\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"136.1\" y=\"-170.311\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"136.1\" y=\"-170.311\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"152.1\" y=\"-170.311\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"101.1\" y=\"-156.311\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;B\u00fcchi]</text>\n",
"<text text-anchor=\"start\" x=\"101.1\" y=\"-156.311\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<g id=\"clust1\" class=\"cluster\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" stroke=\"green\" points=\"70.6,-8 70.6,-79 259.2,-79 259.2,-8 70.6,-8\"/>\n",
"</g>\n",
@ -883,7 +823,7 @@
"<path fill=\"none\" stroke=\"#ff7f00\" stroke-width=\"2\" d=\"M112.506,-34.3378C123.022,-29.4344 137.206,-25.3123 148.6,-31 155.651,-34.52 160.75,-42.0833 163.843,-47.9744\"/>\n",
"<polygon fill=\"none\" stroke=\"#ff7f00\" stroke-width=\"2\" points=\"161.798,-49.3942 166.935,-54.7434 166.255,-47.3582 161.798,-49.3942\"/>\n",
"<text text-anchor=\"start\" x=\"136.1\" y=\"-49.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"132.6\" y=\"-34.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"132.6\" y=\"-34.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- &#45;1&#45;&gt;1 -->\n",
"<g id=\"edge5\" class=\"edge\"><title>&#45;1&#45;&gt;1</title>\n",
@ -910,22 +850,24 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f41e9624660> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<svg height=\"198pt\" viewBox=\"0.00 0.00 253.20 198.00\" width=\"253pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 194)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-194 249.2,-194 249.2,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"100.1\" y=\"-175.8\">Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"125.1\" y=\"-175.8\">\u24ff</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"125.1\" y=\"-175.8\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"141.1\" y=\"-175.8\">)</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"90.1\" y=\"-161.8\">[co-B\u00fcchi]</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"90.1\" y=\"-161.8\">[co-Büchi]</text>\n",
"<g class=\"cluster\" id=\"clust1\"><title>cluster_0</title>\n",
"<polygon fill=\"none\" points=\"8,-8 8,-86 237.2,-86 237.2,-8 8,-8\" stroke=\"green\"/>\n",
"</g>\n",
@ -976,7 +918,7 @@
"<path d=\"M51.8966,-37.389C66.2298,-40.2639 86.1419,-44.2577 96.9907,-46.4337\" fill=\"none\" stroke=\"#ff7f00\" stroke-width=\"2\"/>\n",
"<polygon fill=\"none\" points=\"96.6407,-48.8622 103.986,-47.8367 97.6044,-44.0579 96.6407,-48.8622\" stroke=\"#ff7f00\" stroke-width=\"2\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"73.5\" y=\"-63.8\">b</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"70\" y=\"-48.8\">\u24ff</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"70\" y=\"-48.8\"></text>\n",
"</g>\n",
"<!-- &#45;1.2&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge8\"><title>-1.2-&gt;1</title>\n",
@ -1017,15 +959,84 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 7
}
],
"metadata": {}
}
"source": [
"for a in spot.automata('''\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1&2 {0}\n",
"State: 2\n",
"[1] 2\n",
"--END--\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1 {0}\n",
"State: 2\n",
"[1] 2\n",
"--END--\n",
"'''):\n",
" display(a)\n",
"\n",
"a = spot.automaton('''\n",
"HOA: v1\n",
"States: 3\n",
"Start: 0&2\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Fin(0)\n",
"spot.highlight.edges: 2 2\n",
"--BODY--\n",
"State: 0\n",
"[0] 1&2\n",
"State: 1\n",
"[1] 1&2 {0}\n",
"State: 2\n",
"[1] 1&2\n",
"--END--\n",
"''')\n",
"display(a, a.show('.basy'))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,23 +1,13 @@
{
"metadata": {
"name": "",
"signature": "sha256:6be10f711b59f226415bc570a040611b0a8c554e61bf92877b8af4040963e0ac"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import spot.aux"
],
"language": "python",
"execution_count": 1,
"metadata": {},
"outputs": [],
"prompt_number": 1
"source": [
"import spot.aux"
]
},
{
"cell_type": "markdown",
@ -28,16 +18,12 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.aux.str_to_svg(b'syntax error')"
],
"language": "python",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"stream": "stderr",
"text": [
"Calling 'dot' for the conversion to SVG produced the message:\n",
"Error: <stdin>: syntax error in line 1 near 'syntax'\n",
@ -46,28 +32,41 @@
},
{
"ename": "CalledProcessError",
"evalue": "Command 'dot' returned non-zero exit status 1",
"output_type": "pyerr",
"evalue": "Command 'dot' returned non-zero exit status 1.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-3-294a2c217b9a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maux\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstr_to_svg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mb'syntax error'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/aux.py\u001b[0m in \u001b[0;36mstr_to_svg\u001b[0;34m(str)\u001b[0m\n\u001b[1;32m 60\u001b[0m \u001b[0mret\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 62\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'dot'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 63\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mstdout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'utf-8'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'dot' returned non-zero exit status 1"
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-877ef1b1c636>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maux\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstr_to_svg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mb'syntax error'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/aux.py\u001b[0m in \u001b[0;36mstr_to_svg\u001b[0;34m(str)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0mret\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwait\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 63\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 64\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'dot'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 65\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mstdout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'utf-8'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'dot' returned non-zero exit status 1."
]
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"source": [
"spot.aux.str_to_svg(b'syntax error')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"metadata": {},
"outputs": []
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
],
"metadata": {}
}
]
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -1,125 +1,93 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3+"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import spot\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c = spot.acc_code('Inf(0)&Fin(1)|Inf(2)&Fin(3)'); c"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"text": [
"data": {
"text/plain": [
"(Inf(0) & Fin(1)) | (Inf(2) & Fin(3))"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"c = spot.acc_code('Inf(0)&Fin(1)|Inf(2)&Fin(3)'); c"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c.to_dnf()"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": [
"data": {
"text/plain": [
"(Fin(1) & Inf(0)) | (Fin(3) & Inf(2))"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"c.to_dnf()"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"c.to_cnf()"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"text": [
"data": {
"text/plain": [
"(Inf(0) | Inf(2)) & (Inf(0) | Fin(3)) & (Inf(2) | Fin(1)) & (Fin(1)|Fin(3))"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 4
"source": [
"c.to_cnf()"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for acc in ['all', 't', \n",
" 'Buchi', 'generalized-Buchi 3', 'generalized-Buchi 0',\n",
" 'co-Buchi', 'generalized-co-Buchi 3', 'generalized-co-Buchi 0',\n",
" 'Rabin 2', 'Rabin 0',\n",
" 'Streett 2', 'Streett 0',\n",
" 'generalized-Rabin 3 1 2 3', 'generalized-Rabin 0',\n",
" 'parity min even 6', 'parity max odd 6', 'parity max even 6', 'parity min odd 6',\n",
" 'parity min even 5', 'parity max odd 5', 'parity max even 5', 'parity min odd 5',\n",
" 'parity min even 2', 'parity max odd 2', 'parity max even 2', 'parity min odd 2',\n",
" 'parity min even 1', 'parity max odd 1', 'parity max even 1', 'parity min odd 1',\n",
" 'parity min even 0', 'parity max odd 0', 'parity max even 0', 'parity min odd 0',\n",
" ]:\n",
" print(acc, ': ', spot.acc_code(acc), sep='')"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"all: t\n",
"t: t\n",
@ -158,19 +126,51 @@
]
}
],
"prompt_number": 5
"source": [
"for acc in ['all', 't', \n",
" 'Buchi', 'generalized-Buchi 3', 'generalized-Buchi 0',\n",
" 'co-Buchi', 'generalized-co-Buchi 3', 'generalized-co-Buchi 0',\n",
" 'Rabin 2', 'Rabin 0',\n",
" 'Streett 2', 'Streett 0',\n",
" 'generalized-Rabin 3 1 2 3', 'generalized-Rabin 0',\n",
" 'parity min even 6', 'parity max odd 6', 'parity max even 6', 'parity min odd 6',\n",
" 'parity min even 5', 'parity max odd 5', 'parity max even 5', 'parity min odd 5',\n",
" 'parity min even 2', 'parity max odd 2', 'parity max even 2', 'parity min odd 2',\n",
" 'parity min even 1', 'parity max odd 1', 'parity max even 1', 'parity min odd 1',\n",
" 'parity min even 0', 'parity max odd 0', 'parity max even 0', 'parity min odd 0',\n",
" ]:\n",
" print(acc, ': ', spot.acc_code(acc), sep='')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 5
"source": []
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3+"
}
]
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -1,85 +1,59 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This example is the left part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 \u2014 a framework for LTL and \u03c9-automata manipulation*\"."
"This example is the left part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 — a framework for LTL and ω-automata manipulation*\"."
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import spot\n",
"spot.setup(show_default='.abr')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.formula('GFa <-> GFb'); f"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} \\mathsf{F} a \\leftrightarrow \\mathsf{G} \\mathsf{F} b$"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"text": [
"text/plain": [
"GFa <-> GFb"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"f = spot.formula('GFa <-> GFb'); f"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f.translate()"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -92,11 +66,11 @@
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-351 193.5,-351 193.5,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"47.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"69.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"69.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"85.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\">)&amp;Inf(</text>\n",
"<text text-anchor=\"start\" x=\"121.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">\u2776</text>\n",
"<text text-anchor=\"start\" x=\"121.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\"></text>\n",
"<text text-anchor=\"start\" x=\"137.75\" y=\"-332.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"50.75\" y=\"-318.8\" font-family=\"Lato\" font-size=\"14.00\">[gen. B\u00fcchi 2]</text>\n",
"<text text-anchor=\"start\" x=\"50.75\" y=\"-318.8\" font-family=\"Lato\" font-size=\"14.00\">[gen. Büchi 2]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</title>\n",
@ -147,99 +121,127 @@
"<path fill=\"none\" stroke=\"black\" d=\"M164.828,-135.699C162.523,-152.996 163.914,-172 169,-172 173.371,-172 175.012,-157.965 173.925,-143.04\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"173.172,-135.699 177.02,-142.341 173.529,-139.181 173.886,-142.663 173.886,-142.663 173.886,-142.663 173.529,-139.181 170.753,-142.984 173.172,-135.699 173.172,-135.699\"/>\n",
"<text text-anchor=\"start\" x=\"150.5\" y=\"-190.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; b</text>\n",
"<text text-anchor=\"start\" x=\"161\" y=\"-175.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">\u2776</text>\n",
"<text text-anchor=\"start\" x=\"161\" y=\"-175.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\"></text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge7\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M164.049,-135.467C158.901,-163.149 160.551,-202 169,-202 176.756,-202 178.783,-169.261 175.081,-142.477\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"173.951,-135.467 178.174,-141.877 174.508,-138.923 175.065,-142.378 175.065,-142.378 175.065,-142.378 174.508,-138.923 171.955,-142.879 173.951,-135.467 173.951,-135.467\"/>\n",
"<text text-anchor=\"start\" x=\"150.5\" y=\"-220.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"<text text-anchor=\"start\" x=\"161\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"161\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge8\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163.519,-135.237C155.333,-171.922 157.16,-232 169,-232 180.1,-232 182.399,-179.197 175.898,-142.369\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"174.481,-135.237 178.935,-141.488 175.163,-138.669 175.845,-142.102 175.845,-142.102 175.845,-142.102 175.163,-138.669 172.756,-142.716 174.481,-135.237 174.481,-135.237\"/>\n",
"<text text-anchor=\"start\" x=\"152\" y=\"-249.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; b</text>\n",
"<text text-anchor=\"start\" x=\"153\" y=\"-235.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"169\" y=\"-235.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">\u2776</text>\n",
"<text text-anchor=\"start\" x=\"153\" y=\"-235.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"169\" y=\"-235.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\"></text>\n",
"</g>\n",
"<!-- 2&#45;&gt;2 -->\n",
"<g id=\"edge9\" class=\"edge\"><title>2&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M159.425,-33.5414C156.73,-43.9087 159.922,-54 169,-54 175.95,-54 179.45,-48.0847 179.499,-40.6591\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"178.575,-33.5414 182.6,-40.0771 179.026,-37.0123 179.477,-40.4831 179.477,-40.4831 179.477,-40.4831 179.026,-37.0123 176.353,-40.889 178.575,-33.5414 178.575,-33.5414\"/>\n",
"<text text-anchor=\"start\" x=\"148.5\" y=\"-71.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"<text text-anchor=\"start\" x=\"153\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"169\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">\u2776</text>\n",
"<text text-anchor=\"start\" x=\"153\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"169\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f0d2406cc00> >"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"f.translate()"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def implies(f, g):\n",
" f = spot.formula(f)\n",
" g = spot.formula_Not(spot.formula(g))\n",
" return spot.product(f.translate(), g.translate()).is_empty()\n",
"def equiv(f, g):\n",
" return implies(f, g) and implies(g, f)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"equiv('a U (b U a)', 'b U a')"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"text": [
"data": {
"text/plain": [
"True"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 5
"source": [
"equiv('a U (b U a)', 'b U a')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"equiv('!(a U b)', '!a U !b')"
],
"language": "python",
"metadata": {},
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
"data": {
"text/plain": [
"False"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 6
}
],
"metadata": {}
}
"source": [
"equiv('!(a U b)', '!a U !b')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,55 +1,35 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This example is the right part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 \u2014 a framework for LTL and \u03c9-automata manipulation*\"."
"This example is the right part of Fig.2 in our ATVA'16 paper titled \"*Spot 2.0 — a framework for LTL and ω-automata manipulation*\"."
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import spot\n",
"import spot.ltsmin\n",
"spot.setup(show_default='.abr', max_states=10)\n",
"# This extra line ensures that our test-suite skips this test if divine is not installed.\n",
"spot.ltsmin.require('divine')"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%%dve adding\n",
"int c=1, x1, x2;\n",
"process a1 {\n",
@ -65,26 +45,18 @@
" S -> Q { effect c = x2; };\n",
"}\n",
"system async;"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 2
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"adding"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": [
"data": {
"text/plain": [
"ltsmin model with the following variables:\n",
" c: int\n",
" x1: int\n",
@ -92,24 +64,26 @@
" a1: ['Q', 'R', 'S']\n",
" a2: ['Q', 'R', 'S']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"adding"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"adding.kripke(['a1.Q', 'c==17'])"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -292,50 +266,76 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7fb770097600> >"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 4
"source": [
"adding.kripke(['a1.Q', 'c==17'])"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def model_check(model, f):\n",
" f = spot.formula(f)\n",
" ss = model.kripke(spot.atomic_prop_collect(f))\n",
" nf = spot.formula_Not(f).translate()\n",
" return spot.otf_product(ss, nf).is_empty()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 5
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"model_check(adding, 'F(\"c==2\")')"
],
"language": "python",
"metadata": {},
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"text": [
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 6
}
],
"metadata": {}
}
"source": [
"model_check(adding, 'F(\"c==2\")')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,57 +1,24 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
},
"name": "",
"signature": "sha256:d9763e3af9f29bca127bdbfb9c6b0bcfaf276a0c32d9f789d696bfbe4a563e57"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import display\n",
"import spot\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.translate('a U b')\n",
"for fmt in ('hoa', 'spin', 'dot', 'lbtt'):\n",
" print(a.to_str(fmt))"
],
"language": "python",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"HOA: v1\n",
"States: 2\n",
@ -107,22 +74,20 @@
]
}
],
"prompt_number": 2
"source": [
"a = spot.translate('a U b')\n",
"for fmt in ('hoa', 'spin', 'dot', 'lbtt'):\n",
" print(a.to_str(fmt))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a.save('example.aut').save('example.aut', format='lbtt', append=True)"
],
"language": "python",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -172,25 +137,27 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201e0810> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c050a20> >"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"a.save('example.aut').save('example.aut', format='lbtt', append=True)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!cat example.aut"
],
"language": "python",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"HOA: v1\r\n",
"States: 2\r\n",
@ -218,22 +185,18 @@
]
}
],
"prompt_number": 4
"source": [
"!cat example.aut"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata('example.aut'):\n",
" display(a)"
],
"language": "python",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -283,14 +246,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201e09c0> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195f3ecab0> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -340,12 +305,18 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201ff1b0> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c050960> >"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 5
"source": [
"for a in spot.automata('example.aut'):\n",
" display(a)"
]
},
{
"cell_type": "markdown",
@ -357,8 +328,18 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting example.aut\n"
]
}
],
"source": [
"%%file example.aut\n",
"HOA: v1\n",
"States: 2\n",
@ -382,129 +363,86 @@
"[1] 0\n",
"[0&!1] 1\n",
"--END--"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Overwriting example.aut\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.38.0 (20140413.2041)\n",
" -->\n",
"<!-- Title: G Pages: 1 -->\n",
"<svg width=\"171pt\" height=\"85pt\"\n",
" viewBox=\"0.00 0.00 171.00 85.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 81)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-81 167,-81 167,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 1 -->\n",
"<g id=\"node2\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- I&#45;&gt;1 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-22C2.79388,-22 17.1543,-22 30.6317,-22\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-22 30.9419,-25.1501 34.4419,-22 30.9419,-22.0001 30.9419,-22.0001 30.9419,-22.0001 34.4419,-22 30.9418,-18.8501 37.9419,-22 37.9419,-22\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-39.0373C48.3189,-48.8579 50.4453,-58 56,-58 60.166,-58 62.4036,-52.8576 62.7128,-46.1433\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-39.0373 65.8541,-45.8818 62.5434,-42.5335 62.7076,-46.0296 62.7076,-46.0296 62.7076,-46.0296 62.5434,-42.5335 59.561,-46.1774 62.3792,-39.0373 62.3792,-39.0373\"/>\n",
"<text text-anchor=\"start\" x=\"37.5\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 0 -->\n",
"<g id=\"node3\" class=\"node\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"141\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"141\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"141\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.1977,-22C85.0734,-22 99.3874,-22 111.887,-22\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"118.997,-22 111.997,-25.1501 115.497,-22 111.997,-22.0001 111.997,-22.0001 111.997,-22.0001 115.497,-22 111.997,-18.8501 118.997,-22 118.997,-22\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-25.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M132.994,-42.5808C131.886,-52.8447 134.555,-62 141,-62 145.834,-62 148.544,-56.8502 149.129,-49.9451\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"149.006,-42.5808 152.273,-49.5273 149.065,-46.0803 149.123,-49.5798 149.123,-49.5798 149.123,-49.5798 149.065,-46.0803 145.973,-49.6324 149.006,-42.5808 149.006,-42.5808\"/>\n",
"<text text-anchor=\"middle\" x=\"141\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c050a50> >"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"for a in spot.automata('example.aut'):\n",
" display(a)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
"<!-- Generated by graphviz version 2.38.0 (20140413.2041)\n",
" -->\n",
"<!-- Title: G Pages: 1 -->\n",
"<svg width=\"171pt\" height=\"85pt\"\n",
" viewBox=\"0.00 0.00 171.00 85.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 81)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-81 167,-81 167,4 -4,4\"/>\n",
"<!-- I -->\n",
"<!-- 1 -->\n",
"<g id=\"node2\" class=\"node\"><title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- I&#45;&gt;1 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15491,-22C2.79388,-22 17.1543,-22 30.6317,-22\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.9419,-22 30.9419,-25.1501 34.4419,-22 30.9419,-22.0001 30.9419,-22.0001 30.9419,-22.0001 34.4419,-22 30.9418,-18.8501 37.9419,-22 37.9419,-22\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M49.6208,-39.0373C48.3189,-48.8579 50.4453,-58 56,-58 60.166,-58 62.4036,-52.8576 62.7128,-46.1433\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"62.3792,-39.0373 65.8541,-45.8818 62.5434,-42.5335 62.7076,-46.0296 62.7076,-46.0296 62.7076,-46.0296 62.5434,-42.5335 59.561,-46.1774 62.3792,-39.0373 62.3792,-39.0373\"/>\n",
"<text text-anchor=\"start\" x=\"37.5\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 0 -->\n",
"<g id=\"node3\" class=\"node\"><title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"141\" cy=\"-22\" rx=\"18\" ry=\"18\"/>\n",
"<ellipse fill=\"none\" stroke=\"black\" cx=\"141\" cy=\"-22\" rx=\"22\" ry=\"22\"/>\n",
"<text text-anchor=\"middle\" x=\"141\" y=\"-18.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M74.1977,-22C85.0734,-22 99.3874,-22 111.887,-22\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"118.997,-22 111.997,-25.1501 115.497,-22 111.997,-22.0001 111.997,-22.0001 111.997,-22.0001 115.497,-22 111.997,-18.8501 118.997,-22 118.997,-22\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-25.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M132.994,-42.5808C131.886,-52.8447 134.555,-62 141,-62 145.834,-62 148.544,-56.8502 149.129,-49.9451\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"149.006,-42.5808 152.273,-49.5273 149.065,-46.0803 149.123,-49.5798 149.123,-49.5798 149.123,-49.5798 149.065,-46.0803 145.973,-49.6324 149.006,-42.5808 149.006,-42.5808\"/>\n",
"<text text-anchor=\"middle\" x=\"141\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201e0900> >"
]
}
],
"prompt_number": 7
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata(\"\"\"\n",
"HOA: v1\n",
"States: 2\n",
"Start: 1\n",
"name: \"Hello world\"\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Inf(0)\n",
"--BODY--\n",
"State: 0 {0}\n",
"[t] 0\n",
"State: 1\n",
"[1] 0\n",
"[0&!1] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 1\n",
"Start: 0\n",
"name: \"Hello world 2\"\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 2 Inf(0)&Inf(1)\n",
"--BODY--\n",
"State: 0 {0}\n",
"[t] 0 {1}\n",
"[0&!1] 0\n",
"--END--\n",
"\"\"\"):\n",
" display(a)"
],
"language": "python",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -554,14 +492,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201ff1b0> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c086120> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -589,25 +529,56 @@
"<path fill=\"none\" stroke=\"black\" d=\"M52.7643,-35.7817C52.2144,-45.3149 53.293,-54 56,-54 57.988,-54 59.0977,-49.3161 59.3292,-43.0521\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"59.2357,-35.7817 62.4756,-42.7406 59.2808,-39.2814 59.3258,-42.7812 59.3258,-42.7812 59.3258,-42.7812 59.2808,-39.2814 56.1761,-42.8217 59.2357,-35.7817 59.2357,-35.7817\"/>\n",
"<text text-anchor=\"start\" x=\"51.5\" y=\"-71.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<text text-anchor=\"start\" x=\"40\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"56\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">\u2776</text>\n",
"<text text-anchor=\"start\" x=\"40\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"<text text-anchor=\"start\" x=\"56\" y=\"-57.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\"></text>\n",
"</g>\n",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M50.9375,-35.5938C47.5625,-56.125 49.25,-82 56,-82 61.9854,-82 63.9902,-61.6553 62.0146,-42.7315\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"61.0625,-35.5938 65.1104,-42.1158 61.5253,-39.063 61.9881,-42.5323 61.9881,-42.5323 61.9881,-42.5323 61.5253,-39.063 58.8657,-42.9488 61.0625,-35.5938 61.0625,-35.5938\"/>\n",
"<text text-anchor=\"start\" x=\"37.5\" y=\"-100.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; !b</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-85.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-85.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201e0900> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c050900> >"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 8
"source": [
"for a in spot.automata(\"\"\"\n",
"HOA: v1\n",
"States: 2\n",
"Start: 1\n",
"name: \"Hello world\"\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 1 Inf(0)\n",
"--BODY--\n",
"State: 0 {0}\n",
"[t] 0\n",
"State: 1\n",
"[1] 0\n",
"[0&!1] 1\n",
"--END--\n",
"HOA: v1\n",
"States: 1\n",
"Start: 0\n",
"name: \"Hello world 2\"\n",
"AP: 2 \"a\" \"b\"\n",
"Acceptance: 2 Inf(0)&Inf(1)\n",
"--BODY--\n",
"State: 0 {0}\n",
"[t] 0 {1}\n",
"[0&!1] 0\n",
"--END--\n",
"\"\"\"):\n",
" display(a)"
]
},
{
"cell_type": "markdown",
@ -619,8 +590,18 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Overwriting example.aut\n"
]
}
],
"source": [
"%%file example.aut\n",
"HOA: v1\n",
"States: 2\n",
@ -646,34 +627,16 @@
"[1] 0\n",
"[0&!1] 1\n",
"--END--"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Overwriting example.aut\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata('example.aut'):\n",
" display(a)"
],
"language": "python",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -717,35 +680,35 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201ff390> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c0860c0> >"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"ename": "SyntaxError",
"evalue": "\nexample.aut:20.2: syntax error, unexpected identifier\nexample.aut:20.1-3: ignoring this invalid label\nexample.aut:20.5: state number is larger than state count...\nexample.aut:14.1-9: ... declared here.\n (<string>)",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32munknown\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m \nexample.aut:20.2: syntax error, unexpected identifier\nexample.aut:20.1-3: ignoring this invalid label\nexample.aut:20.5: state number is larger than state count...\nexample.aut:14.1-9: ... declared here.\n\n"
]
}
],
"prompt_number": 10
"source": [
"for a in spot.automata('example.aut'):\n",
" display(a)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('example.aut', timeout=100)"
],
"language": "python",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -789,77 +752,97 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f45201ff270> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f195c086600> >"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 11
"source": [
"spot.automaton('example.aut', timeout=100)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('non-existing-cmd |')"
],
"language": "python",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"ename": "CalledProcessError",
"evalue": "Command 'non-existing-cmd ' returned non-zero exit status 127",
"output_type": "pyerr",
"evalue": "Command 'non-existing-cmd ' returned non-zero exit status 127.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-2b2d1b66dcd6>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'non-existing-cmd |'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 471\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 472\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 473\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 474\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 475\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, debug, *sources)\u001b[0m\n\u001b[1;32m 456\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 457\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 458\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 459\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 460\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'non-existing-cmd ' returned non-zero exit status 127"
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-12-6b4750207d55>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'non-existing-cmd |'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 479\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 480\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 481\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 482\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 483\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 466\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 467\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 468\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'non-existing-cmd ' returned non-zero exit status 127."
]
}
],
"prompt_number": 12
"source": [
"spot.automaton('non-existing-cmd |')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('sleep 3; cat example.aut |', timeout=1)"
],
"language": "python",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"ename": "TimeoutExpired",
"evalue": "Command 'sleep 3; cat example.aut ' timed out after 1 seconds",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[0;31mTimeoutExpired\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-13-d9c814f4e517>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sleep 3; cat example.aut |'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 471\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 472\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 473\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 474\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 475\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, debug, *sources)\u001b[0m\n\u001b[1;32m 415\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 416\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 417\u001b[0;31m \u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 418\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 419\u001b[0m \u001b[0;31m# Using subprocess.check_output() with timeout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36mcommunicate\u001b[0;34m(self, input, timeout)\u001b[0m\n\u001b[1;32m 1063\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1064\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1065\u001b[0;31m \u001b[0mstdout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1066\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1067\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communication_started\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36m_communicate\u001b[0;34m(self, input, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 1698\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1699\u001b[0m \u001b[0mready\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mselector\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1700\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_timeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1701\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1702\u001b[0m \u001b[0;31m# XXX Rewrite these to use non-blocking I/O on the file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.5/subprocess.py\u001b[0m in \u001b[0;36m_check_timeout\u001b[0;34m(self, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 1089\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1090\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_time\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1091\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1092\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1093\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTimeoutExpired\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-13-782317e02e1a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'sleep 3; cat example.aut |'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 479\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 480\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 481\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 482\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 483\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 423\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 424\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 425\u001b[0;31m \u001b[0mout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcommunicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 426\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 427\u001b[0m \u001b[0;31m# Using subprocess.check_output() with timeout\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36mcommunicate\u001b[0;34m(self, input, timeout)\u001b[0m\n\u001b[1;32m 841\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 842\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 843\u001b[0;31m \u001b[0mstdout\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstderr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communicate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 844\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 845\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_communication_started\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36m_communicate\u001b[0;34m(self, input, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 1513\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1514\u001b[0m \u001b[0mready\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mselector\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtimeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1515\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_check_timeout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mendtime\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1516\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1517\u001b[0m \u001b[0;31m# XXX Rewrite these to use non-blocking I/O on the file\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/usr/lib/python3.6/subprocess.py\u001b[0m in \u001b[0;36m_check_timeout\u001b[0;34m(self, endtime, orig_timeout)\u001b[0m\n\u001b[1;32m 869\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 870\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_time\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0mendtime\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 871\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mTimeoutExpired\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0morig_timeout\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 872\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 873\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTimeoutExpired\u001b[0m: Command 'sleep 3; cat example.aut ' timed out after 1 seconds"
]
}
],
"prompt_number": 13
"source": [
"spot.automaton('sleep 3; cat example.aut |', timeout=1)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"rm example.aut"
],
"language": "python",
"execution_count": 14,
"metadata": {},
"outputs": [],
"prompt_number": 14
}
],
"metadata": {}
}
"source": [
"rm example.aut"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,27 +1,3 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@ -35,17 +11,17 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import spot\n",
"import spot.gen as sg\n",
"spot.setup()\n",
"from IPython.display import display"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -58,49 +34,53 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sg.ltl_pattern(sg.LTL_AND_GF, 3)"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} \\mathsf{F} p_{1} \\land \\mathsf{G} \\mathsf{F} p_{2} \\land \\mathsf{G} \\mathsf{F} p_{3}$"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"text": [
"text/plain": [
"GFp1 & GFp2 & GFp3"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"sg.ltl_pattern(sg.LTL_AND_GF, 3)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sg.ltl_pattern(sg.LTL_CCJ_BETA_PRIME, 4)"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} (p \\land \\mathsf{X} p \\land \\mathsf{X} \\mathsf{X} p \\land \\mathsf{X} \\mathsf{X} \\mathsf{X} p) \\land \\mathsf{F} (q \\land \\mathsf{X} q \\land \\mathsf{X} \\mathsf{X} q \\land \\mathsf{X} \\mathsf{X} \\mathsf{X} q)$"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": [
"text/plain": [
"F(p & Xp & XXp & XXXp) & F(q & Xq & XXq & XXXq)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"sg.ltl_pattern(sg.LTL_CCJ_BETA_PRIME, 4)"
]
},
{
"cell_type": "markdown",
@ -118,178 +98,209 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for f in sg.ltl_patterns((sg.LTL_GH_R, 3), (sg.LTL_AND_FG, 1, 3), sg.LTL_EH_PATTERNS):\n",
" display(f)"
],
"language": "python",
"execution_count": 4,
"metadata": {
"collapsed": false,
"scrolled": false
},
"outputs": [
{
"latex": [
"data": {
"text/latex": [
"$(\\mathsf{G} \\mathsf{F} p_{1} \\lor \\mathsf{F} \\mathsf{G} p_{2}) \\land (\\mathsf{G} \\mathsf{F} p_{2} \\lor \\mathsf{F} \\mathsf{G} p_{3}) \\land (\\mathsf{G} \\mathsf{F} p_{3} \\lor \\mathsf{F} \\mathsf{G} p_{4})$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"(GFp1 | FGp2) & (GFp2 | FGp3) & (GFp3 | FGp4)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} \\mathsf{G} p_{1}$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"FGp1"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} \\mathsf{G} p_{1} \\land \\mathsf{F} \\mathsf{G} p_{2}$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"FGp1 & FGp2"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} \\mathsf{G} p_{1} \\land \\mathsf{F} \\mathsf{G} p_{2} \\land \\mathsf{F} \\mathsf{G} p_{3}$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"FGp1 & FGp2 & FGp3"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$p_{0} \\mathbin{\\mathsf{U}} (p_{1} \\land \\mathsf{G} p_{2})$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"p0 U (p1 & Gp2)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$p_{0} \\mathbin{\\mathsf{U}} (p_{1} \\land \\mathsf{X} (p_{2} \\mathbin{\\mathsf{U}} p_{3}))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"p0 U (p1 & X(p2 U p3))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$p_{0} \\mathbin{\\mathsf{U}} (p_{1} \\land \\mathsf{X} (p_{2} \\land \\mathsf{F} (p_{3} \\land \\mathsf{X} \\mathsf{F} (p_{4} \\land \\mathsf{X} \\mathsf{F} (p_{5} \\land \\mathsf{X} \\mathsf{F} p_{6})))))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"p0 U (p1 & X(p2 & F(p3 & XF(p4 & XF(p5 & XFp6)))))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} (p_{0} \\land \\mathsf{X} \\mathsf{G} p_{1})$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"F(p0 & XGp1)"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} (p_{0} \\land \\mathsf{X} (p_{1} \\land \\mathsf{X} \\mathsf{F} p_{2}))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"F(p0 & X(p1 & XFp2))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{F} (p_{0} \\land \\mathsf{X} (p_{1} \\mathbin{\\mathsf{U}} p_{2}))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"F(p0 & X(p1 U p2))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} \\mathsf{F} p_{0} \\lor \\mathsf{F} \\mathsf{G} p_{1}$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"GFp0 | FGp1"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} (p_{0} \\rightarrow (p_{1} \\mathbin{\\mathsf{U}} p_{2}))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"G(p0 -> (p1 U p2))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} (p_{0} \\land \\mathsf{X} \\mathsf{F} (p_{1} \\land \\mathsf{X} \\mathsf{F} (p_{2} \\land \\mathsf{X} \\mathsf{F} p_{3})))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"G(p0 & XF(p1 & XF(p2 & XFp3)))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} \\mathsf{F} p_{1} \\land \\mathsf{G} \\mathsf{F} p_{2} \\land \\mathsf{G} \\mathsf{F} p_{3} \\land \\mathsf{G} \\mathsf{F} p_{0} \\land \\mathsf{G} \\mathsf{F} p_{4}$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"GFp1 & GFp2 & GFp3 & GFp0 & GFp4"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$(p_{0} \\mathbin{\\mathsf{U}} (p_{1} \\mathbin{\\mathsf{U}} p_{2})) \\lor (p_{1} \\mathbin{\\mathsf{U}} (p_{2} \\mathbin{\\mathsf{U}} p_{0})) \\lor (p_{2} \\mathbin{\\mathsf{U}} (p_{0} \\mathbin{\\mathsf{U}} p_{1}))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"(p0 U (p1 U p2)) | (p1 U (p2 U p0)) | (p2 U (p0 U p1))"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"latex": [
"data": {
"text/latex": [
"$\\mathsf{G} (p_{0} \\rightarrow (p_{1} \\mathbin{\\mathsf{U}} (\\mathsf{G} p_{2} \\lor \\mathsf{G} p_{3})))$"
],
"metadata": {},
"output_type": "display_data",
"text": [
"text/plain": [
"G(p0 -> (p1 U (Gp2 | Gp3)))"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 4
"source": [
"for f in sg.ltl_patterns((sg.LTL_GH_R, 3), (sg.LTL_AND_FG, 1, 3), sg.LTL_EH_PATTERNS):\n",
" display(f)"
]
},
{
"cell_type": "markdown",
@ -302,24 +313,19 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"display(sg.aut_pattern(sg.AUT_KS_NCA, 3).show('.a'),\n",
" sg.aut_pattern(sg.AUT_L_DSA, 3).show('.a'),\n",
" sg.aut_pattern(sg.AUT_L_NBA, 3).show('.a'))"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"311pt\" viewBox=\"0.00 0.00 734.00 310.64\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.906173 0.906173) rotate(0) translate(4 338.8)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-338.8 806,-338.8 806,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"368.5\" y=\"-304.6\">[co-B\u00fcchi]</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"368.5\" y=\"-304.6\">[co-Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
@ -485,30 +491,32 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<svg height=\"268pt\" viewBox=\"0.00 0.00 734.00 268.19\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.817976 0.817976) rotate(0) translate(4 323.87)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-323.87 893.337,-323.87 893.337,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"269.168\" y=\"-305.67\">(Fin(</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"297.168\" y=\"-305.67\">\u24ff</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"297.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"313.168\" y=\"-305.67\">) | Inf(</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"350.168\" y=\"-305.67\">\u2776</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"350.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"366.168\" y=\"-305.67\">)) &amp; (Fin(</text>\n",
"<text fill=\"#ff7f00\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"420.168\" y=\"-305.67\">\u2777</text>\n",
"<text fill=\"#ff7f00\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"420.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"436.168\" y=\"-305.67\">) | Inf(</text>\n",
"<text fill=\"#6a3d9a\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"473.168\" y=\"-305.67\">\u2778</text>\n",
"<text fill=\"#6a3d9a\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"473.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"489.168\" y=\"-305.67\">)) &amp; (Fin(</text>\n",
"<text fill=\"#33a02c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"543.168\" y=\"-305.67\">\u2779</text>\n",
"<text fill=\"#33a02c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"543.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"559.168\" y=\"-305.67\">) | Inf(</text>\n",
"<text fill=\"#e31a1c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"596.168\" y=\"-305.67\">\u277a</text>\n",
"<text fill=\"#e31a1c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"596.168\" y=\"-305.67\"></text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"612.168\" y=\"-305.67\">))</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"412.668\" y=\"-291.67\">[Streett 3]</text>\n",
"<!-- I -->\n",
@ -516,7 +524,7 @@
"<g class=\"node\" id=\"node2\"><title>0</title>\n",
"<ellipse cx=\"64.8701\" cy=\"-218.87\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"60.3701\" y=\"-222.67\">0</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"56.8701\" y=\"-207.67\">\u24ff</text>\n",
"<text fill=\"#1f78b4\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"56.8701\" y=\"-207.67\"></text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>I-&gt;0</title>\n",
@ -538,7 +546,7 @@
"<g class=\"node\" id=\"node6\"><title>3</title>\n",
"<ellipse cx=\"298.61\" cy=\"-47.8701\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"294.11\" y=\"-51.6701\">3</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"290.61\" y=\"-36.6701\">\u2776</text>\n",
"<text fill=\"#ff4da0\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"290.61\" y=\"-36.6701\"></text>\n",
"</g>\n",
"<!-- 2&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>2-&gt;3</title>\n",
@ -583,7 +591,7 @@
"<g class=\"node\" id=\"node8\"><title>4</title>\n",
"<ellipse cx=\"761.727\" cy=\"-162.87\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"757.227\" y=\"-166.67\">4</text>\n",
"<text fill=\"#ff7f00\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"753.727\" y=\"-151.67\">\u2777</text>\n",
"<text fill=\"#ff7f00\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"753.727\" y=\"-151.67\"></text>\n",
"</g>\n",
"<!-- 5&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge9\"><title>5-&gt;4</title>\n",
@ -612,7 +620,7 @@
"<g class=\"node\" id=\"node10\"><title>7</title>\n",
"<ellipse cx=\"431.246\" cy=\"-94.8701\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"426.746\" y=\"-98.6701\">7</text>\n",
"<text fill=\"#6a3d9a\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"423.246\" y=\"-83.6701\">\u2778</text>\n",
"<text fill=\"#6a3d9a\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"423.246\" y=\"-83.6701\"></text>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g class=\"edge\" id=\"edge11\"><title>6-&gt;7</title>\n",
@ -647,7 +655,7 @@
"<g class=\"node\" id=\"node12\"><title>8</title>\n",
"<ellipse cx=\"862.467\" cy=\"-26.8701\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"857.967\" y=\"-30.6701\">8</text>\n",
"<text fill=\"#33a02c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"854.467\" y=\"-15.6701\">\u2779</text>\n",
"<text fill=\"#33a02c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"854.467\" y=\"-15.6701\"></text>\n",
"</g>\n",
"<!-- 9&#45;&gt;8 -->\n",
"<g class=\"edge\" id=\"edge15\"><title>9-&gt;8</title>\n",
@ -671,7 +679,7 @@
"<g class=\"node\" id=\"node13\"><title>11</title>\n",
"<ellipse cx=\"502.987\" cy=\"-154.87\" fill=\"#ffffaa\" rx=\"26.7407\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"494.487\" y=\"-158.67\">11</text>\n",
"<text fill=\"#e31a1c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"494.987\" y=\"-143.67\">\u277a</text>\n",
"<text fill=\"#e31a1c\" font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"494.987\" y=\"-143.67\"></text>\n",
"</g>\n",
"<!-- 10&#45;&gt;11 -->\n",
"<g class=\"edge\" id=\"edge17\"><title>10-&gt;11</title>\n",
@ -694,19 +702,21 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<svg height=\"172pt\" viewBox=\"0.00 0.00 734.00 172.28\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.762994 0.762994) rotate(0) translate(4 221.8)\">\n",
"<title>G</title>\n",
"<polygon fill=\"white\" points=\"-4,4 -4,-221.8 958,-221.8 958,4 -4,4\" stroke=\"none\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"454\" y=\"-187.6\">[B\u00fcchi]</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"start\" x=\"454\" y=\"-187.6\">[Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node2\"><title>1</title>\n",
@ -869,12 +879,19 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 5
"source": [
"display(sg.aut_pattern(sg.AUT_KS_NCA, 3).show('.a'),\n",
" sg.aut_pattern(sg.AUT_L_DSA, 3).show('.a'),\n",
" sg.aut_pattern(sg.AUT_L_NBA, 3).show('.a'))"
]
},
{
"cell_type": "markdown",
@ -885,17 +902,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for aut in sg.aut_patterns(sg.AUT_KS_NCA):\n",
" print(aut.num_states())"
],
"language": "python",
"metadata": {},
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"3\n",
"5\n",
@ -910,10 +924,31 @@
]
}
],
"prompt_number": 6
}
],
"metadata": {}
}
"source": [
"for aut in sg.aut_patterns(sg.AUT_KS_NCA):\n",
" print(aut.num_states())"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -8,11 +8,14 @@ Each cell is submitted to the kernel, and the outputs are compared
with those stored in the notebook.
"""
# Derived from https://gist.github.com/minrk/2620735
from __future__ import print_function
import os,sys,time
import base64
import re
import pprint
from difflib import unified_diff as diff
from collections import defaultdict
@ -44,9 +47,9 @@ except ImportError:
# Until Debian Stable ships IPython >3.0, we stick to the v3 format.
try:
from nbformat import v3 as nbformat
from nbformat import v4 as nbformat
except ImportError:
from IPython.nbformat import v3 as nbformat
from IPython.nbformat import v4 as nbformat
def compare_png(a64, b64):
"""compare two b64 PNGs (incomplete)"""
@ -58,7 +61,7 @@ def compare_png(a64, b64):
bdata = base64.decodestring(b64)
return True
def sanitize(s):
def canonicalize(s, type, ignores):
"""sanitize a string for comparison.
fix universal newlines, strip trailing newlines, and normalize likely
@ -85,6 +88,9 @@ def sanitize(s):
s = re.sub(r'SpinS Promela Compiler.*Compiled C .* to .*pml.spins',
'SpinS output', s, flags=re.DOTALL)
# %%file writes `Writing`, or `Overwriting` if the file exists.
s = re.sub(r'^Overwriting ', 'Writing ', s)
# SVG generated by graphviz may put note at different positions
# depending on the graphviz build. Let's just strip anything that
# look like a position.
@ -115,47 +121,58 @@ def sanitize(s):
# CalledProcessError message has a final dot in Python 3.6
s = re.sub(r"(' returned non-zero exit status \d+)\.", r'\1', s)
for n, p in enumerate(ignores):
s = re.sub(p, 'IGN{}'.format(n), s)
return s
def consolidate_outputs(outputs):
"""consolidate outputs into a summary dict (incomplete)"""
data = defaultdict(list)
data['stdout'] = ''
data['stderr'] = ''
def canonical_dict(dict, ignores):
'''Neutralize gratuitous differences in a Jupyter dictionary.
for out in outputs:
if out.type == 'stream':
data[out.stream] += out.text
elif out.type == 'pyerr':
data['pyerr'] = dict(ename=out.ename, evalue=out.evalue)
else:
for key in ('png', 'svg', 'latex', 'html',
'javascript', 'text', 'jpeg',):
if key in out:
data[key].append(out[key])
return data
For instance, neutralize different Graphviz layouts in SVG.
'''
if 'text' in dict:
dict['text'] = canonicalize(dict['text'], 'text', ignores)
if 'data' in dict:
for k in dict['data']:
dict['data'][k] = canonicalize(dict['data'][k], k, ignores)
if ('ename' in dict and
dict['ename'] == 'SystemExit' and dict['evalue'] == '77'):
# sys.exit(77) is used to Skip the test.
sys.exit(77)
if 'transient' in dict:
del dict['transient']
if 'execution_count' in dict:
del dict['execution_count']
if 'traceback' in dict:
del dict['traceback']
return dict
def compare_outputs(test, ref, skip_cmp=('png', 'traceback',
'latex', 'prompt_number')):
for key in ref:
if key not in test:
print("missing key: %s != %s" % (test.keys(), ref.keys()))
return False
elif key not in skip_cmp:
exp = sanitize(ref[key])
eff = sanitize(test[key])
if exp != eff:
print("mismatch %s:" % key)
def compare_outputs(ref, test, ignores=[]):
'''Check that two lists of outputs are equivalent and report the
result.'''
# There can be several outputs. For instance wnen the cell both
# prints a result (goes to "stdout") and displays an automaton
# (goes to "data").
exp = pprint.pformat([canonical_dict(d, ignores) for d in ref], width=132)
eff = pprint.pformat([canonical_dict(d, ignores) for d in test], width=132)
if exp[:-1] != '\n':
exp += '\n'
if eff[:-1] != '\n':
eff += '\n'
if exp == eff:
return True
else:
print(''.join(diff(exp.splitlines(1), eff.splitlines(1),
fromfile='expected', tofile='effective')))
return False
return True
def _wait_for_ready_backport(kc):
"""Backport BlockingKernelClient.wait_for_ready from IPython 3"""
@ -173,8 +190,7 @@ def _wait_for_ready_backport(kc):
break
def run_cell(kc, cell):
# print cell.input
kc.execute(cell.input)
kc.execute(cell.source)
# wait for finish, maximum 20s
reply = kc.get_shell_msg(timeout=20)
outs = []
@ -184,52 +200,38 @@ def run_cell(kc, cell):
msg = kc.get_iopub_msg(timeout=0.2)
except Empty:
break
msg_type = msg['msg_type']
if msg_type in ('status', 'pyin', 'execute_input'):
content = msg['content']
if msg_type == 'status' and content['execution_state'] == 'idle':
break
if msg_type in ('status', 'pyin', 'execute_input',
'comm_open', 'comm_msg'):
continue
if msg_type == 'stream':
if 'Widget' in content['text']:
continue
# If the last stream had the same name, then outputs are
# appended.
if outs:
last = outs[-1]
if last['output_type'] == 'stream' and \
last['name'] == content['name']:
last['text'] += content['text']
continue
elif msg_type == 'clear_output':
outs = []
continue
content = msg['content']
# print (msg_type, content)
if msg_type == 'execute_result':
msg_type = 'pyout'
elif msg_type == 'error':
msg_type = 'pyerr'
out = nbformat.NotebookNode(output_type=msg_type)
if msg_type == 'stream':
out.stream = content['name']
if 'text' in content:
out.text = content['text']
else:
out.text = content['data']
elif msg_type in ('display_data', 'pyout'):
out['metadata'] = content['metadata']
for mime, data in content['data'].items():
attr = mime.split('/')[-1].lower()
# this gets most right, but fix svg+html, plain
attr = attr.replace('+xml', '').replace('plain', 'text')
setattr(out, attr, data)
if 'execution_count' in content:
out.prompt_number = content['execution_count']
elif msg_type == 'pyerr':
out.ename = content['ename']
out.evalue = content['evalue']
out.traceback = content['traceback']
# sys.exit(77) is used to Skip the test.
if out.ename == 'SystemExit' and out.evalue == '77':
sys.exit(77)
else:
print("unhandled iopub msg:", msg_type)
outs.append(out)
content['output_type'] = msg_type
outs.append(content)
return outs
def test_notebook(nb):
def test_notebook(ipynb):
with open(ipynb, encoding='utf-8') as f:
nb = nbformat.reads_json(f.read())
km = KernelManager()
# Do not save the history to disk, as it can yield spurious lock errors.
# See https://github.com/ipython/ipython/issues/2845
@ -246,9 +248,8 @@ def test_notebook(nb):
successes = 0
failures = 0
errors = 0
for ws in nb.worksheets:
for i, cell in enumerate(ws.cells):
if cell.cell_type != 'code' or cell.input.startswith('%timeit'):
for i, cell in enumerate(nb.cells):
if cell.cell_type != 'code' or cell.source.startswith('%timeit'):
continue
try:
outs = run_cell(kc, cell)
@ -263,8 +264,7 @@ def test_notebook(nb):
print("output length mismatch (expected {}, got {})".format(
len(cell.outputs), len(outs)))
failed = True
for out, ref in zip(outs, cell.outputs):
if not compare_outputs(out, ref):
if not compare_outputs(outs, cell.outputs):
failed = True
print("cell %d: " % i, end="")
if failed:
@ -274,8 +274,8 @@ def test_notebook(nb):
print("OK")
successes += 1
print()
print("tested notebook %s" % nb.metadata.name)
print("tested notebook %s" % ipynb)
print(" %3i cells successfully replicated" % successes)
if failures:
print(" %3i cells mismatched output" % failures)
@ -290,6 +290,4 @@ def test_notebook(nb):
if __name__ == '__main__':
for ipynb in sys.argv[1:]:
print("testing %s" % ipynb)
with open(ipynb) as f:
nb = nbformat.reads_json(f.read())
test_notebook(nb)
test_notebook(ipynb)

View file

@ -1,33 +1,13 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import spot\n",
"import spot.ltsmin\n",
"# The following line causes the notebook to exit with 77 if divine is not \n",
@ -35,11 +15,7 @@
"spot.ltsmin.require('divine')\n",
"# This is notebook also tests the limitation of the number of states in the GraphViz output\n",
"spot.setup(max_states=10)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -55,19 +31,31 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!rm -f test1.dve"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 2
"source": [
"!rm -f test1.dve"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Writing test1.dve\n"
]
}
],
"source": [
"%%file test1.dve\n",
"int a = 0, b = 0;\n",
"\n",
@ -89,19 +77,7 @@
"}\n",
"\n",
"system async;"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Writing test1.dve\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "markdown",
@ -112,14 +88,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"m = spot.ltsmin.load('test1.dve')"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 4
"source": [
"m = spot.ltsmin.load('test1.dve')"
]
},
{
"cell_type": "markdown",
@ -132,14 +108,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!rm -f test1.dve test1.dve.cpp test1.dve2C"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 5
"source": [
"!rm -f test1.dve test1.dve.cpp test1.dve2C"
]
},
{
"cell_type": "markdown",
@ -153,8 +129,12 @@
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%%dve m\n",
"int a = 0, b = 0;\n",
"\n",
@ -176,11 +156,7 @@
"}\n",
"\n",
"system async;"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 6
]
},
{
"cell_type": "markdown",
@ -194,49 +170,53 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"m"
],
"language": "python",
"metadata": {},
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 7,
"text": [
"data": {
"text/plain": [
"ltsmin model with the following variables:\n",
" a: int\n",
" b: int\n",
" P: ['x']\n",
" Q: ['wait', 'work']"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 7
"source": [
"m"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"sorted(m.info().items())"
],
"language": "python",
"metadata": {},
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"data": {
"text/plain": [
"[('state_size', 4),\n",
" ('types', [('int', []), ('P', ['x']), ('Q', ['wait', 'work'])]),\n",
" ('variables', [('a', 0), ('b', 0), ('P', 1), ('Q', 2)])]"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 8
"source": [
"sorted(m.info().items())"
]
},
{
"cell_type": "markdown",
@ -247,19 +227,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"k = m.kripke([\"a<1\", \"b>2\"])\n",
"k"
],
"language": "python",
"metadata": {},
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 9,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -445,27 +420,30 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7f402430f9c0> >"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 9
"source": [
"k = m.kripke([\"a<1\", \"b>2\"])\n",
"k"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"k.show('.<15')"
],
"language": "python",
"metadata": {},
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 10,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"200pt\" viewBox=\"0.00 0.00 734.00 199.71\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.524532 0.524532) rotate(0) translate(4 376.74)\">\n",
"<title>G</title>\n",
@ -724,27 +702,29 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 10
"source": [
"k.show('.<15')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"k.show('.<0') # unlimited output"
],
"language": "python",
"metadata": {},
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"151pt\" viewBox=\"0.00 0.00 734.00 150.69\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.390662 0.390662) rotate(0) translate(4 381.74)\">\n",
"<title>G</title>\n",
@ -1080,27 +1060,29 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 11
"source": [
"k.show('.<0') # unlimited output"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.translate('\"a<1\" U \"b>2\"'); a"
],
"language": "python",
"metadata": {},
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -1150,27 +1132,29 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f4024027150> >"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 12
"source": [
"a = spot.translate('\"a<1\" U \"b>2\"'); a"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.otf_product(k, a)"
],
"language": "python",
"metadata": {},
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -1307,17 +1291,23 @@
"<path fill=\"none\" stroke=\"black\" d=\"M1476.26,-134.037C1470.04,-143.858 1480.19,-153 1506.73,-153 1526.64,-153 1537.33,-147.858 1538.81,-141.143\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"1537.21,-134.037 1541.82,-140.178 1537.98,-137.452 1538.74,-140.868 1538.74,-140.868 1538.74,-140.868 1537.98,-137.452 1535.67,-141.557 1537.21,-134.037 1537.21,-134.037\"/>\n",
"<text text-anchor=\"start\" x=\"1438.73\" y=\"-171.8\" font-family=\"Lato\" font-size=\"14.00\">&quot;a&lt;1&quot; &amp; &quot;b&gt;2&quot; &amp; dead</text>\n",
"<text text-anchor=\"start\" x=\"1498.73\" y=\"-156.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"1498.73\" y=\"-156.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_product; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_product > *' at 0x7f402430ffc0> >"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 13
"source": [
"spot.otf_product(k, a)"
]
},
{
"cell_type": "markdown",
@ -1328,61 +1318,65 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"a = spot.atomic_prop_collect(spot.formula('\"a < 2\" W \"b == 1\"')); a"
],
"language": "python",
"metadata": {},
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"latex": [
"data": {
"text/latex": [
"$\\{``\\mathit{a < 2}\\textrm{''}, ``\\mathit{b == 1}\\textrm{''}\\}$"
],
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"text": [
"text/plain": [
"{\"a < 2\", \"b == 1\"}"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 14
"source": [
"a = spot.atomic_prop_collect(spot.formula('\"a < 2\" W \"b == 1\"')); a"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 15,
"metadata": {
"collapsed": false
},
"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() "
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 15
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"model_check('\"a<1\" R \"b > 1\"', m)"
],
"language": "python",
"metadata": {},
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 16,
"text": [
"data": {
"text/plain": [
"False"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 16
"source": [
"model_check('\"a<1\" R \"b > 1\"', m)"
]
},
{
"cell_type": "markdown",
@ -1393,33 +1387,29 @@
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"execution_count": 21,
"metadata": {
"collapsed": true
},
"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)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 21
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"run = model_debug('\"a<1\" R \"b > 1\"', m); run"
],
"language": "python",
"metadata": {},
"execution_count": 23,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 23,
"text": [
"data": {
"text/plain": [
"Prefix:\n",
" a=0, b=0, Q=0\n",
" | \"a<1\" & !\"b > 1\" & !dead\n",
@ -1431,9 +1421,15 @@
" a=3, b=0, Q=0\n",
" | !\"a<1\" & !\"b > 1\" & dead"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 23
"source": [
"run = model_debug('\"a<1\" R \"b > 1\"', m); run"
]
},
{
"cell_type": "markdown",
@ -1444,18 +1440,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"run.as_twa(True)"
],
"language": "python",
"metadata": {},
"execution_count": 24,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 24,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -1520,15 +1512,39 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f4024027720> >"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 24
}
],
"metadata": {}
}
"source": [
"run.as_twa(True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,45 +1,20 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
},
"name": "",
"signature": "sha256:07d2378b77f0b3c281fb9907deb011c1716ab64dab3726379c60ae42d5f4dd80"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import spot\n",
"import spot.ltsmin\n",
"# The following line causes the notebook to exit with 77 if spins is not \n",
"# installed, therefore skipping this test in the test suite.\n",
"spot.ltsmin.require('spins')\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -55,24 +30,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%pml model\n",
"active proctype P() {\n",
"int a = 0;\n",
"int b = 0;\n",
"x: if\n",
" :: d_step {a < 3 && b < 3; a = a + 1; } goto x;\n",
" :: d_step {a < 3 && b < 3; b = b + 1; } goto x;\n",
"fi;\n",
"}"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"stream": "stderr",
"text": [
"SpinS Promela Compiler - version 1.1 (3-Feb-2015)\n",
"(C) University of Twente, Formal Methods and Tools group\n",
@ -270,7 +235,17 @@
]
}
],
"prompt_number": 2
"source": [
"%%pml model\n",
"active proctype P() {\n",
"int a = 0;\n",
"int b = 0;\n",
"x: if\n",
" :: d_step {a < 3 && b < 3; a = a + 1; } goto x;\n",
" :: d_step {a < 3 && b < 3; b = b + 1; } goto x;\n",
"fi;\n",
"}"
]
},
{
"cell_type": "markdown",
@ -281,26 +256,28 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"model"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": [
"data": {
"text/plain": [
"ltsmin model with the following variables:\n",
" P_0._pc: pc\n",
" P_0.a: int\n",
" P_0.b: int"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"model"
]
},
{
"cell_type": "markdown",
@ -311,18 +288,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"k = model.kripke(['P_0.a < 2', 'P_0.b > 1']); k"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -553,12 +526,18 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.kripke; proxy of <Swig Object of type 'std::shared_ptr< spot::kripke > *' at 0x7fe0808e0240> >"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 4
"source": [
"k = model.kripke(['P_0.a < 2', 'P_0.b > 1']); k"
]
},
{
"cell_type": "markdown",
@ -574,19 +553,31 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!rm -rf test1.pml"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 5
"source": [
"!rm -rf test1.pml"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Writing test1.pml\n"
]
}
],
"source": [
"%%file test1.pml\n",
"active proctype P() {\n",
"int a = 0;\n",
@ -596,19 +587,7 @@
" :: d_step {a < 3 && b < 3; b = b + 1; } goto x;\n",
"fi;\n",
"}"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Writing test1.pml\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "markdown",
@ -619,51 +598,71 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"model2 = spot.ltsmin.load('test1.pml')"
],
"language": "python",
"metadata": {},
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 7
"source": [
"model2 = spot.ltsmin.load('test1.pml')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"model2"
],
"language": "python",
"metadata": {},
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"data": {
"text/plain": [
"ltsmin model with the following variables:\n",
" P_0._pc: pc\n",
" P_0.a: int\n",
" P_0.b: int"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 8
"source": [
"model2"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"!rm -f test1.pml test1.pml.spins.c test1.pml.spins"
],
"language": "python",
"metadata": {},
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 9
}
],
"metadata": {}
}
"source": [
"!rm -f test1.pml test1.pml.spins.c test1.pml.spins"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -1,41 +1,15 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import display \n",
"import spot\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -48,18 +22,12 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata('ltl2tgba -s \"a U b\"; ltl2tgba --lbtt \"b\"|', 'ltl2tgba -H \"GFa\" \"a & GFb\"|'):\n",
" display(a)"
],
"language": "python",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -109,14 +77,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d270> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd0404bab0> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -160,14 +130,16 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d450> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd004afa50> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -201,19 +173,21 @@
"<path fill=\"none\" stroke=\"black\" d=\"M50.6841,-35.4203C47.6538,-52.791 49.4258,-72 56,-72 61.7011,-72 63.7908,-57.5545 62.2691,-42.3894\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"61.3159,-35.4203 65.3856,-41.9288 61.7902,-38.888 62.2646,-42.3557 62.2646,-42.3557 62.2646,-42.3557 61.7902,-38.888 59.1437,-42.7826 61.3159,-35.4203 61.3159,-35.4203\"/>\n",
"<text text-anchor=\"start\" x=\"52.5\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"48\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d270> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd004afae0> >"
]
},
{
"metadata": {},
"output_type": "display_data",
"svg": [
"output_type": "display_data"
},
{
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -258,17 +232,23 @@
"<path fill=\"none\" stroke=\"black\" d=\"M129.441,-35.1418C126.17,-52.585 128.023,-72 135,-72 141.05,-72 143.247,-57.3996 141.591,-42.146\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"140.559,-35.1418 144.696,-41.6079 141.07,-38.6044 141.58,-42.067 141.58,-42.067 141.58,-42.067 141.07,-38.6044 138.463,-42.5262 140.559,-35.1418 140.559,-35.1418\"/>\n",
"<text text-anchor=\"start\" x=\"130.5\" y=\"-90.8\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"127\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"127\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d120> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd004afa80> >"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"prompt_number": 2
"source": [
"for a in spot.automata('ltl2tgba -s \"a U b\"; ltl2tgba --lbtt \"b\"|', 'ltl2tgba -H \"GFa\" \"a & GFb\"|'):\n",
" display(a)"
]
},
{
"cell_type": "markdown",
@ -279,18 +259,12 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('ltl2tgba -s6 \"a U b\"|')"
],
"language": "python",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -340,12 +314,18 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d1b0> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd004afa20> >"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"spot.automaton('ltl2tgba -s6 \"a U b\"|')"
]
},
{
"cell_type": "markdown",
@ -358,43 +338,35 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('non-existing-command|')"
],
"language": "python",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"ename": "CalledProcessError",
"evalue": "Command 'non-existing-command' returned non-zero exit status 127",
"output_type": "pyerr",
"evalue": "Command 'non-existing-command' returned non-zero exit status 127.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-765c7cc6937f>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'non-existing-command|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 463\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 464\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 465\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 466\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 467\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 448\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 450\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 451\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 452\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'non-existing-command' returned non-zero exit status 127"
"\u001b[0;32m<ipython-input-4-8ae92920faed>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'non-existing-command|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 479\u001b[0m See `spot.automata` for a list of supported formats.\"\"\"\n\u001b[1;32m 480\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 481\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 482\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 483\u001b[0m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 466\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 467\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 468\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'non-existing-command' returned non-zero exit status 127."
]
}
],
"prompt_number": 4
"source": [
"spot.automaton('non-existing-command|')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for a in spot.automata(\"ltl2tgba 'a U b'|\", 'ltl2tgba \"syntax U U error\"|'):\n",
" display(a)"
],
"language": "python",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -444,24 +416,30 @@
"</g>\n",
"</svg>\n"
],
"text": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f549852d360> >"
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fbd004af8d0> >"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"ename": "CalledProcessError",
"evalue": "Command 'ltl2tgba \"syntax U U error\"' returned non-zero exit status 2",
"output_type": "pyerr",
"evalue": "Command 'ltl2tgba \"syntax U U error\"' returned non-zero exit status 2.",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mCalledProcessError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-5-1163f8abbaad>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"ltl2tgba 'a U b'|\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'ltl2tgba \"syntax U U error\"|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdisplay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 448\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 450\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 451\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 452\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'ltl2tgba \"syntax U U error\"' returned non-zero exit status 2"
"\u001b[0;32m<ipython-input-5-cf613d56390d>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0ma\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"ltl2tgba 'a U b'|\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'ltl2tgba \"syntax U U error\"|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mdisplay\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomata\u001b[0;34m(timeout, ignore_abort, trust_hoa, no_sid, debug, *sources)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[0;32mdel\u001b[0m \u001b[0mproc\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mret\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 466\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0msubprocess\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCalledProcessError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mret\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfilename\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 467\u001b[0m \u001b[0;31m# deleting o explicitely now prevents Python 3.5 from\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 468\u001b[0m \u001b[0;31m# reporting the following error: \"<built-in function\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mCalledProcessError\u001b[0m: Command 'ltl2tgba \"syntax U U error\"' returned non-zero exit status 2."
]
}
],
"prompt_number": 5
"source": [
"for a in spot.automata(\"ltl2tgba 'a U b'|\", 'ltl2tgba \"syntax U U error\"|'):\n",
" display(a)"
]
},
{
"cell_type": "markdown",
@ -472,43 +450,50 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.automaton('true|')"
],
"language": "python",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"ename": "RuntimeError",
"evalue": "Failed to read automaton from true|",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mStopIteration\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 464\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 465\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 466\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 480\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 481\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 482\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mStopIteration\u001b[0m: ",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-6-f4e056a50029>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'true|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 465\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 466\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 467\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 468\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 469\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-6-139f3bb684aa>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mspot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mautomaton\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'true|'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/home/adl/git/spot/python/spot/__init__.py\u001b[0m in \u001b[0;36mautomaton\u001b[0;34m(filename, **kwargs)\u001b[0m\n\u001b[1;32m 481\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnext\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mautomata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 482\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mStopIteration\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 483\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Failed to read automaton from {}\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilename\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mRuntimeError\u001b[0m: Failed to read automaton from true|"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": true,
"input": [],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": null
}
],
"metadata": {}
}
"source": [
"spot.automaton('true|')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,55 +1,28 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
},
"name": "",
"signature": "sha256:c1de5aacd024bbec64b75f61a13e53562185c906051312d9ce5067236b7899d4"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"cell_type": "markdown",
"metadata": {},
"source": [
"Documentation for spot's randltl python binding"
"# Documentation for spot's randltl python binding"
]
},
{
"cell_type": "code",
"collapsed": true,
"input": [
"import spot"
],
"language": "python",
"metadata": {},
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"prompt_number": 1
"source": [
"import spot"
]
},
{
"cell_type": "heading",
"level": 2,
"cell_type": "markdown",
"metadata": {},
"source": [
"Basic usage"
"## Basic usage"
]
},
{
@ -61,18 +34,14 @@
},
{
"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": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"0 R b\n",
@ -80,7 +49,11 @@
]
}
],
"prompt_number": 2
"source": [
"f = spot.randltl(['a', 'b', 'c'])\n",
"for i in range(3):\n",
" print(next(f))"
]
},
{
"cell_type": "markdown",
@ -91,18 +64,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(3)\n",
"for i in range(3):\n",
" print(next(f))"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"0 R p1\n",
@ -110,7 +79,11 @@
]
}
],
"prompt_number": 3
"source": [
"f = spot.randltl(3)\n",
"for i in range(3):\n",
" print(next(f))"
]
},
{
"cell_type": "markdown",
@ -122,18 +95,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(3, 4)\n",
"for formula in f:\n",
" print(formula)"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"0 R p1\n",
@ -142,22 +111,24 @@
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Keyword arguments"
"f = spot.randltl(3, 4)\n",
"for formula in f:\n",
" print(formula)"
]
},
{
"cell_type": "heading",
"level": 2,
"cell_type": "markdown",
"metadata": {},
"source": [
"seed"
"## Keyword arguments"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## seed"
]
},
{
@ -169,30 +140,29 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(3, seed=11)\n",
"print(next(f))"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"G(p1 U Gp0)\n"
]
}
],
"prompt_number": 5
"source": [
"f = spot.randltl(3, seed=11)\n",
"print(next(f))"
]
},
{
"cell_type": "heading",
"level": 3,
"cell_type": "markdown",
"metadata": {},
"source": [
"output"
"### output"
]
},
{
@ -204,30 +174,29 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(3, output='psl', seed=332)\n",
"print(next(f))"
],
"language": "python",
"metadata": {},
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"{{p0 && p2}[*]}<>-> (Fp2 & Fp0)\n"
]
}
],
"prompt_number": 6
"source": [
"f = spot.randltl(3, output='psl', seed=332)\n",
"print(next(f))"
]
},
{
"cell_type": "heading",
"level": 3,
"cell_type": "markdown",
"metadata": {},
"source": [
"allow_dups"
"### allow_dups"
]
},
{
@ -239,19 +208,14 @@
},
{
"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": {},
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"0\n",
@ -259,14 +223,18 @@
]
}
],
"prompt_number": 7
"source": [
"f = spot.randltl(1, allow_dups=True)\n",
"print(next(f))\n",
"print(next(f))\n",
"print(next(f))"
]
},
{
"cell_type": "heading",
"level": 3,
"cell_type": "markdown",
"metadata": {},
"source": [
"tree_size"
"### tree_size"
]
},
{
@ -278,23 +246,23 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(3, tree_size=30, seed=11)\n",
"print(next(f))"
],
"language": "python",
"metadata": {},
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"G(((p0 U !Xp1) M Gp1) U Gp0)\n"
]
}
],
"prompt_number": 8
"source": [
"f = spot.randltl(3, tree_size=30, seed=11)\n",
"print(next(f))"
]
},
{
"cell_type": "markdown",
@ -305,48 +273,43 @@
},
{
"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": {},
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"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
"source": [
"f = spot.randltl(3, tree_size=(1, 40))\n",
"print(next(f))\n",
"print(next(f))"
]
},
{
"cell_type": "heading",
"level": 3,
"cell_type": "markdown",
"metadata": {},
"source": [
"boolean_priorities, ltl_priorities, sere_priorities, dump_priorities"
"### 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": {},
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"!p2 & (p1 <-> p2)\n",
@ -356,7 +319,11 @@
]
}
],
"prompt_number": 10
"source": [
"f = spot.randltl(3, output='bool', boolean_priorities='and=10,or=0')\n",
"for i in range(5):\n",
" print(next(f))"
]
},
{
"cell_type": "markdown",
@ -367,16 +334,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.randltl(3, output='psl', dump_priorities=True)"
],
"language": "python",
"metadata": {},
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"Use argument ltl_priorities=STRING to set the following LTL priorities:\n",
"\n",
@ -478,14 +443,15 @@
]
}
],
"prompt_number": 11
"source": [
"spot.randltl(3, output='psl', dump_priorities=True)"
]
},
{
"cell_type": "heading",
"level": 3,
"cell_type": "markdown",
"metadata": {},
"source": [
"simplify"
"### simplify"
]
},
{
@ -501,33 +467,32 @@
},
{
"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": {},
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"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
"source": [
"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))"
]
},
{
"cell_type": "heading",
"level": 2,
"cell_type": "markdown",
"metadata": {},
"source": [
"Filters and maps"
"## Filters and maps"
]
},
{
@ -539,18 +504,14 @@
},
{
"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": {},
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"0 R p2\n",
@ -563,7 +524,11 @@
]
}
],
"prompt_number": 13
"source": [
"f = spot.randltl(3, 20).is_syntactic_stutter_invariant()\n",
"for formula in f:\n",
" print(formula)"
]
},
{
"cell_type": "markdown",
@ -574,18 +539,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.randltl(2, 6).remove_x()\n",
"for formula in f:\n",
" print(formula)"
],
"language": "python",
"metadata": {},
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"!(F!p1 M 1)\n",
@ -596,7 +557,11 @@
]
}
],
"prompt_number": 14
"source": [
"f = spot.randltl(2, 6).remove_x()\n",
"for formula in f:\n",
" print(formula)"
]
},
{
"cell_type": "markdown",
@ -607,18 +572,14 @@
},
{
"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": {},
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"Ga\n",
@ -631,20 +592,22 @@
]
}
],
"prompt_number": 15
"source": [
"f = spot.randltl(3, 20).is_syntactic_stutter_invariant().relabel(spot.Abc).simplify()\n",
"for formula in f:\n",
" print(formula)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"for formula in spot.randltl(3, 10).simplify().unabbreviate(\"WMGFR\"): print(formula)"
],
"language": "python",
"metadata": {},
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"0\n",
"!(1 U !p1)\n",
@ -659,19 +622,39 @@
]
}
],
"prompt_number": 16
"source": [
"for formula in spot.randltl(3, 10).simplify().unabbreviate(\"WMGFR\"): print(formula)"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 16
"source": []
}
],
"metadata": {}
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3+"
}
]
},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -1,41 +1,17 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from IPython.display import display, HTML\n",
"import spot\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -48,20 +24,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"f = spot.formula('a U Gb')\n",
"a = f.translate('ba')\n",
"a"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -111,12 +81,20 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f99b4744e40> >"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"f = spot.formula('a U Gb')\n",
"a = f.translate('ba')\n",
"a"
]
},
{
"cell_type": "markdown",
@ -127,20 +105,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"propset = spot.atomic_prop_collect_as_bdd(f, a)\n",
"ta = spot.tgba_to_ta(a, propset, True, True, False, False, True)\n",
"ta.show('.A')"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"265pt\" viewBox=\"0.00 0.00 734.00 264.84\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.708119 0.708119) rotate(0) translate(4 370)\">\n",
"<title>G</title>\n",
@ -373,12 +345,20 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"propset = spot.atomic_prop_collect_as_bdd(f, a)\n",
"ta = spot.tgba_to_ta(a, propset, True, True, False, False, True)\n",
"ta.show('.A')"
]
},
{
"cell_type": "markdown",
@ -389,19 +369,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"ta = spot.tgba_to_ta(a, propset, True, True, False, False, False)\n",
"ta.show('.A')"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 4,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"138pt\" viewBox=\"0.00 0.00 734.00 137.69\" width=\"734pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(0.949605 0.949605) rotate(0) translate(4 141)\">\n",
"<title>G</title>\n",
@ -518,12 +493,19 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 4
"source": [
"ta = spot.tgba_to_ta(a, propset, True, True, False, False, False)\n",
"ta.show('.A')"
]
},
{
"cell_type": "markdown",
@ -534,18 +516,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"spot.minimize_ta(ta).show('.A')"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"175pt\" viewBox=\"0.00 0.00 638.00 175.00\" width=\"638pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 171)\">\n",
"<title>G</title>\n",
@ -645,15 +623,39 @@
"</g>\n",
"</svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 5
}
],
"metadata": {}
}
"source": [
"spot.minimize_ta(ta).show('.A')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,40 +1,16 @@
{
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
},
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import spot\n",
"spot.setup()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
]
},
{
"cell_type": "markdown",
@ -45,18 +21,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"aut = spot.translate('!a & G(Fa <-> XXb)'); aut"
],
"language": "python",
"metadata": {},
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 2,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -128,7 +100,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M211.266,-96.0373C209.892,-105.858 212.137,-115 218,-115 222.397,-115 224.759,-109.858 225.086,-103.143\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"224.734,-96.0373 228.226,-102.873 224.907,-99.533 225.08,-103.029 225.08,-103.029 225.08,-103.029 224.907,-99.533 221.934,-103.185 224.734,-96.0373 224.734,-96.0373\"/>\n",
"<text text-anchor=\"start\" x=\"201\" y=\"-133.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; b</text>\n",
"<text text-anchor=\"start\" x=\"210\" y=\"-118.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"210\" y=\"-118.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 2&#45;&gt;3 -->\n",
"<g id=\"edge7\" class=\"edge\"><title>2&#45;&gt;3</title>\n",
@ -152,7 +124,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M310.663,-59.0732C304.666,-61.9449 297.644,-64.9668 291,-67 275.418,-71.7682 257.324,-74.7739 243.173,-76.5847\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"236.167,-77.4257 242.741,-73.4638 239.642,-77.0085 243.117,-76.5914 243.117,-76.5914 243.117,-76.5914 239.642,-77.0085 243.492,-79.7189 236.167,-77.4257 236.167,-77.4257\"/>\n",
"<text text-anchor=\"start\" x=\"255.5\" y=\"-93.8\" font-family=\"Lato\" font-size=\"14.00\">a &amp; b</text>\n",
"<text text-anchor=\"start\" x=\"264.5\" y=\"-78.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"264.5\" y=\"-78.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g id=\"edge10\" class=\"edge\"><title>3&#45;&gt;3</title>\n",
@ -165,7 +137,7 @@
"<path fill=\"none\" stroke=\"black\" d=\"M426.767,-37.5414C424.169,-47.9087 427.246,-58 436,-58 442.702,-58 446.077,-52.0847 446.124,-44.6591\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"445.233,-37.5414 449.229,-44.0955 445.668,-41.0143 446.103,-44.4871 446.103,-44.4871 446.103,-44.4871 445.668,-41.0143 442.977,-44.8788 445.233,-37.5414 445.233,-37.5414\"/>\n",
"<text text-anchor=\"start\" x=\"415.5\" y=\"-76.8\" font-family=\"Lato\" font-size=\"14.00\">!a &amp; !b</text>\n",
"<text text-anchor=\"start\" x=\"428\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">\u24ff</text>\n",
"<text text-anchor=\"start\" x=\"428\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\"></text>\n",
"</g>\n",
"<!-- 5&#45;&gt;4 -->\n",
"<g id=\"edge12\" class=\"edge\"><title>5&#45;&gt;4</title>\n",
@ -176,12 +148,18 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb74c39da80> >"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 2
"source": [
"aut = spot.translate('!a & G(Fa <-> XXb)'); aut"
]
},
{
"cell_type": "markdown",
@ -192,18 +170,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"run = aut.accepting_run(); run"
],
"language": "python",
"metadata": {},
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 3,
"text": [
"data": {
"text/plain": [
"Prefix:\n",
" 0\n",
" | !a\n",
@ -213,9 +187,15 @@
" 2\n",
" | a & b\t{0}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 3
"source": [
"run = aut.accepting_run(); run"
]
},
{
"cell_type": "markdown",
@ -226,24 +206,24 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.bdd_format_formula(aut.get_dict(), run.prefix[0].label))\n",
"print(run.cycle[0].acc)"
],
"language": "python",
"metadata": {},
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"!a\n",
"{0}\n"
]
}
],
"prompt_number": 4
"source": [
"print(spot.bdd_format_formula(aut.get_dict(), run.prefix[0].label))\n",
"print(run.cycle[0].acc)"
]
},
{
"cell_type": "markdown",
@ -254,23 +234,25 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"word = spot.twa_word(run); word"
],
"language": "python",
"metadata": {},
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 5,
"text": [
"data": {
"text/plain": [
"!a; a; cycle{a & b}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 5
"source": [
"word = spot.twa_word(run); word"
]
},
{
"cell_type": "markdown",
@ -281,18 +263,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"word.show()"
],
"language": "python",
"metadata": {},
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 6,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"112\" version=\"1.1\" width=\"200\" xmlns=\"http://www.w3.org/2000/svg\">\n",
"<rect fill=\"#f4f4f4\" height=\"100\" width=\"200\" x=\"0\" y=\"0\"/>\n",
"<line stroke=\"white\" stroke-width=\"4\" x1=\"100\" x2=\"100\" y1=\"0\" y2=\"100\"/>\n",
@ -300,12 +278,18 @@
"<line stroke=\"white\" stroke-width=\"4\" x1=\"0\" x2=\"200\" y1=\"0\" y2=\"0\"/><text font-size=\"20\" text-anchor=\"start\" x=\"3\" y=\"30\">a</text><line stroke=\"white\" stroke-width=\"1\" x1=\"50\" x2=\"50\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"0\" x2=\"50\" y1=\"45\" y2=\"45\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"100\" x2=\"100\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"50\" x2=\"50\" y1=\"5\" y2=\"45\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"50\" x2=\"100\" y1=\"5\" y2=\"5\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"150\" x2=\"150\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"150\" y1=\"5\" y2=\"5\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"200\" x2=\"200\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"150\" x2=\"200\" y1=\"5\" y2=\"5\"/><line stroke=\"white\" stroke-width=\"4\" x1=\"0\" x2=\"200\" y1=\"50\" y2=\"50\"/><text font-size=\"20\" text-anchor=\"start\" x=\"3\" y=\"80\">b</text><line stroke=\"white\" stroke-width=\"1\" x1=\"50\" x2=\"50\" y1=\"50\" y2=\"100\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"100\" x2=\"100\" y1=\"50\" y2=\"100\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"150\" x2=\"150\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"150\" y1=\"55\" y2=\"55\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"200\" x2=\"200\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"150\" x2=\"200\" y1=\"55\" y2=\"55\"/><text font-size=\"10\" text-anchor=\"start\" x=\"0\" y=\"110\">prefix</text><text font-size=\"10\" text-anchor=\"start\" x=\"100\" y=\"110\">cycle</text>\n",
"<text font-size=\"10\" text-anchor=\"start\" x=\"150\" y=\"110\">cycle</text></svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 6
"source": [
"word.show()"
]
},
{
"cell_type": "markdown",
@ -316,18 +300,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.bdd_format_formula(aut.get_dict(), word.prefix[0]))\n",
"print(spot.bdd_format_formula(aut.get_dict(), word.prefix[1]))\n",
"print(spot.bdd_format_formula(aut.get_dict(), word.cycle[0]))"
],
"language": "python",
"metadata": {},
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"!a\n",
"a\n",
@ -335,7 +315,11 @@
]
}
],
"prompt_number": 7
"source": [
"print(spot.bdd_format_formula(aut.get_dict(), word.prefix[0]))\n",
"print(spot.bdd_format_formula(aut.get_dict(), word.prefix[1]))\n",
"print(spot.bdd_format_formula(aut.get_dict(), word.cycle[0]))"
]
},
{
"cell_type": "markdown",
@ -346,24 +330,26 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"word.simplify()\n",
"word"
],
"language": "python",
"metadata": {},
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 8,
"text": [
"data": {
"text/plain": [
"!a; cycle{a & b}"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 8
"source": [
"word.simplify()\n",
"word"
]
},
{
"cell_type": "markdown",
@ -374,23 +360,25 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"aut.accepting_word()"
],
"language": "python",
"metadata": {},
"execution_count": 9,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 9,
"text": [
"data": {
"text/plain": [
"!a; cycle{a & b}"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 9
"source": [
"aut.accepting_word()"
]
},
{
"cell_type": "markdown",
@ -401,18 +389,14 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.parse_word('a; b; cycle{a&b}'))\n",
"print(spot.parse_word('cycle{a&bb|bac&(aaa|bbb)}'))\n",
"print(spot.parse_word('a; b;b; qiwuei;\"a;b&c;a\" ;cycle{a}'))"
],
"language": "python",
"metadata": {},
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
"text": [
"a; b; cycle{a & b}\n",
"cycle{(a & bb) | (aaa & bac) | (bac & bbb)}\n",
@ -420,43 +404,45 @@
]
}
],
"prompt_number": 10
"source": [
"print(spot.parse_word('a; b; cycle{a&b}'))\n",
"print(spot.parse_word('cycle{a&bb|bac&(aaa|bbb)}'))\n",
"print(spot.parse_word('a; b;b; qiwuei;\"a;b&c;a\" ;cycle{a}'))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# make sure that we can parse a word back after it has been printed\n",
"w = spot.parse_word(str(spot.parse_word('a;b&a;cycle{!a&!b;!a&b}'))); w"
],
"language": "python",
"metadata": {},
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 11,
"text": [
"data": {
"text/plain": [
"a; a & b; cycle{!a & !b; !a & b}"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 11
"source": [
"# make sure that we can parse a word back after it has been printed\n",
"w = spot.parse_word(str(spot.parse_word('a;b&a;cycle{!a&!b;!a&b}'))); w"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"w.show()"
],
"language": "python",
"metadata": {},
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"svg": [
"data": {
"image/svg+xml": [
"<svg height=\"112\" version=\"1.1\" width=\"300\" xmlns=\"http://www.w3.org/2000/svg\">\n",
"<rect fill=\"#f4f4f4\" height=\"100\" width=\"300\" x=\"0\" y=\"0\"/>\n",
"<line stroke=\"white\" stroke-width=\"4\" x1=\"100\" x2=\"100\" y1=\"0\" y2=\"100\"/>\n",
@ -464,12 +450,18 @@
"<line stroke=\"white\" stroke-width=\"4\" x1=\"0\" x2=\"300\" y1=\"0\" y2=\"0\"/><text font-size=\"20\" text-anchor=\"start\" x=\"3\" y=\"30\">a</text><line stroke=\"white\" stroke-width=\"1\" x1=\"50\" x2=\"50\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"0\" x2=\"50\" y1=\"5\" y2=\"5\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"100\" x2=\"100\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"50\" x2=\"100\" y1=\"5\" y2=\"5\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"150\" x2=\"150\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"100\" y1=\"5\" y2=\"45\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"150\" y1=\"45\" y2=\"45\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"200\" x2=\"200\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"150\" x2=\"200\" y1=\"45\" y2=\"45\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"250\" x2=\"250\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"200\" x2=\"250\" y1=\"45\" y2=\"45\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"300\" x2=\"300\" y1=\"0\" y2=\"50\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"250\" x2=\"300\" y1=\"45\" y2=\"45\"/><line stroke=\"white\" stroke-width=\"4\" x1=\"0\" x2=\"300\" y1=\"50\" y2=\"50\"/><text font-size=\"20\" text-anchor=\"start\" x=\"3\" y=\"80\">b</text><line stroke=\"white\" stroke-width=\"1\" x1=\"50\" x2=\"50\" y1=\"50\" y2=\"100\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"100\" x2=\"100\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"50\" x2=\"100\" y1=\"55\" y2=\"55\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"150\" x2=\"150\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"100\" y1=\"55\" y2=\"95\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"100\" x2=\"150\" y1=\"95\" y2=\"95\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"200\" x2=\"200\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"150\" x2=\"150\" y1=\"55\" y2=\"95\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"150\" x2=\"200\" y1=\"55\" y2=\"55\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"250\" x2=\"250\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"200\" x2=\"200\" y1=\"55\" y2=\"95\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"200\" x2=\"250\" y1=\"95\" y2=\"95\"/><line stroke=\"white\" stroke-width=\"1\" x1=\"300\" x2=\"300\" y1=\"50\" y2=\"100\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"250\" x2=\"250\" y1=\"55\" y2=\"95\"/><line stroke=\"#ff0000\" stroke-width=\"2\" x1=\"250\" x2=\"300\" y1=\"55\" y2=\"55\"/><text font-size=\"10\" text-anchor=\"start\" x=\"0\" y=\"110\">prefix</text><text font-size=\"10\" text-anchor=\"start\" x=\"100\" y=\"110\">cycle</text>\n",
"<text font-size=\"10\" text-anchor=\"start\" x=\"200\" y=\"110\">cycle</text></svg>"
],
"text": [
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 12
"source": [
"w.show()"
]
},
{
"cell_type": "markdown",
@ -480,29 +472,25 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"w1 = spot.parse_word('a; !a; cycle{a; !a; a}')"
],
"language": "python",
"metadata": {},
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [],
"prompt_number": 13
"source": [
"w1 = spot.parse_word('a; !a; cycle{a; !a; a}')"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"w1.as_automaton()"
],
"language": "python",
"metadata": {},
"execution_count": 14,
"metadata": {
"collapsed": false
},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"svg": [
"data": {
"image/svg+xml": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
@ -578,12 +566,18 @@
"</g>\n",
"</svg>\n"
],
"text": [
"text/plain": [
"<spot.impl.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7fb74c39d990> >"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"prompt_number": 14
"source": [
"w1.as_automaton()"
]
},
{
"cell_type": "markdown",
@ -594,110 +588,107 @@
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.parse_word('a; b&!a; b'))"
],
"language": "python",
"metadata": {},
"execution_count": 15,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "\n>>> a; b&!a; b\n ^\nA twa_word must contain a cycle\n (<string>)",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32munknown\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m \n>>> a; b&!a; b\n ^\nA twa_word must contain a cycle\n\n"
]
}
],
"prompt_number": 15
"source": [
"print(spot.parse_word('a; b&!a; b'))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.parse_word('a; b; c}'))"
],
"language": "python",
"metadata": {},
"execution_count": 16,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "\n>>> a; b; c}\n ^\nExpected ';' delimiter: '}' stands for ending a cycle\n (<string>)",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32munknown\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m \n>>> a; b; c}\n ^\nExpected ';' delimiter: '}' stands for ending a cycle\n\n"
]
}
],
"prompt_number": 16
"source": [
"print(spot.parse_word('a; b; c}'))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.parse_word('a; cycle{}'))"
],
"language": "python",
"metadata": {},
"execution_count": 17,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "\n>>> a; cycle{}\n ^\nempty input\n\n (<string>)",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32munknown\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m \n>>> a; cycle{}\n ^\nempty input\n\n\n"
]
}
],
"prompt_number": 17
"source": [
"print(spot.parse_word('a; cycle{}'))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print(spot.parse_word('a; cycle{!a}; a'))"
],
"language": "python",
"metadata": {},
"execution_count": 18,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "\n>>> a; cycle{!a}; a\n ^\nInput should be finished after cycle\n (<string>)",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;36m File \u001b[0;32m\"<string>\"\u001b[0;36m, line \u001b[0;32munknown\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m \n>>> a; cycle{!a}; a\n ^\nInput should be finished after cycle\n\n"
]
}
],
"prompt_number": 18
"source": [
"print(spot.parse_word('a; cycle{!a}; a'))"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"execution_count": 19,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"# Creating an empty word is OK...\n",
"w = spot.twa_word(spot._bdd_dict)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 19
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"# ... as long as this word is not printed.\n",
"print(w)"
],
"language": "python",
"metadata": {},
"execution_count": 20,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "RuntimeError",
"evalue": "a twa_word may not have an empty cycle",
"output_type": "pyerr",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
@ -707,10 +698,31 @@
]
}
],
"prompt_number": 20
}
],
"metadata": {}
}
"source": [
"# ... as long as this word is not printed.\n",
"print(w)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}