spot/tests/python/testingaut.ipynb
Alexandre Duret-Lutz 58e64e752c 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.
2018-01-07 12:59:59 +01:00

661 lines
49 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from IPython.display import display, HTML\n",
"import spot\n",
"spot.setup()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To translate a formula into a Testing Automaton\n",
"\n",
"Start by building a Buchi automaton"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"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",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\"><title>0</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\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\"><title>I&#45;&gt;0</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",
"<!-- 0&#45;&gt;0 -->\n",
"<g id=\"edge2\" class=\"edge\"><title>0&#45;&gt;0</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=\"52.5\" y=\"-61.8\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\"><title>1</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\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge3\" class=\"edge\"><title>0&#45;&gt;1</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",
"<!-- 1&#45;&gt;1 -->\n",
"<g id=\"edge4\" class=\"edge\"><title>1&#45;&gt;1</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=\"start\" x=\"136.5\" y=\"-65.8\" font-family=\"Lato\" font-size=\"14.00\">b</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 0x7f99b4744e40> >"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"f = spot.formula('a U Gb')\n",
"a = f.translate('ba')\n",
"a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then, gather all the atomic proposition in the formula, and create an automaton with changesets"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"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",
"<polygon fill=\"white\" points=\"-4,4 -4,-370 1032.55,-370 1032.55,4 -4,4\" stroke=\"none\"/>\n",
"<!-- 0 -->\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node2\"><title>1</title>\n",
"<ellipse cx=\"118\" cy=\"-250\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"118\" y=\"-246.3\">init</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>0-&gt;1</title>\n",
"<path d=\"M54.2216,-250C63.4559,-250 73.9612,-250 83.7008,-250\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"90.9659,-250 83.9659,-253.15 87.4659,-250 83.9659,-250 83.9659,-250 83.9659,-250 87.4659,-250 83.9658,-246.85 90.9659,-250 90.9659,-250\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g class=\"node\" id=\"node3\"><title>2</title>\n",
"<ellipse cx=\"539.969\" cy=\"-195\" fill=\"#ffffaa\" rx=\"37.4533\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"539.969\" y=\"-198.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"539.969\" y=\"-183.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>1-&gt;2</title>\n",
"<path d=\"M134.194,-264.679C169.197,-296.674 258.802,-368.267 340.711,-348 412.401,-330.261 429.922,-312.696 481.664,-260 490.758,-250.738 491.221,-246.86 499.664,-237 503.862,-232.098 508.445,-226.994 512.951,-222.103\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"517.79,-216.899 515.33,-224.171 515.406,-219.462 513.023,-222.026 513.023,-222.026 513.023,-222.026 515.406,-219.462 510.716,-219.881 517.79,-216.899 517.79,-216.899\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"322.211\" y=\"-354.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g class=\"node\" id=\"node4\"><title>3</title>\n",
"<ellipse cx=\"250.355\" cy=\"-154\" fill=\"#ffffaa\" rx=\"35.2113\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.355\" y=\"-157.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.355\" y=\"-142.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>1-&gt;3</title>\n",
"<path d=\"M136.852,-236.853C157.767,-221.45 192.789,-195.658 218.211,-176.936\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"224.127,-172.579 220.359,-179.267 221.309,-174.655 218.491,-176.73 218.491,-176.73 218.491,-176.73 221.309,-174.655 216.623,-174.194 224.127,-172.579 224.127,-172.579\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"180\" y=\"-220.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g class=\"node\" id=\"node5\"><title>4</title>\n",
"<ellipse cx=\"396.187\" cy=\"-195\" fill=\"#ffffaa\" rx=\"37.4533\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.187\" y=\"-198.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.187\" y=\"-183.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;4</title>\n",
"<path d=\"M144.886,-246.934C186.554,-241.693 270.897,-229.822 340.711,-212 345.355,-210.815 350.189,-209.47 354.975,-208.069\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"361.926,-205.988 356.124,-211.013 358.573,-206.992 355.22,-207.996 355.22,-207.996 355.22,-207.996 358.573,-206.992 354.317,-204.978 361.926,-205.988 361.926,-205.988\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.355\" y=\"-240.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g class=\"node\" id=\"node6\"><title>5</title>\n",
"<ellipse cx=\"685.63\" cy=\"-147\" fill=\"#ffffaa\" rx=\"35.2259\" ry=\"26.7574\" stroke=\"black\"/>\n",
"<ellipse cx=\"685.63\" cy=\"-147\" fill=\"none\" rx=\"39.2112\" ry=\"30.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"685.63\" y=\"-150.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"685.63\" y=\"-135.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>2-&gt;5</title>\n",
"<path d=\"M574.289,-183.867C594.558,-177.095 620.635,-168.382 642.349,-161.127\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"649.233,-158.827 643.592,-164.033 645.914,-159.936 642.594,-161.045 642.594,-161.045 642.594,-161.045 645.914,-159.936 641.596,-158.057 649.233,-158.827 649.233,-158.827\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"613.274\" y=\"-179.8\">{a}</text>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g class=\"node\" id=\"node7\"><title>6</title>\n",
"<ellipse cx=\"832.462\" cy=\"-148\" fill=\"#ffffaa\" rx=\"37.4556\" ry=\"26.7574\" stroke=\"black\"/>\n",
"<ellipse cx=\"832.462\" cy=\"-148\" fill=\"none\" rx=\"41.4533\" ry=\"30.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"832.462\" y=\"-151.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"832.462\" y=\"-136.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge6\"><title>2-&gt;6</title>\n",
"<path d=\"M573.227,-207.569C610.507,-220.235 673.351,-235.819 724.985,-220 753.069,-211.396 780.422,-192.606 800.371,-176.378\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"805.796,-171.88 802.418,-178.773 803.102,-174.114 800.407,-176.348 800.407,-176.348 800.407,-176.348 803.102,-174.114 798.397,-173.923 805.796,-171.88 805.796,-171.88\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"685.63\" y=\"-230.8\">{}</text>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g class=\"node\" id=\"node8\"><title>7</title>\n",
"<ellipse cx=\"984.243\" cy=\"-61\" fill=\"#ffffaa\" rx=\"37.4556\" ry=\"26.7574\" stroke=\"black\"/>\n",
"<ellipse cx=\"984.243\" cy=\"-61\" fill=\"none\" rx=\"41.4533\" ry=\"30.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"984.243\" y=\"-64.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"984.243\" y=\"-49.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;7 -->\n",
"<g class=\"edge\" id=\"edge7\"><title>2-&gt;7</title>\n",
"<path d=\"M561.908,-172.669C581.815,-152.7 613.507,-124.033 646.274,-107 740.039,-58.2596 867.402,-55.1871 935.553,-57.7503\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"942.762,-58.051 935.637,-60.9064 939.265,-57.9051 935.768,-57.7592 935.768,-57.7592 935.768,-57.7592 939.265,-57.9051 935.9,-54.6119 942.762,-58.051 942.762,-58.051\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"757.985\" y=\"-76.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g class=\"node\" id=\"node9\"><title>8</title>\n",
"<ellipse cx=\"984.243\" cy=\"-269\" fill=\"#ffffaa\" rx=\"40.1285\" ry=\"26.7574\" stroke=\"black\"/>\n",
"<ellipse cx=\"984.243\" cy=\"-269\" fill=\"none\" rx=\"44.111\" ry=\"30.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"984.243\" y=\"-272.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"984.243\" y=\"-257.8\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;8 -->\n",
"<g class=\"edge\" id=\"edge8\"><title>2-&gt;8</title>\n",
"<path d=\"M566.189,-214.259C575.831,-220.927 587.181,-227.979 598.274,-233 618.41,-242.113 624.663,-241.37 646.274,-246 709.952,-259.643 726.118,-263.23 790.985,-269 835.685,-272.976 847.063,-270.556 891.938,-271 905.271,-271.132 908.607,-271.217 921.938,-271 925.442,-270.943 929.058,-270.867 932.699,-270.779\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"939.71,-270.595 932.795,-273.928 936.211,-270.687 932.713,-270.779 932.713,-270.779 932.713,-270.779 936.211,-270.687 932.63,-267.63 939.71,-270.595 939.71,-270.595\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"757.985\" y=\"-271.8\">{b}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge10\"><title>3-&gt;2</title>\n",
"<path d=\"M284.427,-146.736C321.317,-139.886 382.531,-132.27 433.664,-144 458.854,-149.779 485.017,-162.411 504.962,-173.657\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"511.211,-177.249 503.572,-176.491 508.176,-175.504 505.142,-173.76 505.142,-173.76 505.142,-173.76 508.176,-175.504 506.712,-171.029 511.211,-177.249 511.211,-177.249\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.187\" y=\"-147.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge9\"><title>3-&gt;3</title>\n",
"<path d=\"M237.346,-179.37C236.448,-189.924 240.785,-198.87 250.355,-198.87 257.683,-198.87 261.942,-193.626 263.133,-186.431\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"263.365,-179.37 266.284,-186.47 263.25,-182.868 263.135,-186.366 263.135,-186.366 263.135,-186.366 263.25,-182.868 259.987,-186.263 263.365,-179.37 263.365,-179.37\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"250.355\" y=\"-202.67\">{}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge11\"><title>3-&gt;4</title>\n",
"<path d=\"M277.29,-171.585C285.43,-176.344 294.662,-181.001 303.711,-184 318.716,-188.973 335.769,-191.746 351.052,-193.276\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"358.396,-193.931 351.144,-196.446 354.91,-193.62 351.424,-193.309 351.424,-193.309 351.424,-193.309 354.91,-193.62 351.704,-190.171 358.396,-193.931 358.396,-193.931\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"322.211\" y=\"-196.8\">{b}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge13\"><title>3-&gt;5</title>\n",
"<path d=\"M281.956,-141.797C288.997,-139.463 296.529,-137.335 303.711,-136 327.76,-131.531 334.264,-134.839 358.711,-134 400.02,-132.582 410.335,-131.667 451.664,-131 464.996,-130.785 468.341,-130.476 481.664,-131 535.973,-133.137 598.267,-138.48 639.36,-142.406\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"646.526,-143.096 639.256,-145.56 643.042,-142.761 639.559,-142.425 639.559,-142.425 639.559,-142.425 643.042,-142.761 639.861,-139.289 646.526,-143.096 646.526,-143.096\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"466.664\" y=\"-134.8\">{}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge14\"><title>3-&gt;6</title>\n",
"<path d=\"M279.776,-138.836C287.362,-135.387 295.687,-132.119 303.711,-130 485.008,-82.1242 540.631,-72.7326 724.985,-107 747.556,-111.196 771.514,-119.996 790.976,-128.371\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"797.396,-131.188 789.72,-131.26 794.191,-129.782 790.986,-128.375 790.986,-128.375 790.986,-128.375 794.191,-129.782 792.252,-125.491 797.396,-131.188 797.396,-131.188\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"539.969\" y=\"-92.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;7 -->\n",
"<g class=\"edge\" id=\"edge15\"><title>3-&gt;7</title>\n",
"<path d=\"M261.396,-128.224C280.358,-84.3838 325.861,-0 395.187,-0 395.187,-0 395.187,-0 833.462,-0 874.485,-0 917.471,-19.8698 946.816,-36.9288\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"952.866,-40.5182 945.238,-39.6552 949.856,-38.7322 946.846,-36.9462 946.846,-36.9462 946.846,-36.9462 949.856,-38.7322 948.453,-34.2371 952.866,-40.5182 952.866,-40.5182\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"613.274\" y=\"-3.8\">{b}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;8 -->\n",
"<g class=\"edge\" id=\"edge16\"><title>3-&gt;8</title>\n",
"<path d=\"M264.11,-178.915C278.761,-207.451 301.126,-250.719 303.711,-254 337.135,-296.426 341.177,-334 395.187,-334 395.187,-334 395.187,-334 833.462,-334 874.746,-334 917.534,-312.962 946.753,-294.824\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"952.777,-291.006 948.551,-297.414 949.821,-292.88 946.864,-294.754 946.864,-294.754 946.864,-294.754 949.821,-292.88 945.178,-292.093 952.777,-291.006 952.777,-291.006\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"613.274\" y=\"-337.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 9 -->\n",
"<g class=\"node\" id=\"node10\"><title>9</title>\n",
"<ellipse cx=\"539.969\" cy=\"-273\" fill=\"#ffffaa\" rx=\"40.1111\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"539.969\" y=\"-276.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"539.969\" y=\"-261.8\">!a &amp; !b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;9 -->\n",
"<g class=\"edge\" id=\"edge12\"><title>3-&gt;9</title>\n",
"<path d=\"M266.4,-178.295C284.53,-205.019 317.728,-246.497 358.711,-264 401.529,-282.287 455.372,-282.377 493.015,-279.234\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"500.32,-278.566 493.635,-282.34 496.834,-278.885 493.349,-279.203 493.349,-279.203 493.349,-279.203 496.834,-278.885 493.062,-276.066 500.32,-278.566 500.32,-278.566\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.187\" y=\"-283.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge18\"><title>4-&gt;2</title>\n",
"<path d=\"M433.7,-195C452.407,-195 475.328,-195 495.001,-195\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"502.088,-195 495.088,-198.15 498.588,-195 495.088,-195 495.088,-195 495.088,-195 498.588,-195 495.088,-191.85 502.088,-195 502.088,-195\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"466.664\" y=\"-198.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge17\"><title>4-&gt;3</title>\n",
"<path d=\"M367.838,-177.29C359.434,-172.587 349.956,-167.991 340.711,-165 325.63,-160.121 308.477,-157.381 293.258,-155.851\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"285.96,-155.193 293.215,-152.685 289.446,-155.508 292.932,-155.822 292.932,-155.822 292.932,-155.822 289.446,-155.508 292.649,-158.959 285.96,-155.193 285.96,-155.193\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"322.211\" y=\"-168.8\">{b}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge19\"><title>4-&gt;4</title>\n",
"<path d=\"M383.178,-220.37C382.28,-230.924 386.617,-239.87 396.187,-239.87 403.515,-239.87 407.774,-234.626 408.965,-227.431\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"409.197,-220.37 412.116,-227.47 409.082,-223.868 408.967,-227.366 408.967,-227.366 408.967,-227.366 409.082,-223.868 405.819,-227.263 409.197,-220.37 409.197,-220.37\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.187\" y=\"-243.67\">{}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;9 -->\n",
"<g class=\"edge\" id=\"edge20\"><title>4-&gt;9</title>\n",
"<path d=\"M426.565,-211.162C448.455,-223.204 478.5,-239.733 502.02,-252.673\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"508.158,-256.05 500.507,-255.435 505.092,-254.363 502.025,-252.675 502.025,-252.675 502.025,-252.675 505.092,-254.363 503.543,-249.916 508.158,-256.05 508.158,-256.05\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"466.664\" y=\"-244.8\">{a}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge21\"><title>5-&gt;5</title>\n",
"<path d=\"M672.159,-176.099C671.718,-186.944 676.208,-195.87 685.63,-195.87 692.843,-195.87 697.166,-190.638 698.598,-183.318\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"699.1,-176.099 701.756,-183.301 698.857,-179.591 698.614,-183.082 698.614,-183.082 698.614,-183.082 698.857,-179.591 695.472,-182.864 699.1,-176.099 699.1,-176.099\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"685.63\" y=\"-199.67\">{}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge22\"><title>5-&gt;6</title>\n",
"<path d=\"M723.792,-139.455C730.169,-138.433 736.749,-137.549 742.985,-137 756.267,-135.831 759.709,-135.762 772.985,-137 777.004,-137.375 781.159,-137.891 785.315,-138.498\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"792.284,-139.594 784.88,-141.618 788.827,-139.05 785.369,-138.506 785.369,-138.506 785.369,-138.506 788.827,-139.05 785.859,-135.395 792.284,-139.594 792.284,-139.594\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"757.985\" y=\"-140.8\">{a}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;7 -->\n",
"<g class=\"edge\" id=\"edge23\"><title>5-&gt;7</title>\n",
"<path d=\"M717.018,-128.04C737.263,-116.236 764.855,-101.695 790.985,-93 838.741,-77.1092 895.906,-68.8814 935.425,-64.7764\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"942.593,-64.057 935.942,-67.8904 939.11,-64.4066 935.628,-64.7562 935.628,-64.7562 935.628,-64.7562 939.11,-64.4066 935.313,-61.6219 942.593,-64.057 942.593,-64.057\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"832.462\" y=\"-96.8\">{b}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;8 -->\n",
"<g class=\"edge\" id=\"edge24\"><title>5-&gt;8</title>\n",
"<path d=\"M712.809,-169.774C732.946,-186.203 762.126,-207.739 790.985,-221 836.894,-242.096 893.401,-254.784 933.238,-261.769\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"940.477,-263.007 933.046,-264.932 937.027,-262.417 933.577,-261.827 933.577,-261.827 933.577,-261.827 937.027,-262.417 934.108,-258.722 940.477,-263.007 940.477,-263.007\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"832.462\" y=\"-253.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge25\"><title>6-&gt;5</title>\n",
"<path d=\"M790.94,-151.354C775.882,-152.2 758.653,-152.694 742.985,-152 739.397,-151.841 735.685,-151.626 731.956,-151.373\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"724.795,-150.846 732.007,-148.218 728.286,-151.103 731.776,-151.36 731.776,-151.36 731.776,-151.36 728.286,-151.103 731.545,-154.501 724.795,-150.846 724.795,-150.846\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"757.985\" y=\"-156.8\">{a}</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge26\"><title>6-&gt;6</title>\n",
"<path d=\"M818.6,-177.584C818.302,-188.208 822.922,-196.87 832.462,-196.87 839.765,-196.87 844.185,-191.793 845.722,-184.644\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"846.323,-177.584 848.868,-184.825 846.026,-181.071 845.729,-184.558 845.729,-184.558 845.729,-184.558 846.026,-181.071 842.591,-184.291 846.323,-177.584 846.323,-177.584\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"832.462\" y=\"-200.67\">{}</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g class=\"edge\" id=\"edge27\"><title>6-&gt;7</title>\n",
"<path d=\"M866.363,-129.701C883.073,-120.333 903.657,-108.68 921.938,-98 929.486,-93.591 937.512,-88.8128 945.184,-84.2007\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"951.528,-80.3775 947.159,-86.6888 948.53,-82.1842 945.533,-83.9909 945.533,-83.9909 945.533,-83.9909 948.53,-82.1842 943.907,-81.293 951.528,-80.3775 951.528,-80.3775\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"906.938\" y=\"-118.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;8 -->\n",
"<g class=\"edge\" id=\"edge28\"><title>6-&gt;8</title>\n",
"<path d=\"M861.401,-170.328C878.835,-184.283 901.727,-202.649 921.938,-219 930.869,-226.225 940.508,-234.066 949.439,-241.35\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"954.896,-245.802 947.481,-243.818 952.184,-243.59 949.473,-241.377 949.473,-241.377 949.473,-241.377 952.184,-243.59 951.464,-238.936 954.896,-245.802 954.896,-245.802\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"906.938\" y=\"-222.8\">{b}</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"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",
"metadata": {},
"source": [
"Then, remove dead states, and remove stuttering transitions (i.e., transitions labeled by `{}`), marking as *livelock accepting* (rectangles) any states from which there exists a an accepting path labeled by `{}`."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"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",
"<polygon fill=\"white\" points=\"-4,4 -4,-141 768.953,-141 768.953,4 -4,4\" stroke=\"none\"/>\n",
"<!-- 0 -->\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node2\"><title>1</title>\n",
"<ellipse cx=\"118\" cy=\"-60\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"118\" y=\"-56.3\">init</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>0-&gt;1</title>\n",
"<path d=\"M54.2216,-60C63.4559,-60 73.9612,-60 83.7008,-60\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"90.9659,-60 83.9659,-63.1501 87.4659,-60 83.9659,-60.0001 83.9659,-60.0001 83.9659,-60.0001 87.4659,-60 83.9658,-56.8501 90.9659,-60 90.9659,-60\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g class=\"node\" id=\"node3\"><title>2</title>\n",
"<polygon fill=\"#ffffaa\" points=\"536.953,-131 482.953,-131 482.953,-93 536.953,-93 536.953,-131\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"509.953\" y=\"-115.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"509.953\" y=\"-100.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>1-&gt;2</title>\n",
"<path d=\"M140.661,-70.1783C147.693,-73.2591 155.593,-76.488 163,-79 240.685,-105.346 260.59,-113.924 342,-124 375.06,-128.092 383.648,-124.694 416.953,-124 438.301,-123.555 443.789,-124.822 464.953,-122 468.455,-121.533 472.088,-120.92 475.698,-120.228\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"482.57,-118.815 476.348,-123.31 479.142,-119.52 475.714,-120.225 475.714,-120.225 475.714,-120.225 479.142,-119.52 475.079,-117.139 482.57,-118.815 482.57,-118.815\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-125.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g class=\"node\" id=\"node4\"><title>3</title>\n",
"<polygon fill=\"#ffffaa\" points=\"269,-79 215,-79 215,-41 269,-41 269,-79\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"242\" y=\"-63.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"242\" y=\"-48.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>1-&gt;3</title>\n",
"<path d=\"M145.172,-60C163.505,-60 188.15,-60 207.856,-60\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"214.871,-60 207.871,-63.1501 211.371,-60 207.871,-60.0001 207.871,-60.0001 207.871,-60.0001 211.371,-60 207.871,-56.8501 214.871,-60 214.871,-60\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"180\" y=\"-63.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g class=\"node\" id=\"node5\"><title>4</title>\n",
"<ellipse cx=\"379.477\" cy=\"-55\" fill=\"#ffffaa\" rx=\"37.4533\" ry=\"26.7407\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"379.477\" y=\"-58.8\">0</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"379.477\" y=\"-43.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;4</title>\n",
"<path d=\"M138.748,-48.1679C157.586,-37.6194 187.14,-22.9544 215,-17 258.628,-7.67553 308.546,-23.0974 341.624,-37.0003\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"348.418,-39.9345 340.743,-40.0511 345.205,-38.5469 341.992,-37.1593 341.992,-37.1593 341.992,-37.1593 345.205,-38.5469 343.241,-34.2674 348.418,-39.9345 348.418,-39.9345\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"242\" y=\"-20.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g class=\"node\" id=\"node6\"><title>5</title>\n",
"<polygon fill=\"#ffffaa\" points=\"646.953,-113 592.953,-113 592.953,-75 646.953,-75 646.953,-113\" stroke=\"black\"/>\n",
"<polygon fill=\"none\" points=\"650.953,-117 588.953,-117 588.953,-71 650.953,-71 650.953,-117\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"619.953\" y=\"-97.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"619.953\" y=\"-82.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>2-&gt;5</title>\n",
"<path d=\"M537.097,-107.643C550.509,-105.407 567.079,-102.646 581.794,-100.193\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"588.847,-99.0177 582.46,-103.276 585.394,-99.5932 581.942,-100.169 581.942,-100.169 581.942,-100.169 585.394,-99.5932 581.424,-97.0615 588.847,-99.0177 588.847,-99.0177\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"562.953\" y=\"-108.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge6\"><title>3-&gt;2</title>\n",
"<path d=\"M269.277,-71.5305C275.054,-73.8451 281.184,-76.1356 287,-78 351.879,-98.7976 431.62,-107.045 475.691,-110.185\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"482.711,-110.663 475.513,-113.33 479.219,-110.425 475.728,-110.187 475.728,-110.187 475.728,-110.187 479.219,-110.425 475.942,-107.044 482.711,-110.663 482.711,-110.663\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"379.477\" y=\"-108.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge7\"><title>3-&gt;4</title>\n",
"<path d=\"M269.009,-47.4294C274.803,-45.1796 281.007,-43.1784 287,-42 303.379,-38.7793 321.557,-40.3251 337.366,-43.2944\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"344.448,-44.7469 336.957,-46.4261 341.019,-44.0436 337.59,-43.3404 337.59,-43.3404 337.59,-43.3404 341.019,-44.0436 338.223,-40.2546 344.448,-44.7469 344.448,-44.7469\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-45.8\">{b}</text>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g class=\"node\" id=\"node7\"><title>6</title>\n",
"<polygon fill=\"#ffffaa\" points=\"760.953,-75 706.953,-75 706.953,-37 760.953,-37 760.953,-75\" stroke=\"black\"/>\n",
"<polygon fill=\"none\" points=\"764.953,-79 702.953,-79 702.953,-33 764.953,-33 764.953,-79\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"733.953\" y=\"-59.8\">1</text>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"733.953\" y=\"-44.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge8\"><title>3-&gt;6</title>\n",
"<path d=\"M268.995,-40.6854C295.22,-23.1454 337.576,-0 378.477,-0 378.477,-0 378.477,-0 620.953,-0 649.369,-0 677.966,-14.5993 699.151,-28.8894\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"704.923,-32.8993 697.377,-31.4926 702.049,-30.9025 699.174,-28.9056 699.174,-28.9056 699.174,-28.9056 702.049,-30.9025 700.971,-26.3186 704.923,-32.8993 704.923,-32.8993\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"509.953\" y=\"-3.8\">{a}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge10\"><title>4-&gt;2</title>\n",
"<path d=\"M412.887,-67.1768C428.742,-73.3526 448.013,-81.1868 464.953,-89 468.664,-90.7114 472.509,-92.5777 476.312,-94.4828\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"482.64,-97.7051 474.973,-97.3358 479.521,-96.117 476.402,-94.5288 476.402,-94.5288 476.402,-94.5288 479.521,-96.117 477.831,-91.7217 482.64,-97.7051 482.64,-97.7051\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"449.953\" y=\"-92.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge9\"><title>4-&gt;3</title>\n",
"<path d=\"M341.937,-56.3485C321.456,-57.1045 296.105,-58.0401 276.192,-58.775\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"269.121,-59.0359 276,-55.6298 272.619,-58.9068 276.117,-58.7777 276.117,-58.7777 276.117,-58.7777 272.619,-58.9068 276.233,-61.9255 269.121,-59.0359 269.121,-59.0359\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-62.8\">{b}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;6 -->\n",
"<g class=\"edge\" id=\"edge11\"><title>5-&gt;6</title>\n",
"<path d=\"M644.792,-70.8632C652,-65.2601 660.312,-60.0196 668.953,-57 677.314,-54.0787 686.671,-52.8793 695.595,-52.6129\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"702.631,-52.5842 695.644,-55.7628 699.131,-52.5985 695.631,-52.6128 695.631,-52.6128 695.631,-52.6128 699.131,-52.5985 695.618,-49.4629 702.631,-52.5842 702.631,-52.5842\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"676.953\" y=\"-60.8\">{a}</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge12\"><title>6-&gt;5</title>\n",
"<path d=\"M702.857,-66.2114C689.036,-70.9005 672.516,-76.5056 657.944,-81.4496\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"650.967,-83.8167 656.584,-78.5846 654.282,-82.6921 657.596,-81.5676 657.596,-81.5676 657.596,-81.5676 654.282,-82.6921 658.608,-84.5505 650.967,-83.8167 650.967,-83.8167\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"676.953\" y=\"-81.8\">{a}</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ta = spot.tgba_to_ta(a, propset, True, True, False, False, False)\n",
"ta.show('.A')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finally, use bisimulation to minimize the number of states."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"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",
"<polygon fill=\"white\" points=\"-4,4 -4,-171 634,-171 634,4 -4,4\" stroke=\"none\"/>\n",
"<!-- 0 -->\n",
"<!-- 1 -->\n",
"<g class=\"node\" id=\"node2\"><title>1</title>\n",
"<ellipse cx=\"118\" cy=\"-144\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"118\" y=\"-140.3\">init</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g class=\"edge\" id=\"edge1\"><title>0-&gt;1</title>\n",
"<path d=\"M54.2216,-144C63.4559,-144 73.9612,-144 83.7008,-144\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"90.9659,-144 83.9659,-147.15 87.4659,-144 83.9659,-144 83.9659,-144 83.9659,-144 87.4659,-144 83.9658,-140.85 90.9659,-144 90.9659,-144\" stroke=\"black\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g class=\"node\" id=\"node3\"><title>2</title>\n",
"<polygon fill=\"#ffffaa\" points=\"516,-84 462,-84 462,-48 516,-48 516,-84\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"489\" y=\"-62.3\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge2\"><title>1-&gt;2</title>\n",
"<path d=\"M144.031,-149.269C150.205,-150.37 156.819,-151.383 163,-152 186.001,-154.297 191.886,-152.778 215,-153 296.033,-153.779 318.806,-155.658 396,-131 418.534,-123.802 424.536,-121.445 444,-108 451.893,-102.548 459.725,-95.6761 466.546,-89.0791\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"471.548,-84.116 468.797,-91.2823 469.063,-86.5811 466.579,-89.0462 466.579,-89.0462 466.579,-89.0462 469.063,-86.5811 464.36,-86.81 471.548,-84.116 471.548,-84.116\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-155.8\">!a &amp; b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g class=\"node\" id=\"node4\"><title>3</title>\n",
"<polygon fill=\"#ffffaa\" points=\"269,-94 215,-94 215,-58 269,-58 269,-94\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"242\" y=\"-72.3\">3</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge3\"><title>1-&gt;3</title>\n",
"<path d=\"M137.532,-131.079C145.273,-125.87 154.441,-119.937 163,-115 177.671,-106.538 194.414,-98.0238 208.618,-91.1196\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"214.948,-88.0665 210.011,-93.9447 211.796,-89.587 208.643,-91.1074 208.643,-91.1074 208.643,-91.1074 211.796,-89.587 207.275,-88.2701 214.948,-88.0665 214.948,-88.0665\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"180\" y=\"-118.8\">a &amp; b</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g class=\"node\" id=\"node5\"><title>4</title>\n",
"<ellipse cx=\"369\" cy=\"-104\" fill=\"#ffffaa\" rx=\"27\" ry=\"18\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"369\" y=\"-100.3\">1</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge4\"><title>1-&gt;4</title>\n",
"<path d=\"M145.11,-141.879C184.28,-138.401 260.441,-130.489 324,-117 328.397,-116.067 332.995,-114.913 337.489,-113.682\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"344.425,-111.703 338.558,-116.653 341.06,-112.663 337.694,-113.623 337.694,-113.623 337.694,-113.623 341.06,-112.663 336.83,-110.594 344.425,-111.703 344.425,-111.703\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"242\" y=\"-137.8\">a &amp; !b</text>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g class=\"node\" id=\"node6\"><title>5</title>\n",
"<polygon fill=\"#ffffaa\" points=\"626,-40 572,-40 572,-4 626,-4 626,-40\" stroke=\"black\"/>\n",
"<polygon fill=\"none\" points=\"630,-44 568,-44 568,-3.55271e-15 630,-3.55271e-15 630,-44\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"599\" y=\"-18.3\">4</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge5\"><title>2-&gt;5</title>\n",
"<path d=\"M516.144,-55.3488C529.678,-49.8349 546.427,-43.0113 561.241,-36.9757\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"567.894,-34.2656 562.599,-39.8239 564.652,-35.5862 561.411,-36.9067 561.411,-36.9067 561.411,-36.9067 564.652,-35.5862 560.222,-33.9895 567.894,-34.2656 567.894,-34.2656\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"542\" y=\"-51.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge6\"><title>3-&gt;2</title>\n",
"<path d=\"M269.038,-71.72C274.939,-70.7884 281.181,-69.833 287,-69 311.393,-65.5082 317.408,-63.5587 342,-62 365.952,-60.4819 372.006,-61.4786 396,-62 415.44,-62.4224 437.174,-63.3463 454.635,-64.1999\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"461.837,-64.5597 454.689,-67.3564 458.341,-64.385 454.846,-64.2103 454.846,-64.2103 454.846,-64.2103 458.341,-64.385 455.003,-61.0642 461.837,-64.5597 461.837,-64.5597\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"369\" y=\"-65.8\">{a}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g class=\"edge\" id=\"edge7\"><title>3-&gt;4</title>\n",
"<path d=\"M269.05,-72.8485C285.188,-71.7406 306.166,-71.8454 324,-77 331.103,-79.0531 338.198,-82.587 344.552,-86.434\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"350.631,-90.3422 343.04,-89.2068 347.687,-88.4496 344.743,-86.557 344.743,-86.557 344.743,-86.557 347.687,-88.4496 346.446,-83.9073 350.631,-90.3422 350.631,-90.3422\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-80.8\">{b}</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge8\"><title>3-&gt;5</title>\n",
"<path d=\"M269.231,-65.3796C275.01,-63.3453 281.153,-61.4125 287,-60 383.846,-36.6029 501.317,-27.2334 560.32,-23.7959\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"567.564,-23.3867 560.753,-26.9265 564.07,-23.5841 560.575,-23.7816 560.575,-23.7816 560.575,-23.7816 564.07,-23.5841 560.398,-20.6366 567.564,-23.3867 567.564,-23.3867\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"429\" y=\"-40.8\">{a}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;2 -->\n",
"<g class=\"edge\" id=\"edge10\"><title>4-&gt;2</title>\n",
"<path d=\"M393.595,-96.4015C411.283,-90.7053 435.708,-82.8397 455.282,-76.5362\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"461.985,-74.3778 456.287,-79.522 458.653,-75.4507 455.322,-76.5236 455.322,-76.5236 455.322,-76.5236 458.653,-75.4507 454.356,-73.5253 461.985,-74.3778 461.985,-74.3778\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"429\" y=\"-92.8\">{a, b}</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;3 -->\n",
"<g class=\"edge\" id=\"edge9\"><title>4-&gt;3</title>\n",
"<path d=\"M342.202,-101.522C326.158,-99.6513 305.191,-96.6048 287,-92 283.447,-91.1006 279.78,-90.0215 276.15,-88.8541\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"269.254,-86.5241 276.894,-85.7807 272.57,-87.6445 275.886,-88.7649 275.886,-88.7649 275.886,-88.7649 272.57,-87.6445 274.878,-91.7492 269.254,-86.5241 269.254,-86.5241\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"305.5\" y=\"-101.8\">{b}</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;5 -->\n",
"<g class=\"edge\" id=\"edge11\"><title>5-&gt;5</title>\n",
"<path d=\"M588.626,-44.2124C587.776,-53.7952 591.234,-62 599,-62 604.703,-62 608.083,-57.5751 609.139,-51.4291\" fill=\"none\" stroke=\"black\"/>\n",
"<polygon fill=\"black\" points=\"609.374,-44.2124 612.295,-51.3112 609.26,-47.7105 609.147,-51.2086 609.147,-51.2086 609.147,-51.2086 609.26,-47.7105 605.998,-51.1061 609.374,-44.2124 609.374,-44.2124\" stroke=\"black\"/>\n",
"<text font-family=\"Lato\" font-size=\"14.00\" text-anchor=\"middle\" x=\"599\" y=\"-65.8\">{a}</text>\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"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
}