spot/tests/python/games.ipynb
Alexandre Duret-Lutz 444e2b5b89 parseaut: Add support for PGSolver's format
* spot/parseaut/parseaut.yy, spot/parseaut/scanaut.ll: Add rules for
PGSolver's format.
* spot/parseaut/public.hh: PGAME is a new type of output.
* tests/core/pgsolver.test: New file.
* tests/Makefile.am: Add it.
* tests/python/games.ipynb: More exemples.
* NEWS: Mention the new feature.
2022-07-22 10:54:08 +02:00

1655 lines
102 KiB
Text

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import spot\n",
"from buddy import bddtrue\n",
"spot.setup()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Support for games\n",
"\n",
"The support for games is currently quite rudimentary, as Spot currently only uses those games in `ltlsynt`.\n",
"\n",
"In essence, a game is just an ω-automaton with a property named `state-player` that stores the player owning each state. The players are named 0 and 1. The player owning a state can decide what the next transition from this state should be. The goal for player 1 is to force the play to be infinite and to satisfy the acceptance condition of the automaton, while the goal for player 0 is to prevent it by either forcing a finite play, or forcing an infinite play that does not satisfy the acceptance condition.\n",
"\n",
"The support is currently restricted to games that use:\n",
"- `t` acceptance: all infinite run are accepting, and player 0 can only win if it manages to force a finite play (this requires reaching states without successors).\n",
"- `parity` acceptance of any form (`max odd`, `max even`, `min odd`, `min even`): player 0 can win if the maximal (or minimal) value seen infinitely often is even (or odd)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Creating games from scratch\n",
"\n",
"Games can be [created like any automaton](https://spot.lrde.epita.fr/tut22.html). \n",
"Using `set_state_players()` will fix the state owners."
]
},
{
"cell_type": "code",
"execution_count": 2,
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"495pt\" height=\"190pt\"\n",
" viewBox=\"0.00 0.00 495.00 190.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.0 1.0) rotate(0) translate(4 186)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-186 491,-186 491,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"240.5\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"232.5\" y=\"-151.8\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"64,-144 37,-126 64,-108 91,-126 64,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"64\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.04,-126C1.93,-126 15.66,-126 29.98,-126\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37,-126 30,-129.15 33.5,-126 30,-126 30,-126 30,-126 33.5,-126 30,-122.85 37,-126 37,-126\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"145\" cy=\"-126\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M82.53,-120.28C93.75,-119.1 108.43,-118.93 120.64,-119.78\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"127.86,-120.43 120.61,-122.94 124.38,-120.12 120.89,-119.8 120.89,-119.8 120.89,-119.8 124.38,-120.12 121.17,-116.66 127.86,-120.43 127.86,-120.43\"/>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"145\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M78.05,-117.08C90.47,-108.59 109.36,-95.68 123.74,-85.85\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"129.6,-81.85 125.59,-88.4 126.71,-83.82 123.82,-85.8 123.82,-85.8 123.82,-85.8 126.71,-83.82 122.04,-83.2 129.6,-81.85 129.6,-81.85\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M127.86,-131.57C116.84,-132.84 102.04,-133.09 89.56,-132.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"82.53,-131.72 89.77,-129.16 86.02,-132.01 89.51,-132.3 89.51,-132.3 89.51,-132.3 86.02,-132.01 89.25,-135.44 82.53,-131.72 82.53,-131.72\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>2</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"226,-144 199,-126 226,-108 253,-126 226,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M162.37,-120.41C173.4,-119.15 188.15,-118.92 200.56,-119.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"207.56,-120.29 200.32,-122.85 204.07,-120 200.58,-119.71 200.58,-119.71 200.58,-119.71 204.07,-120 200.84,-116.57 207.56,-120.29 207.56,-120.29\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M160.49,-81.9C173.24,-90.62 191.89,-103.37 205.86,-112.92\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"211.91,-117.05 204.36,-115.7 209.02,-115.08 206.13,-113.1 206.13,-113.1 206.13,-113.1 209.02,-115.08 207.91,-110.5 211.91,-117.05 211.91,-117.05\"/>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>4</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"226,-90 199,-72 226,-54 253,-72 226,-90\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163.14,-72C171.54,-72 181.95,-72 191.82,-72\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"198.87,-72 191.87,-75.15 195.37,-72 191.87,-72 191.87,-72 191.87,-72 195.37,-72 191.87,-68.85 198.87,-72 198.87,-72\"/>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>6</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"226,-36 199,-18 226,0 253,-18 226,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;6 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>3&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M160.49,-62.1C173.24,-53.38 191.89,-40.63 205.86,-31.08\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"211.91,-26.95 207.91,-33.5 209.02,-28.92 206.13,-30.9 206.13,-30.9 206.13,-30.9 209.02,-28.92 204.36,-28.3 211.91,-26.95 211.91,-26.95\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M207.56,-131.71C196.4,-132.89 181.78,-133.07 169.59,-132.24\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"162.37,-131.59 169.62,-129.08 165.85,-131.9 169.34,-132.22 169.34,-132.22 169.34,-132.22 165.85,-131.9 169.06,-135.35 162.37,-131.59 162.37,-131.59\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"460,-90 433,-72 460,-54 487,-72 460,-90\"/>\n",
"<text text-anchor=\"middle\" x=\"460\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M246.38,-121.49C287.92,-111.82 385.57,-89.09 432.67,-78.13\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"439.51,-76.54 433.41,-81.19 436.1,-77.33 432.69,-78.12 432.69,-78.12 432.69,-78.12 436.1,-77.33 431.98,-75.06 439.51,-76.54 439.51,-76.54\"/>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>7</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"307\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"307\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>6&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M244.53,-12.28C255.75,-11.1 270.43,-10.93 282.64,-11.78\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"289.86,-12.43 282.61,-14.94 286.38,-12.12 282.89,-11.8 282.89,-11.8 282.89,-11.8 286.38,-12.12 283.17,-8.66 289.86,-12.43 289.86,-12.43\"/>\n",
"</g>\n",
"<!-- 7&#45;&gt;6 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>7&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M289.86,-23.57C278.84,-24.84 264.04,-25.09 251.56,-24.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"244.53,-23.72 251.77,-21.16 248.02,-24.01 251.51,-24.3 251.51,-24.3 251.51,-24.3 248.02,-24.01 251.25,-27.44 244.53,-23.72 244.53,-23.72\"/>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g id=\"node10\" class=\"node\">\n",
"<title>8</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"379\" cy=\"-49\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"379\" y=\"-45.3\" font-family=\"Lato\" font-size=\"14.00\">8</text>\n",
"</g>\n",
"<!-- 7&#45;&gt;8 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>7&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M323.88,-25.03C333.28,-29.2 345.33,-34.53 355.67,-39.11\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"362.18,-41.99 354.5,-42.04 358.98,-40.58 355.78,-39.16 355.78,-39.16 355.78,-39.16 358.98,-40.58 357.05,-36.28 362.18,-41.99 362.18,-41.99\"/>\n",
"</g>\n",
"<!-- 8&#45;&gt;5 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>8&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M396.37,-53.77C407.17,-56.91 421.54,-61.1 433.79,-64.66\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"440.72,-66.68 433.12,-67.75 437.36,-65.7 434,-64.72 434,-64.72 434,-64.72 437.36,-65.7 434.88,-61.7 440.72,-66.68 440.72,-66.68\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bdict = spot.make_bdd_dict();\n",
"game = spot.make_twa_graph(bdict)\n",
"game.new_states(9)\n",
"for (s, d) in ((0,1), (0, 3), \n",
" (1, 0), (1, 2),\n",
" (2, 1), (2, 5),\n",
" (3, 2), (3, 4), (3, 6),\n",
" (6, 7),\n",
" (7, 6), (7, 8),\n",
" (8, 5)):\n",
" game.new_edge(s, d, bddtrue)\n",
"spot.set_state_players(game, [True, False, True, False, True, True, True, False, False])\n",
"game.show('.g') # Use \"g\" to hide the irrelevant edge labels."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `set_state_players()` function takes a list of owner for each of the states in the automaton. In the output,\n",
"states from player 0 use circles, ellispes, or rectangle with rounded corners (mnemonic: 0 is round) while states from player 1 have a losanse shape (1 has only straight lines). \n",
"\n",
"\n",
"State ownership can also be manipulated by the following functions:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(True, False, True, False, True, True, True, False, False)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.get_state_players(game)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.get_state_player(game, 4)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"495pt\" height=\"190pt\"\n",
" viewBox=\"0.00 0.00 495.00 190.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.0 1.0) rotate(0) translate(4 186)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-186 491,-186 491,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"240.5\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"232.5\" y=\"-151.8\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"64,-144 37,-126 64,-108 91,-126 64,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"64\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.04,-126C1.93,-126 15.66,-126 29.98,-126\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37,-126 30,-129.15 33.5,-126 30,-126 30,-126 30,-126 33.5,-126 30,-122.85 37,-126 37,-126\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"145\" cy=\"-126\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M82.53,-120.28C93.75,-119.1 108.43,-118.93 120.64,-119.78\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"127.86,-120.43 120.61,-122.94 124.38,-120.12 120.89,-119.8 120.89,-119.8 120.89,-119.8 124.38,-120.12 121.17,-116.66 127.86,-120.43 127.86,-120.43\"/>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"145\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M78.05,-117.08C90.47,-108.59 109.36,-95.68 123.74,-85.85\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"129.6,-81.85 125.59,-88.4 126.71,-83.82 123.82,-85.8 123.82,-85.8 123.82,-85.8 126.71,-83.82 122.04,-83.2 129.6,-81.85 129.6,-81.85\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M127.86,-131.57C116.84,-132.84 102.04,-133.09 89.56,-132.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"82.53,-131.72 89.77,-129.16 86.02,-132.01 89.51,-132.3 89.51,-132.3 89.51,-132.3 86.02,-132.01 89.25,-135.44 82.53,-131.72 82.53,-131.72\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>2</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"226,-144 199,-126 226,-108 253,-126 226,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M162.37,-120.41C173.4,-119.15 188.15,-118.92 200.56,-119.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"207.56,-120.29 200.32,-122.85 204.07,-120 200.58,-119.71 200.58,-119.71 200.58,-119.71 204.07,-120 200.84,-116.57 207.56,-120.29 207.56,-120.29\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M160.49,-81.9C173.24,-90.62 191.89,-103.37 205.86,-112.92\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"211.91,-117.05 204.36,-115.7 209.02,-115.08 206.13,-113.1 206.13,-113.1 206.13,-113.1 209.02,-115.08 207.91,-110.5 211.91,-117.05 211.91,-117.05\"/>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>4</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"226\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163.14,-72C174.12,-72 188.52,-72 200.67,-72\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"207.89,-72 200.89,-75.15 204.39,-72 200.89,-72 200.89,-72 200.89,-72 204.39,-72 200.89,-68.85 207.89,-72 207.89,-72\"/>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>6</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"226,-36 199,-18 226,0 253,-18 226,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;6 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>3&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M160.49,-62.1C173.24,-53.38 191.89,-40.63 205.86,-31.08\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"211.91,-26.95 207.91,-33.5 209.02,-28.92 206.13,-30.9 206.13,-30.9 206.13,-30.9 209.02,-28.92 204.36,-28.3 211.91,-26.95 211.91,-26.95\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M207.56,-131.71C196.4,-132.89 181.78,-133.07 169.59,-132.24\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"162.37,-131.59 169.62,-129.08 165.85,-131.9 169.34,-132.22 169.34,-132.22 169.34,-132.22 165.85,-131.9 169.06,-135.35 162.37,-131.59 162.37,-131.59\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"460,-90 433,-72 460,-54 487,-72 460,-90\"/>\n",
"<text text-anchor=\"middle\" x=\"460\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M246.38,-121.49C287.92,-111.82 385.57,-89.09 432.67,-78.13\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"439.51,-76.54 433.41,-81.19 436.1,-77.33 432.69,-78.12 432.69,-78.12 432.69,-78.12 436.1,-77.33 431.98,-75.06 439.51,-76.54 439.51,-76.54\"/>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>7</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"307\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"307\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>6&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M244.53,-12.28C255.75,-11.1 270.43,-10.93 282.64,-11.78\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"289.86,-12.43 282.61,-14.94 286.38,-12.12 282.89,-11.8 282.89,-11.8 282.89,-11.8 286.38,-12.12 283.17,-8.66 289.86,-12.43 289.86,-12.43\"/>\n",
"</g>\n",
"<!-- 7&#45;&gt;6 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>7&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M289.86,-23.57C278.84,-24.84 264.04,-25.09 251.56,-24.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"244.53,-23.72 251.77,-21.16 248.02,-24.01 251.51,-24.3 251.51,-24.3 251.51,-24.3 248.02,-24.01 251.25,-27.44 244.53,-23.72 244.53,-23.72\"/>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g id=\"node10\" class=\"node\">\n",
"<title>8</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"379\" cy=\"-49\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"379\" y=\"-45.3\" font-family=\"Lato\" font-size=\"14.00\">8</text>\n",
"</g>\n",
"<!-- 7&#45;&gt;8 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>7&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M323.88,-25.03C333.28,-29.2 345.33,-34.53 355.67,-39.11\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"362.18,-41.99 354.5,-42.04 358.98,-40.58 355.78,-39.16 355.78,-39.16 355.78,-39.16 358.98,-40.58 357.05,-36.28 362.18,-41.99 362.18,-41.99\"/>\n",
"</g>\n",
"<!-- 8&#45;&gt;5 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>8&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M396.37,-53.77C407.17,-56.91 421.54,-61.1 433.79,-64.66\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"440.72,-66.68 433.12,-67.75 437.36,-65.7 434,-64.72 434,-64.72 434,-64.72 437.36,-65.7 434.88,-61.7 440.72,-66.68 440.72,-66.68\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.set_state_player(game, 4, False)\n",
"game.show('.g')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Solving a game\n",
"\n",
"Solving a game is done my calling `solve_game()`. This function actually dispatches to `solve_safety_game()` (if the acceptance is `t`) or to `solve_parity_game()` (if the acceptance is any parity condition). You may call these functions directly if desired, but using `solve_game()` makes it possible for future version of Spot to dispatch to some better function if we add some.\n",
"\n",
"These functions will attach two additional vectors into the game automaton: one vector stores the winner of each state, and one vector stores (memory-less) strategy for each state, i.e., the transition that should always be taken by the owner of this state in order to win. \n",
"\n",
"The return value of those functions is simply the winner for the initial state."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.solve_game(game)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calling the `highlight_strategy()` function can be used to decorate the `game` automaton using the winning regions and strategies. Below, green represent the winning region/strategy for player 1 and red those for player 0."
]
},
{
"cell_type": "code",
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"495pt\" height=\"190pt\"\n",
" viewBox=\"0.00 0.00 495.00 190.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.0 1.0) rotate(0) translate(4 186)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-186 491,-186 491,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"240.5\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
"<text text-anchor=\"start\" x=\"232.5\" y=\"-151.8\" font-family=\"Lato\" font-size=\"14.00\">[all]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"64,-144 37,-126 64,-108 91,-126 64,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"64\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.04,-126C1.93,-126 15.66,-126 29.98,-126\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37,-126 30,-129.15 33.5,-126 30,-126 30,-126 30,-126 33.5,-126 30,-122.85 37,-126 37,-126\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"145\" cy=\"-126\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M82.53,-120.28C93.75,-119.1 108.43,-118.93 120.64,-119.78\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"127.86,-120.43 120.61,-122.94 124.33,-120.62 120.84,-120.3 120.89,-119.8 120.94,-119.3 124.42,-119.62 121.17,-116.66 127.86,-120.43 127.86,-120.43\"/>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"145\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"145\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;3 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M78.05,-117.08C90.47,-108.59 109.36,-95.68 123.74,-85.85\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"129.6,-81.85 125.59,-88.4 126.71,-83.82 123.82,-85.8 123.82,-85.8 123.82,-85.8 126.71,-83.82 122.04,-83.2 129.6,-81.85 129.6,-81.85\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;0 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M127.86,-131.57C116.84,-132.84 102.04,-133.09 89.56,-132.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"82.53,-131.72 89.77,-129.16 86.02,-132.01 89.51,-132.3 89.51,-132.3 89.51,-132.3 86.02,-132.01 89.25,-135.44 82.53,-131.72 82.53,-131.72\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>2</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"226,-144 199,-126 226,-108 253,-126 226,-144\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M162.37,-120.41C173.4,-119.15 188.15,-118.92 200.56,-119.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"207.56,-120.29 200.32,-122.85 204.07,-120 200.58,-119.71 200.58,-119.71 200.58,-119.71 204.07,-120 200.84,-116.57 207.56,-120.29 207.56,-120.29\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M160.49,-81.9C173.24,-90.62 191.89,-103.37 205.86,-112.92\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"211.91,-117.05 204.36,-115.7 209.02,-115.08 206.13,-113.1 206.13,-113.1 206.13,-113.1 209.02,-115.08 207.91,-110.5 211.91,-117.05 211.91,-117.05\"/>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>4</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"226\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163.14,-72C174.12,-72 188.52,-72 200.67,-72\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"207.89,-72 200.89,-75.15 204.39,-72 200.89,-72 200.89,-72 200.89,-72 204.39,-72 200.89,-68.85 207.89,-72 207.89,-72\"/>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>6</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"226,-36 199,-18 226,0 253,-18 226,-36\"/>\n",
"<text text-anchor=\"middle\" x=\"226\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;6 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>3&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M160.49,-62.1C173.24,-53.38 191.89,-40.63 205.86,-31.08\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"211.91,-26.95 207.91,-33.5 209.31,-29.33 206.42,-31.31 206.13,-30.9 205.85,-30.48 208.74,-28.51 204.36,-28.3 211.91,-26.95 211.91,-26.95\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M207.56,-131.71C196.4,-132.89 181.78,-133.07 169.59,-132.24\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"162.37,-131.59 169.62,-129.08 165.9,-131.41 169.39,-131.72 169.34,-132.22 169.3,-132.71 165.81,-132.4 169.06,-135.35 162.37,-131.59 162.37,-131.59\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"460,-90 433,-72 460,-54 487,-72 460,-90\"/>\n",
"<text text-anchor=\"middle\" x=\"460\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;5 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M246.38,-121.49C287.92,-111.82 385.57,-89.09 432.67,-78.13\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"439.51,-76.54 433.41,-81.19 436.1,-77.33 432.69,-78.12 432.69,-78.12 432.69,-78.12 436.1,-77.33 431.98,-75.06 439.51,-76.54 439.51,-76.54\"/>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>7</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"307\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"307\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>6&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M244.53,-12.28C255.75,-11.1 270.43,-10.93 282.64,-11.78\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"289.86,-12.43 282.61,-14.94 286.38,-12.12 282.89,-11.8 282.89,-11.8 282.89,-11.8 286.38,-12.12 283.17,-8.66 289.86,-12.43 289.86,-12.43\"/>\n",
"</g>\n",
"<!-- 7&#45;&gt;6 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>7&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M289.86,-23.57C278.84,-24.84 264.04,-25.09 251.56,-24.3\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"244.53,-23.72 251.77,-21.16 248.02,-24.01 251.51,-24.3 251.51,-24.3 251.51,-24.3 248.02,-24.01 251.25,-27.44 244.53,-23.72 244.53,-23.72\"/>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g id=\"node10\" class=\"node\">\n",
"<title>8</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"379\" cy=\"-49\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"379\" y=\"-45.3\" font-family=\"Lato\" font-size=\"14.00\">8</text>\n",
"</g>\n",
"<!-- 7&#45;&gt;8 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>7&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M323.88,-25.03C333.28,-29.2 345.33,-34.53 355.67,-39.11\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"362.18,-41.99 354.5,-42.04 358.78,-41.03 355.58,-39.62 355.78,-39.16 355.98,-38.7 359.18,-40.12 357.05,-36.28 362.18,-41.99 362.18,-41.99\"/>\n",
"</g>\n",
"<!-- 8&#45;&gt;5 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>8&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M396.37,-53.77C407.17,-56.91 421.54,-61.1 433.79,-64.66\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"440.72,-66.68 433.12,-67.75 437.22,-66.18 433.86,-65.2 434,-64.72 434.14,-64.24 437.5,-65.22 434.88,-61.7 440.72,-66.68 440.72,-66.68\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.highlight_strategy(game)\n",
"game.show('.g')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Input/Output in HOA format\n",
"\n",
"An extension of the HOA format makes it possible to store the `state-player` property. This allows us to read the parity game constructed by `ltlsynt` using `spot.automaton()` like any other automaton."
]
},
{
"cell_type": "code",
"execution_count": 8,
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"553pt\" height=\"271pt\"\n",
" viewBox=\"0.00 0.00 552.58 270.53\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 266.53)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-266.53 548.58,-266.53 548.58,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"250.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"273.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"289.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"240.79\" y=\"-234.33\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-128.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-125.16\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-128.86C2.79,-128.86 17.15,-128.86 30.63,-128.86\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-128.86 30.94,-132.01 34.44,-128.86 30.94,-128.86 30.94,-128.86 30.94,-128.86 34.44,-128.86 30.94,-125.71 37.94,-128.86 37.94,-128.86\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"143.98,-119.86 121.02,-101.86 143.98,-83.86 166.94,-101.86 143.98,-119.86\"/>\n",
"<text text-anchor=\"middle\" x=\"143.98\" y=\"-98.16\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;5 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.87,-122C78.81,-119.57 85.65,-116.93 92,-114.86 100.68,-112.03 110.36,-109.43 118.93,-107.31\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.83,-105.64 119.76,-110.35 122.42,-106.46 119.02,-107.29 119.02,-107.29 119.02,-107.29 122.42,-106.46 118.28,-104.22 125.83,-105.64 125.83,-105.64\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-118.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>6</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"143.98,-173.86 121.02,-155.86 143.98,-137.86 166.94,-155.86 143.98,-173.86\"/>\n",
"<text text-anchor=\"middle\" x=\"143.98\" y=\"-152.16\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;6 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M73.58,-134.07C86.83,-138.23 105.55,-144.11 120.21,-148.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"127.03,-150.85 119.41,-151.76 123.69,-149.81 120.36,-148.76 120.36,-148.76 120.36,-148.76 123.69,-149.81 121.3,-145.75 127.03,-150.85 127.03,-150.85\"/>\n",
"<text text-anchor=\"start\" x=\"94\" y=\"-146.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"232.96\" cy=\"-116.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"232.96\" y=\"-113.16\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;1 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>5&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163,-104.97C176.05,-107.22 193.83,-110.29 208.06,-112.74\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"215.14,-113.96 207.71,-115.88 211.69,-113.37 208.24,-112.77 208.24,-112.77 208.24,-112.77 211.69,-113.37 208.78,-109.67 215.14,-113.96 215.14,-113.96\"/>\n",
"<text text-anchor=\"start\" x=\"184.96\" y=\"-113.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"232.96\" cy=\"-55.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"232.96\" y=\"-52.16\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;3 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>5&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M158.19,-94.88C172.03,-87.55 194.01,-75.93 210.38,-67.28\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"216.57,-64 211.85,-70.06 213.47,-65.64 210.38,-67.27 210.38,-67.27 210.38,-67.27 213.47,-65.64 208.91,-64.49 216.57,-64 216.57,-64\"/>\n",
"<text text-anchor=\"start\" x=\"186.96\" y=\"-83.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"418.92\" cy=\"-187.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"418.92\" y=\"-184.16\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;2 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>6&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M159.42,-162.04C194.28,-176.56 286.13,-212.59 366.92,-224.86 373.95,-225.93 376.38,-227.67 382.92,-224.86 391.16,-221.31 398.38,-214.75 404.08,-208.13\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"408.5,-202.62 406.57,-210.06 406.31,-205.35 404.12,-208.08 404.12,-208.08 404.12,-208.08 406.31,-205.35 401.66,-206.11 408.5,-202.62 408.5,-202.62\"/>\n",
"<text text-anchor=\"start\" x=\"270.96\" y=\"-208.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;3 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>6&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M159.75,-150.14C171.09,-145.14 186.53,-136.93 196.96,-125.86 196.99,-125.83 210.6,-98.59 220.84,-78.11\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"224.03,-71.74 223.71,-79.41 222.46,-74.87 220.9,-78 220.9,-78 220.9,-78 222.46,-74.87 218.08,-76.59 224.03,-71.74 224.03,-71.74\"/>\n",
"<text text-anchor=\"start\" x=\"186.96\" y=\"-138.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>7</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"514.25,-137.86 491.29,-119.86 514.25,-101.86 537.21,-119.86 514.25,-137.86\"/>\n",
"<text text-anchor=\"middle\" x=\"514.25\" y=\"-116.16\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;7 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M251.01,-117.04C297.46,-117.54 426.64,-118.93 484.53,-119.55\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"491.56,-119.63 484.53,-122.7 488.06,-119.59 484.56,-119.55 484.56,-119.55 484.56,-119.55 488.06,-119.59 484.59,-116.4 491.56,-119.63 491.56,-119.63\"/>\n",
"<text text-anchor=\"start\" x=\"369.42\" y=\"-121.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>8</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"325.94,-183.86 302.98,-165.86 325.94,-147.86 348.89,-165.86 325.94,-183.86\"/>\n",
"<text text-anchor=\"middle\" x=\"325.94\" y=\"-162.16\" font-family=\"Lato\" font-size=\"14.00\">8</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;8 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M249.39,-125.17C264.88,-133.51 288.77,-146.38 305.53,-155.41\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"311.79,-158.78 304.14,-158.24 308.71,-157.12 305.63,-155.46 305.63,-155.46 305.63,-155.46 308.71,-157.12 307.12,-152.69 311.79,-158.78 311.79,-158.78\"/>\n",
"<text text-anchor=\"start\" x=\"273.46\" y=\"-162.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"268.96\" y=\"-147.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 7&#45;&gt;1 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>7&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M495.65,-116.11C470.71,-111 423.58,-102.12 382.92,-98.86 338.63,-95.32 287.24,-104.48 257.87,-111\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"250.89,-112.59 257.02,-107.96 254.3,-111.81 257.72,-111.03 257.72,-111.03 257.72,-111.03 254.3,-111.81 258.42,-114.1 250.89,-112.59 250.89,-112.59\"/>\n",
"<text text-anchor=\"middle\" x=\"374.92\" y=\"-102.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 8&#45;&gt;2 -->\n",
"<g id=\"edge15\" class=\"edge\">\n",
"<title>8&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M338.12,-174.43C345.77,-179.74 356.39,-186.05 366.92,-188.86 375.61,-191.18 385.43,-191.5 394.12,-191.05\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"401.1,-190.51 394.36,-194.19 397.61,-190.78 394.12,-191.05 394.12,-191.05 394.12,-191.05 397.61,-190.78 393.87,-187.91 401.1,-190.51 401.1,-190.51\"/>\n",
"<text text-anchor=\"start\" x=\"370.42\" y=\"-209.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<text text-anchor=\"start\" x=\"366.92\" y=\"-194.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;7 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M434.09,-177.53C450.53,-165.56 477.65,-145.79 495.49,-132.8\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"501.6,-128.35 497.8,-135.02 498.77,-130.41 495.94,-132.47 495.94,-132.47 495.94,-132.47 498.77,-130.41 494.09,-129.92 501.6,-128.35 501.6,-128.35\"/>\n",
"<text text-anchor=\"start\" x=\"454.92\" y=\"-165.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;8 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M406.32,-174.72C400.07,-168.65 391.82,-162.07 382.92,-158.86 372.14,-154.98 359.52,-156.1 348.99,-158.47\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"342.09,-160.27 348.07,-155.46 345.47,-159.39 348.86,-158.51 348.86,-158.51 348.86,-158.51 345.47,-159.39 349.65,-161.56 342.09,-160.27 342.09,-160.27\"/>\n",
"<text text-anchor=\"start\" x=\"371.42\" y=\"-177.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"366.92\" y=\"-162.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 9 -->\n",
"<g id=\"node10\" class=\"node\">\n",
"<title>9</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"325.94,-42.86 302.98,-24.86 325.94,-6.86 348.89,-24.86 325.94,-42.86\"/>\n",
"<text text-anchor=\"middle\" x=\"325.94\" y=\"-21.16\" font-family=\"Lato\" font-size=\"14.00\">9</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;9 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;9</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M250.22,-50.32C264.76,-45.37 286.2,-38.06 302.39,-32.54\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"309.42,-30.15 303.81,-35.39 306.11,-31.28 302.79,-32.41 302.79,-32.41 302.79,-32.41 306.11,-31.28 301.78,-29.42 309.42,-30.15 309.42,-30.15\"/>\n",
"<text text-anchor=\"middle\" x=\"276.96\" y=\"-46.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 9&#45;&gt;3 -->\n",
"<g id=\"edge16\" class=\"edge\">\n",
"<title>9&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M314.27,-15.58C302.73,-6.73 283.98,4.14 268.96,-3.86 257.42,-10 249.01,-21.82 243.33,-32.64\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"240.14,-39.19 240.37,-31.52 241.67,-36.05 243.2,-32.9 243.2,-32.9 243.2,-32.9 241.67,-36.05 246.03,-34.28 240.14,-39.19 240.14,-39.19\"/>\n",
"<text text-anchor=\"start\" x=\"272.96\" y=\"-22.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"268.96\" y=\"-7.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node11\" class=\"node\">\n",
"<title>4</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"418.92\" cy=\"-24.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"418.92\" y=\"-21.16\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 9&#45;&gt;4 -->\n",
"<g id=\"edge17\" class=\"edge\">\n",
"<title>9&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M348.96,-24.86C362.36,-24.86 379.5,-24.86 393.34,-24.86\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"400.65,-24.86 393.65,-28.01 397.15,-24.86 393.65,-24.86 393.65,-24.86 393.65,-24.86 397.15,-24.86 393.65,-21.71 400.65,-24.86 400.65,-24.86\"/>\n",
"<text text-anchor=\"start\" x=\"368.92\" y=\"-28.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 10 -->\n",
"<g id=\"node12\" class=\"node\">\n",
"<title>10</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"514.25,-37.86 484.08,-19.86 514.25,-1.86 544.41,-19.86 514.25,-37.86\"/>\n",
"<text text-anchor=\"middle\" x=\"514.25\" y=\"-16.16\" font-family=\"Lato\" font-size=\"14.00\">10</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;10 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>4&#45;&gt;10</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M433.27,-13.43C439.44,-8.89 447.11,-4.2 454.92,-1.86 467.36,1.86 481.26,-2.11 492.37,-7.25\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"498.89,-10.55 491.22,-10.2 495.76,-8.97 492.64,-7.39 492.64,-7.39 492.64,-7.39 495.76,-8.97 494.06,-4.58 498.89,-10.55 498.89,-10.55\"/>\n",
"<text text-anchor=\"middle\" x=\"460.42\" y=\"-5.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 10&#45;&gt;4 -->\n",
"<g id=\"edge18\" class=\"edge\">\n",
"<title>10&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M486.34,-21.3C473.06,-22.01 457.16,-22.87 444.25,-23.56\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"437.03,-23.94 443.86,-20.42 440.53,-23.76 444.02,-23.57 444.02,-23.57 444.02,-23.57 440.53,-23.76 444.19,-26.72 437.03,-23.94 437.03,-23.94\"/>\n",
"<text text-anchor=\"middle\" x=\"460.42\" y=\"-27.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f8f1861bd20> >"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"game = spot.automaton(\"ltlsynt --ins=a --outs=b -f '!b & GFa <-> Gb' --print-game-hoa |\");\n",
"game"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the graphical output, player 0 is represented by circles (or ellipses or rounded rectangles depending on the situations), while player 1's states are diamond shaped. In the case of `ltlsynt`, player 0 plays the role of the environment, and player 1 plays the role of the controler.\n",
"\n",
"In the HOA output, a header `spot-state-player` (or `spot.state-player` in HOA 1.1) lists the owner of each state."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"HOA: v1\n",
"States: 11\n",
"Start: 0\n",
"AP: 2 \"b\" \"a\"\n",
"acc-name: co-Buchi\n",
"Acceptance: 1 Fin(0)\n",
"properties: trans-labels explicit-labels trans-acc complete\n",
"properties: deterministic\n",
"spot-state-player: 0 0 0 0 0 1 1 1 1 1 1\n",
"controllable-AP: 0\n",
"--BODY--\n",
"State: 0\n",
"[!1] 5\n",
"[1] 6\n",
"State: 1\n",
"[!1] 7\n",
"[1] 8 {0}\n",
"State: 2\n",
"[!1] 7\n",
"[1] 8 {0}\n",
"State: 3\n",
"[t] 9\n",
"State: 4\n",
"[t] 10\n",
"State: 5\n",
"[!0] 1\n",
"[0] 3\n",
"State: 6\n",
"[!0] 2\n",
"[0] 3\n",
"State: 7\n",
"[t] 1\n",
"State: 8\n",
"[t] 2 {0}\n",
"State: 9\n",
"[0] 3 {0}\n",
"[!0] 4\n",
"State: 10\n",
"[t] 4\n",
"--END--\n"
]
}
],
"source": [
"print(game.to_str('hoa'))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is the solution of this particular game."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.solve_parity_game(game)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"553pt\" height=\"271pt\"\n",
" viewBox=\"0.00 0.00 552.58 270.53\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 266.53)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-266.53 548.58,-266.53 548.58,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"250.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"273.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"289.79\" y=\"-248.33\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"240.79\" y=\"-234.33\" font-family=\"Lato\" font-size=\"14.00\">[co&#45;Büchi]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"56\" cy=\"-128.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"56\" y=\"-125.16\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-128.86C2.79,-128.86 17.15,-128.86 30.63,-128.86\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-128.86 30.94,-132.01 34.44,-128.86 30.94,-128.86 30.94,-128.86 30.94,-128.86 34.44,-128.86 30.94,-125.71 37.94,-128.86 37.94,-128.86\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>5</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"143.98,-119.86 121.02,-101.86 143.98,-83.86 166.94,-101.86 143.98,-119.86\"/>\n",
"<text text-anchor=\"middle\" x=\"143.98\" y=\"-98.16\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;5 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M72.87,-122C78.81,-119.57 85.65,-116.93 92,-114.86 100.68,-112.03 110.36,-109.43 118.93,-107.31\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.83,-105.64 119.76,-110.35 122.42,-106.46 119.02,-107.29 119.02,-107.29 119.02,-107.29 122.42,-106.46 118.28,-104.22 125.83,-105.64 125.83,-105.64\"/>\n",
"<text text-anchor=\"start\" x=\"92\" y=\"-118.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>6</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"143.98,-173.86 121.02,-155.86 143.98,-137.86 166.94,-155.86 143.98,-173.86\"/>\n",
"<text text-anchor=\"middle\" x=\"143.98\" y=\"-152.16\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;6 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M73.58,-134.07C86.83,-138.23 105.55,-144.11 120.21,-148.71\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"127.03,-150.85 119.41,-151.76 123.69,-149.81 120.36,-148.76 120.36,-148.76 120.36,-148.76 123.69,-149.81 121.3,-145.75 127.03,-150.85 127.03,-150.85\"/>\n",
"<text text-anchor=\"start\" x=\"94\" y=\"-146.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>1</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"232.96\" cy=\"-116.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"232.96\" y=\"-113.16\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;1 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>5&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M163,-104.97C176.05,-107.22 193.83,-110.29 208.06,-112.74\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"215.14,-113.96 207.71,-115.88 211.69,-113.37 208.24,-112.77 208.24,-112.77 208.24,-112.77 211.69,-113.37 208.78,-109.67 215.14,-113.96 215.14,-113.96\"/>\n",
"<text text-anchor=\"start\" x=\"184.96\" y=\"-113.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>3</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"232.96\" cy=\"-55.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"232.96\" y=\"-52.16\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;3 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>5&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M158.19,-94.88C172.03,-87.55 194.01,-75.93 210.38,-67.28\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"216.57,-64 211.85,-70.06 213.71,-66.08 210.61,-67.72 210.38,-67.27 210.14,-66.83 213.24,-65.2 208.91,-64.49 216.57,-64 216.57,-64\"/>\n",
"<text text-anchor=\"start\" x=\"186.96\" y=\"-83.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>2</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" cx=\"418.92\" cy=\"-187.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"418.92\" y=\"-184.16\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;2 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>6&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M159.42,-162.04C194.28,-176.56 286.13,-212.59 366.92,-224.86 373.95,-225.93 376.38,-227.67 382.92,-224.86 391.16,-221.31 398.38,-214.75 404.08,-208.13\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"408.5,-202.62 406.57,-210.06 406.31,-205.35 404.12,-208.08 404.12,-208.08 404.12,-208.08 406.31,-205.35 401.66,-206.11 408.5,-202.62 408.5,-202.62\"/>\n",
"<text text-anchor=\"start\" x=\"270.96\" y=\"-208.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 6&#45;&gt;3 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>6&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M159.75,-150.14C171.09,-145.14 186.53,-136.93 196.96,-125.86 196.99,-125.83 210.6,-98.59 220.84,-78.11\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"224.03,-71.74 223.71,-79.41 222.91,-75.09 221.34,-78.22 220.9,-78 220.45,-77.77 222.01,-74.64 218.08,-76.59 224.03,-71.74 224.03,-71.74\"/>\n",
"<text text-anchor=\"start\" x=\"186.96\" y=\"-138.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>7</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"514.25,-137.86 491.29,-119.86 514.25,-101.86 537.21,-119.86 514.25,-137.86\"/>\n",
"<text text-anchor=\"middle\" x=\"514.25\" y=\"-116.16\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;7 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M251.01,-117.04C297.46,-117.54 426.64,-118.93 484.53,-119.55\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"491.56,-119.63 484.53,-122.7 488.06,-119.59 484.56,-119.55 484.56,-119.55 484.56,-119.55 488.06,-119.59 484.59,-116.4 491.56,-119.63 491.56,-119.63\"/>\n",
"<text text-anchor=\"start\" x=\"369.42\" y=\"-121.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 8 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>8</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"325.94,-183.86 302.98,-165.86 325.94,-147.86 348.89,-165.86 325.94,-183.86\"/>\n",
"<text text-anchor=\"middle\" x=\"325.94\" y=\"-162.16\" font-family=\"Lato\" font-size=\"14.00\">8</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;8 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M249.39,-125.17C264.88,-133.51 288.77,-146.38 305.53,-155.41\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"311.79,-158.78 304.14,-158.24 308.48,-157.56 305.39,-155.9 305.63,-155.46 305.87,-155.02 308.95,-156.68 307.12,-152.69 311.79,-158.78 311.79,-158.78\"/>\n",
"<text text-anchor=\"start\" x=\"273.46\" y=\"-162.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"268.96\" y=\"-147.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 7&#45;&gt;1 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>7&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M495.65,-116.11C470.71,-111 423.58,-102.12 382.92,-98.86 338.63,-95.32 287.24,-104.48 257.87,-111\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"250.89,-112.59 257.02,-107.96 254.3,-111.81 257.72,-111.03 257.72,-111.03 257.72,-111.03 254.3,-111.81 258.42,-114.1 250.89,-112.59 250.89,-112.59\"/>\n",
"<text text-anchor=\"middle\" x=\"374.92\" y=\"-102.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 8&#45;&gt;2 -->\n",
"<g id=\"edge15\" class=\"edge\">\n",
"<title>8&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M338.12,-174.43C345.77,-179.74 356.39,-186.05 366.92,-188.86 375.61,-191.18 385.43,-191.5 394.12,-191.05\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"401.1,-190.51 394.36,-194.19 397.61,-190.78 394.12,-191.05 394.12,-191.05 394.12,-191.05 397.61,-190.78 393.87,-187.91 401.1,-190.51 401.1,-190.51\"/>\n",
"<text text-anchor=\"start\" x=\"370.42\" y=\"-209.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<text text-anchor=\"start\" x=\"366.92\" y=\"-194.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;7 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M434.09,-177.53C450.53,-165.56 477.65,-145.79 495.49,-132.8\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"501.6,-128.35 497.8,-135.02 498.77,-130.41 495.94,-132.47 495.94,-132.47 495.94,-132.47 498.77,-130.41 494.09,-129.92 501.6,-128.35 501.6,-128.35\"/>\n",
"<text text-anchor=\"start\" x=\"454.92\" y=\"-165.66\" font-family=\"Lato\" font-size=\"14.00\">!a</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;8 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;8</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M406.32,-174.72C400.07,-168.65 391.82,-162.07 382.92,-158.86 372.14,-154.98 359.52,-156.1 348.99,-158.47\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"342.09,-160.27 348.07,-155.46 345.35,-158.9 348.74,-158.02 348.86,-158.51 348.99,-158.99 345.6,-159.87 349.65,-161.56 342.09,-160.27 342.09,-160.27\"/>\n",
"<text text-anchor=\"start\" x=\"371.42\" y=\"-177.66\" font-family=\"Lato\" font-size=\"14.00\">a</text>\n",
"<text text-anchor=\"start\" x=\"366.92\" y=\"-162.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 9 -->\n",
"<g id=\"node10\" class=\"node\">\n",
"<title>9</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"325.94,-42.86 302.98,-24.86 325.94,-6.86 348.89,-24.86 325.94,-42.86\"/>\n",
"<text text-anchor=\"middle\" x=\"325.94\" y=\"-21.16\" font-family=\"Lato\" font-size=\"14.00\">9</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;9 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;9</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M250.22,-50.32C264.76,-45.37 286.2,-38.06 302.39,-32.54\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"309.42,-30.15 303.81,-35.39 306.11,-31.28 302.79,-32.41 302.79,-32.41 302.79,-32.41 306.11,-31.28 301.78,-29.42 309.42,-30.15 309.42,-30.15\"/>\n",
"<text text-anchor=\"middle\" x=\"276.96\" y=\"-46.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 9&#45;&gt;3 -->\n",
"<g id=\"edge16\" class=\"edge\">\n",
"<title>9&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M314.27,-15.58C302.73,-6.73 283.98,4.14 268.96,-3.86 257.42,-10 249.01,-21.82 243.33,-32.64\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"240.14,-39.19 240.37,-31.52 241.67,-36.05 243.2,-32.9 243.2,-32.9 243.2,-32.9 241.67,-36.05 246.03,-34.28 240.14,-39.19 240.14,-39.19\"/>\n",
"<text text-anchor=\"start\" x=\"272.96\" y=\"-22.66\" font-family=\"Lato\" font-size=\"14.00\">b</text>\n",
"<text text-anchor=\"start\" x=\"268.96\" y=\"-7.66\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node11\" class=\"node\">\n",
"<title>4</title>\n",
"<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"418.92\" cy=\"-24.86\" rx=\"18\" ry=\"18\"/>\n",
"<text text-anchor=\"middle\" x=\"418.92\" y=\"-21.16\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"</g>\n",
"<!-- 9&#45;&gt;4 -->\n",
"<g id=\"edge17\" class=\"edge\">\n",
"<title>9&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M348.96,-24.86C362.36,-24.86 379.5,-24.86 393.34,-24.86\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"400.65,-24.86 393.65,-28.01 397.15,-25.36 393.65,-25.36 393.65,-24.86 393.65,-24.36 397.15,-24.36 393.65,-21.71 400.65,-24.86 400.65,-24.86\"/>\n",
"<text text-anchor=\"start\" x=\"368.92\" y=\"-28.66\" font-family=\"Lato\" font-size=\"14.00\">!b</text>\n",
"</g>\n",
"<!-- 10 -->\n",
"<g id=\"node12\" class=\"node\">\n",
"<title>10</title>\n",
"<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"514.25,-37.86 484.08,-19.86 514.25,-1.86 544.41,-19.86 514.25,-37.86\"/>\n",
"<text text-anchor=\"middle\" x=\"514.25\" y=\"-16.16\" font-family=\"Lato\" font-size=\"14.00\">10</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;10 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>4&#45;&gt;10</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M433.27,-13.43C439.44,-8.89 447.11,-4.2 454.92,-1.86 467.36,1.86 481.26,-2.11 492.37,-7.25\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"498.89,-10.55 491.22,-10.2 495.76,-8.97 492.64,-7.39 492.64,-7.39 492.64,-7.39 495.76,-8.97 494.06,-4.58 498.89,-10.55 498.89,-10.55\"/>\n",
"<text text-anchor=\"middle\" x=\"460.42\" y=\"-5.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"<!-- 10&#45;&gt;4 -->\n",
"<g id=\"edge18\" class=\"edge\">\n",
"<title>10&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M486.34,-21.3C473.06,-22.01 457.16,-22.87 444.25,-23.56\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"437.03,-23.94 443.86,-20.42 440.5,-23.26 444,-23.07 444.02,-23.57 444.05,-24.07 440.56,-24.26 444.19,-26.72 437.03,-23.94 437.03,-23.94\"/>\n",
"<text text-anchor=\"middle\" x=\"460.42\" y=\"-27.66\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.twa_graph; proxy of <Swig Object of type 'std::shared_ptr< spot::twa_graph > *' at 0x7f8f187f5ef0> >"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"spot.highlight_strategy(game)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Input in PGSolver format\n",
"\n",
"The automaton parser is also able to parse the [PGSolver](https://github.com/tcsprojects/pgsolver) format. Here are two examples from the manual of PGSolver. The support for C-style comments is not part of the PGSolver format.\n",
"\n",
"Note that we use diamond node for player 1, while PGSolver use those of player 0. Also in Spot the acceptance condition is what Player 1 should satisfy; player 0 has two way to not satisfy it: leading to a rejecting cycle, or to a state without successor. In PGSolver, the graph is assumed to be total (i.e. each state has a successor), so player 0 can only win by reaching a rejecting cycle, which is equivalent to a `parity max even` acceptance."
]
},
{
"cell_type": "code",
"execution_count": 12,
"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.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"698pt\" height=\"228pt\"\n",
" viewBox=\"0.00 0.00 698.00 228.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.0 1.0) rotate(0) translate(4 224)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-224 694,-224 694,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"72\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">Fin(</text>\n",
"<text text-anchor=\"start\" x=\"95\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#6bf6ff\">❽</text>\n",
"<text text-anchor=\"start\" x=\"111\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) &amp; (Inf(</text>\n",
"<text text-anchor=\"start\" x=\"157\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#505050\">❼</text>\n",
"<text text-anchor=\"start\" x=\"173\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) | (Fin(</text>\n",
"<text text-anchor=\"start\" x=\"215\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#c4c400\">❻</text>\n",
"<text text-anchor=\"start\" x=\"231\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) &amp; (Inf(</text>\n",
"<text text-anchor=\"start\" x=\"277\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#e31a1c\">❺</text>\n",
"<text text-anchor=\"start\" x=\"293\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) | (Fin(</text>\n",
"<text text-anchor=\"start\" x=\"335\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#33a02c\">❹</text>\n",
"<text text-anchor=\"start\" x=\"351\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) &amp; (Inf(</text>\n",
"<text text-anchor=\"start\" x=\"397\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#6a3d9a\">❸</text>\n",
"<text text-anchor=\"start\" x=\"413\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) | (Fin(</text>\n",
"<text text-anchor=\"start\" x=\"455\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff7f00\">❷</text>\n",
"<text text-anchor=\"start\" x=\"471\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) &amp; (Inf(</text>\n",
"<text text-anchor=\"start\" x=\"517\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<text text-anchor=\"start\" x=\"533\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">) | Fin(</text>\n",
"<text text-anchor=\"start\" x=\"571\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"587\" y=\"-205.8\" font-family=\"Lato\" font-size=\"14.00\">))))))))</text>\n",
"<text text-anchor=\"start\" x=\"289.5\" y=\"-191.8\" font-family=\"Lato\" font-size=\"14.00\">[parity max odd 9]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M80.25,-167.01C80.25,-167.01 46.75,-142.99 46.75,-142.99 41.88,-139.5 41.88,-132.5 46.75,-129.01 46.75,-129.01 80.25,-104.99 80.25,-104.99 85.12,-101.5 94.88,-101.5 99.75,-104.99 99.75,-104.99 133.25,-129.01 133.25,-129.01 138.12,-132.5 138.12,-139.5 133.25,-142.99 133.25,-142.99 99.75,-167.01 99.75,-167.01 94.88,-170.5 85.12,-170.5 80.25,-167.01\"/>\n",
"<text text-anchor=\"start\" x=\"71.5\" y=\"-139.8\" font-family=\"Lato\" font-size=\"14.00\">Africa</text>\n",
"<text text-anchor=\"start\" x=\"82\" y=\"-124.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#c4c400\">❻</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.06,-136C2.06,-136 14.52,-136 29.77,-136\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"36.94,-136 29.94,-139.15 33.44,-136 29.94,-136 29.94,-136 29.94,-136 33.44,-136 29.94,-132.85 36.94,-136 36.94,-136\"/>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>4</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M600.19,-178.8C600.19,-178.8 542.81,-151.2 542.81,-151.2 537.41,-148.6 537.41,-143.4 542.81,-140.8 542.81,-140.8 600.19,-113.2 600.19,-113.2 605.59,-110.6 616.41,-110.6 621.81,-113.2 621.81,-113.2 679.19,-140.8 679.19,-140.8 684.59,-143.4 684.59,-148.6 679.19,-151.2 679.19,-151.2 621.81,-178.8 621.81,-178.8 616.41,-181.4 605.59,-181.4 600.19,-178.8\"/>\n",
"<text text-anchor=\"start\" x=\"579.5\" y=\"-149.8\" font-family=\"Lato\" font-size=\"14.00\">Antarctica</text>\n",
"<text text-anchor=\"start\" x=\"603\" y=\"-134.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#e31a1c\">❺</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;4 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M137.52,-139.96C212.89,-150.81 366.34,-174.5 496,-161 510.18,-159.52 525.19,-157.04 539.5,-154.41\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"546.46,-153.11 540.16,-157.49 543.02,-153.75 539.58,-154.39 539.58,-154.39 539.58,-154.39 543.02,-153.75 539,-151.3 546.46,-153.11 546.46,-153.11\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>2</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M209,-99C209,-99 191,-99 191,-99 185,-99 179,-93 179,-87 179,-87 179,-73 179,-73 179,-67 185,-61 191,-61 191,-61 209,-61 209,-61 215,-61 221,-67 221,-73 221,-73 221,-87 221,-87 221,-93 215,-99 209,-99\"/>\n",
"<text text-anchor=\"start\" x=\"187\" y=\"-83.8\" font-family=\"Lato\" font-size=\"14.00\">Asia</text>\n",
"<text text-anchor=\"start\" x=\"192\" y=\"-68.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#505050\">❼</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M116.59,-116.89C133.45,-106.96 155.45,-95.53 172.49,-87.84\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"178.98,-84.99 173.84,-90.69 175.78,-86.4 172.57,-87.81 172.57,-87.81 172.57,-87.81 175.78,-86.4 171.31,-84.92 178.98,-84.99 178.98,-84.99\"/>\n",
"</g>\n",
"<!-- 4&#45;&gt;0 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>4&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M570.23,-164.47C548.47,-170.69 520.94,-176.4 496,-179 363.59,-192.79 206.38,-167.79 132.84,-150.08\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"125.99,-148.39 133.54,-147.01 129.38,-149.23 132.78,-150.06 132.78,-150.06 132.78,-150.06 129.38,-149.23 132.03,-153.12 125.99,-148.39 125.99,-148.39\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;0 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>2&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M178.7,-95.94C165.82,-103.81 148.69,-113.08 132.99,-120.83\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"126.36,-124.04 131.29,-118.15 129.51,-122.51 132.66,-120.99 132.66,-120.99 132.66,-120.99 129.51,-122.51 134.04,-123.82 126.36,-124.04 126.36,-124.04\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;4 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>2&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M217.67,-99.03C227.89,-109.28 241.89,-121.03 257,-127 350.27,-163.82 468.28,-161.38 541.45,-154.8\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"548.83,-154.1 542.15,-157.89 545.34,-154.43 541.86,-154.76 541.86,-154.76 541.86,-154.76 545.34,-154.43 541.57,-151.62 548.83,-154.1 548.83,-154.1\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>1</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M313.56,-112.08C313.56,-112.08 267.44,-85.92 267.44,-85.92 262.22,-82.96 262.22,-77.04 267.44,-74.08 267.44,-74.08 313.56,-47.92 313.56,-47.92 318.78,-44.96 329.22,-44.96 334.44,-47.92 334.44,-47.92 380.56,-74.08 380.56,-74.08 385.78,-77.04 385.78,-82.96 380.56,-85.92 380.56,-85.92 334.44,-112.08 334.44,-112.08 329.22,-115.04 318.78,-115.04 313.56,-112.08\"/>\n",
"<text text-anchor=\"start\" x=\"298.5\" y=\"-83.8\" font-family=\"Lato\" font-size=\"14.00\">America</text>\n",
"<text text-anchor=\"start\" x=\"316\" y=\"-68.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#6bf6ff\">❽</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;1 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>2&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M221.15,-74.83C232.31,-73.79 246.86,-73.26 261.45,-73.25\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"268.6,-73.29 261.59,-76.4 265.1,-73.77 261.6,-73.75 261.6,-73.25 261.6,-72.75 265.1,-72.77 261.62,-70.1 268.6,-73.29 268.6,-73.29\"/>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>3</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M484,-38C484,-38 439,-38 439,-38 433,-38 427,-32 427,-26 427,-26 427,-12 427,-12 427,-6 433,0 439,0 439,0 484,0 484,0 490,0 496,-6 496,-12 496,-12 496,-26 496,-26 496,-32 490,-38 484,-38\"/>\n",
"<text text-anchor=\"start\" x=\"435\" y=\"-22.8\" font-family=\"Lato\" font-size=\"14.00\">Australia</text>\n",
"<text text-anchor=\"start\" x=\"453.5\" y=\"-7.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#c4c400\">❻</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;3 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M211.36,-60.77C221.64,-47.44 238.52,-31.46 257,-24 310.09,-2.58 377.27,-2.63 419.58,-7.84\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"426.67,-8.79 419.31,-10.98 423.2,-8.33 419.73,-7.86 419.73,-7.86 419.73,-7.86 423.2,-8.33 420.15,-4.74 426.67,-8.79 426.67,-8.79\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;4 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M372.06,-90.9C420.78,-102.18 497.05,-119.84 550.06,-132.12\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"557.05,-133.74 549.52,-135.23 553.64,-132.95 550.23,-132.16 550.23,-132.16 550.23,-132.16 553.64,-132.95 550.94,-129.09 557.05,-133.74 557.05,-133.74\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M268.6,-86.71C254.61,-86.86 240.16,-86.54 228.22,-85.73\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"221.15,-85.17 228.37,-82.58 224.63,-85.44 228.12,-85.72 228.12,-85.72 228.12,-85.72 224.63,-85.44 227.87,-88.86 221.15,-85.17 221.15,-85.17\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>1&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M362.03,-63.33C380.03,-55.23 401.71,-45.47 420.14,-37.17\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"426.77,-34.19 421.68,-39.93 423.57,-35.62 420.38,-37.06 420.38,-37.06 420.38,-37.06 423.57,-35.62 419.09,-34.19 426.77,-34.19 426.77,-34.19\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M484.58,-38.01C508.92,-58.97 548.34,-92.91 576.49,-117.14\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"581.96,-121.86 574.6,-119.68 579.31,-119.57 576.65,-117.29 576.65,-117.29 576.65,-117.29 579.31,-119.57 578.71,-114.9 581.96,-121.86 581.96,-121.86\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;2 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>3&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M426.67,-21.43C385.09,-20.71 313.16,-19.34 257,-42 245.99,-46.44 235.55,-53.91 226.74,-61.16\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"221.19,-65.86 224.49,-58.93 223.54,-63.22 226.21,-60.96 226.53,-61.34 226.85,-61.72 224.18,-63.98 228.57,-63.74 221.19,-65.86 221.19,-65.86\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"metadata": {},
"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",
"<!-- Generated by graphviz version 2.43.0 (0)\n",
" -->\n",
"<!-- Pages: 1 -->\n",
"<svg width=\"697pt\" height=\"252pt\"\n",
" viewBox=\"0.00 0.00 697.00 252.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.0 1.0) rotate(0) translate(4 248)\">\n",
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-248 693,-248 693,4 -4,4\"/>\n",
"<text text-anchor=\"start\" x=\"297\" y=\"-229.8\" font-family=\"Lato\" font-size=\"14.00\">Inf(</text>\n",
"<text text-anchor=\"start\" x=\"318\" y=\"-229.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"<text text-anchor=\"start\" x=\"334\" y=\"-229.8\" font-family=\"Lato\" font-size=\"14.00\">) | Fin(</text>\n",
"<text text-anchor=\"start\" x=\"372\" y=\"-229.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"<text text-anchor=\"start\" x=\"388\" y=\"-229.8\" font-family=\"Lato\" font-size=\"14.00\">)</text>\n",
"<text text-anchor=\"start\" x=\"313\" y=\"-215.8\" font-family=\"Lato\" font-size=\"14.00\">[Streett 1]</text>\n",
"<!-- I -->\n",
"<!-- 0 -->\n",
"<g id=\"node2\" class=\"node\">\n",
"<title>0</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M61,-76C61,-76 49,-76 49,-76 43,-76 37,-70 37,-64 37,-64 37,-50 37,-50 37,-44 43,-38 49,-38 49,-38 61,-38 61,-38 67,-38 73,-44 73,-50 73,-50 73,-64 73,-64 73,-70 67,-76 61,-76\"/>\n",
"<text text-anchor=\"start\" x=\"50.5\" y=\"-60.8\" font-family=\"Lato\" font-size=\"14.00\">0</text>\n",
"<text text-anchor=\"start\" x=\"47\" y=\"-45.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- I&#45;&gt;0 -->\n",
"<g id=\"edge1\" class=\"edge\">\n",
"<title>I&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M1.15,-57C2.75,-57 16.68,-57 29.83,-57\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"36.98,-57 29.98,-60.15 33.48,-57 29.98,-57 29.98,-57 29.98,-57 33.48,-57 29.98,-53.85 36.98,-57 36.98,-57\"/>\n",
"</g>\n",
"<!-- 1 -->\n",
"<g id=\"node3\" class=\"node\">\n",
"<title>1</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M133.27,-170.82C133.27,-170.82 116.73,-151.18 116.73,-151.18 112.86,-146.59 112.86,-137.41 116.73,-132.82 116.73,-132.82 133.27,-113.18 133.27,-113.18 137.14,-108.59 144.86,-108.59 148.73,-113.18 148.73,-113.18 165.27,-132.82 165.27,-132.82 169.14,-137.41 169.14,-146.59 165.27,-151.18 165.27,-151.18 148.73,-170.82 148.73,-170.82 144.86,-175.41 137.14,-175.41 133.27,-170.82\"/>\n",
"<text text-anchor=\"start\" x=\"136.5\" y=\"-145.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
"<text text-anchor=\"start\" x=\"133\" y=\"-130.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;1 -->\n",
"<g id=\"edge2\" class=\"edge\">\n",
"<title>0&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M73.4,-74.61C86.42,-87.78 104.29,-105.86 118.24,-119.98\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"123.19,-124.99 116.03,-122.23 120.73,-122.5 118.27,-120.01 118.27,-120.01 118.27,-120.01 120.73,-122.5 120.51,-117.8 123.19,-124.99 123.19,-124.99\"/>\n",
"</g>\n",
"<!-- 2 -->\n",
"<g id=\"node4\" class=\"node\">\n",
"<title>2</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M233,-109C233,-109 221,-109 221,-109 215,-109 209,-103 209,-97 209,-97 209,-83 209,-83 209,-77 215,-71 221,-71 221,-71 233,-71 233,-71 239,-71 245,-77 245,-83 245,-83 245,-97 245,-97 245,-103 239,-109 233,-109\"/>\n",
"<text text-anchor=\"start\" x=\"222.5\" y=\"-93.8\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
"<text text-anchor=\"start\" x=\"219\" y=\"-78.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 0&#45;&gt;2 -->\n",
"<g id=\"edge3\" class=\"edge\">\n",
"<title>0&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M73.24,-60.35C103.73,-66.27 167.26,-78.6 202.01,-85.34\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"208.97,-86.69 201.5,-88.45 205.44,-86.52 202,-85.85 202.1,-85.36 202.19,-84.87 205.63,-85.54 202.7,-82.27 208.97,-86.69 208.97,-86.69\"/>\n",
"</g>\n",
"<!-- 1&#45;&gt;2 -->\n",
"<g id=\"edge4\" class=\"edge\">\n",
"<title>1&#45;&gt;2</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M162.76,-129.15C174.84,-121.67 190.11,-112.22 202.61,-104.48\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"208.87,-100.61 204.57,-106.97 205.89,-102.45 202.91,-104.29 202.91,-104.29 202.91,-104.29 205.89,-102.45 201.26,-101.61 208.87,-100.61 208.87,-100.61\"/>\n",
"</g>\n",
"<!-- 3 -->\n",
"<g id=\"node5\" class=\"node\">\n",
"<title>3</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M305.27,-170.82C305.27,-170.82 288.73,-151.18 288.73,-151.18 284.86,-146.59 284.86,-137.41 288.73,-132.82 288.73,-132.82 305.27,-113.18 305.27,-113.18 309.14,-108.59 316.86,-108.59 320.73,-113.18 320.73,-113.18 337.27,-132.82 337.27,-132.82 341.14,-137.41 341.14,-146.59 337.27,-151.18 337.27,-151.18 320.73,-170.82 320.73,-170.82 316.86,-175.41 309.14,-175.41 305.27,-170.82\"/>\n",
"<text text-anchor=\"start\" x=\"308.5\" y=\"-145.8\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
"<text text-anchor=\"start\" x=\"305\" y=\"-130.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 1&#45;&gt;3 -->\n",
"<g id=\"edge5\" class=\"edge\">\n",
"<title>1&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M173.18,-142C201.49,-142 243.33,-142 273.67,-142\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"280.73,-142 273.73,-145.15 277.23,-142.5 273.73,-142.5 273.73,-142 273.73,-141.5 277.23,-141.5 273.73,-138.85 280.73,-142 280.73,-142\"/>\n",
"</g>\n",
"<!-- 2&#45;&gt;3 -->\n",
"<g id=\"edge6\" class=\"edge\">\n",
"<title>2&#45;&gt;3</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M245.4,-100.77C256.89,-107.88 272.15,-117.33 285.17,-125.39\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"291.36,-129.22 283.75,-128.21 288.38,-127.38 285.4,-125.54 285.4,-125.54 285.4,-125.54 288.38,-127.38 287.06,-122.86 291.36,-129.22 291.36,-129.22\"/>\n",
"</g>\n",
"<!-- 4 -->\n",
"<g id=\"node6\" class=\"node\">\n",
"<title>4</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M405,-109C405,-109 393,-109 393,-109 387,-109 381,-103 381,-97 381,-97 381,-83 381,-83 381,-77 387,-71 393,-71 393,-71 405,-71 405,-71 411,-71 417,-77 417,-83 417,-83 417,-97 417,-97 417,-103 411,-109 405,-109\"/>\n",
"<text text-anchor=\"start\" x=\"394.5\" y=\"-93.8\" font-family=\"Lato\" font-size=\"14.00\">4</text>\n",
"<text text-anchor=\"start\" x=\"391\" y=\"-78.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 2&#45;&gt;4 -->\n",
"<g id=\"edge7\" class=\"edge\">\n",
"<title>2&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M245.24,-90C275.61,-90 338.73,-90 373.58,-90\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"380.97,-90 373.97,-93.15 377.47,-90.5 373.97,-90.5 373.97,-90 373.97,-89.5 377.47,-89.5 373.97,-86.85 380.97,-90 380.97,-90\"/>\n",
"</g>\n",
"<!-- 3&#45;&gt;4 -->\n",
"<g id=\"edge8\" class=\"edge\">\n",
"<title>3&#45;&gt;4</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M334.76,-129.15C346.84,-121.67 362.11,-112.22 374.61,-104.48\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"380.87,-100.61 376.57,-106.97 377.89,-102.45 374.91,-104.29 374.91,-104.29 374.91,-104.29 377.89,-102.45 373.26,-101.61 380.87,-100.61 380.87,-100.61\"/>\n",
"</g>\n",
"<!-- 5 -->\n",
"<g id=\"node7\" class=\"node\">\n",
"<title>5</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M477.27,-170.82C477.27,-170.82 460.73,-151.18 460.73,-151.18 456.86,-146.59 456.86,-137.41 460.73,-132.82 460.73,-132.82 477.27,-113.18 477.27,-113.18 481.14,-108.59 488.86,-108.59 492.73,-113.18 492.73,-113.18 509.27,-132.82 509.27,-132.82 513.14,-137.41 513.14,-146.59 509.27,-151.18 509.27,-151.18 492.73,-170.82 492.73,-170.82 488.86,-175.41 481.14,-175.41 477.27,-170.82\"/>\n",
"<text text-anchor=\"start\" x=\"480.5\" y=\"-145.8\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
"<text text-anchor=\"start\" x=\"477\" y=\"-130.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 3&#45;&gt;5 -->\n",
"<g id=\"edge9\" class=\"edge\">\n",
"<title>3&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M345.18,-142C373.49,-142 415.33,-142 445.67,-142\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"452.73,-142 445.73,-145.15 449.23,-142.5 445.73,-142.5 445.73,-142 445.73,-141.5 449.23,-141.5 445.73,-138.85 452.73,-142 452.73,-142\"/>\n",
"</g>\n",
"<!-- 4&#45;&gt;5 -->\n",
"<g id=\"edge10\" class=\"edge\">\n",
"<title>4&#45;&gt;5</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M417.4,-100.77C428.89,-107.88 444.15,-117.33 457.17,-125.39\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"463.36,-129.22 455.75,-128.21 460.38,-127.38 457.4,-125.54 457.4,-125.54 457.4,-125.54 460.38,-127.38 459.06,-122.86 463.36,-129.22 463.36,-129.22\"/>\n",
"</g>\n",
"<!-- 6 -->\n",
"<g id=\"node8\" class=\"node\">\n",
"<title>6</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M577,-104C577,-104 565,-104 565,-104 559,-104 553,-98 553,-92 553,-92 553,-78 553,-78 553,-72 559,-66 565,-66 565,-66 577,-66 577,-66 583,-66 589,-72 589,-78 589,-78 589,-92 589,-92 589,-98 583,-104 577,-104\"/>\n",
"<text text-anchor=\"start\" x=\"566.5\" y=\"-88.8\" font-family=\"Lato\" font-size=\"14.00\">6</text>\n",
"<text text-anchor=\"start\" x=\"563\" y=\"-73.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#1f78b4\">⓿</text>\n",
"</g>\n",
"<!-- 4&#45;&gt;6 -->\n",
"<g id=\"edge11\" class=\"edge\">\n",
"<title>4&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M417.24,-89.49C447.61,-88.6 510.73,-86.74 545.58,-85.72\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"552.97,-85.5 546.07,-88.86 549.49,-86.1 545.99,-86.21 545.97,-85.71 545.96,-85.21 549.46,-85.1 545.88,-82.56 552.97,-85.5 552.97,-85.5\"/>\n",
"</g>\n",
"<!-- 5&#45;&gt;6 -->\n",
"<g id=\"edge12\" class=\"edge\">\n",
"<title>5&#45;&gt;6</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M505.91,-128.49C518.16,-120.17 533.93,-109.47 546.76,-100.77\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"552.79,-96.68 548.77,-103.21 549.9,-98.64 547,-100.61 547,-100.61 547,-100.61 549.9,-98.64 545.23,-98 552.79,-96.68 552.79,-96.68\"/>\n",
"</g>\n",
"<!-- 7 -->\n",
"<g id=\"node9\" class=\"node\">\n",
"<title>7</title>\n",
"<path fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M649.27,-146.82C649.27,-146.82 632.73,-127.18 632.73,-127.18 628.86,-122.59 628.86,-113.41 632.73,-108.82 632.73,-108.82 649.27,-89.18 649.27,-89.18 653.14,-84.59 660.86,-84.59 664.73,-89.18 664.73,-89.18 681.27,-108.82 681.27,-108.82 685.14,-113.41 685.14,-122.59 681.27,-127.18 681.27,-127.18 664.73,-146.82 664.73,-146.82 660.86,-151.41 653.14,-151.41 649.27,-146.82\"/>\n",
"<text text-anchor=\"start\" x=\"652.5\" y=\"-121.8\" font-family=\"Lato\" font-size=\"14.00\">7</text>\n",
"<text text-anchor=\"start\" x=\"649\" y=\"-106.8\" font-family=\"Lato\" font-size=\"14.00\" fill=\"#ff4da0\">❶</text>\n",
"</g>\n",
"<!-- 5&#45;&gt;7 -->\n",
"<g id=\"edge13\" class=\"edge\">\n",
"<title>5&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M514.07,-138.04C543.32,-133.91 589.21,-127.43 620.85,-122.96\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"628.17,-121.93 621.68,-126.03 624.77,-122.91 621.31,-123.4 621.24,-122.91 621.17,-122.41 624.63,-121.92 620.8,-119.79 628.17,-121.93 628.17,-121.93\"/>\n",
"</g>\n",
"<!-- 6&#45;&gt;0 -->\n",
"<g id=\"edge15\" class=\"edge\">\n",
"<title>6&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"#e31a1c\" stroke-width=\"2\" d=\"M552.57,-76.81C522.26,-63.35 457.57,-38 400,-38 226,-38 226,-38 226,-38 173.82,-38 113.18,-46.95 80.28,-52.57\"/>\n",
"<polygon fill=\"#e31a1c\" stroke=\"#e31a1c\" stroke-width=\"2\" points=\"73.3,-53.78 79.66,-49.48 76.67,-52.69 80.12,-52.09 80.2,-52.58 80.29,-53.07 76.84,-53.67 80.74,-55.68 73.3,-53.78 73.3,-53.78\"/>\n",
"</g>\n",
"<!-- 6&#45;&gt;7 -->\n",
"<g id=\"edge14\" class=\"edge\">\n",
"<title>6&#45;&gt;7</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M589.4,-91.84C599.95,-95.98 613.68,-101.37 625.94,-106.19\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"632.56,-108.79 624.9,-109.16 629.31,-107.51 626.05,-106.23 626.05,-106.23 626.05,-106.23 629.31,-107.51 627.2,-103.3 632.56,-108.79 632.56,-108.79\"/>\n",
"</g>\n",
"<!-- 7&#45;&gt;0 -->\n",
"<g id=\"edge16\" class=\"edge\">\n",
"<title>7&#45;&gt;0</title>\n",
"<path fill=\"none\" stroke=\"black\" d=\"M641.33,-98.25C614.52,-64.66 554.08,0 486,0 226,0 226,0 226,0 171.36,0 111.74,-26.79 79.64,-43.64\"/>\n",
"<polygon fill=\"black\" stroke=\"black\" points=\"73.22,-47.07 77.91,-40.99 76.31,-45.42 79.4,-43.77 79.4,-43.77 79.4,-43.77 76.31,-45.42 80.88,-46.55 73.22,-47.07 73.22,-47.07\"/>\n",
"</g>\n",
"<!-- 7&#45;&gt;1 -->\n",
"<g id=\"edge17\" class=\"edge\">\n",
"<title>7&#45;&gt;1</title>\n",
"<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M638.75,-134.51C609.71,-160.49 548.11,-208 486,-208 312,-208 312,-208 312,-208 257.98,-208 200.45,-178.68 168.09,-159.13\"/>\n",
"<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"161.96,-155.36 169.57,-156.34 165.2,-156.76 168.18,-158.6 167.92,-159.02 167.66,-159.45 164.68,-157.62 166.27,-161.71 161.96,-155.36 161.96,-155.36\"/>\n",
"</g>\n",
"</g>\n",
"</svg>\n"
],
"text/plain": [
"<spot.jupyter.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"a,b = spot.automata(\"\"\"\n",
"parity 4; /* Example 6 in the manual for PGSolver 4.1 */\n",
"0 6 1 4,2 \"Africa\";\n",
"4 5 1 0 \"Antarctica\";\n",
"1 8 1 2,4,3 \"America\";\n",
"3 6 0 4,2 \"Australia\";\n",
"2 7 0 3,1,0,4 \"Asia\";\n",
"parity 8; /* Example 7 in the manual for PGSolver 4.1 */\n",
"0 0 0 1,2;\n",
"1 1 1 2,3;\n",
"2 0 0 3,4;\n",
"3 1 1 4,5;\n",
"4 0 0 5,6;\n",
"5 1 1 6,7;\n",
"6 0 0 7,0;\n",
"7 1 1 0,1;\n",
"\"\"\")\n",
"spot.solve_game(a)\n",
"spot.highlight_strategy(a)\n",
"spot.solve_game(b)\n",
"spot.highlight_strategy(b)\n",
"display(a.show('.g'), b.show('.g'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}