Warning, /education/cantor/src/test/data/Automata and Computability using Jupyter.ipynb is written in an unsupported language. File is not indexed.

0001 {
0002  "cells": [
0003   {
0004    "cell_type": "markdown",
0005    "metadata": {
0006     "run_control": {
0007      "frozen": false,
0008      "read_only": false
0009     }
0010    },
0011    "source": [
0012     "# Jove helps teach models of computation using Jupyter \n",
0013     "\n",
0014     "Included are modules on:\n",
0015     "\n",
0016     "* Sets, strings and languages\n",
0017     "* Language operations\n",
0018     "* Construction of and operations on DFA and NFA\n",
0019     "* Regular expression parsing and automata inter-conversion\n",
0020     "* Derivate-based parsing\n",
0021     "* Pushdown automata\n",
0022     "* The construction of parsers using context-free productions, including\n",
0023     "  a full lexer/parser for Jove's own markdown syntax\n",
0024     "* Studies of parsing: ambiguity, associativity, precedence\n",
0025     "* Turing machines (including one for the Collatz problem)\n",
0026     "\n",
0027     "For a complete Jove top-level reference, kindly refer to https://github.com/ganeshutah/Jove from where you can download and obtain Jove. You can also visit this Github link now and poke around (the NBViewer will display the contents).\n",
0028     "\n",
0029     "Once you are in the top-level Gallery link we provide, feel free to explore the hierarchy of modules found there.\n",
0030     "\n",
0031     "These notebooks should give you an idea of the contents.\n",
0032     "\n",
0033     "* [DFA Illustrations (has a Youtube)](http://nbviewer.jupyter.org/github/ganeshutah/Jove/blob/master/notebooks/tutorial/DFAUnit2.ipynb)\n",
0034     "\n",
0035     "* [Regular Operations](http://nbviewer.jupyter.org/github/ganeshutah/Jove/blob/master/notebooks/driver/Drive_AllRegularOps.ipynb)\n",
0036     "\n",
0037     "* [PDA Operations](http://nbviewer.jupyter.org/github/ganeshutah/Jove/blob/master/notebooks/driver/Drive_PDA_Based_Parsing.ipynb)\n",
0038     "\n",
0039     "* [TM Operations](http://nbviewer.jupyter.org/github/ganeshutah/Jove/blob/master/notebooks/driver/Drive_TM.ipynb)"
0040    ]
0041   },
0042   {
0043    "cell_type": "code",
0044    "execution_count": 1,
0045    "metadata": {
0046     "run_control": {
0047      "frozen": false,
0048      "read_only": false
0049     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QyJxTkkm1fXdsvYuf269Ide1WCzWslCPU12R/TW4HrYPJ8N9vsfBtylTq3SVpwVlbestjNjPthjq1OpTnVTjNp2UUrJO+Vctm2+ztA9hB47jvtVXxFTpKlOlm6Po45ekWXVtTjaWktdoo/auvGpOr0dGVWWvSSUs0eqo6da26/a2B7EDyX0X9t8XhaKowjSlGLbTmptq7va+bYa/WPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08HmHrHxv5WH7s/OPWPjfysP3Z+cD08rr+z8TzT1j438rD92fnIz/ALRcY1Z0sP3Z+YD0kHmnrCxn5WH7s/MPWFjPysP3Z+YD0shVbS001S+bPN/WFjPysP3Z+YP+0HFtWdLDv+GfmA9FpTbdnfZvSW8sxf4T7Poeax+3+LWyjhl/BPzHan9oOMlHK6WHt+7PzAfJgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/9k=\n",
0055       "text/html": [
0056        "\n",
0057        "        <iframe\n",
0058        "            width=\"400\"\n",
0059        "            height=\"300\"\n",
0060        "            src=\"https://www.youtube.com/embed/dGcLHtYLgDU\"\n",
0061        "            frameborder=\"0\"\n",
0062        "            allowfullscreen\n",
0063        "        ></iframe>\n",
0064        "        "
0065       ],
0066       "text/plain": [
0067        "<IPython.lib.display.YouTubeVideo at 0x7fa7a1ee4c50>"
0068       ]
0069      },
0070      "execution_count": 1,
0071      "metadata": {},
0072      "output_type": "execute_result"
0073     }
0074    ],
0075    "source": [
0076     "from IPython.display import YouTubeVideo\n",
0077     "YouTubeVideo('dGcLHtYLgDU')"
0078    ]
0079   },
0080   {
0081    "cell_type": "code",
0082    "execution_count": 2,
0083    "metadata": {
0084     "run_control": {
0085      "frozen": false,
0086      "read_only": false
0087     }
0088    },
0089    "outputs": [
0090     {
0091      "name": "stdout",
0092      "output_type": "stream",
0093      "text": [
0094       "You may use any of these help commands:\n",
0095       "help(ResetStNum)\n",
0096       "help(NxtStateStr)\n",
0097       "\n",
0098       "You may use any of these help commands:\n",
0099       "help(mkp_dfa)\n",
0100       "help(mk_dfa)\n",
0101       "help(totalize_dfa)\n",
0102       "help(addtosigma_delta)\n",
0103       "help(step_dfa)\n",
0104       "help(run_dfa)\n",
0105       "help(accepts_dfa)\n",
0106       "help(comp_dfa)\n",
0107       "help(union_dfa)\n",
0108       "help(intersect_dfa)\n",
0109       "help(pruneUnreach)\n",
0110       "help(iso_dfa)\n",
0111       "help(langeq_dfa)\n",
0112       "help(same_status)\n",
0113       "help(h_langeq_dfa)\n",
0114       "help(fixptDist)\n",
0115       "help(min_dfa)\n",
0116       "help(pairFR)\n",
0117       "help(state_combos)\n",
0118       "help(sepFinNonFin)\n",
0119       "help(bash_eql_classes)\n",
0120       "help(listminus)\n",
0121       "help(bash_1)\n",
0122       "help(mk_rep_eqc)\n",
0123       "help(F_of)\n",
0124       "help(rep_of_s)\n",
0125       "help(q0_of)\n",
0126       "help(Delta_of)\n",
0127       "help(mk_state_eqc_name)\n",
0128       "\n",
0129       "You may use any of these help commands:\n",
0130       "help(mk_nfa)\n",
0131       "help(totalize_nfa)\n",
0132       "help(step_nfa)\n",
0133       "help(run_nfa)\n",
0134       "help(ec_step_nfa)\n",
0135       "help(Eclosure)\n",
0136       "help(Echelp)\n",
0137       "help(accepts_nfa)\n",
0138       "help(nfa2dfa)\n",
0139       "help(n2d)\n",
0140       "help(inSets)\n",
0141       "help(rev_dfa)\n",
0142       "help(min_dfa_brz)\n",
0143       "\n",
0144       "You may use any of these help commands:\n",
0145       "help(re2nfa)\n",
0146       "\n",
0147       "You may use any of these help commands:\n",
0148       "help(RE2Str)\n",
0149       "help(mk_gnfa)\n",
0150       "help(mk_gnfa_from_D)\n",
0151       "help(dfa2nfa)\n",
0152       "help(del_gnfa_states)\n",
0153       "help(gnfa_w_REStr)\n",
0154       "help(del_one_gnfa_state)\n",
0155       "help(Edges_Exist_Via)\n",
0156       "help(choose_state_to_del)\n",
0157       "help(form_alt_RE)\n",
0158       "help(form_concat_RE)\n",
0159       "help(form_kleene_RE)\n",
0160       "\n",
0161       "You may use any of these help commands:\n",
0162       "help(md2mc)\n",
0163       ".. and if you want to dig more, then ..\n",
0164       "help(default_line_attr)\n",
0165       "help(length_ok_input_items)\n",
0166       "help(union_line_attr_list_fld)\n",
0167       "help(extend_rsltdict)\n",
0168       "help(form_delta)\n",
0169       "help(get_machine_components)\n",
0170       "\n"
0171      ]
0172     }
0173    ],
0174    "source": [
0175     "import sys\n",
0176     "sys.path[0:0] = ['/home/mmmm1998/Документы/Репозитории/Jove','/home/mmmm1998/Документы/Репозитории/Jove/3rdparty'] # Put these at the head of the search path\n",
0177     "from jove.DotBashers import *\n",
0178     "from jove.Def_DFA import *\n",
0179     "from jove.Def_NFA import *\n",
0180     "from jove.Def_RE2NFA import *\n",
0181     "from jove.Def_NFA2RE import *\n",
0182     "from jove.Def_md2mc import *"
0183    ]
0184   },
0185   {
0186    "cell_type": "markdown",
0187    "metadata": {
0188     "run_control": {
0189      "frozen": false,
0190      "read_only": false
0191     }
0192    },
0193    "source": [
0194     " # Jove allows you to set problems in markdown and have students solve"
0195    ]
0196   },
0197   {
0198    "cell_type": "markdown",
0199    "metadata": {
0200     "run_control": {
0201      "frozen": false,
0202      "read_only": false
0203     }
0204    },
0205    "source": [
0206     "1) LOdd1Three0 : Set of strings over {0,1} with an odd # of 1s OR exactly three 0s. \n",
0207     "\n",
0208     "* Hint on how to arrive at the language:\n",
0209     "\n",
0210     "  - develop NFAs for the two cases and perform their union. Obtain DFA\n",
0211     "\n",
0212     "  - develop REs for the two cases and perform the union. \n",
0213     "\n",
0214     "  - Testing the creations:\n",
0215     "\n",
0216     "    .   Come up with language for even # of 1s and separately for \"other than three 0s\". \n",
0217     " \n",
0218     "    .   Do two intersections. \n",
0219     " \n",
0220     "    .   Is the language empty?\n",
0221     "\n",
0222     "\n",
0223     "2) Language of strings over {0,1} with exactly two occurrences of 0101 in it.\n",
0224     "\n",
0225     " * Come up with it directly (take overlaps into account, i.e. 010101 has two occurrences in it\n",
0226     "\n",
0227     " * Come up in another way\n",
0228     "\n",
0229     "Notes:\n",
0230     "\n",
0231     "* Most of the problem students will have in this course is interpreting English (technical English)\n",
0232     "\n",
0233     "* So again, read the writeup at the beginning of Module6 (should be ready soon today) and work on using the tool.\n",
0234     "\n",
0235     "\n",
0236     "\n"
0237    ]
0238   },
0239   {
0240    "cell_type": "markdown",
0241    "metadata": {
0242     "run_control": {
0243      "frozen": false,
0244      "read_only": false
0245     }
0246    },
0247    "source": [
0248     "__Solutions__\n",
0249     "\n",
0250     "1) LOdd1Three0 : Set of strings over {0,1} with an odd # of 1s OR exactly three 0s. \n",
0251     "\n",
0252     "* Hint on how to arrive at the language:\n",
0253     "\n",
0254     "  - develop NFAs for the two cases and perform their union. Obtain DFA\n",
0255     "\n",
0256     "  - develop REs for the two cases and perform the union. \n",
0257     "\n",
0258     "  - Testing the creations:\n",
0259     "\n",
0260     "    .   Come up with language for even # of 1s and separately for \"other than three 0s\". \n",
0261     " \n",
0262     "    .   Do two intersections. \n",
0263     " \n",
0264     "    .   Is the language empty?\n",
0265     "\n",
0266     "\n",
0267     "2) Language of strings over {0,1} with exactly two occurrences of 0101 in it.\n",
0268     "\n",
0269     " * Come up with it directly (take overlaps into account, i.e. 010101 has two occurrences in it\n",
0270     "\n",
0271     " * Come up in another way\n",
0272     "\n",
0273     "Notes:\n",
0274     "\n",
0275     "* Most of the problem students will have in this course is interpreting English (technical English)\n",
0276     "\n",
0277     "* So again, read the writeup at the beginning of Module6 (should be ready soon today) and work on using the tool.\n",
0278     "\n",
0279     "\n",
0280     "\n"
0281    ]
0282   },
0283   {
0284    "cell_type": "code",
0285    "execution_count": 3,
0286    "metadata": {
0287     "run_control": {
0288      "frozen": false,
0289      "read_only": false
0290     }
0291    },
0292    "outputs": [
0293     {
0294      "data": {
0295       "image/svg+xml": [
0296        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
0297        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
0298        " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
0299        "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n",
0300        " -->\n",
0301        "<!-- Title: %3 Pages: 1 -->\n",
0302        "<svg width=\"337pt\" height=\"130pt\"\n",
0303        " viewBox=\"0.00 0.00 337.49 130.50\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
0304        "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 126.496)\">\n",
0305        "<title>%3</title>\n",
0306        "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-126.496 333.4879,-126.496 333.4879,4 -4,4\"/>\n",
0307        "<!-- EMPTY -->\n",
0308        "<g id=\"node1\" class=\"node\">\n",
0309        "<title>EMPTY</title>\n",
0310        "</g>\n",
0311        "<!-- St6 -->\n",
0312        "<g id=\"node4\" class=\"node\">\n",
0313        "<title>St6</title>\n",
0314        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"117.748\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0315        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"117.748\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0316        "<text text-anchor=\"middle\" x=\"117.748\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St6</text>\n",
0317        "</g>\n",
0318        "<!-- EMPTY&#45;&gt;St6 -->\n",
0319        "<g id=\"edge1\" class=\"edge\">\n",
0320        "<title>EMPTY&#45;&gt;St6</title>\n",
0321        "<path fill=\"none\" stroke=\"#000000\" d=\"M54.2274,-26.748C62.5578,-26.748 71.8652,-26.748 80.7317,-26.748\"/>\n",
0322        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"80.8526,-30.2481 90.8525,-26.748 80.8525,-23.2481 80.8526,-30.2481\"/>\n",
0323        "</g>\n",
0324        "<!-- St7 -->\n",
0325        "<g id=\"node2\" class=\"node\">\n",
0326        "<title>St7</title>\n",
0327        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"210.2439\" cy=\"-66.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0328        "<text text-anchor=\"middle\" x=\"210.2439\" y=\"-63.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St7</text>\n",
0329        "</g>\n",
0330        "<!-- St7&#45;&gt;St7 -->\n",
0331        "<g id=\"edge4\" class=\"edge\">\n",
0332        "<title>St7&#45;&gt;St7</title>\n",
0333        "<path fill=\"none\" stroke=\"#000000\" d=\"M202.1954,-88.1313C201.2017,-98.4165 203.8846,-107.496 210.2439,-107.496 214.3179,-107.496 216.8831,-103.7698 217.9393,-98.3874\"/>\n",
0334        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"221.4462,-98.2458 218.2925,-88.1313 214.4503,-98.0048 221.4462,-98.2458\"/>\n",
0335        "<text text-anchor=\"middle\" x=\"210.2439\" y=\"-111.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0336        "</g>\n",
0337        "<!-- St3 -->\n",
0338        "<g id=\"node3\" class=\"node\">\n",
0339        "<title>St3</title>\n",
0340        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"302.7399\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0341        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"302.7399\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0342        "<text text-anchor=\"middle\" x=\"302.7399\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St3</text>\n",
0343        "</g>\n",
0344        "<!-- St7&#45;&gt;St3 -->\n",
0345        "<g id=\"edge5\" class=\"edge\">\n",
0346        "<title>St7&#45;&gt;St3</title>\n",
0347        "<path fill=\"none\" stroke=\"#000000\" d=\"M231.2327,-57.6714C242.276,-52.8957 256.0912,-46.9213 268.6265,-41.5004\"/>\n",
0348        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"270.1064,-44.6737 277.8957,-37.4919 267.3279,-38.2487 270.1064,-44.6737\"/>\n",
0349        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-51.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0350        "</g>\n",
0351        "<!-- St3&#45;&gt;St3 -->\n",
0352        "<g id=\"edge6\" class=\"edge\">\n",
0353        "<title>St3&#45;&gt;St3</title>\n",
0354        "<path fill=\"none\" stroke=\"#000000\" d=\"M298.2498,-53.3928C298.1026,-63.3224 299.5993,-71.496 302.7399,-71.496 304.7028,-71.496 306.0235,-68.3032 306.7021,-63.4843\"/>\n",
0355        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"310.2027,-63.562 307.23,-53.3928 303.2123,-63.1963 310.2027,-63.562\"/>\n",
0356        "<text text-anchor=\"middle\" x=\"302.7399\" y=\"-75.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0357        "</g>\n",
0358        "<!-- St3&#45;&gt;St3 -->\n",
0359        "<g id=\"edge7\" class=\"edge\">\n",
0360        "<title>St3&#45;&gt;St3</title>\n",
0361        "<path fill=\"none\" stroke=\"#000000\" d=\"M294.7089,-52.5298C292.0942,-71.0489 294.7712,-89.496 302.7399,-89.496 309.2145,-89.496 312.1957,-77.318 311.6836,-62.8181\"/>\n",
0362        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"315.1409,-62.1814 310.7709,-52.5298 308.1683,-62.8 315.1409,-62.1814\"/>\n",
0363        "<text text-anchor=\"middle\" x=\"302.7399\" y=\"-93.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0364        "</g>\n",
0365        "<!-- St6&#45;&gt;St7 -->\n",
0366        "<g id=\"edge2\" class=\"edge\">\n",
0367        "<title>St6&#45;&gt;St7</title>\n",
0368        "<path fill=\"none\" stroke=\"#000000\" d=\"M142.5352,-37.4672C154.0203,-42.434 167.7743,-48.3819 179.8769,-53.6157\"/>\n",
0369        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"178.5861,-56.8707 189.1539,-57.6276 181.3647,-50.4458 178.5861,-56.8707\"/>\n",
0370        "<text text-anchor=\"middle\" x=\"165.996\" y=\"-51.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0371        "</g>\n",
0372        "<!-- St6&#45;&gt;St3 -->\n",
0373        "<g id=\"edge3\" class=\"edge\">\n",
0374        "<title>St6&#45;&gt;St3</title>\n",
0375        "<path fill=\"none\" stroke=\"#000000\" d=\"M144.5288,-23.4275C157.4841,-21.9831 173.275,-20.4598 187.496,-19.748 207.6911,-18.7371 212.7968,-18.7371 232.9919,-19.748 243.6576,-20.2819 255.2064,-21.2722 265.7798,-22.3433\"/>\n",
0376        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"265.6447,-25.8486 275.9591,-23.4275 266.3861,-18.888 265.6447,-25.8486\"/>\n",
0377        "<text text-anchor=\"middle\" x=\"210.2439\" y=\"-23.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0378        "</g>\n",
0379        "</g>\n",
0380        "</svg>\n"
0381       ],
0382       "text/plain": [
0383        "<graphviz.dot.Digraph at 0x7fa7a1407eb8>"
0384       ]
0385      },
0386      "execution_count": 3,
0387      "metadata": {},
0388      "output_type": "execute_result"
0389     }
0390    ],
0391    "source": [
0392     "RE_Odd1s  = \"(0* 1 0* (1 0* 1 0)*)*\"\n",
0393     "NFA_Odd1s = re2nfa(RE_Odd1s)\n",
0394     "DO_Odd1s  = dotObj_dfa(min_dfa(nfa2dfa(NFA_Odd1s)))\n",
0395     "DO_Odd1s"
0396    ]
0397   },
0398   {
0399    "cell_type": "code",
0400    "execution_count": 4,
0401    "metadata": {
0402     "run_control": {
0403      "frozen": false,
0404      "read_only": false
0405     }
0406    },
0407    "outputs": [
0408     {
0409      "data": {
0410       "image/svg+xml": [
0411        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
0412        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
0413        " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
0414        "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n",
0415        " -->\n",
0416        "<!-- Title: %3 Pages: 1 -->\n",
0417        "<svg width=\"658pt\" height=\"284pt\"\n",
0418        " viewBox=\"0.00 0.00 658.17 284.40\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
0419        "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 280.3956)\">\n",
0420        "<title>%3</title>\n",
0421        "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-280.3956 654.173,-280.3956 654.173,4 -4,4\"/>\n",
0422        "<!-- EMPTY -->\n",
0423        "<g id=\"node1\" class=\"node\">\n",
0424        "<title>EMPTY</title>\n",
0425        "</g>\n",
0426        "<!-- St3 -->\n",
0427        "<g id=\"node2\" class=\"node\">\n",
0428        "<title>St3</title>\n",
0429        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"113.748\" cy=\"-64.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0430        "<text text-anchor=\"middle\" x=\"113.748\" y=\"-61.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St3</text>\n",
0431        "</g>\n",
0432        "<!-- EMPTY&#45;&gt;St3 -->\n",
0433        "<g id=\"edge1\" class=\"edge\">\n",
0434        "<title>EMPTY&#45;&gt;St3</title>\n",
0435        "<path fill=\"none\" stroke=\"#000000\" d=\"M54.4476,-64.748C62.7759,-64.748 72.0138,-64.748 80.671,-64.748\"/>\n",
0436        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"80.8425,-68.2481 90.8425,-64.748 80.8425,-61.2481 80.8425,-68.2481\"/>\n",
0437        "</g>\n",
0438        "<!-- St28 -->\n",
0439        "<g id=\"node4\" class=\"node\">\n",
0440        "<title>St28</title>\n",
0441        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-102.748\" rx=\"26.7961\" ry=\"26.7961\"/>\n",
0442        "<text text-anchor=\"middle\" x=\"206.2439\" y=\"-99.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St28</text>\n",
0443        "</g>\n",
0444        "<!-- St3&#45;&gt;St28 -->\n",
0445        "<g id=\"edge2\" class=\"edge\">\n",
0446        "<title>St3&#45;&gt;St28</title>\n",
0447        "<path fill=\"none\" stroke=\"#000000\" d=\"M135.2009,-73.5615C146.0654,-78.0249 159.5218,-83.5532 171.7913,-88.5939\"/>\n",
0448        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"170.7247,-91.9395 181.3046,-92.5022 173.3848,-85.4646 170.7247,-91.9395\"/>\n",
0449        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-87.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0450        "</g>\n",
0451        "<!-- St2 -->\n",
0452        "<g id=\"node9\" class=\"node\">\n",
0453        "<title>St2</title>\n",
0454        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0455        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0456        "<text text-anchor=\"middle\" x=\"206.2439\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St2</text>\n",
0457        "</g>\n",
0458        "<!-- St3&#45;&gt;St2 -->\n",
0459        "<g id=\"edge3\" class=\"edge\">\n",
0460        "<title>St3&#45;&gt;St2</title>\n",
0461        "<path fill=\"none\" stroke=\"#000000\" d=\"M135.2009,-55.9345C146.0654,-51.4711 159.5218,-45.9428 171.7913,-40.9021\"/>\n",
0462        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"173.3848,-44.0314 181.3046,-36.9938 170.7247,-37.5565 173.3848,-44.0314\"/>\n",
0463        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-51.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0464        "</g>\n",
0465        "<!-- St7 -->\n",
0466        "<g id=\"node3\" class=\"node\">\n",
0467        "<title>St7</title>\n",
0468        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"306.6396\" cy=\"-140.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0469        "<text text-anchor=\"middle\" x=\"306.6396\" y=\"-137.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St7</text>\n",
0470        "</g>\n",
0471        "<!-- St14 -->\n",
0472        "<g id=\"node7\" class=\"node\">\n",
0473        "<title>St14</title>\n",
0474        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"410.9348\" cy=\"-178.748\" rx=\"26.7766\" ry=\"26.7766\"/>\n",
0475        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"410.9348\" cy=\"-178.748\" rx=\"30.796\" ry=\"30.796\"/>\n",
0476        "<text text-anchor=\"middle\" x=\"410.9348\" y=\"-175.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St14</text>\n",
0477        "</g>\n",
0478        "<!-- St7&#45;&gt;St14 -->\n",
0479        "<g id=\"edge8\" class=\"edge\">\n",
0480        "<title>St7&#45;&gt;St14</title>\n",
0481        "<path fill=\"none\" stroke=\"#000000\" d=\"M328.2496,-148.6216C340.9751,-153.2582 357.4467,-159.2596 372.3352,-164.6842\"/>\n",
0482        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"371.2412,-168.0106 381.8351,-168.1455 373.6375,-161.4336 371.2412,-168.0106\"/>\n",
0483        "<text text-anchor=\"middle\" x=\"358.7872\" y=\"-164.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0484        "</g>\n",
0485        "<!-- St9 -->\n",
0486        "<g id=\"node10\" class=\"node\">\n",
0487        "<title>St9</title>\n",
0488        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"410.9348\" cy=\"-102.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0489        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"410.9348\" cy=\"-102.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0490        "<text text-anchor=\"middle\" x=\"410.9348\" y=\"-99.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St9</text>\n",
0491        "</g>\n",
0492        "<!-- St7&#45;&gt;St9 -->\n",
0493        "<g id=\"edge9\" class=\"edge\">\n",
0494        "<title>St7&#45;&gt;St9</title>\n",
0495        "<path fill=\"none\" stroke=\"#000000\" d=\"M322.6201,-124.4374C331.4358,-116.5952 343.0576,-107.993 355.2872,-103.748 361.135,-101.7181 367.5409,-100.6416 373.8592,-100.1683\"/>\n",
0496        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"374.3967,-103.6549 384.296,-99.8796 374.203,-96.6575 374.3967,-103.6549\"/>\n",
0497        "<text text-anchor=\"middle\" x=\"358.7872\" y=\"-107.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0498        "</g>\n",
0499        "<!-- St28&#45;&gt;St7 -->\n",
0500        "<g id=\"edge4\" class=\"edge\">\n",
0501        "<title>St28&#45;&gt;St7</title>\n",
0502        "<path fill=\"none\" stroke=\"#000000\" d=\"M231.319,-112.239C244.8151,-117.3473 261.5757,-123.6912 275.8574,-129.0969\"/>\n",
0503        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"274.6867,-132.396 285.2782,-132.6626 277.1647,-125.8493 274.6867,-132.396\"/>\n",
0504        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-125.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0505        "</g>\n",
0506        "<!-- St20 -->\n",
0507        "<g id=\"node8\" class=\"node\">\n",
0508        "<title>St20</title>\n",
0509        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"306.6396\" cy=\"-64.748\" rx=\"26.7766\" ry=\"26.7766\"/>\n",
0510        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"306.6396\" cy=\"-64.748\" rx=\"30.796\" ry=\"30.796\"/>\n",
0511        "<text text-anchor=\"middle\" x=\"306.6396\" y=\"-61.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St20</text>\n",
0512        "</g>\n",
0513        "<!-- St28&#45;&gt;St20 -->\n",
0514        "<g id=\"edge5\" class=\"edge\">\n",
0515        "<title>St28&#45;&gt;St20</title>\n",
0516        "<path fill=\"none\" stroke=\"#000000\" d=\"M224.4383,-82.9539C231.9312,-76.1751 241.1599,-69.3865 250.9919,-65.748 255.6192,-64.0356 260.6145,-62.9665 265.6469,-62.3523\"/>\n",
0517        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"266.1767,-65.8249 275.9228,-61.6699 265.7128,-58.8403 266.1767,-65.8249\"/>\n",
0518        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-69.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0519        "</g>\n",
0520        "<!-- St31 -->\n",
0521        "<g id=\"node5\" class=\"node\">\n",
0522        "<title>St31</title>\n",
0523        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"515.2301\" cy=\"-216.748\" rx=\"26.7961\" ry=\"26.7961\"/>\n",
0524        "<text text-anchor=\"middle\" x=\"515.2301\" y=\"-213.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St31</text>\n",
0525        "</g>\n",
0526        "<!-- St31&#45;&gt;St31 -->\n",
0527        "<g id=\"edge16\" class=\"edge\">\n",
0528        "<title>St31&#45;&gt;St31</title>\n",
0529        "<path fill=\"none\" stroke=\"#000000\" d=\"M505.5658,-241.9922C504.8993,-252.4937 508.1207,-261.3956 515.2301,-261.3956 519.7845,-261.3956 522.7434,-257.7423 524.1066,-252.3555\"/>\n",
0530        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"527.6262,-252.2288 524.8944,-241.9922 520.6464,-251.6981 527.6262,-252.2288\"/>\n",
0531        "<text text-anchor=\"middle\" x=\"515.2301\" y=\"-265.1956\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0532        "</g>\n",
0533        "<!-- St21 -->\n",
0534        "<g id=\"node11\" class=\"node\">\n",
0535        "<title>St21</title>\n",
0536        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"619.5254\" cy=\"-178.748\" rx=\"26.7766\" ry=\"26.7766\"/>\n",
0537        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"619.5254\" cy=\"-178.748\" rx=\"30.796\" ry=\"30.796\"/>\n",
0538        "<text text-anchor=\"middle\" x=\"619.5254\" y=\"-175.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St21</text>\n",
0539        "</g>\n",
0540        "<!-- St31&#45;&gt;St21 -->\n",
0541        "<g id=\"edge17\" class=\"edge\">\n",
0542        "<title>St31&#45;&gt;St21</title>\n",
0543        "<path fill=\"none\" stroke=\"#000000\" d=\"M534.3531,-197.7153C542.7017,-190.6783 553.0515,-183.5059 563.8777,-179.748 568.5389,-178.13 573.5546,-177.1177 578.5979,-176.5339\"/>\n",
0544        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"579.1261,-180.0075 588.884,-175.8803 578.6822,-173.0215 579.1261,-180.0075\"/>\n",
0545        "<text text-anchor=\"middle\" x=\"567.3777\" y=\"-183.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0546        "</g>\n",
0547        "<!-- St13 -->\n",
0548        "<g id=\"node6\" class=\"node\">\n",
0549        "<title>St13</title>\n",
0550        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"515.2301\" cy=\"-140.748\" rx=\"26.7766\" ry=\"26.7766\"/>\n",
0551        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"515.2301\" cy=\"-140.748\" rx=\"30.796\" ry=\"30.796\"/>\n",
0552        "<text text-anchor=\"middle\" x=\"515.2301\" y=\"-137.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St13</text>\n",
0553        "</g>\n",
0554        "<!-- St13&#45;&gt;St14 -->\n",
0555        "<g id=\"edge19\" class=\"edge\">\n",
0556        "<title>St13&#45;&gt;St14</title>\n",
0557        "<path fill=\"none\" stroke=\"#000000\" d=\"M484.8466,-135.5746C476.4631,-135.2331 467.5,-135.9109 459.5825,-138.748 452.6474,-141.233 445.9931,-145.1807 439.9521,-149.6489\"/>\n",
0558        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"437.7019,-146.9673 432.1259,-155.9762 442.1028,-152.4109 437.7019,-146.9673\"/>\n",
0559        "<text text-anchor=\"middle\" x=\"463.0825\" y=\"-142.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0560        "</g>\n",
0561        "<!-- St13&#45;&gt;St21 -->\n",
0562        "<g id=\"edge18\" class=\"edge\">\n",
0563        "<title>St13&#45;&gt;St21</title>\n",
0564        "<path fill=\"none\" stroke=\"#000000\" d=\"M544.5449,-149.7622C553.0822,-152.5135 562.3932,-155.6369 570.8777,-158.748 574.3848,-160.0339 578.0132,-161.4196 581.6347,-162.8402\"/>\n",
0565        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"580.5318,-166.1688 591.1162,-166.638 583.1346,-159.6706 580.5318,-166.1688\"/>\n",
0566        "<text text-anchor=\"middle\" x=\"567.3777\" y=\"-162.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0567        "</g>\n",
0568        "<!-- St14&#45;&gt;St31 -->\n",
0569        "<g id=\"edge12\" class=\"edge\">\n",
0570        "<title>St14&#45;&gt;St31</title>\n",
0571        "<path fill=\"none\" stroke=\"#000000\" d=\"M439.9869,-189.3331C452.4748,-193.8831 467.1772,-199.2399 480.2569,-204.0055\"/>\n",
0572        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"479.2851,-207.3765 489.8791,-207.5113 481.6815,-200.7994 479.2851,-207.3765\"/>\n",
0573        "<text text-anchor=\"middle\" x=\"463.0825\" y=\"-202.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0574        "</g>\n",
0575        "<!-- St14&#45;&gt;St13 -->\n",
0576        "<g id=\"edge13\" class=\"edge\">\n",
0577        "<title>St14&#45;&gt;St13</title>\n",
0578        "<path fill=\"none\" stroke=\"#000000\" d=\"M439.9869,-168.1629C451.4012,-164.0041 464.6656,-159.1712 476.8498,-154.7318\"/>\n",
0579        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"478.1363,-157.9883 486.3339,-151.2763 475.7399,-151.4112 478.1363,-157.9883\"/>\n",
0580        "<text text-anchor=\"middle\" x=\"463.0825\" y=\"-164.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0581        "</g>\n",
0582        "<!-- St20&#45;&gt;St28 -->\n",
0583        "<g id=\"edge11\" class=\"edge\">\n",
0584        "<title>St20&#45;&gt;St28</title>\n",
0585        "<path fill=\"none\" stroke=\"#000000\" d=\"M277.6189,-75.7324C266.1742,-80.0642 252.9312,-85.0767 240.983,-89.5991\"/>\n",
0586        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"239.4325,-86.4436 231.319,-93.257 241.9105,-92.9904 239.4325,-86.4436\"/>\n",
0587        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-89.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0588        "</g>\n",
0589        "<!-- St20&#45;&gt;St9 -->\n",
0590        "<g id=\"edge10\" class=\"edge\">\n",
0591        "<title>St20&#45;&gt;St9</title>\n",
0592        "<path fill=\"none\" stroke=\"#000000\" d=\"M335.8929,-74.4706C344.4288,-77.3792 353.7545,-80.6267 362.2872,-83.748 366.8881,-85.431 371.7139,-87.25 376.4648,-89.0725\"/>\n",
0593        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"375.4262,-92.4237 386.0152,-92.7762 377.9572,-85.8973 375.4262,-92.4237\"/>\n",
0594        "<text text-anchor=\"middle\" x=\"358.7872\" y=\"-87.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0595        "</g>\n",
0596        "<!-- St2&#45;&gt;St3 -->\n",
0597        "<g id=\"edge7\" class=\"edge\">\n",
0598        "<title>St2&#45;&gt;St3</title>\n",
0599        "<path fill=\"none\" stroke=\"#000000\" d=\"M179.7427,-23.0296C171.4174,-22.8306 162.3533,-23.6528 154.496,-26.748 147.4422,-29.5266 140.8882,-34.1656 135.1892,-39.2654\"/>\n",
0600        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"132.6436,-36.8601 127.9809,-46.3738 137.5587,-41.8443 132.6436,-36.8601\"/>\n",
0601        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0602        "</g>\n",
0603        "<!-- St2&#45;&gt;St20 -->\n",
0604        "<g id=\"edge6\" class=\"edge\">\n",
0605        "<title>St2&#45;&gt;St20</title>\n",
0606        "<path fill=\"none\" stroke=\"#000000\" d=\"M231.55,-35.9221C239.9751,-39.0077 249.4001,-42.4932 257.9919,-45.748 261.4604,-47.0619 265.0625,-48.441 268.667,-49.831\"/>\n",
0607        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"267.5348,-53.1459 278.1238,-53.4983 270.0658,-46.6194 267.5348,-53.1459\"/>\n",
0608        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-49.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0609        "</g>\n",
0610        "<!-- St9&#45;&gt;St7 -->\n",
0611        "<g id=\"edge15\" class=\"edge\">\n",
0612        "<title>St9&#45;&gt;St7</title>\n",
0613        "<path fill=\"none\" stroke=\"#000000\" d=\"M385.6795,-111.9498C371.2741,-117.1984 353.0992,-123.8204 337.8108,-129.3907\"/>\n",
0614        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"336.4472,-126.1624 328.2496,-132.8744 338.8436,-132.7395 336.4472,-126.1624\"/>\n",
0615        "<text text-anchor=\"middle\" x=\"358.7872\" y=\"-126.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0616        "</g>\n",
0617        "<!-- St9&#45;&gt;St13 -->\n",
0618        "<g id=\"edge14\" class=\"edge\">\n",
0619        "<title>St9&#45;&gt;St13</title>\n",
0620        "<path fill=\"none\" stroke=\"#000000\" d=\"M437.5736,-99.8796C446.9662,-99.7337 457.4541,-100.5794 466.5825,-103.748 473.0481,-105.9923 479.3439,-109.4545 485.1449,-113.3783\"/>\n",
0621        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"483.1298,-116.2411 493.2522,-119.3695 487.29,-110.6115 483.1298,-116.2411\"/>\n",
0622        "<text text-anchor=\"middle\" x=\"463.0825\" y=\"-107.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0623        "</g>\n",
0624        "<!-- St21&#45;&gt;St31 -->\n",
0625        "<g id=\"edge21\" class=\"edge\">\n",
0626        "<title>St21&#45;&gt;St31</title>\n",
0627        "<path fill=\"none\" stroke=\"#000000\" d=\"M590.4517,-189.341C577.9381,-193.9003 563.2043,-199.2686 550.1084,-204.0401\"/>\n",
0628        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"548.6747,-200.8373 540.4771,-207.5492 551.0711,-207.4143 548.6747,-200.8373\"/>\n",
0629        "<text text-anchor=\"middle\" x=\"567.3777\" y=\"-202.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0630        "</g>\n",
0631        "<!-- St21&#45;&gt;St21 -->\n",
0632        "<g id=\"edge20\" class=\"edge\">\n",
0633        "<title>St21&#45;&gt;St21</title>\n",
0634        "<path fill=\"none\" stroke=\"#000000\" d=\"M609.7849,-208.1969C609.5754,-218.773 612.8222,-227.3956 619.5254,-227.3956 623.8196,-227.3956 626.6953,-223.8569 628.1525,-218.5328\"/>\n",
0635        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"631.6747,-218.5142 629.2659,-208.1969 624.715,-217.7645 631.6747,-218.5142\"/>\n",
0636        "<text text-anchor=\"middle\" x=\"619.5254\" y=\"-231.1956\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0637        "</g>\n",
0638        "</g>\n",
0639        "</svg>\n"
0640       ],
0641       "text/plain": [
0642        "<graphviz.dot.Digraph at 0x7fa7a169b8d0>"
0643       ]
0644      },
0645      "execution_count": 4,
0646      "metadata": {},
0647      "output_type": "execute_result"
0648     }
0649    ],
0650    "source": [
0651     "RE_Ex3z = \"1* 0 1* 0 1* 0 1* + (0* 1 0* (1 0* 1 0*)*)\"\n",
0652     "NFA_Ex3z = re2nfa(RE_Ex3z)\n",
0653     "DO_Ex3z  = dotObj_dfa(min_dfa(nfa2dfa(NFA_Ex3z)))\n",
0654     "DO_Ex3z"
0655    ]
0656   },
0657   {
0658    "cell_type": "markdown",
0659    "metadata": {
0660     "run_control": {
0661      "frozen": false,
0662      "read_only": false
0663     }
0664    },
0665    "source": [
0666     "# Check out all remaining modules of Jove covering these\n",
0667     "\n",
0668     "* Brzozowski derivatives for parsing\n",
0669     "* Brzozowski minimization\n",
0670     "* Context-free parsing\n",
0671     "* (soon to come) [Binary Decision Diagrams; obtain now from software/ at](http://www.cs.utah.edu/fv)\n",
0672     "* (soon to come) Post Correspondence Problem"
0673    ]
0674   },
0675   {
0676    "cell_type": "markdown",
0677    "metadata": {
0678     "run_control": {
0679      "frozen": false,
0680      "read_only": false
0681     }
0682    },
0683    "source": [
0684     "# Brzozowski's minimization defined\n",
0685     "\n",
0686     "It is nothing but these steps done in this order:\n",
0687     "\n",
0688     "* Reverse\n",
0689     "* Determinize\n",
0690     "* Reverse\n",
0691     "* Determinize\n",
0692     "\n",
0693     "Voila! The machine is now minimal!"
0694    ]
0695   },
0696   {
0697    "cell_type": "code",
0698    "execution_count": 5,
0699    "metadata": {
0700     "run_control": {
0701      "frozen": false,
0702      "read_only": false
0703     }
0704    },
0705    "outputs": [],
0706    "source": [
0707     "# The above example, with min_dfa replaced by the rev;det;rev;det\n",
0708     "\n",
0709     "DofNFA_Ex3z = nfa2dfa(re2nfa(\"1* 0 1* 0 1* 0 1* + (0* 1 0* (1 0* 1 0*)*)\"))\n",
0710     "dotObj_dfa(DofNFA_Ex3z)\n",
0711     "dotObj_dfa(DofNFA_Ex3z)\n",
0712     "minDofNFA_Ex3z = nfa2dfa(rev_dfa(nfa2dfa(rev_dfa(DofNFA_Ex3z))))"
0713    ]
0714   },
0715   {
0716    "cell_type": "code",
0717    "execution_count": 6,
0718    "metadata": {
0719     "run_control": {
0720      "frozen": false,
0721      "read_only": false
0722     }
0723    },
0724    "outputs": [
0725     {
0726      "data": {
0727       "image/svg+xml": [
0728        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
0729        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
0730        " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
0731        "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n",
0732        " -->\n",
0733        "<!-- Title: %3 Pages: 1 -->\n",
0734        "<svg width=\"627pt\" height=\"280pt\"\n",
0735        " viewBox=\"0.00 0.00 626.98 280.50\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
0736        "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 276.496)\">\n",
0737        "<title>%3</title>\n",
0738        "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-276.496 622.9758,-276.496 622.9758,4 -4,4\"/>\n",
0739        "<!-- EMPTY -->\n",
0740        "<g id=\"node1\" class=\"node\">\n",
0741        "<title>EMPTY</title>\n",
0742        "</g>\n",
0743        "<!-- St0 -->\n",
0744        "<g id=\"node5\" class=\"node\">\n",
0745        "<title>St0</title>\n",
0746        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"113.748\" cy=\"-64.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0747        "<text text-anchor=\"middle\" x=\"113.748\" y=\"-61.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St0</text>\n",
0748        "</g>\n",
0749        "<!-- EMPTY&#45;&gt;St0 -->\n",
0750        "<g id=\"edge1\" class=\"edge\">\n",
0751        "<title>EMPTY&#45;&gt;St0</title>\n",
0752        "<path fill=\"none\" stroke=\"#000000\" d=\"M54.4476,-64.748C62.7759,-64.748 72.0138,-64.748 80.671,-64.748\"/>\n",
0753        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"80.8425,-68.2481 90.8425,-64.748 80.8425,-61.2481 80.8425,-68.2481\"/>\n",
0754        "</g>\n",
0755        "<!-- St4 -->\n",
0756        "<g id=\"node2\" class=\"node\">\n",
0757        "<title>St4</title>\n",
0758        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-102.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0759        "<text text-anchor=\"middle\" x=\"206.2439\" y=\"-99.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St4</text>\n",
0760        "</g>\n",
0761        "<!-- St2 -->\n",
0762        "<g id=\"node4\" class=\"node\">\n",
0763        "<title>St2</title>\n",
0764        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"302.7399\" cy=\"-140.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0765        "<text text-anchor=\"middle\" x=\"302.7399\" y=\"-137.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St2</text>\n",
0766        "</g>\n",
0767        "<!-- St4&#45;&gt;St2 -->\n",
0768        "<g id=\"edge4\" class=\"edge\">\n",
0769        "<title>St4&#45;&gt;St2</title>\n",
0770        "<path fill=\"none\" stroke=\"#000000\" d=\"M227.6595,-111.1814C240.6522,-116.2979 257.4514,-122.9134 271.8638,-128.589\"/>\n",
0771        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"270.7972,-131.9305 281.3842,-132.3381 273.3621,-125.4174 270.7972,-131.9305\"/>\n",
0772        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-126.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0773        "</g>\n",
0774        "<!-- St7 -->\n",
0775        "<g id=\"node10\" class=\"node\">\n",
0776        "<title>St7</title>\n",
0777        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"302.7399\" cy=\"-64.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0778        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"302.7399\" cy=\"-64.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0779        "<text text-anchor=\"middle\" x=\"302.7399\" y=\"-61.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St7</text>\n",
0780        "</g>\n",
0781        "<!-- St4&#45;&gt;St7 -->\n",
0782        "<g id=\"edge5\" class=\"edge\">\n",
0783        "<title>St4&#45;&gt;St7</title>\n",
0784        "<path fill=\"none\" stroke=\"#000000\" d=\"M227.6595,-94.3145C239.5444,-89.6343 254.6142,-83.6998 268.1288,-78.3778\"/>\n",
0785        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"269.6048,-81.5582 277.6268,-74.6375 267.0398,-75.0451 269.6048,-81.5582\"/>\n",
0786        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-88.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0787        "</g>\n",
0788        "<!-- St5 -->\n",
0789        "<g id=\"node3\" class=\"node\">\n",
0790        "<title>St5</title>\n",
0791        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"495.7318\" cy=\"-216.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
0792        "<text text-anchor=\"middle\" x=\"495.7318\" y=\"-213.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St5</text>\n",
0793        "</g>\n",
0794        "<!-- St5&#45;&gt;St5 -->\n",
0795        "<g id=\"edge16\" class=\"edge\">\n",
0796        "<title>St5&#45;&gt;St5</title>\n",
0797        "<path fill=\"none\" stroke=\"#000000\" d=\"M486.9516,-238.1313C485.8676,-248.4165 488.7943,-257.496 495.7318,-257.496 500.1762,-257.496 502.9745,-253.7698 504.1268,-248.3874\"/>\n",
0798        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"507.6341,-248.2556 504.5121,-238.1313 500.6391,-247.9928 507.6341,-248.2556\"/>\n",
0799        "<text text-anchor=\"middle\" x=\"495.7318\" y=\"-261.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0800        "</g>\n",
0801        "<!-- St9 -->\n",
0802        "<g id=\"node7\" class=\"node\">\n",
0803        "<title>St9</title>\n",
0804        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"592.2278\" cy=\"-178.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0805        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"592.2278\" cy=\"-178.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0806        "<text text-anchor=\"middle\" x=\"592.2278\" y=\"-175.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St9</text>\n",
0807        "</g>\n",
0808        "<!-- St5&#45;&gt;St9 -->\n",
0809        "<g id=\"edge17\" class=\"edge\">\n",
0810        "<title>St5&#45;&gt;St9</title>\n",
0811        "<path fill=\"none\" stroke=\"#000000\" d=\"M517.1474,-208.3145C529.0322,-203.6343 544.102,-197.6998 557.6166,-192.3778\"/>\n",
0812        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"559.0927,-195.5582 567.1147,-188.6375 556.5277,-189.0451 559.0927,-195.5582\"/>\n",
0813        "<text text-anchor=\"middle\" x=\"543.9798\" y=\"-202.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0814        "</g>\n",
0815        "<!-- St3 -->\n",
0816        "<g id=\"node6\" class=\"node\">\n",
0817        "<title>St3</title>\n",
0818        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"399.2359\" cy=\"-178.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0819        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"399.2359\" cy=\"-178.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0820        "<text text-anchor=\"middle\" x=\"399.2359\" y=\"-175.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St3</text>\n",
0821        "</g>\n",
0822        "<!-- St2&#45;&gt;St3 -->\n",
0823        "<g id=\"edge8\" class=\"edge\">\n",
0824        "<title>St2&#45;&gt;St3</title>\n",
0825        "<path fill=\"none\" stroke=\"#000000\" d=\"M324.1555,-149.1814C336.0403,-153.8616 351.1101,-159.7961 364.6247,-165.1181\"/>\n",
0826        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"363.5358,-168.4509 374.1228,-168.8585 366.1007,-161.9377 363.5358,-168.4509\"/>\n",
0827        "<text text-anchor=\"middle\" x=\"350.9879\" y=\"-164.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0828        "</g>\n",
0829        "<!-- St8 -->\n",
0830        "<g id=\"node9\" class=\"node\">\n",
0831        "<title>St8</title>\n",
0832        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"399.2359\" cy=\"-102.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0833        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"399.2359\" cy=\"-102.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0834        "<text text-anchor=\"middle\" x=\"399.2359\" y=\"-99.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St8</text>\n",
0835        "</g>\n",
0836        "<!-- St2&#45;&gt;St8 -->\n",
0837        "<g id=\"edge9\" class=\"edge\">\n",
0838        "<title>St2&#45;&gt;St8</title>\n",
0839        "<path fill=\"none\" stroke=\"#000000\" d=\"M324.1555,-132.3145C336.0403,-127.6343 351.1101,-121.6998 364.6247,-116.3778\"/>\n",
0840        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"366.1007,-119.5582 374.1228,-112.6375 363.5358,-113.0451 366.1007,-119.5582\"/>\n",
0841        "<text text-anchor=\"middle\" x=\"350.9879\" y=\"-126.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0842        "</g>\n",
0843        "<!-- St0&#45;&gt;St4 -->\n",
0844        "<g id=\"edge2\" class=\"edge\">\n",
0845        "<title>St0&#45;&gt;St4</title>\n",
0846        "<path fill=\"none\" stroke=\"#000000\" d=\"M135.2009,-73.5615C147.1086,-78.4535 162.1298,-84.6246 175.2894,-90.031\"/>\n",
0847        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"174.3275,-93.4196 184.9074,-93.9823 176.9876,-86.9447 174.3275,-93.4196\"/>\n",
0848        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-87.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0849        "</g>\n",
0850        "<!-- St1 -->\n",
0851        "<g id=\"node11\" class=\"node\">\n",
0852        "<title>St1</title>\n",
0853        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0854        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"206.2439\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0855        "<text text-anchor=\"middle\" x=\"206.2439\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St1</text>\n",
0856        "</g>\n",
0857        "<!-- St0&#45;&gt;St1 -->\n",
0858        "<g id=\"edge3\" class=\"edge\">\n",
0859        "<title>St0&#45;&gt;St1</title>\n",
0860        "<path fill=\"none\" stroke=\"#000000\" d=\"M135.2009,-55.9345C146.0654,-51.4711 159.5218,-45.9428 171.7913,-40.9021\"/>\n",
0861        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"173.3848,-44.0314 181.3046,-36.9938 170.7247,-37.5565 173.3848,-44.0314\"/>\n",
0862        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-50.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0863        "</g>\n",
0864        "<!-- St3&#45;&gt;St5 -->\n",
0865        "<g id=\"edge12\" class=\"edge\">\n",
0866        "<title>St3&#45;&gt;St5</title>\n",
0867        "<path fill=\"none\" stroke=\"#000000\" d=\"M424.3371,-188.6328C436.708,-193.5045 451.7395,-199.4238 464.8132,-204.5723\"/>\n",
0868        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"463.7657,-207.9213 474.3527,-208.3289 466.3307,-201.4082 463.7657,-207.9213\"/>\n",
0869        "<text text-anchor=\"middle\" x=\"447.4839\" y=\"-202.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0870        "</g>\n",
0871        "<!-- St6 -->\n",
0872        "<g id=\"node8\" class=\"node\">\n",
0873        "<title>St6</title>\n",
0874        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"495.7318\" cy=\"-140.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
0875        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"495.7318\" cy=\"-140.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
0876        "<text text-anchor=\"middle\" x=\"495.7318\" y=\"-137.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St6</text>\n",
0877        "</g>\n",
0878        "<!-- St3&#45;&gt;St6 -->\n",
0879        "<g id=\"edge13\" class=\"edge\">\n",
0880        "<title>St3&#45;&gt;St6</title>\n",
0881        "<path fill=\"none\" stroke=\"#000000\" d=\"M424.3371,-168.8631C435.6173,-164.421 449.1097,-159.1077 461.3128,-154.3022\"/>\n",
0882        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"462.7342,-157.5041 470.7562,-150.5833 460.1692,-150.9909 462.7342,-157.5041\"/>\n",
0883        "<text text-anchor=\"middle\" x=\"447.4839\" y=\"-164.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0884        "</g>\n",
0885        "<!-- St9&#45;&gt;St5 -->\n",
0886        "<g id=\"edge21\" class=\"edge\">\n",
0887        "<title>St9&#45;&gt;St5</title>\n",
0888        "<path fill=\"none\" stroke=\"#000000\" d=\"M565.7723,-173.7375C557.4494,-173.2025 548.3752,-173.7335 540.4798,-176.748 532.0836,-179.9536 524.2656,-185.5397 517.5893,-191.5382\"/>\n",
0889        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"515.0159,-189.1592 510.31,-198.6516 519.9083,-194.1657 515.0159,-189.1592\"/>\n",
0890        "<text text-anchor=\"middle\" x=\"543.9798\" y=\"-180.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0891        "</g>\n",
0892        "<!-- St9&#45;&gt;St9 -->\n",
0893        "<g id=\"edge20\" class=\"edge\">\n",
0894        "<title>St9&#45;&gt;St9</title>\n",
0895        "<path fill=\"none\" stroke=\"#000000\" d=\"M583.3069,-204.049C582.6917,-214.574 585.6653,-223.496 592.2278,-223.496 596.5344,-223.496 599.2955,-219.6536 600.5109,-214.0374\"/>\n",
0896        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"604.0043,-214.2517 601.1487,-204.049 597.0185,-213.8056 604.0043,-214.2517\"/>\n",
0897        "<text text-anchor=\"middle\" x=\"592.2278\" y=\"-227.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0898        "</g>\n",
0899        "<!-- St6&#45;&gt;St3 -->\n",
0900        "<g id=\"edge19\" class=\"edge\">\n",
0901        "<title>St6&#45;&gt;St3</title>\n",
0902        "<path fill=\"none\" stroke=\"#000000\" d=\"M469.2763,-135.7375C460.9535,-135.2025 451.8793,-135.7335 443.9839,-138.748 436.7558,-141.5076 429.9563,-146.0314 423.9447,-151.0637\"/>\n",
0903        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"421.2601,-148.7777 416.2693,-158.1234 425.9989,-153.9297 421.2601,-148.7777\"/>\n",
0904        "<text text-anchor=\"middle\" x=\"447.4839\" y=\"-142.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0905        "</g>\n",
0906        "<!-- St6&#45;&gt;St9 -->\n",
0907        "<g id=\"edge18\" class=\"edge\">\n",
0908        "<title>St6&#45;&gt;St9</title>\n",
0909        "<path fill=\"none\" stroke=\"#000000\" d=\"M522.4242,-137.9141C530.6727,-137.9159 539.6445,-138.8424 547.4798,-141.748 554.0841,-144.1971 560.4169,-148.0657 566.1344,-152.3966\"/>\n",
0910        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"564.1035,-155.2598 574.0308,-158.961 568.5784,-149.8768 564.1035,-155.2598\"/>\n",
0911        "<text text-anchor=\"middle\" x=\"543.9798\" y=\"-145.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0912        "</g>\n",
0913        "<!-- St8&#45;&gt;St2 -->\n",
0914        "<g id=\"edge15\" class=\"edge\">\n",
0915        "<title>St8&#45;&gt;St2</title>\n",
0916        "<path fill=\"none\" stroke=\"#000000\" d=\"M372.7804,-97.7375C364.4575,-97.2025 355.3833,-97.7335 347.4879,-100.748 339.0917,-103.9536 331.2737,-109.5397 324.5973,-115.5382\"/>\n",
0917        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"322.024,-113.1592 317.3181,-122.6516 326.9164,-118.1657 322.024,-113.1592\"/>\n",
0918        "<text text-anchor=\"middle\" x=\"350.9879\" y=\"-104.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0919        "</g>\n",
0920        "<!-- St8&#45;&gt;St6 -->\n",
0921        "<g id=\"edge14\" class=\"edge\">\n",
0922        "<title>St8&#45;&gt;St6</title>\n",
0923        "<path fill=\"none\" stroke=\"#000000\" d=\"M425.9282,-99.9141C434.1767,-99.9159 443.1485,-100.8424 450.9839,-103.748 457.5881,-106.1971 463.9209,-110.0657 469.6384,-114.3966\"/>\n",
0924        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"467.6075,-117.2598 477.5349,-120.961 472.0824,-111.8768 467.6075,-117.2598\"/>\n",
0925        "<text text-anchor=\"middle\" x=\"447.4839\" y=\"-107.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0926        "</g>\n",
0927        "<!-- St7&#45;&gt;St4 -->\n",
0928        "<g id=\"edge11\" class=\"edge\">\n",
0929        "<title>St7&#45;&gt;St4</title>\n",
0930        "<path fill=\"none\" stroke=\"#000000\" d=\"M276.2844,-59.7375C267.9616,-59.2025 258.8873,-59.7335 250.9919,-62.748 242.5957,-65.9536 234.7777,-71.5397 228.1014,-77.5382\"/>\n",
0931        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"225.528,-75.1592 220.8221,-84.6516 230.4204,-80.1657 225.528,-75.1592\"/>\n",
0932        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-66.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0933        "</g>\n",
0934        "<!-- St7&#45;&gt;St8 -->\n",
0935        "<g id=\"edge10\" class=\"edge\">\n",
0936        "<title>St7&#45;&gt;St8</title>\n",
0937        "<path fill=\"none\" stroke=\"#000000\" d=\"M329.4322,-61.9141C337.6808,-61.9159 346.6526,-62.8424 354.4879,-65.748 361.0922,-68.1971 367.4249,-72.0657 373.1424,-76.3966\"/>\n",
0938        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"371.1116,-79.2598 381.0389,-82.961 375.5864,-73.8768 371.1116,-79.2598\"/>\n",
0939        "<text text-anchor=\"middle\" x=\"350.9879\" y=\"-69.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0940        "</g>\n",
0941        "<!-- St1&#45;&gt;St0 -->\n",
0942        "<g id=\"edge7\" class=\"edge\">\n",
0943        "<title>St1&#45;&gt;St0</title>\n",
0944        "<path fill=\"none\" stroke=\"#000000\" d=\"M179.7427,-23.0296C171.4174,-22.8306 162.3533,-23.6528 154.496,-26.748 147.4422,-29.5266 140.8882,-34.1656 135.1892,-39.2654\"/>\n",
0945        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"132.6436,-36.8601 127.9809,-46.3738 137.5587,-41.8443 132.6436,-36.8601\"/>\n",
0946        "<text text-anchor=\"middle\" x=\"157.996\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
0947        "</g>\n",
0948        "<!-- St1&#45;&gt;St7 -->\n",
0949        "<g id=\"edge6\" class=\"edge\">\n",
0950        "<title>St1&#45;&gt;St7</title>\n",
0951        "<path fill=\"none\" stroke=\"#000000\" d=\"M232.9363,-23.9141C241.1848,-23.9159 250.1566,-24.8424 257.9919,-27.748 264.5962,-30.1971 270.929,-34.0657 276.6465,-38.3966\"/>\n",
0952        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"274.6156,-41.2598 284.5429,-44.961 279.0905,-35.8768 274.6156,-41.2598\"/>\n",
0953        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-31.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0</text>\n",
0954        "</g>\n",
0955        "</g>\n",
0956        "</svg>\n"
0957       ],
0958       "text/plain": [
0959        "<graphviz.dot.Digraph at 0x7fa7a14078d0>"
0960       ]
0961      },
0962      "execution_count": 6,
0963      "metadata": {},
0964      "output_type": "execute_result"
0965     }
0966    ],
0967    "source": [
0968     "dotObj_dfa(minDofNFA_Ex3z)"
0969    ]
0970   },
0971   {
0972    "cell_type": "markdown",
0973    "metadata": {
0974     "run_control": {
0975      "frozen": false,
0976      "read_only": false
0977     }
0978    },
0979    "source": [
0980     "# What's the largest postage that can't be made using 3,5 and 7 cents?\n",
0981     "\n",
0982     "Answer is 4. Find it out."
0983    ]
0984   },
0985   {
0986    "cell_type": "code",
0987    "execution_count": 7,
0988    "metadata": {
0989     "run_control": {
0990      "frozen": false,
0991      "read_only": false
0992     }
0993    },
0994    "outputs": [
0995     {
0996      "data": {
0997       "image/svg+xml": [
0998        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
0999        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
1000        " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
1001        "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n",
1002        " -->\n",
1003        "<!-- Title: %3 Pages: 1 -->\n",
1004        "<svg width=\"611pt\" height=\"94pt\"\n",
1005        " viewBox=\"0.00 0.00 610.98 94.50\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
1006        "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 90.496)\">\n",
1007        "<title>%3</title>\n",
1008        "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-90.496 606.9758,-90.496 606.9758,4 -4,4\"/>\n",
1009        "<!-- EMPTY -->\n",
1010        "<g id=\"node1\" class=\"node\">\n",
1011        "<title>EMPTY</title>\n",
1012        "</g>\n",
1013        "<!-- St5 -->\n",
1014        "<g id=\"node6\" class=\"node\">\n",
1015        "<title>St5</title>\n",
1016        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"117.748\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
1017        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"117.748\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
1018        "<text text-anchor=\"middle\" x=\"117.748\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St5</text>\n",
1019        "</g>\n",
1020        "<!-- EMPTY&#45;&gt;St5 -->\n",
1021        "<g id=\"edge1\" class=\"edge\">\n",
1022        "<title>EMPTY&#45;&gt;St5</title>\n",
1023        "<path fill=\"none\" stroke=\"#000000\" d=\"M54.2274,-26.748C62.5578,-26.748 71.8652,-26.748 80.7317,-26.748\"/>\n",
1024        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"80.8526,-30.2481 90.8525,-26.748 80.8525,-23.2481 80.8526,-30.2481\"/>\n",
1025        "</g>\n",
1026        "<!-- St1 -->\n",
1027        "<g id=\"node2\" class=\"node\">\n",
1028        "<title>St1</title>\n",
1029        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"483.7318\" cy=\"-26.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
1030        "<text text-anchor=\"middle\" x=\"483.7318\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St1</text>\n",
1031        "</g>\n",
1032        "<!-- St0 -->\n",
1033        "<g id=\"node7\" class=\"node\">\n",
1034        "<title>St0</title>\n",
1035        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"576.2278\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
1036        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"576.2278\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
1037        "<text text-anchor=\"middle\" x=\"576.2278\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St0</text>\n",
1038        "</g>\n",
1039        "<!-- St1&#45;&gt;St0 -->\n",
1040        "<g id=\"edge6\" class=\"edge\">\n",
1041        "<title>St1&#45;&gt;St0</title>\n",
1042        "<path fill=\"none\" stroke=\"#000000\" d=\"M506.596,-26.748C516.4069,-26.748 528.1231,-26.748 539.121,-26.748\"/>\n",
1043        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"539.3596,-30.2481 549.3596,-26.748 539.3596,-23.2481 539.3596,-30.2481\"/>\n",
1044        "<text text-anchor=\"middle\" x=\"527.9798\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1045        "</g>\n",
1046        "<!-- St4 -->\n",
1047        "<g id=\"node3\" class=\"node\">\n",
1048        "<title>St4</title>\n",
1049        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"210.2439\" cy=\"-26.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
1050        "<text text-anchor=\"middle\" x=\"210.2439\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St4</text>\n",
1051        "</g>\n",
1052        "<!-- St2 -->\n",
1053        "<g id=\"node4\" class=\"node\">\n",
1054        "<title>St2</title>\n",
1055        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"298.7399\" cy=\"-26.748\" rx=\"22.9987\" ry=\"22.9987\"/>\n",
1056        "<text text-anchor=\"middle\" x=\"298.7399\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St2</text>\n",
1057        "</g>\n",
1058        "<!-- St4&#45;&gt;St2 -->\n",
1059        "<g id=\"edge3\" class=\"edge\">\n",
1060        "<title>St4&#45;&gt;St2</title>\n",
1061        "<path fill=\"none\" stroke=\"#000000\" d=\"M233.0339,-26.748C242.9691,-26.748 254.8086,-26.748 265.6831,-26.748\"/>\n",
1062        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"265.7197,-30.2481 275.7197,-26.748 265.7196,-23.2481 265.7197,-30.2481\"/>\n",
1063        "<text text-anchor=\"middle\" x=\"254.4919\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1064        "</g>\n",
1065        "<!-- St3 -->\n",
1066        "<g id=\"node5\" class=\"node\">\n",
1067        "<title>St3</title>\n",
1068        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"391.2359\" cy=\"-26.748\" rx=\"22.9609\" ry=\"22.9609\"/>\n",
1069        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"391.2359\" cy=\"-26.748\" rx=\"26.9983\" ry=\"26.9983\"/>\n",
1070        "<text text-anchor=\"middle\" x=\"391.2359\" y=\"-23.048\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">St3</text>\n",
1071        "</g>\n",
1072        "<!-- St2&#45;&gt;St3 -->\n",
1073        "<g id=\"edge4\" class=\"edge\">\n",
1074        "<title>St2&#45;&gt;St3</title>\n",
1075        "<path fill=\"none\" stroke=\"#000000\" d=\"M321.6041,-26.748C331.415,-26.748 343.1312,-26.748 354.1291,-26.748\"/>\n",
1076        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"354.3677,-30.2481 364.3677,-26.748 354.3676,-23.2481 354.3677,-30.2481\"/>\n",
1077        "<text text-anchor=\"middle\" x=\"342.9879\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1078        "</g>\n",
1079        "<!-- St3&#45;&gt;St1 -->\n",
1080        "<g id=\"edge5\" class=\"edge\">\n",
1081        "<title>St3&#45;&gt;St1</title>\n",
1082        "<path fill=\"none\" stroke=\"#000000\" d=\"M417.9895,-26.748C428.1536,-26.748 439.8553,-26.748 450.5433,-26.748\"/>\n",
1083        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"450.799,-30.2481 460.799,-26.748 450.7989,-23.2481 450.799,-30.2481\"/>\n",
1084        "<text text-anchor=\"middle\" x=\"439.4839\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1085        "</g>\n",
1086        "<!-- St5&#45;&gt;St4 -->\n",
1087        "<g id=\"edge2\" class=\"edge\">\n",
1088        "<title>St5&#45;&gt;St4</title>\n",
1089        "<path fill=\"none\" stroke=\"#000000\" d=\"M144.5016,-26.748C154.6657,-26.748 166.3674,-26.748 177.0554,-26.748\"/>\n",
1090        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"177.3111,-30.2481 187.3111,-26.748 177.3111,-23.2481 177.3111,-30.2481\"/>\n",
1091        "<text text-anchor=\"middle\" x=\"165.996\" y=\"-30.548\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1092        "</g>\n",
1093        "<!-- St0&#45;&gt;St0 -->\n",
1094        "<g id=\"edge7\" class=\"edge\">\n",
1095        "<title>St0&#45;&gt;St0</title>\n",
1096        "<path fill=\"none\" stroke=\"#000000\" d=\"M567.3069,-52.049C566.6917,-62.574 569.6653,-71.496 576.2278,-71.496 580.5344,-71.496 583.2955,-67.6536 584.5109,-62.0374\"/>\n",
1097        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"588.0043,-62.2517 585.1487,-52.049 581.0185,-61.8056 588.0043,-62.2517\"/>\n",
1098        "<text text-anchor=\"middle\" x=\"576.2278\" y=\"-75.296\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1</text>\n",
1099        "</g>\n",
1100        "</g>\n",
1101        "</svg>\n"
1102       ],
1103       "text/plain": [
1104        "<graphviz.dot.Digraph at 0x7fa7a169ba90>"
1105       ]
1106      },
1107      "execution_count": 7,
1108      "metadata": {},
1109      "output_type": "execute_result"
1110     }
1111    ],
1112    "source": [
1113     "dotObj_dfa(min_dfa_brz(nfa2dfa(re2nfa(\"(111+11111+1111111)*\"))))"
1114    ]
1115   },
1116   {
1117    "cell_type": "markdown",
1118    "metadata": {
1119     "run_control": {
1120      "frozen": false,
1121      "read_only": false
1122     }
1123    },
1124    "source": [
1125     "# Show ambiguity in parsing"
1126    ]
1127   },
1128   {
1129    "cell_type": "code",
1130    "execution_count": 8,
1131    "metadata": {
1132     "run_control": {
1133      "frozen": false,
1134      "read_only": false
1135     }
1136    },
1137    "outputs": [
1138     {
1139      "name": "stderr",
1140      "output_type": "stream",
1141      "text": [
1142       "Generating LALR tables\n"
1143      ]
1144     }
1145    ],
1146    "source": [
1147     "# Parsing an arithmetic expression\n",
1148     "pdaEamb = md2mc('''PDA\n",
1149     "!!E -> E * E | E + E | ~E | ( E ) | 2 | 3\n",
1150     "I : '', #  ; E#  -> M\n",
1151     "M : '', E  ; ~E  -> M\n",
1152     "M : '', E  ; E+E -> M\n",
1153     "M : '', E  ; E*E -> M\n",
1154     "M : '', E  ; (E) -> M\n",
1155     "M : '', E  ; 2   -> M\n",
1156     "M : '', E  ; 3   -> M\n",
1157     "M : ~,  ~  ; ''  -> M\n",
1158     "M : 2,  2  ; ''  -> M\n",
1159     "M : 3,  3  ; ''  -> M\n",
1160     "M : (,  (  ; ''  -> M\n",
1161     "M : ),  )  ; ''  -> M\n",
1162     "M : +,  +  ; ''  -> M\n",
1163     "M : *,  *  ; ''  -> M\n",
1164     "M : '', #  ; #   -> F\n",
1165     "'''\n",
1166     ")"
1167    ]
1168   },
1169   {
1170    "cell_type": "code",
1171    "execution_count": 9,
1172    "metadata": {
1173     "run_control": {
1174      "frozen": false,
1175      "read_only": false
1176     }
1177    },
1178    "outputs": [
1179     {
1180      "name": "stdout",
1181      "output_type": "stream",
1182      "text": [
1183       "You may use any of these help commands:\n",
1184       "help(explore_pda)\n",
1185       "help(run_pda)\n",
1186       "help(classify_l_id_path)\n",
1187       "help(h_run_pda)\n",
1188       "help(interpret_w_eps)\n",
1189       "help(step_pda)\n",
1190       "help(suvivor_id)\n",
1191       "help(term_id)\n",
1192       "help(final_id)\n",
1193       "help(cvt_str_to_sym)\n",
1194       "help(is_surv_id)\n",
1195       "help(subsumed)\n",
1196       "help(is_term_id)\n",
1197       "help(is_final_id)\n",
1198       "\n"
1199      ]
1200     }
1201    ],
1202    "source": [
1203     "from jove.Def_PDA       import *"
1204    ]
1205   },
1206   {
1207    "cell_type": "code",
1208    "execution_count": 10,
1209    "metadata": {
1210     "run_control": {
1211      "frozen": false,
1212      "read_only": false
1213     }
1214    },
1215    "outputs": [
1216     {
1217      "name": "stdout",
1218      "output_type": "stream",
1219      "text": [
1220       "*** Exploring wrt STKMAX =  7 ; increase it if needed ***\n",
1221       "String 3+2*3+2*3 accepted by your PDA in 13 ways :-) \n",
1222       "Here are the ways: \n",
1223       "Final state  ('F', '', '#')\n",
1224       "Reached as follows:\n",
1225       "->  ('I', '3+2*3+2*3', '#')\n",
1226       "->  ('M', '3+2*3+2*3', 'E#')\n",
1227       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1228       "->  ('M', '3+2*3+2*3', 'E*E*E#')\n",
1229       "->  ('M', '3+2*3+2*3', 'E+E*E*E#')\n",
1230       "->  ('M', '3+2*3+2*3', '3+E*E*E#')\n",
1231       "->  ('M', '+2*3+2*3', '+E*E*E#')\n",
1232       "->  ('M', '2*3+2*3', 'E*E*E#')\n",
1233       "->  ('M', '2*3+2*3', '2*E*E#')\n",
1234       "->  ('M', '*3+2*3', '*E*E#')\n",
1235       "->  ('M', '3+2*3', 'E*E#')\n",
1236       "->  ('M', '3+2*3', 'E+E*E#')\n",
1237       "->  ('M', '3+2*3', '3+E*E#')\n",
1238       "->  ('M', '+2*3', '+E*E#')\n",
1239       "->  ('M', '2*3', 'E*E#')\n",
1240       "->  ('M', '2*3', '2*E#')\n",
1241       "->  ('M', '*3', '*E#')\n",
1242       "->  ('M', '3', 'E#')\n",
1243       "->  ('M', '3', '3#')\n",
1244       "->  ('M', '', '#')\n",
1245       "->  ('F', '', '#') .\n",
1246       "Final state  ('F', '', '#')\n",
1247       "Reached as follows:\n",
1248       "->  ('I', '3+2*3+2*3', '#')\n",
1249       "->  ('M', '3+2*3+2*3', 'E#')\n",
1250       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1251       "->  ('M', '3+2*3+2*3', 'E+E*E#')\n",
1252       "->  ('M', '3+2*3+2*3', '3+E*E#')\n",
1253       "->  ('M', '+2*3+2*3', '+E*E#')\n",
1254       "->  ('M', '2*3+2*3', 'E*E#')\n",
1255       "->  ('M', '2*3+2*3', 'E*E*E#')\n",
1256       "->  ('M', '2*3+2*3', '2*E*E#')\n",
1257       "->  ('M', '*3+2*3', '*E*E#')\n",
1258       "->  ('M', '3+2*3', 'E*E#')\n",
1259       "->  ('M', '3+2*3', 'E+E*E#')\n",
1260       "->  ('M', '3+2*3', '3+E*E#')\n",
1261       "->  ('M', '+2*3', '+E*E#')\n",
1262       "->  ('M', '2*3', 'E*E#')\n",
1263       "->  ('M', '2*3', '2*E#')\n",
1264       "->  ('M', '*3', '*E#')\n",
1265       "->  ('M', '3', 'E#')\n",
1266       "->  ('M', '3', '3#')\n",
1267       "->  ('M', '', '#')\n",
1268       "->  ('F', '', '#') .\n",
1269       "Final state  ('F', '', '#')\n",
1270       "Reached as follows:\n",
1271       "->  ('I', '3+2*3+2*3', '#')\n",
1272       "->  ('M', '3+2*3+2*3', 'E#')\n",
1273       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1274       "->  ('M', '3+2*3+2*3', 'E+E*E#')\n",
1275       "->  ('M', '3+2*3+2*3', '3+E*E#')\n",
1276       "->  ('M', '+2*3+2*3', '+E*E#')\n",
1277       "->  ('M', '2*3+2*3', 'E*E#')\n",
1278       "->  ('M', '2*3+2*3', '2*E#')\n",
1279       "->  ('M', '*3+2*3', '*E#')\n",
1280       "->  ('M', '3+2*3', 'E#')\n",
1281       "->  ('M', '3+2*3', 'E*E#')\n",
1282       "->  ('M', '3+2*3', 'E+E*E#')\n",
1283       "->  ('M', '3+2*3', '3+E*E#')\n",
1284       "->  ('M', '+2*3', '+E*E#')\n",
1285       "->  ('M', '2*3', 'E*E#')\n",
1286       "->  ('M', '2*3', '2*E#')\n",
1287       "->  ('M', '*3', '*E#')\n",
1288       "->  ('M', '3', 'E#')\n",
1289       "->  ('M', '3', '3#')\n",
1290       "->  ('M', '', '#')\n",
1291       "->  ('F', '', '#') .\n",
1292       "Final state  ('F', '', '#')\n",
1293       "Reached as follows:\n",
1294       "->  ('I', '3+2*3+2*3', '#')\n",
1295       "->  ('M', '3+2*3+2*3', 'E#')\n",
1296       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1297       "->  ('M', '3+2*3+2*3', 'E+E*E#')\n",
1298       "->  ('M', '3+2*3+2*3', '3+E*E#')\n",
1299       "->  ('M', '+2*3+2*3', '+E*E#')\n",
1300       "->  ('M', '2*3+2*3', 'E*E#')\n",
1301       "->  ('M', '2*3+2*3', '2*E#')\n",
1302       "->  ('M', '*3+2*3', '*E#')\n",
1303       "->  ('M', '3+2*3', 'E#')\n",
1304       "->  ('M', '3+2*3', 'E+E#')\n",
1305       "->  ('M', '3+2*3', '3+E#')\n",
1306       "->  ('M', '+2*3', '+E#')\n",
1307       "->  ('M', '2*3', 'E#')\n",
1308       "->  ('M', '2*3', 'E*E#')\n",
1309       "->  ('M', '2*3', '2*E#')\n",
1310       "->  ('M', '*3', '*E#')\n",
1311       "->  ('M', '3', 'E#')\n",
1312       "->  ('M', '3', '3#')\n",
1313       "->  ('M', '', '#')\n",
1314       "->  ('F', '', '#') .\n",
1315       "Final state  ('F', '', '#')\n",
1316       "Reached as follows:\n",
1317       "->  ('I', '3+2*3+2*3', '#')\n",
1318       "->  ('M', '3+2*3+2*3', 'E#')\n",
1319       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1320       "->  ('M', '3+2*3+2*3', 'E+E*E#')\n",
1321       "->  ('M', '3+2*3+2*3', '3+E*E#')\n",
1322       "->  ('M', '+2*3+2*3', '+E*E#')\n",
1323       "->  ('M', '2*3+2*3', 'E*E#')\n",
1324       "->  ('M', '2*3+2*3', 'E+E*E#')\n",
1325       "->  ('M', '2*3+2*3', 'E*E+E*E#')\n",
1326       "->  ('M', '2*3+2*3', '2*E+E*E#')\n",
1327       "->  ('M', '*3+2*3', '*E+E*E#')\n",
1328       "->  ('M', '3+2*3', 'E+E*E#')\n",
1329       "->  ('M', '3+2*3', '3+E*E#')\n",
1330       "->  ('M', '+2*3', '+E*E#')\n",
1331       "->  ('M', '2*3', 'E*E#')\n",
1332       "->  ('M', '2*3', '2*E#')\n",
1333       "->  ('M', '*3', '*E#')\n",
1334       "->  ('M', '3', 'E#')\n",
1335       "->  ('M', '3', '3#')\n",
1336       "->  ('M', '', '#')\n",
1337       "->  ('F', '', '#') .\n",
1338       "Final state  ('F', '', '#')\n",
1339       "Reached as follows:\n",
1340       "->  ('I', '3+2*3+2*3', '#')\n",
1341       "->  ('M', '3+2*3+2*3', 'E#')\n",
1342       "->  ('M', '3+2*3+2*3', 'E*E#')\n",
1343       "->  ('M', '3+2*3+2*3', 'E+E*E#')\n",
1344       "->  ('M', '3+2*3+2*3', 'E+E+E*E#')\n",
1345       "->  ('M', '3+2*3+2*3', '3+E+E*E#')\n",
1346       "->  ('M', '+2*3+2*3', '+E+E*E#')\n",
1347       "->  ('M', '2*3+2*3', 'E+E*E#')\n",
1348       "->  ('M', '2*3+2*3', 'E*E+E*E#')\n",
1349       "->  ('M', '2*3+2*3', '2*E+E*E#')\n",
1350       "->  ('M', '*3+2*3', '*E+E*E#')\n",
1351       "->  ('M', '3+2*3', 'E+E*E#')\n",
1352       "->  ('M', '3+2*3', '3+E*E#')\n",
1353       "->  ('M', '+2*3', '+E*E#')\n",
1354       "->  ('M', '2*3', 'E*E#')\n",
1355       "->  ('M', '2*3', '2*E#')\n",
1356       "->  ('M', '*3', '*E#')\n",
1357       "->  ('M', '3', 'E#')\n",
1358       "->  ('M', '3', '3#')\n",
1359       "->  ('M', '', '#')\n",
1360       "->  ('F', '', '#') .\n",
1361       "Final state  ('F', '', '#')\n",
1362       "Reached as follows:\n",
1363       "->  ('I', '3+2*3+2*3', '#')\n",
1364       "->  ('M', '3+2*3+2*3', 'E#')\n",
1365       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1366       "->  ('M', '3+2*3+2*3', 'E*E+E#')\n",
1367       "->  ('M', '3+2*3+2*3', 'E+E*E+E#')\n",
1368       "->  ('M', '3+2*3+2*3', '3+E*E+E#')\n",
1369       "->  ('M', '+2*3+2*3', '+E*E+E#')\n",
1370       "->  ('M', '2*3+2*3', 'E*E+E#')\n",
1371       "->  ('M', '2*3+2*3', '2*E+E#')\n",
1372       "->  ('M', '*3+2*3', '*E+E#')\n",
1373       "->  ('M', '3+2*3', 'E+E#')\n",
1374       "->  ('M', '3+2*3', '3+E#')\n",
1375       "->  ('M', '+2*3', '+E#')\n",
1376       "->  ('M', '2*3', 'E#')\n",
1377       "->  ('M', '2*3', 'E*E#')\n",
1378       "->  ('M', '2*3', '2*E#')\n",
1379       "->  ('M', '*3', '*E#')\n",
1380       "->  ('M', '3', 'E#')\n",
1381       "->  ('M', '3', '3#')\n",
1382       "->  ('M', '', '#')\n",
1383       "->  ('F', '', '#') .\n",
1384       "Final state  ('F', '', '#')\n",
1385       "Reached as follows:\n",
1386       "->  ('I', '3+2*3+2*3', '#')\n",
1387       "->  ('M', '3+2*3+2*3', 'E#')\n",
1388       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1389       "->  ('M', '3+2*3+2*3', '3+E#')\n",
1390       "->  ('M', '+2*3+2*3', '+E#')\n",
1391       "->  ('M', '2*3+2*3', 'E#')\n",
1392       "->  ('M', '2*3+2*3', 'E*E#')\n",
1393       "->  ('M', '2*3+2*3', 'E*E*E#')\n",
1394       "->  ('M', '2*3+2*3', '2*E*E#')\n",
1395       "->  ('M', '*3+2*3', '*E*E#')\n",
1396       "->  ('M', '3+2*3', 'E*E#')\n",
1397       "->  ('M', '3+2*3', 'E+E*E#')\n",
1398       "->  ('M', '3+2*3', '3+E*E#')\n",
1399       "->  ('M', '+2*3', '+E*E#')\n",
1400       "->  ('M', '2*3', 'E*E#')\n",
1401       "->  ('M', '2*3', '2*E#')\n",
1402       "->  ('M', '*3', '*E#')\n",
1403       "->  ('M', '3', 'E#')\n",
1404       "->  ('M', '3', '3#')\n",
1405       "->  ('M', '', '#')\n",
1406       "->  ('F', '', '#') .\n",
1407       "Final state  ('F', '', '#')\n",
1408       "Reached as follows:\n",
1409       "->  ('I', '3+2*3+2*3', '#')\n",
1410       "->  ('M', '3+2*3+2*3', 'E#')\n",
1411       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1412       "->  ('M', '3+2*3+2*3', '3+E#')\n",
1413       "->  ('M', '+2*3+2*3', '+E#')\n",
1414       "->  ('M', '2*3+2*3', 'E#')\n",
1415       "->  ('M', '2*3+2*3', 'E*E#')\n",
1416       "->  ('M', '2*3+2*3', '2*E#')\n",
1417       "->  ('M', '*3+2*3', '*E#')\n",
1418       "->  ('M', '3+2*3', 'E#')\n",
1419       "->  ('M', '3+2*3', 'E*E#')\n",
1420       "->  ('M', '3+2*3', 'E+E*E#')\n",
1421       "->  ('M', '3+2*3', '3+E*E#')\n",
1422       "->  ('M', '+2*3', '+E*E#')\n",
1423       "->  ('M', '2*3', 'E*E#')\n",
1424       "->  ('M', '2*3', '2*E#')\n",
1425       "->  ('M', '*3', '*E#')\n",
1426       "->  ('M', '3', 'E#')\n",
1427       "->  ('M', '3', '3#')\n",
1428       "->  ('M', '', '#')\n",
1429       "->  ('F', '', '#') .\n",
1430       "Final state  ('F', '', '#')\n",
1431       "Reached as follows:\n",
1432       "->  ('I', '3+2*3+2*3', '#')\n",
1433       "->  ('M', '3+2*3+2*3', 'E#')\n",
1434       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1435       "->  ('M', '3+2*3+2*3', '3+E#')\n",
1436       "->  ('M', '+2*3+2*3', '+E#')\n",
1437       "->  ('M', '2*3+2*3', 'E#')\n",
1438       "->  ('M', '2*3+2*3', 'E*E#')\n",
1439       "->  ('M', '2*3+2*3', '2*E#')\n",
1440       "->  ('M', '*3+2*3', '*E#')\n",
1441       "->  ('M', '3+2*3', 'E#')\n",
1442       "->  ('M', '3+2*3', 'E+E#')\n",
1443       "->  ('M', '3+2*3', '3+E#')\n",
1444       "->  ('M', '+2*3', '+E#')\n",
1445       "->  ('M', '2*3', 'E#')\n",
1446       "->  ('M', '2*3', 'E*E#')\n",
1447       "->  ('M', '2*3', '2*E#')\n",
1448       "->  ('M', '*3', '*E#')\n",
1449       "->  ('M', '3', 'E#')\n",
1450       "->  ('M', '3', '3#')\n",
1451       "->  ('M', '', '#')\n",
1452       "->  ('F', '', '#') .\n",
1453       "Final state  ('F', '', '#')\n",
1454       "Reached as follows:\n",
1455       "->  ('I', '3+2*3+2*3', '#')\n",
1456       "->  ('M', '3+2*3+2*3', 'E#')\n",
1457       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1458       "->  ('M', '3+2*3+2*3', '3+E#')\n",
1459       "->  ('M', '+2*3+2*3', '+E#')\n",
1460       "->  ('M', '2*3+2*3', 'E#')\n",
1461       "->  ('M', '2*3+2*3', 'E*E#')\n",
1462       "->  ('M', '2*3+2*3', 'E+E*E#')\n",
1463       "->  ('M', '2*3+2*3', 'E*E+E*E#')\n",
1464       "->  ('M', '2*3+2*3', '2*E+E*E#')\n",
1465       "->  ('M', '*3+2*3', '*E+E*E#')\n",
1466       "->  ('M', '3+2*3', 'E+E*E#')\n",
1467       "->  ('M', '3+2*3', '3+E*E#')\n",
1468       "->  ('M', '+2*3', '+E*E#')\n",
1469       "->  ('M', '2*3', 'E*E#')\n",
1470       "->  ('M', '2*3', '2*E#')\n",
1471       "->  ('M', '*3', '*E#')\n",
1472       "->  ('M', '3', 'E#')\n",
1473       "->  ('M', '3', '3#')\n",
1474       "->  ('M', '', '#')\n",
1475       "->  ('F', '', '#') .\n",
1476       "Final state  ('F', '', '#')\n",
1477       "Reached as follows:\n",
1478       "->  ('I', '3+2*3+2*3', '#')\n",
1479       "->  ('M', '3+2*3+2*3', 'E#')\n",
1480       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1481       "->  ('M', '3+2*3+2*3', '3+E#')\n",
1482       "->  ('M', '+2*3+2*3', '+E#')\n",
1483       "->  ('M', '2*3+2*3', 'E#')\n",
1484       "->  ('M', '2*3+2*3', 'E+E#')\n",
1485       "->  ('M', '2*3+2*3', 'E*E+E#')\n",
1486       "->  ('M', '2*3+2*3', '2*E+E#')\n",
1487       "->  ('M', '*3+2*3', '*E+E#')\n",
1488       "->  ('M', '3+2*3', 'E+E#')\n",
1489       "->  ('M', '3+2*3', '3+E#')\n",
1490       "->  ('M', '+2*3', '+E#')\n",
1491       "->  ('M', '2*3', 'E#')\n",
1492       "->  ('M', '2*3', 'E*E#')\n",
1493       "->  ('M', '2*3', '2*E#')\n",
1494       "->  ('M', '*3', '*E#')\n",
1495       "->  ('M', '3', 'E#')\n",
1496       "->  ('M', '3', '3#')\n",
1497       "->  ('M', '', '#')\n",
1498       "->  ('F', '', '#') .\n",
1499       "Final state  ('F', '', '#')\n",
1500       "Reached as follows:\n",
1501       "->  ('I', '3+2*3+2*3', '#')\n",
1502       "->  ('M', '3+2*3+2*3', 'E#')\n",
1503       "->  ('M', '3+2*3+2*3', 'E+E#')\n",
1504       "->  ('M', '3+2*3+2*3', 'E+E+E#')\n",
1505       "->  ('M', '3+2*3+2*3', '3+E+E#')\n",
1506       "->  ('M', '+2*3+2*3', '+E+E#')\n",
1507       "->  ('M', '2*3+2*3', 'E+E#')\n",
1508       "->  ('M', '2*3+2*3', 'E*E+E#')\n",
1509       "->  ('M', '2*3+2*3', '2*E+E#')\n",
1510       "->  ('M', '*3+2*3', '*E+E#')\n",
1511       "->  ('M', '3+2*3', 'E+E#')\n",
1512       "->  ('M', '3+2*3', '3+E#')\n",
1513       "->  ('M', '+2*3', '+E#')\n",
1514       "->  ('M', '2*3', 'E#')\n",
1515       "->  ('M', '2*3', 'E*E#')\n",
1516       "->  ('M', '2*3', '2*E#')\n",
1517       "->  ('M', '*3', '*E#')\n",
1518       "->  ('M', '3', 'E#')\n",
1519       "->  ('M', '3', '3#')\n",
1520       "->  ('M', '', '#')\n",
1521       "->  ('F', '', '#') .\n"
1522      ]
1523     }
1524    ],
1525    "source": [
1526     "explore_pda(\"3+2*3+2*3\", pdaEamb, STKMAX=7)"
1527    ]
1528   },
1529   {
1530    "cell_type": "markdown",
1531    "metadata": {
1532     "run_control": {
1533      "frozen": false,
1534      "read_only": false
1535     }
1536    },
1537    "source": [
1538     "# Show how to disambiguate"
1539    ]
1540   },
1541   {
1542    "cell_type": "code",
1543    "execution_count": 11,
1544    "metadata": {
1545     "run_control": {
1546      "frozen": false,
1547      "read_only": false
1548     }
1549    },
1550    "outputs": [
1551     {
1552      "name": "stderr",
1553      "output_type": "stream",
1554      "text": [
1555       "Generating LALR tables\n"
1556      ]
1557     }
1558    ],
1559    "source": [
1560     "# Parsing an arithmetic expression\n",
1561     "pdaE = md2mc('''PDA\n",
1562     "!!E -> E+T | T\n",
1563     "!!T -> T*F | F\n",
1564     "!!F -> 2 | 3 | ~F | (E)\n",
1565     "I : '', #  ; E#  -> M\n",
1566     "M : '', E  ; E+T -> M\n",
1567     "M : '', E  ; T   -> M\n",
1568     "M : '', T  ; T*F -> M\n",
1569     "M : '', T  ; F   -> M\n",
1570     "M : '', F  ; 2   -> M\n",
1571     "M : '', F  ; 3   -> M\n",
1572     "M : '', F  ; ~F  -> M\n",
1573     "M : '', F  ; (E) -> M\n",
1574     "M : ~,  ~  ; ''  -> M\n",
1575     "M : 2,  2  ; ''  -> M\n",
1576     "M : 3,  3  ; ''  -> M\n",
1577     "M : (,  (  ; ''  -> M\n",
1578     "M : ),  )  ; ''  -> M\n",
1579     "M : +,  +  ; ''  -> M\n",
1580     "M : *,  *  ; ''  -> M\n",
1581     "M : '', #  ; #   -> F\n",
1582     "'''\n",
1583     ")"
1584    ]
1585   },
1586   {
1587    "cell_type": "code",
1588    "execution_count": 12,
1589    "metadata": {
1590     "run_control": {
1591      "frozen": false,
1592      "read_only": false
1593     }
1594    },
1595    "outputs": [
1596     {
1597      "name": "stdout",
1598      "output_type": "stream",
1599      "text": [
1600       "*** Exploring wrt STKMAX =  7 ; increase it if needed ***\n",
1601       "String 3+2*3+2*3 accepted by your PDA in 1 ways :-) \n",
1602       "Here are the ways: \n",
1603       "Final state  ('F', '', '#')\n",
1604       "Reached as follows:\n",
1605       "->  ('I', '3+2*3+2*3', '#')\n",
1606       "->  ('M', '3+2*3+2*3', 'E#')\n",
1607       "->  ('M', '3+2*3+2*3', 'E+T#')\n",
1608       "->  ('M', '3+2*3+2*3', 'E+T+T#')\n",
1609       "->  ('M', '3+2*3+2*3', 'T+T+T#')\n",
1610       "->  ('M', '3+2*3+2*3', 'F+T+T#')\n",
1611       "->  ('M', '3+2*3+2*3', '3+T+T#')\n",
1612       "->  ('M', '+2*3+2*3', '+T+T#')\n",
1613       "->  ('M', '2*3+2*3', 'T+T#')\n",
1614       "->  ('M', '2*3+2*3', 'T*F+T#')\n",
1615       "->  ('M', '2*3+2*3', 'F*F+T#')\n",
1616       "->  ('M', '2*3+2*3', '2*F+T#')\n",
1617       "->  ('M', '*3+2*3', '*F+T#')\n",
1618       "->  ('M', '3+2*3', 'F+T#')\n",
1619       "->  ('M', '3+2*3', '3+T#')\n",
1620       "->  ('M', '+2*3', '+T#')\n",
1621       "->  ('M', '2*3', 'T#')\n",
1622       "->  ('M', '2*3', 'T*F#')\n",
1623       "->  ('M', '2*3', 'F*F#')\n",
1624       "->  ('M', '2*3', '2*F#')\n",
1625       "->  ('M', '*3', '*F#')\n",
1626       "->  ('M', '3', 'F#')\n",
1627       "->  ('M', '3', '3#')\n",
1628       "->  ('M', '', '#')\n",
1629       "->  ('F', '', '#') .\n"
1630      ]
1631     }
1632    ],
1633    "source": [
1634     "explore_pda(\"3+2*3+2*3\", pdaE, STKMAX=7)"
1635    ]
1636   },
1637   {
1638    "cell_type": "markdown",
1639    "metadata": {
1640     "run_control": {
1641      "frozen": false,
1642      "read_only": false
1643     }
1644    },
1645    "source": [
1646     "# And finally, run a Turing Machine with \"dynamic tape allocation\" :-)\n",
1647     "\n",
1648     "* Why not show how TMs are encoded? \n",
1649     "* This markdown gets parsed to build a TM!\n",
1650     "* This TM is for the famous \"3x+1\" problem (Collatz's Problem)"
1651    ]
1652   },
1653   {
1654    "cell_type": "code",
1655    "execution_count": 13,
1656    "metadata": {
1657     "run_control": {
1658      "frozen": false,
1659      "read_only": false
1660     }
1661    },
1662    "outputs": [],
1663    "source": [
1664     "collatz_tm_str = \"\"\"\n",
1665     "TM\n",
1666     "\n",
1667     "i_start      : 0; ., R -> i_start             !! erase this zero and try to find more\n",
1668     "i_start      : 1; 1, R -> goto_lsb            !! we have a proper number, go to the lsb\n",
1669     "i_start      : .; ., S -> error               !! error on no input or input == 0\n",
1670     "\n",
1671     "\n",
1672     "goto_lsb     : 0; 0,R | 1; 1,R -> goto_lsb    !! scan off the right edge of the number\n",
1673     "goto_lsb     : .; .,L -> branch               !! take a step back to be on the lsb and start branch\n",
1674     "\n",
1675     "\n",
1676     "branch       : 0; .,L -> branch               !! number is even, divide by two and re-branch\n",
1677     "branch       : 1; 1,L -> check_n_eq_1         !! number is odd, check if it is 1\n",
1678     "\n",
1679     "\n",
1680     "check_n_eq_1 : 0; 0,R | 1; 1,R -> 01_fma      !! number wasn't 1, goto 3n+1\n",
1681     "check_n_eq_1 : .; .,R -> f_halt               !! number was 1, halt\n",
1682     "\n",
1683     "\n",
1684     "!! carrying 0 we see a 0 so write 0 and carry 0 forward\n",
1685     "00_fma       : 0; 0,L -> 00_fma\n",
1686     "\n",
1687     "!! carrying 0 we see a 1 (times 3 is 11) so write 1 and carry 1 forward\n",
1688     "00_fma       : 1; 1,L -> 01_fma\n",
1689     "\n",
1690     "!! reached the end of the number, go back to the start\n",
1691     "00_fma       : .; .,R -> goto_lsb             \n",
1692     "\n",
1693     "\n",
1694     "!! carrying 1 we see a 0 so write 1 and carry 0 forward\n",
1695     "01_fma       : 0; 1,L -> 00_fma  \n",
1696     "\n",
1697     "!! carrying 1 we see a 1 (times 3 is 11, plus our carry is 100) so write 0 and carry 10 forward\n",
1698     "01_fma       : 1; 0,L -> 10_fma  \n",
1699     "\n",
1700     "!! reached the end of the number, write our 1 and go back to the start\n",
1701     "01_fma       : .; 1,R -> goto_lsb             \n",
1702     "\n",
1703     "\n",
1704     "!! carrying 10 we see a 0, so write 0 and carry 1 forward\n",
1705     "10_fma       : 0; 0,L -> 01_fma\n",
1706     "\n",
1707     "!! carrying 10 we see a 1 (times 3 is 11, plus our carry is 101), so write 1 and carry 10 forward\n",
1708     "10_fma       : 1; 1,L -> 10_fma\n",
1709     "\n",
1710     "!! reached the end of the number, write a 0 from our 10 and carry 1\n",
1711     "10_fma       : .; 0,L -> 01_fma\n",
1712     "\n",
1713     "!!\"\"\"\n"
1714    ]
1715   },
1716   {
1717    "cell_type": "code",
1718    "execution_count": 14,
1719    "metadata": {
1720     "run_control": {
1721      "frozen": false,
1722      "read_only": false
1723     }
1724    },
1725    "outputs": [
1726     {
1727      "name": "stderr",
1728      "output_type": "stream",
1729      "text": [
1730       "Generating LALR tables\n"
1731      ]
1732     },
1733     {
1734      "data": {
1735       "image/svg+xml": [
1736        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
1737        "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
1738        " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n",
1739        "<!-- Generated by graphviz version 2.40.1 (20161225.0304)\n",
1740        " -->\n",
1741        "<!-- Title: %3 Pages: 1 -->\n",
1742        "<svg width=\"961pt\" height=\"326pt\"\n",
1743        " viewBox=\"0.00 0.00 960.66 326.29\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
1744        "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 322.2941)\">\n",
1745        "<title>%3</title>\n",
1746        "<polygon fill=\"#ffffff\" stroke=\"transparent\" points=\"-4,4 -4,-322.2941 956.6563,-322.2941 956.6563,4 -4,4\"/>\n",
1747        "<!-- EMPTY -->\n",
1748        "<g id=\"node1\" class=\"node\">\n",
1749        "<title>EMPTY</title>\n",
1750        "</g>\n",
1751        "<!-- i_start -->\n",
1752        "<g id=\"node5\" class=\"node\">\n",
1753        "<title>i_start</title>\n",
1754        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"123.4971\" cy=\"-46.9475\" rx=\"32.4942\" ry=\"32.4942\"/>\n",
1755        "<text text-anchor=\"middle\" x=\"123.4971\" y=\"-43.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">i_start</text>\n",
1756        "</g>\n",
1757        "<!-- EMPTY&#45;&gt;i_start -->\n",
1758        "<g id=\"edge1\" class=\"edge\">\n",
1759        "<title>EMPTY&#45;&gt;i_start</title>\n",
1760        "<path fill=\"none\" stroke=\"#000000\" d=\"M54.1366,-46.9475C62.3991,-46.9475 71.6905,-46.9475 80.7226,-46.9475\"/>\n",
1761        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"80.7414,-50.4476 90.7413,-46.9475 80.7413,-43.4476 80.7414,-50.4476\"/>\n",
1762        "</g>\n",
1763        "<!-- branch -->\n",
1764        "<g id=\"node2\" class=\"node\">\n",
1765        "<title>branch</title>\n",
1766        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"413.3339\" cy=\"-114.9475\" rx=\"34.394\" ry=\"34.394\"/>\n",
1767        "<text text-anchor=\"middle\" x=\"413.3339\" y=\"-111.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">branch</text>\n",
1768        "</g>\n",
1769        "<!-- branch&#45;&gt;branch -->\n",
1770        "<g id=\"edge7\" class=\"edge\">\n",
1771        "<title>branch&#45;&gt;branch</title>\n",
1772        "<path fill=\"none\" stroke=\"#000000\" d=\"M400.9619,-147.2131C400.831,-158.378 404.955,-167.3945 413.3339,-167.3945 418.9635,-167.3945 422.6723,-163.3243 424.4604,-157.267\"/>\n",
1773        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"427.9499,-157.5676 425.7059,-147.2131 421.003,-156.7069 427.9499,-157.5676\"/>\n",
1774        "<text text-anchor=\"middle\" x=\"413.3339\" y=\"-171.1945\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; .,L</text>\n",
1775        "</g>\n",
1776        "<!-- check_n_eq_1 -->\n",
1777        "<g id=\"node3\" class=\"node\">\n",
1778        "<title>check_n_eq_1</title>\n",
1779        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"582.5254\" cy=\"-119.9475\" rx=\"61.99\" ry=\"61.99\"/>\n",
1780        "<text text-anchor=\"middle\" x=\"582.5254\" y=\"-116.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">check_n_eq_1</text>\n",
1781        "</g>\n",
1782        "<!-- branch&#45;&gt;check_n_eq_1 -->\n",
1783        "<g id=\"edge8\" class=\"edge\">\n",
1784        "<title>branch&#45;&gt;check_n_eq_1</title>\n",
1785        "<path fill=\"none\" stroke=\"#000000\" d=\"M447.9806,-115.9714C466.008,-116.5042 488.7503,-117.1763 510.3821,-117.8155\"/>\n",
1786        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"510.4538,-121.3191 520.5529,-118.1161 510.6607,-114.3221 510.4538,-121.3191\"/>\n",
1787        "<text text-anchor=\"middle\" x=\"484.2809\" y=\"-121.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1 ; 1,L</text>\n",
1788        "</g>\n",
1789        "<!-- 01_fma -->\n",
1790        "<g id=\"node4\" class=\"node\">\n",
1791        "<title>01_fma</title>\n",
1792        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"760.6165\" cy=\"-194.9475\" rx=\"38.1938\" ry=\"38.1938\"/>\n",
1793        "<text text-anchor=\"middle\" x=\"760.6165\" y=\"-191.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">01_fma</text>\n",
1794        "</g>\n",
1795        "<!-- check_n_eq_1&#45;&gt;01_fma -->\n",
1796        "<g id=\"edge9\" class=\"edge\">\n",
1797        "<title>check_n_eq_1&#45;&gt;01_fma</title>\n",
1798        "<path fill=\"none\" stroke=\"#000000\" d=\"M640.9754,-140.4924C661.2223,-148.0138 683.9329,-156.9073 704.2699,-165.9475 708.6274,-167.8845 713.1247,-169.997 717.5894,-172.1699\"/>\n",
1799        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"716.1406,-175.3583 726.6529,-176.6782 719.2582,-169.0908 716.1406,-175.3583\"/>\n",
1800        "<text text-anchor=\"middle\" x=\"683.2699\" y=\"-184.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; 0,R </text>\n",
1801        "<text text-anchor=\"middle\" x=\"683.2699\" y=\"-169.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> 1 ; 1,R</text>\n",
1802        "</g>\n",
1803        "<!-- f_halt -->\n",
1804        "<g id=\"node10\" class=\"node\">\n",
1805        "<title>f_halt</title>\n",
1806        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"760.6165\" cy=\"-102.9475\" rx=\"31.373\" ry=\"31.373\"/>\n",
1807        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"760.6165\" cy=\"-102.9475\" rx=\"35.3956\" ry=\"35.3956\"/>\n",
1808        "<text text-anchor=\"middle\" x=\"760.6165\" y=\"-99.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">f_halt</text>\n",
1809        "</g>\n",
1810        "<!-- check_n_eq_1&#45;&gt;f_halt -->\n",
1811        "<g id=\"edge10\" class=\"edge\">\n",
1812        "<title>check_n_eq_1&#45;&gt;f_halt</title>\n",
1813        "<path fill=\"none\" stroke=\"#000000\" d=\"M644.3132,-114.0495C667.6237,-111.8243 693.6923,-109.3359 715.2317,-107.2798\"/>\n",
1814        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"715.7877,-110.7427 725.4098,-106.3082 715.1224,-103.7744 715.7877,-110.7427\"/>\n",
1815        "<text text-anchor=\"middle\" x=\"683.2699\" y=\"-116.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">. ; .,R</text>\n",
1816        "</g>\n",
1817        "<!-- goto_lsb -->\n",
1818        "<g id=\"node6\" class=\"node\">\n",
1819        "<title>goto_lsb</title>\n",
1820        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"270.9406\" cy=\"-114.9475\" rx=\"40.8928\" ry=\"40.8928\"/>\n",
1821        "<text text-anchor=\"middle\" x=\"270.9406\" y=\"-111.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">goto_lsb</text>\n",
1822        "</g>\n",
1823        "<!-- 01_fma&#45;&gt;goto_lsb -->\n",
1824        "<g id=\"edge16\" class=\"edge\">\n",
1825        "<title>01_fma&#45;&gt;goto_lsb</title>\n",
1826        "<path fill=\"none\" stroke=\"#000000\" d=\"M722.8337,-201.8586C652.8892,-213.0782 499.3821,-230.283 378.887,-190.9475 353.035,-182.5082 327.9581,-165.5656 308.4914,-149.815\"/>\n",
1827        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"310.7034,-147.1024 300.7772,-143.398 306.2268,-152.4839 310.7034,-147.1024\"/>\n",
1828        "<text text-anchor=\"middle\" x=\"484.2809\" y=\"-216.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">. ; 1,R</text>\n",
1829        "</g>\n",
1830        "<!-- 10_fma -->\n",
1831        "<g id=\"node7\" class=\"node\">\n",
1832        "<title>10_fma</title>\n",
1833        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"914.3097\" cy=\"-246.9475\" rx=\"38.1938\" ry=\"38.1938\"/>\n",
1834        "<text text-anchor=\"middle\" x=\"914.3097\" y=\"-243.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">10_fma</text>\n",
1835        "</g>\n",
1836        "<!-- 01_fma&#45;&gt;10_fma -->\n",
1837        "<g id=\"edge15\" class=\"edge\">\n",
1838        "<title>01_fma&#45;&gt;10_fma</title>\n",
1839        "<path fill=\"none\" stroke=\"#000000\" d=\"M793.5249,-215.1272C801.0352,-219.1407 809.1193,-223.0155 816.9631,-225.9475 832.5063,-231.7576 850.0776,-236.1629 865.9716,-239.4\"/>\n",
1840        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"865.6538,-242.9032 876.1359,-241.3616 866.9804,-236.03 865.6538,-242.9032\"/>\n",
1841        "<text text-anchor=\"middle\" x=\"837.4631\" y=\"-240.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1 ; 0,L</text>\n",
1842        "</g>\n",
1843        "<!-- 00_fma -->\n",
1844        "<g id=\"node9\" class=\"node\">\n",
1845        "<title>00_fma</title>\n",
1846        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"914.3097\" cy=\"-118.9475\" rx=\"38.1938\" ry=\"38.1938\"/>\n",
1847        "<text text-anchor=\"middle\" x=\"914.3097\" y=\"-115.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">00_fma</text>\n",
1848        "</g>\n",
1849        "<!-- 01_fma&#45;&gt;00_fma -->\n",
1850        "<g id=\"edge14\" class=\"edge\">\n",
1851        "<title>01_fma&#45;&gt;00_fma</title>\n",
1852        "<path fill=\"none\" stroke=\"#000000\" d=\"M794.8124,-177.1712C802.1055,-173.4296 809.7756,-169.5315 816.9631,-165.9475 834.3931,-157.2562 853.6895,-147.8875 870.4745,-139.819\"/>\n",
1853        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"872.011,-142.9639 879.5133,-135.4828 868.9832,-136.6525 872.011,-142.9639\"/>\n",
1854        "<text text-anchor=\"middle\" x=\"837.4631\" y=\"-169.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; 1,L</text>\n",
1855        "</g>\n",
1856        "<!-- i_start&#45;&gt;i_start -->\n",
1857        "<g id=\"edge2\" class=\"edge\">\n",
1858        "<title>i_start&#45;&gt;i_start</title>\n",
1859        "<path fill=\"none\" stroke=\"#000000\" d=\"M114.1221,-78.5082C114.1221,-89.0285 117.2471,-97.4446 123.4971,-97.4446 127.501,-97.4446 130.2224,-93.9906 131.6613,-88.7422\"/>\n",
1860        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"135.1729,-88.8502 132.8721,-78.5082 128.2214,-88.0277 135.1729,-88.8502\"/>\n",
1861        "<text text-anchor=\"middle\" x=\"123.4971\" y=\"-101.2446\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; .,R</text>\n",
1862        "</g>\n",
1863        "<!-- i_start&#45;&gt;goto_lsb -->\n",
1864        "<g id=\"edge3\" class=\"edge\">\n",
1865        "<title>i_start&#45;&gt;goto_lsb</title>\n",
1866        "<path fill=\"none\" stroke=\"#000000\" d=\"M153.3345,-60.7083C173.6728,-70.0882 201.0174,-82.6994 224.2209,-93.4007\"/>\n",
1867        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"223.0001,-96.6919 233.5468,-97.7017 225.9318,-90.3354 223.0001,-96.6919\"/>\n",
1868        "<text text-anchor=\"middle\" x=\"192.9942\" y=\"-91.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1 ; 1,R</text>\n",
1869        "</g>\n",
1870        "<!-- error -->\n",
1871        "<g id=\"node8\" class=\"node\">\n",
1872        "<title>error</title>\n",
1873        "<ellipse fill=\"none\" stroke=\"#000000\" cx=\"270.9406\" cy=\"-27.9475\" rx=\"27.8951\" ry=\"27.8951\"/>\n",
1874        "<text text-anchor=\"middle\" x=\"270.9406\" y=\"-24.2475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">error</text>\n",
1875        "</g>\n",
1876        "<!-- i_start&#45;&gt;error -->\n",
1877        "<g id=\"edge4\" class=\"edge\">\n",
1878        "<title>i_start&#45;&gt;error</title>\n",
1879        "<path fill=\"none\" stroke=\"#000000\" d=\"M155.8542,-42.7779C178.5978,-39.8471 209.1074,-35.9155 232.9987,-32.8368\"/>\n",
1880        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"233.6531,-36.2815 243.1237,-31.5321 232.7584,-29.3389 233.6531,-36.2815\"/>\n",
1881        "<text text-anchor=\"middle\" x=\"192.9942\" y=\"-44.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">. ; .,S</text>\n",
1882        "</g>\n",
1883        "<!-- goto_lsb&#45;&gt;branch -->\n",
1884        "<g id=\"edge6\" class=\"edge\">\n",
1885        "<title>goto_lsb&#45;&gt;branch</title>\n",
1886        "<path fill=\"none\" stroke=\"#000000\" d=\"M312.1266,-114.9475C329.704,-114.9475 350.2684,-114.9475 368.2523,-114.9475\"/>\n",
1887        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"368.5006,-118.4476 378.5006,-114.9475 368.5006,-111.4476 368.5006,-118.4476\"/>\n",
1888        "<text text-anchor=\"middle\" x=\"345.387\" y=\"-118.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">. ; .,L</text>\n",
1889        "</g>\n",
1890        "<!-- goto_lsb&#45;&gt;goto_lsb -->\n",
1891        "<g id=\"edge5\" class=\"edge\">\n",
1892        "<title>goto_lsb&#45;&gt;goto_lsb</title>\n",
1893        "<path fill=\"none\" stroke=\"#000000\" d=\"M257.0961,-153.499C257.5094,-164.9689 262.1242,-173.8939 270.9406,-173.8939 276.8641,-173.8939 280.891,-169.865 283.0212,-163.7423\"/>\n",
1894        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"286.5372,-163.9479 284.7851,-153.499 279.6388,-162.76 286.5372,-163.9479\"/>\n",
1895        "<text text-anchor=\"middle\" x=\"270.9406\" y=\"-192.6939\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; 0,R </text>\n",
1896        "<text text-anchor=\"middle\" x=\"270.9406\" y=\"-177.6939\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> 1 ; 1,R</text>\n",
1897        "</g>\n",
1898        "<!-- 10_fma&#45;&gt;01_fma -->\n",
1899        "<g id=\"edge17\" class=\"edge\">\n",
1900        "<title>10_fma&#45;&gt;01_fma</title>\n",
1901        "<path fill=\"none\" stroke=\"#000000\" d=\"M891.1439,-216.3106C881.9914,-206.6223 870.624,-197.1024 857.9631,-191.9475 842.676,-185.7234 824.8929,-184.6823 808.7401,-185.7763\"/>\n",
1902        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"808.0224,-182.3291 798.4035,-186.7706 808.6927,-189.297 808.0224,-182.3291\"/>\n",
1903        "<text text-anchor=\"middle\" x=\"837.4631\" y=\"-210.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; 0,L </text>\n",
1904        "<text text-anchor=\"middle\" x=\"837.4631\" y=\"-195.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\"> . ; 0,L</text>\n",
1905        "</g>\n",
1906        "<!-- 10_fma&#45;&gt;10_fma -->\n",
1907        "<g id=\"edge18\" class=\"edge\">\n",
1908        "<title>10_fma&#45;&gt;10_fma</title>\n",
1909        "<path fill=\"none\" stroke=\"#000000\" d=\"M900.0632,-282.7127C900.2093,-294.1942 904.9581,-303.2941 914.3097,-303.2941 920.5928,-303.2941 924.7981,-299.1863 926.9257,-293.0082\"/>\n",
1910        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"930.4488,-293.1371 928.5562,-282.7127 923.535,-292.0421 930.4488,-293.1371\"/>\n",
1911        "<text text-anchor=\"middle\" x=\"914.3097\" y=\"-307.0941\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1 ; 1,L</text>\n",
1912        "</g>\n",
1913        "<!-- 00_fma&#45;&gt;01_fma -->\n",
1914        "<g id=\"edge12\" class=\"edge\">\n",
1915        "<title>00_fma&#45;&gt;01_fma</title>\n",
1916        "<path fill=\"none\" stroke=\"#000000\" d=\"M876.6487,-111.3608C857.675,-109.4491 834.9441,-110.2053 816.9631,-119.9475 804.2825,-126.818 807.4719,-135.3028 798.9631,-146.9475 796.4853,-150.3385 793.8626,-153.8219 791.1981,-157.289\"/>\n",
1917        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"788.342,-155.26 784.9537,-165.2985 793.8625,-159.564 788.342,-155.26\"/>\n",
1918        "<text text-anchor=\"middle\" x=\"837.4631\" y=\"-123.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">1 ; 1,L</text>\n",
1919        "</g>\n",
1920        "<!-- 00_fma&#45;&gt;goto_lsb -->\n",
1921        "<g id=\"edge13\" class=\"edge\">\n",
1922        "<title>00_fma&#45;&gt;goto_lsb</title>\n",
1923        "<path fill=\"none\" stroke=\"#000000\" d=\"M888.1197,-90.4893C859.6708,-62.8227 811.4429,-24.9475 760.6165,-24.9475 413.3339,-24.9475 413.3339,-24.9475 413.3339,-24.9475 371.9436,-24.9475 332.7971,-52.4553 306.0641,-77.0555\"/>\n",
1924        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"303.3568,-74.8 298.5201,-84.2263 308.1795,-79.8736 303.3568,-74.8\"/>\n",
1925        "<text text-anchor=\"middle\" x=\"582.5254\" y=\"-28.7475\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">. ; .,R</text>\n",
1926        "</g>\n",
1927        "<!-- 00_fma&#45;&gt;00_fma -->\n",
1928        "<g id=\"edge11\" class=\"edge\">\n",
1929        "<title>00_fma&#45;&gt;00_fma</title>\n",
1930        "<path fill=\"none\" stroke=\"#000000\" d=\"M900.0632,-154.7127C900.2093,-166.1942 904.9581,-175.2941 914.3097,-175.2941 920.5928,-175.2941 924.7981,-171.1863 926.9257,-165.0082\"/>\n",
1931        "<polygon fill=\"#000000\" stroke=\"#000000\" points=\"930.4488,-165.1371 928.5562,-154.7127 923.535,-164.0421 930.4488,-165.1371\"/>\n",
1932        "<text text-anchor=\"middle\" x=\"914.3097\" y=\"-179.0941\" font-family=\"Times,serif\" font-size=\"14.00\" fill=\"#000000\">0 ; 0,L</text>\n",
1933        "</g>\n",
1934        "</g>\n",
1935        "</svg>\n"
1936       ],
1937       "text/plain": [
1938        "<graphviz.dot.Digraph at 0x7fa7a0d23908>"
1939       ]
1940      },
1941      "execution_count": 14,
1942      "metadata": {},
1943      "output_type": "execute_result"
1944     }
1945    ],
1946    "source": [
1947     "# Now show the above TM graphically!\n",
1948     "collatz_tm = md2mc(collatz_tm_str)\n",
1949     "dotObj_tm(collatz_tm, FuseEdges=True)"
1950    ]
1951   },
1952   {
1953    "cell_type": "code",
1954    "execution_count": 15,
1955    "metadata": {
1956     "run_control": {
1957      "frozen": false,
1958      "read_only": false
1959     }
1960    },
1961    "outputs": [
1962     {
1963      "name": "stdout",
1964      "output_type": "stream",
1965      "text": [
1966       "You may use any of these help commands:\n",
1967       "help(step_tm)\n",
1968       "help(run_tm)\n",
1969       "help(explore_tm)\n",
1970       "\n"
1971      ]
1972     }
1973    ],
1974    "source": [
1975     "from jove.Def_TM      import *"
1976    ]
1977   },
1978   {
1979    "cell_type": "code",
1980    "execution_count": 16,
1981    "metadata": {
1982     "run_control": {
1983      "frozen": false,
1984      "read_only": false
1985     }
1986    },
1987    "outputs": [
1988     {
1989      "name": "stdout",
1990      "output_type": "stream",
1991      "text": [
1992       "Allocating  8  tape cells to the RIGHT!\n",
1993       "Allocating  8  tape cells to the LEFT!\n",
1994       "Detailing the halted configs now.\n",
1995       "Accepted at  ('f_halt', 5, '.....1..............', 65)\n",
1996       " via .. \n",
1997       " ->('i_start', 0, '0110', 100)\n",
1998       " ->('i_start', 1, '.110', 99)\n",
1999       " ->('goto_lsb', 2, '.110', 98)\n",
2000       " ->('goto_lsb', 3, '.110', 97)\n",
2001       " ->('goto_lsb', 4, '.110', 96)\n",
2002       " ->('branch', 3, '.110........', 95)\n",
2003       " ->('branch', 2, '.11.........', 94)\n",
2004       " ->('check_n_eq_1', 1, '.11.........', 93)\n",
2005       " ->('01_fma', 2, '.11.........', 92)\n",
2006       " ->('10_fma', 1, '.10.........', 91)\n",
2007       " ->('10_fma', 0, '.10.........', 90)\n",
2008       " ->('01_fma', 7, '........010.........', 89)\n",
2009       " ->('goto_lsb', 8, '.......1010.........', 88)\n",
2010       " ->('goto_lsb', 9, '.......1010.........', 87)\n",
2011       " ->('goto_lsb', 10, '.......1010.........', 86)\n",
2012       " ->('goto_lsb', 11, '.......1010.........', 85)\n",
2013       " ->('branch', 10, '.......1010.........', 84)\n",
2014       " ->('branch', 9, '.......101..........', 83)\n",
2015       " ->('check_n_eq_1', 8, '.......101..........', 82)\n",
2016       " ->('01_fma', 9, '.......101..........', 81)\n",
2017       " ->('10_fma', 8, '.......100..........', 80)\n",
2018       " ->('01_fma', 7, '.......100..........', 79)\n",
2019       " ->('10_fma', 6, '.......000..........', 78)\n",
2020       " ->('01_fma', 5, '......0000..........', 77)\n",
2021       " ->('goto_lsb', 6, '.....10000..........', 76)\n",
2022       " ->('goto_lsb', 7, '.....10000..........', 75)\n",
2023       " ->('goto_lsb', 8, '.....10000..........', 74)\n",
2024       " ->('goto_lsb', 9, '.....10000..........', 73)\n",
2025       " ->('goto_lsb', 10, '.....10000..........', 72)\n",
2026       " ->('branch', 9, '.....10000..........', 71)\n",
2027       " ->('branch', 8, '.....1000...........', 70)\n",
2028       " ->('branch', 7, '.....100............', 69)\n",
2029       " ->('branch', 6, '.....10.............', 68)\n",
2030       " ->('branch', 5, '.....1..............', 67)\n",
2031       " ->('check_n_eq_1', 4, '.....1..............', 66)\n",
2032       " ->('f_halt', 5, '.....1..............', 65)\n"
2033      ]
2034     }
2035    ],
2036    "source": [
2037     "# Will loop if the Collatz (\"3x+1\") program will ever loop!\n",
2038     "explore_tm(collatz_tm, \"0110\", 100)"
2039    ]
2040   },
2041   {
2042    "cell_type": "markdown",
2043    "metadata": {
2044     "run_control": {
2045      "frozen": false,
2046      "read_only": false
2047     }
2048    },
2049    "source": [
2050     "# END: You have a ton more waiting for your execution pleasure!"
2051    ]
2052   }
2053  ],
2054  "metadata": {
2055   "kernelspec": {
2056    "display_name": "Python 3",
2057    "language": "python",
2058    "name": "python3"
2059   },
2060   "language_info": {
2061    "codemirror_mode": {
2062     "name": "ipython",
2063     "version": 3
2064    },
2065    "file_extension": ".py",
2066    "mimetype": "text/x-python",
2067    "name": "python",
2068    "nbconvert_exporter": "python",
2069    "pygments_lexer": "ipython3",
2070    "version": "3.6.8"
2071   },
2072   "toc": {
2073    "colors": {
2074     "hover_highlight": "#DAA520",
2075     "running_highlight": "#FF0000",
2076     "selected_highlight": "#FFD700"
2077    },
2078    "moveMenuLeft": true,
2079    "nav_menu": {
2080     "height": "318px",
2081     "width": "252px"
2082    },
2083    "navigate_menu": true,
2084    "number_sections": true,
2085    "sideBar": true,
2086    "threshold": 4,
2087    "toc_cell": false,
2088    "toc_section_display": "block",
2089    "toc_window_display": false,
2090    "widenNotebook": false
2091   }
2092  },
2093  "nbformat": 4,
2094  "nbformat_minor": 2
2095 }