{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1d49634e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import spot, buddy\n",
    "spot.setup()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0aeb74c0",
   "metadata": {},
   "source": [
    "Read input NBA:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "350c3c73",
   "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=\"353pt\" height=\"169pt\"\n",
       " viewBox=\"0.00 0.00 353.00 169.44\" 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 165.44)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-165.44 349,-165.44 349,4 -4,4\"/>\n",
       "<text text-anchor=\"start\" x=\"151\" y=\"-131.24\" font-family=\"Lato\" font-size=\"14.00\">[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=\"-36.64\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-32.94\" 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,-36.64C2.79,-36.64 17.15,-36.64 30.63,-36.64\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-36.64 30.94,-39.79 34.44,-36.64 30.94,-36.64 30.94,-36.64 30.94,-36.64 34.44,-36.64 30.94,-33.49 37.94,-36.64 37.94,-36.64\"/>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;0 -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>0&#45;&gt;0</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M49.62,-53.67C48.32,-63.5 50.45,-72.64 56,-72.64 60.17,-72.64 62.4,-67.5 62.71,-60.78\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"62.38,-53.67 65.85,-60.52 62.54,-57.17 62.71,-60.67 62.71,-60.67 62.71,-60.67 62.54,-57.17 59.56,-60.81 62.38,-53.67 62.38,-53.67\"/>\n",
       "<text text-anchor=\"start\" x=\"51.5\" y=\"-76.44\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>1</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"144\" cy=\"-36.64\" rx=\"18\" ry=\"18\"/>\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"144\" cy=\"-36.64\" rx=\"22\" ry=\"22\"/>\n",
       "<text text-anchor=\"start\" x=\"139.5\" y=\"-32.94\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;1 -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>0&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M74.4,-36.64C86,-36.64 101.5,-36.64 114.83,-36.64\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"121.98,-36.64 114.98,-39.79 118.48,-36.64 114.98,-36.64 114.98,-36.64 114.98,-36.64 118.48,-36.64 114.98,-33.49 121.98,-36.64 121.98,-36.64\"/>\n",
       "<text text-anchor=\"start\" x=\"92\" y=\"-40.44\" font-family=\"Lato\" font-size=\"14.00\">!y</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>2</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"323\" cy=\"-26.64\" rx=\"18\" ry=\"18\"/>\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"323\" cy=\"-26.64\" rx=\"22\" ry=\"22\"/>\n",
       "<text text-anchor=\"middle\" x=\"323\" y=\"-22.94\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;2 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>0&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M71.54,-27.37C84.28,-19.84 103.59,-9.8 122,-5.64 182.91,8.14 256.34,-7.59 295.06,-18.31\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"301.88,-20.25 294.28,-21.37 298.51,-19.29 295.14,-18.34 295.14,-18.34 295.14,-18.34 298.51,-19.29 296,-15.31 301.88,-20.25 301.88,-20.25\"/>\n",
       "<text text-anchor=\"start\" x=\"184.5\" y=\"-4.44\" font-family=\"Lato\" font-size=\"14.00\">!x</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>3</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"236\" cy=\"-89.64\" rx=\"18\" ry=\"18\"/>\n",
       "<ellipse fill=\"none\" stroke=\"black\" cx=\"236\" cy=\"-89.64\" rx=\"22\" ry=\"22\"/>\n",
       "<text text-anchor=\"middle\" x=\"236\" y=\"-85.94\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;3 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>0&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M66.63,-51.39C77.81,-67.01 97.82,-90.73 122,-100.64 149.77,-112.01 184.48,-105.97 208.05,-99.2\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"214.98,-97.09 209.2,-102.14 211.64,-98.11 208.29,-99.13 208.29,-99.13 208.29,-99.13 211.64,-98.11 207.37,-96.11 214.98,-97.09 214.98,-97.09\"/>\n",
       "<text text-anchor=\"start\" x=\"140\" y=\"-110.44\" font-family=\"Lato\" font-size=\"14.00\">y</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;1 -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>1&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M135.63,-57.22C134.47,-67.48 137.26,-76.64 144,-76.64 149.05,-76.64 151.89,-71.49 152.5,-64.58\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"152.37,-57.22 155.64,-64.16 152.43,-60.72 152.49,-64.22 152.49,-64.22 152.49,-64.22 152.43,-60.72 149.34,-64.27 152.37,-57.22 152.37,-57.22\"/>\n",
       "<text text-anchor=\"start\" x=\"138\" y=\"-80.44\" font-family=\"Lato\" font-size=\"14.00\">!y</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;2 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>1&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M166,-35.45C197.8,-33.65 258.24,-30.24 293.83,-28.23\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"301.03,-27.82 294.22,-31.36 297.53,-28.02 294.04,-28.22 294.04,-28.22 294.04,-28.22 297.53,-28.02 293.86,-25.07 301.03,-27.82 301.03,-27.82\"/>\n",
       "<text text-anchor=\"start\" x=\"232.5\" y=\"-35.44\" font-family=\"Lato\" font-size=\"14.00\">x</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;3 -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>1&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M164.85,-44.87C174.48,-49.14 186.09,-54.7 196,-60.64 201.63,-64.01 207.45,-68.02 212.81,-71.95\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"218.43,-76.17 210.94,-74.48 215.63,-74.07 212.83,-71.97 212.83,-71.97 212.83,-71.97 215.63,-74.07 214.72,-69.45 218.43,-76.17 218.43,-76.17\"/>\n",
       "<text text-anchor=\"start\" x=\"186\" y=\"-64.44\" font-family=\"Lato\" font-size=\"14.00\">y</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;2 -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>2&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M315.32,-47.63C314.37,-57.72 316.93,-66.64 323,-66.64 327.55,-66.64 330.13,-61.62 330.74,-54.86\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"330.68,-47.63 333.88,-54.6 330.71,-51.13 330.73,-54.63 330.73,-54.63 330.73,-54.63 330.71,-51.13 327.58,-54.65 330.68,-47.63 330.68,-47.63\"/>\n",
       "<text text-anchor=\"start\" x=\"318.5\" y=\"-70.44\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;1 -->\n",
       "<g id=\"edge11\" class=\"edge\">\n",
       "<title>3&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M214.19,-86.46C204.54,-84.37 193.21,-80.99 184,-75.64 176.37,-71.2 169.18,-64.9 163.1,-58.66\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"158.27,-53.47 165.34,-56.44 160.65,-56.03 163.03,-58.59 163.03,-58.59 163.03,-58.59 160.65,-56.03 160.73,-60.74 158.27,-53.47 158.27,-53.47\"/>\n",
       "<text text-anchor=\"start\" x=\"184\" y=\"-84.44\" font-family=\"Lato\" font-size=\"14.00\">!y</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;2 -->\n",
       "<g id=\"edge10\" class=\"edge\">\n",
       "<title>3&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M254.2,-76.89C267.1,-67.32 284.9,-54.13 299.02,-43.67\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"304.82,-39.37 301.08,-46.07 302.01,-41.45 299.2,-43.54 299.2,-43.54 299.2,-43.54 302.01,-41.45 297.33,-41.01 304.82,-39.37 304.82,-39.37\"/>\n",
       "<text text-anchor=\"start\" x=\"276\" y=\"-63.44\" font-family=\"Lato\" font-size=\"14.00\">x</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 0x7fa5cc19c3f0> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "aut = spot.automaton('spec.hoa')\n",
    "display(aut)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d3687b96",
   "metadata": {},
   "source": [
    "Determinize to DPA:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "453947cb",
   "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=\"271pt\" height=\"169pt\"\n",
       " viewBox=\"0.00 0.00 271.00 169.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 165)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-165 267,-165 267,4 -4,4\"/>\n",
       "<text text-anchor=\"start\" x=\"128.5\" y=\"-145.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
       "<text text-anchor=\"start\" x=\"120.5\" y=\"-130.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",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-68.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.15,-72C2.79,-72 17.15,-72 30.63,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-72 30.94,-75.15 34.44,-72 30.94,-72 30.94,-72 30.94,-72 34.44,-72 30.94,-68.85 37.94,-72 37.94,-72\"/>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>1</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"245\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"245\" y=\"-68.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=\"M71.47,-81.34C77.58,-84.88 84.92,-88.64 92,-91 130.09,-103.72 142.26,-104.76 182,-99 196.37,-96.92 211.34,-90.54 222.96,-84.51\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"229.39,-81.03 224.73,-87.13 226.31,-82.7 223.23,-84.36 223.23,-84.36 223.23,-84.36 226.31,-82.7 221.73,-81.59 229.39,-81.03 229.39,-81.03\"/>\n",
       "<text text-anchor=\"start\" x=\"158.5\" y=\"-105.8\" font-family=\"Lato\" font-size=\"14.00\">!x</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>2</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"164\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"164\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">2</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=\"M74.03,-72C91.47,-72 118.74,-72 138.49,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"145.66,-72 138.66,-75.15 142.16,-72 138.66,-72 138.66,-72 138.66,-72 142.16,-72 138.66,-68.85 145.66,-72 145.66,-72\"/>\n",
       "<text text-anchor=\"start\" x=\"92\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; !y</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>3</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"164\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"164\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;3 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>0&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M72.26,-63.55C78.37,-60.21 85.49,-56.37 92,-53 108.26,-44.58 126.82,-35.45 140.88,-28.62\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"147.4,-25.47 142.47,-31.36 144.25,-27 141.1,-28.52 141.1,-28.52 141.1,-28.52 144.25,-27 139.73,-25.69 147.4,-25.47 147.4,-25.47\"/>\n",
       "<text text-anchor=\"start\" x=\"94.5\" y=\"-56.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; y</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;1 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>1&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M237.97,-88.66C236.41,-98.62 238.75,-108 245,-108 249.69,-108 252.18,-102.73 252.47,-95.89\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"252.03,-88.66 255.6,-95.46 252.24,-92.16 252.46,-95.65 252.46,-95.65 252.46,-95.65 252.24,-92.16 249.31,-95.84 252.03,-88.66 252.03,-88.66\"/>\n",
       "<text text-anchor=\"middle\" x=\"245\" y=\"-111.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\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=\"M182.14,-72C193.12,-72 207.52,-72 219.67,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"226.89,-72 219.89,-75.15 223.39,-72 219.89,-72 219.89,-72 219.89,-72 223.39,-72 219.89,-68.85 226.89,-72 226.89,-72\"/>\n",
       "<text text-anchor=\"middle\" x=\"204.5\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;1 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>3&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M179.49,-27.9C191.85,-36.35 209.76,-48.6 223.58,-58.04\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"229.6,-62.16 222.05,-60.81 226.71,-60.18 223.82,-58.21 223.82,-58.21 223.82,-58.21 226.71,-60.18 225.6,-55.61 229.6,-62.16 229.6,-62.16\"/>\n",
       "<text text-anchor=\"middle\" x=\"204.5\" y=\"-49.8\" 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 0x7fa5cc19c210> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "det = aut.postprocess('deterministic', 'parity', 'low')\n",
    "display(det)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "64b967bd",
   "metadata": {},
   "source": [
    "Define controlable APs:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4b9826af",
   "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=\"359pt\" height=\"151pt\"\n",
       " viewBox=\"0.00 0.00 358.50 151.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 147)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-147 354.5,-147 354.5,4 -4,4\"/>\n",
       "<!-- I -->\n",
       "<!-- 0 -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>0</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-68.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.15,-72C2.79,-72 17.15,-72 30.63,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-72 30.94,-75.15 34.44,-72 30.94,-72 30.94,-72 30.94,-72 34.44,-72 30.94,-68.85 37.94,-72 37.94,-72\"/>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>1</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"328\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"328\" y=\"-68.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=\"M69.07,-84.53C75.32,-90.11 83.43,-96.08 92,-99 176.13,-127.68 207.87,-127.68 292,-99 298.16,-96.9 304.08,-93.23 309.24,-89.26\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"314.93,-84.53 311.56,-91.43 312.23,-86.77 309.54,-89.01 309.54,-89.01 309.54,-89.01 312.23,-86.77 307.53,-86.58 314.93,-84.53 314.93,-84.53\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"184.5,-121.5 184.5,-140.5 197.5,-140.5 197.5,-121.5 184.5,-121.5\"/>\n",
       "<text text-anchor=\"start\" x=\"186.5\" y=\"-127.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"201.5\" y=\"-127.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"212.5,-121.5 212.5,-140.5 227.5,-140.5 227.5,-121.5 212.5,-121.5\"/>\n",
       "<text text-anchor=\"start\" x=\"214.5\" y=\"-127.3\" font-family=\"Lato\" font-size=\"14.00\">!x</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>2</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"205.5\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"205.5\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">2</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=\"M74.21,-72C100.41,-72 150.41,-72 180.27,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"187.4,-72 180.4,-75.15 183.9,-72 180.4,-72 180.4,-72 180.4,-72 183.9,-72 180.4,-68.85 187.4,-72 187.4,-72\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"94,-73.5 94,-92.5 107,-92.5 107,-73.5 94,-73.5\"/>\n",
       "<text text-anchor=\"start\" x=\"96\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"111\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"122,-73.5 122,-92.5 162,-92.5 162,-73.5 122,-73.5\"/>\n",
       "<text text-anchor=\"start\" x=\"124\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">x &amp; !y</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>3</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"205.5\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"205.5\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;3 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>0&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M69.75,-60.05C76.03,-54.75 83.97,-48.84 92,-45 120.61,-31.31 156.73,-24.24 180.21,-20.82\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"187.36,-19.84 180.86,-23.92 183.89,-20.32 180.43,-20.79 180.43,-20.79 180.43,-20.79 183.89,-20.32 180,-17.67 187.36,-19.84 187.36,-19.84\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"97,-46.5 97,-65.5 110,-65.5 110,-46.5 97,-46.5\"/>\n",
       "<text text-anchor=\"start\" x=\"99\" y=\"-52.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"114\" y=\"-52.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"125,-46.5 125,-65.5 160,-65.5 160,-46.5 125,-46.5\"/>\n",
       "<text text-anchor=\"start\" x=\"127\" y=\"-52.3\" font-family=\"Lato\" font-size=\"14.00\">x &amp; y</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;1 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>1&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M318.19,-87.17C315.21,-97.66 318.48,-108 328,-108 335.29,-108 338.91,-101.94 338.87,-94.39\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"337.81,-87.17 341.95,-93.63 338.32,-90.63 338.83,-94.09 338.83,-94.09 338.83,-94.09 338.32,-90.63 335.71,-94.55 337.81,-87.17 337.81,-87.17\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"308,-109.5 308,-128.5 321,-128.5 321,-109.5 308,-109.5\"/>\n",
       "<text text-anchor=\"start\" x=\"310\" y=\"-115.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"325\" y=\"-115.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"336,-109.5 336,-128.5 349,-128.5 349,-109.5 336,-109.5\"/>\n",
       "<text text-anchor=\"start\" x=\"338\" y=\"-115.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\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=\"M223.51,-72C244.11,-72 278.98,-72 302.49,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"309.69,-72 302.69,-75.15 306.19,-72 302.69,-72 302.69,-72 302.69,-72 306.19,-72 302.69,-68.85 309.69,-72 309.69,-72\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"249.5,-73.5 249.5,-92.5 262.5,-92.5 262.5,-73.5 249.5,-73.5\"/>\n",
       "<text text-anchor=\"start\" x=\"251.5\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"266.5\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"277.5,-73.5 277.5,-92.5 290.5,-92.5 290.5,-73.5 277.5,-73.5\"/>\n",
       "<text text-anchor=\"start\" x=\"279.5\" y=\"-79.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;1 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>3&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M223.25,-21.45C241,-25.52 269.51,-33.25 292,-45 297.67,-47.96 303.36,-51.86 308.46,-55.77\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"314.13,-60.31 306.69,-58.39 311.39,-58.12 308.66,-55.93 308.66,-55.93 308.66,-55.93 311.39,-58.12 310.63,-53.47 314.13,-60.31 314.13,-60.31\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"249.5,-46.5 249.5,-65.5 262.5,-65.5 262.5,-46.5 249.5,-46.5\"/>\n",
       "<text text-anchor=\"start\" x=\"251.5\" y=\"-52.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"266.5\" y=\"-52.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"277.5,-46.5 277.5,-65.5 290.5,-65.5 290.5,-46.5 277.5,-46.5\"/>\n",
       "<text text-anchor=\"start\" x=\"279.5\" y=\"-52.3\" 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 0x7fa5cc19c210> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = buddy.bdd_ithvar(det.register_ap(\"x\"))\n",
    "y = buddy.bdd_ithvar(det.register_ap(\"y\"))\n",
    "spot.set_synthesis_outputs(det, x & y)\n",
    "display(det)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ca6552f6",
   "metadata": {},
   "source": [
    "Turn into a game:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "3866dbd9",
   "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=\"388pt\" height=\"190pt\"\n",
       " viewBox=\"0.00 0.00 388.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 384,-186 384,4 -4,4\"/>\n",
       "<text text-anchor=\"start\" x=\"187\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
       "<text text-anchor=\"start\" x=\"179\" 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",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-68.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.15,-72C2.79,-72 17.15,-72 30.63,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-72 30.94,-75.15 34.44,-72 30.94,-72 30.94,-72 30.94,-72 34.44,-72 30.94,-68.85 37.94,-72 37.94,-72\"/>\n",
       "</g>\n",
       "<!-- 4 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>4</title>\n",
       "<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"146,-90 119,-72 146,-54 173,-72 146,-90\"/>\n",
       "<text text-anchor=\"middle\" x=\"146\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">4</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=\"M74.39,-72C85.02,-72 98.98,-72 111.68,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"118.97,-72 111.97,-75.15 115.47,-72 111.97,-72 111.97,-72 111.97,-72 115.47,-72 111.97,-68.85 118.97,-72 118.97,-72\"/>\n",
       "<text text-anchor=\"start\" x=\"92\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>1</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"263\" cy=\"-126\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"start\" x=\"258.5\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;1 -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>4&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M162.51,-79.28C182.49,-88.66 217.33,-105.02 240.03,-115.68\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"246.37,-118.66 238.69,-118.54 243.2,-117.17 240.03,-115.68 240.03,-115.68 240.03,-115.68 243.2,-117.17 241.37,-112.83 246.37,-118.66 246.37,-118.66\"/>\n",
       "<text text-anchor=\"start\" x=\"203.5\" y=\"-111.8\" font-family=\"Lato\" font-size=\"14.00\">!x</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>2</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"263\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"263\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;2 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>4&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M173.1,-72C192.52,-72 218.84,-72 237.79,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"244.92,-72 237.92,-75.15 241.42,-72 237.92,-72 237.92,-72 237.92,-72 241.42,-72 237.92,-68.85 244.92,-72 244.92,-72\"/>\n",
       "<text text-anchor=\"start\" x=\"191\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; !y</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>3</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"263\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"263\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;3 -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>4&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M162.51,-64.72C182.49,-55.34 217.33,-38.98 240.03,-28.32\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"246.37,-25.34 241.37,-31.17 243.2,-26.83 240.03,-28.32 240.03,-28.32 240.03,-28.32 243.2,-26.83 238.69,-25.46 246.37,-25.34 246.37,-25.34\"/>\n",
       "<text text-anchor=\"start\" x=\"193.5\" y=\"-52.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; y</text>\n",
       "</g>\n",
       "<!-- 5 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>5</title>\n",
       "<polygon fill=\"#ffffaa\" stroke=\"black\" points=\"353,-105 326,-87 353,-69 380,-87 353,-105\"/>\n",
       "<text text-anchor=\"middle\" x=\"353\" y=\"-83.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;5 -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>1&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M281.25,-126.7C289.59,-126.48 299.6,-125.37 308,-122 318.54,-117.77 328.59,-110.16 336.41,-103.11\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"341.94,-97.9 339.01,-104.99 339.39,-100.3 336.85,-102.7 336.85,-102.7 336.85,-102.7 339.39,-100.3 334.68,-100.41 341.94,-97.9 341.94,-97.9\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-127.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 5&#45;&gt;1 -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>5&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M332.62,-91.41C322.36,-94.1 309.71,-97.99 299,-103 293.81,-105.42 288.51,-108.53 283.64,-111.68\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"277.76,-115.63 281.82,-109.11 280.67,-113.68 283.57,-111.72 283.57,-111.72 283.57,-111.72 280.67,-113.68 285.33,-114.34 277.76,-115.63 277.76,-115.63\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-106.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;5 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>2&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M280.84,-68.8C289.09,-67.76 299.13,-67.26 308,-69 315.65,-70.5 323.65,-73.35 330.7,-76.34\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"337.38,-79.34 329.7,-79.35 334.18,-77.91 330.99,-76.48 330.99,-76.48 330.99,-76.48 334.18,-77.91 332.28,-73.6 337.38,-79.34 337.38,-79.34\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-72.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;5 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>3&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M278.59,-27.28C287.32,-32.99 298.52,-40.61 308,-48 317.55,-55.44 327.7,-64.36 335.84,-71.79\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"341.12,-76.66 333.84,-74.23 338.55,-74.29 335.97,-71.91 335.97,-71.91 335.97,-71.91 338.55,-74.29 338.11,-69.6 341.12,-76.66 341.12,-76.66\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-51.8\" 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 0x7fa5cc19c090> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "game = spot.split_2step(det, spot.get_synthesis_outputs(det), False)\n",
    "display(game)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "90ccb7a7",
   "metadata": {},
   "source": [
    "Solve game:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "b66311b0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spot.solve_game(game)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "d105e43d",
   "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=\"388pt\" height=\"190pt\"\n",
       " viewBox=\"0.00 0.00 388.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 384,-186 384,4 -4,4\"/>\n",
       "<text text-anchor=\"start\" x=\"187\" y=\"-166.8\" font-family=\"Lato\" font-size=\"14.00\">t</text>\n",
       "<text text-anchor=\"start\" x=\"179\" 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",
       "<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"56\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-68.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.15,-72C2.79,-72 17.15,-72 30.63,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-72 30.94,-75.15 34.44,-72 30.94,-72 30.94,-72 30.94,-72 34.44,-72 30.94,-68.85 37.94,-72 37.94,-72\"/>\n",
       "</g>\n",
       "<!-- 4 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>4</title>\n",
       "<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"146,-90 119,-72 146,-54 173,-72 146,-90\"/>\n",
       "<text text-anchor=\"middle\" x=\"146\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">4</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=\"M74.39,-72C85.02,-72 98.98,-72 111.68,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"118.97,-72 111.97,-75.15 115.47,-72 111.97,-72 111.97,-72 111.97,-72 115.47,-72 111.97,-68.85 118.97,-72 118.97,-72\"/>\n",
       "<text text-anchor=\"start\" x=\"92\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 1 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>1</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"263\" cy=\"-126\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"start\" x=\"258.5\" y=\"-122.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;1 -->\n",
       "<g id=\"edge6\" class=\"edge\">\n",
       "<title>4&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M162.51,-79.28C182.49,-88.66 217.33,-105.02 240.03,-115.68\"/>\n",
       "<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"246.37,-118.66 238.69,-118.54 242.99,-117.63 239.82,-116.14 240.03,-115.68 240.25,-115.23 243.41,-116.72 241.37,-112.83 246.37,-118.66 246.37,-118.66\"/>\n",
       "<text text-anchor=\"start\" x=\"203.5\" y=\"-111.8\" font-family=\"Lato\" font-size=\"14.00\">!x</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>2</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"263\" cy=\"-72\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"263\" y=\"-68.3\" font-family=\"Lato\" font-size=\"14.00\">2</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;2 -->\n",
       "<g id=\"edge7\" class=\"edge\">\n",
       "<title>4&#45;&gt;2</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M173.1,-72C192.52,-72 218.84,-72 237.79,-72\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"244.92,-72 237.92,-75.15 241.42,-72 237.92,-72 237.92,-72 237.92,-72 241.42,-72 237.92,-68.85 244.92,-72 244.92,-72\"/>\n",
       "<text text-anchor=\"start\" x=\"191\" y=\"-75.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; !y</text>\n",
       "</g>\n",
       "<!-- 3 -->\n",
       "<g id=\"node7\" class=\"node\">\n",
       "<title>3</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" cx=\"263\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"263\" y=\"-14.3\" font-family=\"Lato\" font-size=\"14.00\">3</text>\n",
       "</g>\n",
       "<!-- 4&#45;&gt;3 -->\n",
       "<g id=\"edge8\" class=\"edge\">\n",
       "<title>4&#45;&gt;3</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M162.51,-64.72C182.49,-55.34 217.33,-38.98 240.03,-28.32\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"246.37,-25.34 241.37,-31.17 243.2,-26.83 240.03,-28.32 240.03,-28.32 240.03,-28.32 243.2,-26.83 238.69,-25.46 246.37,-25.34 246.37,-25.34\"/>\n",
       "<text text-anchor=\"start\" x=\"193.5\" y=\"-52.8\" font-family=\"Lato\" font-size=\"14.00\">x &amp; y</text>\n",
       "</g>\n",
       "<!-- 5 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>5</title>\n",
       "<polygon fill=\"#ffffaa\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"353,-105 326,-87 353,-69 380,-87 353,-105\"/>\n",
       "<text text-anchor=\"middle\" x=\"353\" y=\"-83.3\" font-family=\"Lato\" font-size=\"14.00\">5</text>\n",
       "</g>\n",
       "<!-- 1&#45;&gt;5 -->\n",
       "<g id=\"edge3\" class=\"edge\">\n",
       "<title>1&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M281.25,-126.7C289.59,-126.48 299.6,-125.37 308,-122 318.54,-117.77 328.59,-110.16 336.41,-103.11\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"341.94,-97.9 339.01,-104.99 339.39,-100.3 336.85,-102.7 336.85,-102.7 336.85,-102.7 339.39,-100.3 334.68,-100.41 341.94,-97.9 341.94,-97.9\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-127.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 5&#45;&gt;1 -->\n",
       "<g id=\"edge9\" class=\"edge\">\n",
       "<title>5&#45;&gt;1</title>\n",
       "<path fill=\"none\" stroke=\"#33a02c\" stroke-width=\"2\" d=\"M332.62,-91.41C322.36,-94.1 309.71,-97.99 299,-103 293.81,-105.42 288.51,-108.53 283.64,-111.68\"/>\n",
       "<polygon fill=\"#33a02c\" stroke=\"#33a02c\" stroke-width=\"2\" points=\"277.76,-115.63 281.82,-109.11 280.39,-113.26 283.29,-111.31 283.57,-111.72 283.85,-112.14 280.95,-114.09 285.33,-114.34 277.76,-115.63 277.76,-115.63\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-106.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 2&#45;&gt;5 -->\n",
       "<g id=\"edge4\" class=\"edge\">\n",
       "<title>2&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M280.84,-68.8C289.09,-67.76 299.13,-67.26 308,-69 315.65,-70.5 323.65,-73.35 330.7,-76.34\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"337.38,-79.34 329.7,-79.35 334.18,-77.91 330.99,-76.48 330.99,-76.48 330.99,-76.48 334.18,-77.91 332.28,-73.6 337.38,-79.34 337.38,-79.34\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-72.8\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "</g>\n",
       "<!-- 3&#45;&gt;5 -->\n",
       "<g id=\"edge5\" class=\"edge\">\n",
       "<title>3&#45;&gt;5</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M278.59,-27.28C287.32,-32.99 298.52,-40.61 308,-48 317.55,-55.44 327.7,-64.36 335.84,-71.79\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"341.12,-76.66 333.84,-74.23 338.55,-74.29 335.97,-71.91 335.97,-71.91 335.97,-71.91 338.55,-74.29 338.11,-69.6 341.12,-76.66 341.12,-76.66\"/>\n",
       "<text text-anchor=\"start\" x=\"299\" y=\"-51.8\" 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 0x7fa5cc19c090> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "spot.highlight_strategy(game)\n",
    "display(game)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "003abf6f",
   "metadata": {},
   "source": [
    "Extract winning strategy:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "015332a2",
   "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=\"88pt\" height=\"85pt\"\n",
       " viewBox=\"0.00 0.00 87.50 85.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g id=\"graph0\" class=\"graph\" transform=\"scale(1.0 1.0) rotate(0) translate(4 81)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-81 83.5,-81 83.5,4 -4,4\"/>\n",
       "<!-- I -->\n",
       "<!-- 0 -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>0</title>\n",
       "<ellipse fill=\"#ffffaa\" stroke=\"black\" cx=\"56\" cy=\"-18\" rx=\"18\" ry=\"18\"/>\n",
       "<text text-anchor=\"middle\" x=\"56\" y=\"-14.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.15,-18C2.79,-18 17.15,-18 30.63,-18\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"37.94,-18 30.94,-21.15 34.44,-18 30.94,-18 30.94,-18 30.94,-18 34.44,-18 30.94,-14.85 37.94,-18 37.94,-18\"/>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;0 -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>0&#45;&gt;0</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M49.62,-35.04C48.32,-44.86 50.45,-54 56,-54 60.17,-54 62.4,-48.86 62.71,-42.14\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"62.38,-35.04 65.85,-41.88 62.54,-38.53 62.71,-42.03 62.71,-42.03 62.71,-42.03 62.54,-38.53 59.56,-42.18 62.38,-35.04 62.38,-35.04\"/>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"transparent\" points=\"35,-55.5 35,-74.5 48,-74.5 48,-55.5 35,-55.5\"/>\n",
       "<text text-anchor=\"start\" x=\"37\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">1</text>\n",
       "<text text-anchor=\"start\" x=\"52\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">/</text>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"transparent\" points=\"63,-55.5 63,-74.5 78,-74.5 78,-55.5 63,-55.5\"/>\n",
       "<text text-anchor=\"start\" x=\"65\" y=\"-61.3\" font-family=\"Lato\" font-size=\"14.00\">!x</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 0x7fa5cc156060> >"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "m = spot.solved_game_to_separated_mealy(game)\n",
    "display(m)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "de60fdd4",
   "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=\"357pt\" height=\"136pt\"\n",
       " viewBox=\"0.00 0.00 356.69 136.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 132)\">\n",
       "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-132 352.69,-132 352.69,4 -4,4\"/>\n",
       "<!-- o0 -->\n",
       "<g id=\"node1\" class=\"node\">\n",
       "<title>o0</title>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"black\" points=\"32.5,-82 64.99,-116.5 0,-116.5 32.5,-82\"/>\n",
       "<text text-anchor=\"middle\" x=\"32.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\">x</text>\n",
       "</g>\n",
       "<!-- o1 -->\n",
       "<g id=\"node2\" class=\"node\">\n",
       "<title>o1</title>\n",
       "<polygon fill=\"#ffe5f1\" stroke=\"black\" points=\"115.5,-82 147.99,-116.5 83,-116.5 115.5,-82\"/>\n",
       "<text text-anchor=\"middle\" x=\"115.5\" y=\"-101.3\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n",
       "</g>\n",
       "<!-- 2 -->\n",
       "<g id=\"node3\" class=\"node\">\n",
       "<title>2</title>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"black\" points=\"150.5,-46 118,-11.5 182.99,-11.5 150.5,-46\"/>\n",
       "<text text-anchor=\"middle\" x=\"150.5\" y=\"-19.3\" font-family=\"Times,serif\" font-size=\"14.00\">a</text>\n",
       "</g>\n",
       "<!-- 4 -->\n",
       "<g id=\"node4\" class=\"node\">\n",
       "<title>4</title>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"black\" points=\"234.5,-46 200.9,-11.5 268.09,-11.5 234.5,-46\"/>\n",
       "<text text-anchor=\"middle\" x=\"234.5\" y=\"-19.3\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n",
       "</g>\n",
       "<!-- 6 -->\n",
       "<g id=\"node5\" class=\"node\">\n",
       "<title>6</title>\n",
       "<polygon fill=\"#e9f4fb\" stroke=\"black\" points=\"317.5,-46 286.1,-11.5 348.89,-11.5 317.5,-46\"/>\n",
       "<text text-anchor=\"middle\" x=\"317.5\" y=\"-19.3\" font-family=\"Times,serif\" font-size=\"14.00\">c</text>\n",
       "</g>\n",
       "<!-- 0 -->\n",
       "<g id=\"node6\" class=\"node\">\n",
       "<title>0</title>\n",
       "<polygon fill=\"#ffe6cc\" stroke=\"black\" points=\"100.5,-41 46.5,-41 46.5,-5 100.5,-5 100.5,-41\"/>\n",
       "<text text-anchor=\"middle\" x=\"73.5\" y=\"-19.3\" font-family=\"Times,serif\" font-size=\"14.00\">False</text>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;o0 -->\n",
       "<g id=\"edge1\" class=\"edge\">\n",
       "<title>0&#45;&gt;o0:s</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M53,-41.16C44.99,-49.41 36.98,-60.06 33.86,-71.85\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"30.36,-71.62 32.5,-82 37.3,-72.56 30.36,-71.62\"/>\n",
       "</g>\n",
       "<!-- 0&#45;&gt;o1 -->\n",
       "<g id=\"edge2\" class=\"edge\">\n",
       "<title>0&#45;&gt;o1:s</title>\n",
       "<path fill=\"none\" stroke=\"black\" d=\"M94.5,-41.06C102.7,-49.29 110.9,-59.93 114.1,-71.79\"/>\n",
       "<polygon fill=\"black\" stroke=\"black\" points=\"110.67,-72.57 115.5,-82 117.61,-71.62 110.67,-72.57\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>\n"
      ],
      "text/plain": [
       "<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7fa5cc19cd80> >"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "spot.mealy_machine_to_aig(m, \"isop\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d970bf6a",
   "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.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
