diff --git a/info4/kapitel-3/PDA_nach_kfG.ipynb b/info4/kapitel-3/PDA_nach_kfG.ipynb index d21054f911344d2bcac989bef5a65be320b1a51f..af214c735fb0c0bfe5868bb68e3466459e47eb33 100644 --- a/info4/kapitel-3/PDA_nach_kfG.ipynb +++ b/info4/kapitel-3/PDA_nach_kfG.ipynb @@ -30,16 +30,17 @@ "MACHINE PDA_to_CFG\n", "/* Translating a PDA to a CFG */\n", "SETS\n", - " Z = {z0,z1, symbol}; \n", - " /* symbol: virtueller Zustand um S und andere Symbole in der Grammatik darzustellen */\n", - " SYMBOLE={a,b, A, BOT, lambda, S} /* BOT = # = Ende vom Keller */\n", + " Z = {z0,z1, `-`}; \n", + " /* `-`: virtueller Zustand um S und andere Symbole in der Grammatik darzustellen */\n", + " SYMBOLE={a,b, A, `#`, `λ`, S} /* BOT = # = Ende vom Keller */\n", "DEFINITIONS\n", - " kfG_Alphabet == (Z*(SYMBOLE \\ {lambda})*Z);\n", + " kfG_Alphabet == (Z*(SYMBOLE \\ {`λ`})*Z);\n", " Σ == {a,b};\n", - " Γ == {A,BOT};\n", - " PDA_Zustände == (Z-{symbol});\n", + " Γ == {A,`#`};\n", + " symbol == `-`; // virtueller Zustand für einfache Symbole\n", + " PDA_Zustände == (Z-{symbol}); // echte PDA Zustände\n", "\n", - " SYMS(s) == IF (s=lambda) THEN [] ELSE [SYM(s)] END;\n", + " SYMS(s) == IF (s=`λ`) THEN [] ELSE [SYM(s)] END;\n", " SYM(s) == (symbol,s,symbol); // Darstellung eines Symbols als Tripel für die Grammatik\n", " kfG_TERMINALE == {x|∃t.(t∈Σ ∧ x=SYM(t))};\n", " \n", @@ -49,25 +50,31 @@ " THEN TO_STRING(prj2(Z,SYMBOLE)(prj1((Z*SYMBOLE),Z)(cur(c))))\n", " ELSE TO_STRING(cur(c)) END};\n", " ANIMATION_STR_JUSTIFY_LEFT == TRUE;\n", - " SET_PREF_PP_SEQUENCES == TRUE\n", + " SET_PREF_PP_SEQUENCES == TRUE;\n", + " TOS == %(s1,s,s2).(s1:Z & s2:Z & s:SYMBOLE| \n", + " IF s1=symbol THEN TO_STRING(s)\n", + " ELSE conc([\"(\",TO_STRING(s1),\",\",\n", + " TO_STRING(s),\",\",\n", + " TO_STRING(s2),\")\"]) END);\n", + " CURS == conc((cur ; TOS)) // can be used for state space projection\n", "CONSTANTS δ, Regeln, RegelnP1, RegelnP2, RegelnP3, RegelnP4\n", "PROPERTIES\n", " /* Ein PDA für {a^m b^m| m≥1} ; Beispiel von Info 4 (Folie 95ff) */\n", - " δ = { (z0,a,BOT) ↦ (z0,[A,BOT]),\n", - " (z0,a,A) ↦ (z0,[A,A]),\n", - " (z0,b,A) ↦ (z1,[]),\n", - " (z1,lambda,BOT) ↦ (z1,[]),\n", - " (z1,b,A) ↦ (z1,[]) } ∧\n", + " δ = { (z0, a, `#`) ↦ (z0,[A,`#`]),\n", + " (z0, a, A) ↦ (z0,[A,A]),\n", + " (z0, b, A) ↦ (z1,[]),\n", + " (z1,`λ`,`#`) ↦ (z1,[]),\n", + " (z1, b, A) ↦ (z1,[]) } ∧\n", " \n", " /*Die Regeln der kfG zum PDA*/\n", - " /* Punkt 1 Folie 109 */\n", - " RegelnP1 = { lhs,rhs | ∃z.(z∈PDA_Zustände ∧ lhs=SYM(S) ∧ rhs = [(z0,BOT,z)])} ∧\n", - " /* Punkt 2 Folie 109 */\n", + " /* Punkt 1 Folie 109: Regeln für das Startsymbol */\n", + " RegelnP1 = { lhs,rhs | #z.(z:PDA_Zustände & lhs=SYM(S) & rhs = [(z0,`#`,z)])} ∧\n", + " /* Punkt 2 Folie 109: Regeln für PDA Übergänge die \"Poppen\" */\n", " RegelnP2 = { lhs,rhs | ∃(z,a,A,z2).((z,a,A)↦(z2,[])∈δ ∧ lhs=(z,A,z2) ∧ rhs = SYMS(a)) } ∧\n", - " /* Punkt 3 Folie 110 */\n", + " /* Punkt 3 Folie 110: Regeln für PDA Übergänge die die Stapelgröße nicht verändern */\n", " RegelnP3 = { lhs,rhs | ∃(z,a,A,B,z1,z2).((z,a,A)↦(z1,[B])∈δ ∧ z2∈PDA_Zustände ∧\n", " lhs=(z,A,z2) ∧ rhs = SYMS(a)^[(z1,B,z2)]) } ∧\n", - " /* Punkt 4 Folie 110 */\n", + " /* Punkt 4 Folie 110: Regeln für PDA Übergänge die auf den Stapel \"Pushen\" */\n", " RegelnP4 = { lhs,rhs | ∃(z,a,A,B,C,z1,z2,z3).((z,a,A)↦(z1,[B,C])∈δ ∧ \n", " z2∈PDA_Zustände ∧ z3∈PDA_Zustände ∧\n", " lhs=(z,A,z3) ∧ \n", @@ -99,7 +106,7 @@ { "data": { "text/plain": [ - "Machine constants set up using operation 0: $setup_constants()" + "Executed operation: SETUP_CONSTANTS()" ] }, "execution_count": 2, @@ -119,7 +126,7 @@ { "data": { "text/plain": [ - "Machine initialised using operation 1: $initialise_machine()" + "Executed operation: INITIALISATION()" ] }, "execution_count": 3, @@ -139,10 +146,10 @@ { "data": { "text/markdown": [ - "$\\{(\\mathit{z0}\\mapsto \\mathit{a}\\mapsto \\mathit{A}\\mapsto(\\mathit{z0}\\mapsto [A,A])),(\\mathit{z0}\\mapsto \\mathit{a}\\mapsto \\mathit{BOT}\\mapsto(\\mathit{z0}\\mapsto [A,BOT])),(\\mathit{z0}\\mapsto \\mathit{b}\\mapsto \\mathit{A}\\mapsto(\\mathit{z1}\\mapsto [])),(\\mathit{z1}\\mapsto \\mathit{b}\\mapsto \\mathit{A}\\mapsto(\\mathit{z1}\\mapsto [])),(\\mathit{z1}\\mapsto \\mathit{lambda}\\mapsto \\mathit{BOT}\\mapsto(\\mathit{z1}\\mapsto []))\\}$" + "$\\{(\\mathit{\\text{`}-\\text{`}}\\mapsto\\mathit{S}\\mapsto\\mathit{\\text{`}-\\text{`}}\\mapsto[(\\mathit{z0}\\mapsto\\mathit{\\text{`}\\#\\text{`}}\\mapsto\\mathit{z0})]),(\\mathit{\\text{`}-\\text{`}}\\mapsto\\mathit{S}\\mapsto\\mathit{\\text{`}-\\text{`}}\\mapsto[(\\mathit{z0}\\mapsto\\mathit{\\text{`}\\#\\text{`}}\\mapsto\\mathit{z1})])\\}$" ], "text/plain": [ - "{(z0↦a↦A↦(z0↦[A,A])),(z0↦a↦BOT↦(z0↦[A,BOT])),(z0↦b↦A↦(z1↦[])),(z1↦b↦A↦(z1↦[])),(z1↦lambda↦BOT↦(z1↦[]))}" + "{(`-`↦S↦`-`↦[(z0↦`#`↦z0)]),(`-`↦S↦`-`↦[(z0↦`#`↦z1)])}" ] }, "execution_count": 4, @@ -151,7 +158,91 @@ } ], "source": [ - "δ" + "RegelnP1" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "|prj111|prj112|prj12|prj2|\n", + "|---|---|---|---|\n", + "|z0|A|z0|[(`-`↦a↦`-`),(z0↦A↦z0),(z0↦A↦z0)]|\n", + "|z0|A|z0|[(`-`↦a↦`-`),(z0↦A↦z1),(z1↦A↦z0)]|\n", + "|z0|A|z1|[(`-`↦b↦`-`)]|\n", + "|z0|A|z1|[(`-`↦a↦`-`),(z0↦A↦z0),(z0↦A↦z1)]|\n", + "|z0|A|z1|[(`-`↦a↦`-`),(z0↦A↦z1),(z1↦A↦z1)]|\n", + "|z0|`#`|z0|[(`-`↦a↦`-`),(z0↦A↦z0),(z0↦`#`↦z0)]|\n", + "|z0|`#`|z0|[(`-`↦a↦`-`),(z0↦A↦z1),(z1↦`#`↦z0)]|\n", + "|z0|`#`|z1|[(`-`↦a↦`-`),(z0↦A↦z0),(z0↦`#`↦z1)]|\n", + "|z0|`#`|z1|[(`-`↦a↦`-`),(z0↦A↦z1),(z1↦`#`↦z1)]|\n", + "|z1|A|z1|[(`-`↦b↦`-`)]|\n", + "|z1|`#`|z1|[]|\n", + "|`-`|S|`-`|[(z0↦`#`↦z0)]|\n", + "|`-`|S|`-`|[(z0↦`#`↦z1)]|\n" + ], + "text/plain": [ + "prj111\tprj112\tprj12\tprj2\n", + "z0\tA\tz0\t[(`-`|->a|->`-`),(z0|->A|->z0),(z0|->A|->z0)]\n", + "z0\tA\tz0\t[(`-`|->a|->`-`),(z0|->A|->z1),(z1|->A|->z0)]\n", + "z0\tA\tz1\t[(`-`|->b|->`-`)]\n", + "z0\tA\tz1\t[(`-`|->a|->`-`),(z0|->A|->z0),(z0|->A|->z1)]\n", + "z0\tA\tz1\t[(`-`|->a|->`-`),(z0|->A|->z1),(z1|->A|->z1)]\n", + "z0\t`#`\tz0\t[(`-`|->a|->`-`),(z0|->A|->z0),(z0|->`#`|->z0)]\n", + "z0\t`#`\tz0\t[(`-`|->a|->`-`),(z0|->A|->z1),(z1|->`#`|->z0)]\n", + "z0\t`#`\tz1\t[(`-`|->a|->`-`),(z0|->A|->z0),(z0|->`#`|->z1)]\n", + "z0\t`#`\tz1\t[(`-`|->a|->`-`),(z0|->A|->z1),(z1|->`#`|->z1)]\n", + "z1\tA\tz1\t[(`-`|->b|->`-`)]\n", + "z1\t`#`\tz1\t[]\n", + "`-`\tS\t`-`\t[(z0|->`#`|->z0)]\n", + "`-`\tS\t`-`\t[(z0|->`#`|->z1)]\n" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":table Regeln" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "|prj111|prj112|prj12|prj21|prj22|\n", + "|---|---|---|---|---|\n", + "|z0|a|A|z0|[A,A]|\n", + "|z0|a|`#`|z0|[A,`#`]|\n", + "|z0|b|A|z1|[]|\n", + "|z1|b|A|z1|[]|\n", + "|z1|`λ`|`#`|z1|[]|\n" + ], + "text/plain": [ + "prj111\tprj112\tprj12\tprj21\tprj22\n", + "z0\ta\tA\tz0\t[A,A]\n", + "z0\ta\t`#`\tz0\t[A,`#`]\n", + "z0\tb\tA\tz1\t[]\n", + "z1\tb\tA\tz1\t[]\n", + "z1\t`λ`\t`#`\tz1\t[]\n" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":table δ" ] }, { @@ -163,7 +254,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -179,7 +270,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -190,7 +281,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -201,11 +292,11 @@ "Constants: δ, Regeln, RegelnP1, RegelnP2, RegelnP3, RegelnP4\n", "Variables: cur\n", "Operations: \n", - "ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z0)],[],[])\n", - "ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])" + "ApplyRule((`-`|->S|->`-`),[(z0|->`#`|->z0)],[],[])\n", + "ApplyRule((`-`|->S|->`-`),[(z0|->`#`|->z1)],[],[])" ] }, - "execution_count": 6, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -216,27 +307,27 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: ApplyRule((symbol|->S|->symbol),[(z0|->BOT|->z1)],[],[])" + "Executed operation: ApplyRule((`-`|->S|->`-`),[(z0|->`#`|->z1)],[],[])" ] }, - "execution_count": 7, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":exec ApplyRule RHS = [(z0|->BOT|->z1)]" + ":exec ApplyRule RHS = [(z0|->`#`|->z1)]" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -244,7 +335,7 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">(z0|->BOT|->z1)</td>\n", + "<td style=\"padding:10px\">(z0|->`#`|->z1)</td>\n", "</tr>\n", "</tbody></table>" ], @@ -252,7 +343,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 8, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -263,27 +354,27 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: ApplyRule((z0|->BOT|->z1),[(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)],[],[])" + "Executed operation: ApplyRule((z0|->`#`|->z1),[(`-`|->a|->`-`),(z0|->A|->z1),(z1|->`#`|->z1)],[],[])" ] }, - "execution_count": 9, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":exec ApplyRule RHS = [(symbol|->a|->symbol),(z0|->A|->z1),(z1|->BOT|->z1)]" + ":exec ApplyRule RHS = [(`-`|->a|->`-`),(z0|->A|->z1),(z1|->`#`|->z1)]" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -293,7 +384,7 @@ "<tr>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">(z0|->A|->z1)</td>\n", - "<td style=\"padding:10px\">(z1|->BOT|->z1)</td>\n", + "<td style=\"padding:10px\">(z1|->`#`|->z1)</td>\n", "</tr>\n", "</tbody></table>" ], @@ -301,7 +392,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 10, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -312,27 +403,27 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: ApplyRule((z0|->A|->z1),[(symbol|->b|->symbol)],[(symbol|->a|->symbol)],[(z1|->BOT|->z1)])" + "Executed operation: ApplyRule((z0|->A|->z1),[(`-`|->b|->`-`)],[(`-`|->a|->`-`)],[(z1|->`#`|->z1)])" ] }, - "execution_count": 11, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":exec ApplyRule RHS=[(symbol|->b|->symbol)]" + ":exec ApplyRule RHS=[(`-`|->b|->`-`)]" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -342,7 +433,7 @@ "<tr>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">(z1|->BOT|->z1)</td>\n", + "<td style=\"padding:10px\">(z1|->`#`|->z1)</td>\n", "</tr>\n", "</tbody></table>" ], @@ -350,7 +441,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 12, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -361,16 +452,16 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: ApplyRule((z1|->BOT|->z1),[],[(symbol|->a|->symbol),(symbol|->b|->symbol)],[])" + "Executed operation: ApplyRule((z1|->`#`|->z1),[],[(`-`|->a|->`-`),(`-`|->b|->`-`)],[])" ] }, - "execution_count": 13, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -381,7 +472,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -398,7 +489,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 14, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -409,7 +500,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -422,7 +513,7 @@ "Operations: " ] }, - "execution_count": 15, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -438,6 +529,243 @@ "Da das Wort fertig abgeleitet wurde ist keine Regel mehr ausführbar." ] }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", + "<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n", + " -->\n", + "<!-- Title: prob_graph Pages: 1 -->\n", + "<svg width=\"540pt\" height=\"719pt\"\n", + " viewBox=\"0.00 0.00 540.00 719.43\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(0.538922 0.538922) rotate(0) translate(4 1330.94)\">\n", + "<title>prob_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-1330.94 998,-1330.94 998,4 -4,4\"/>\n", + "<!-- 1 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>1</title>\n", + "<polygon fill=\"none\" stroke=\"orange\" points=\"0,-1255.38 0,-1300.62 883.5,-1300.62 883.5,-1255.38 0,-1255.38\"/>\n", + "<text text-anchor=\"middle\" x=\"9.5\" y=\"-1273.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"19,-1255.38 19,-1300.62\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-1285.22\" font-family=\"Times,serif\" font-size=\"12.00\">conc((cur ; λ(s1,s,s2).(s1 ∈ Z ∧ s ∈ SYMBOLE ∧ s2 ∈ Z|(IF s1 = `-` THEN TO_STRING(s) ELSE conc(["(",TO_STRING(s1),",",TO_STRING(s),",",TO_STRING(s2),"...</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"19,-1277.62 864.5,-1277.62\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-1262.22\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"864.5,-1255.38 864.5,-1300.62\"/>\n", + "<text text-anchor=\"middle\" x=\"874\" y=\"-1273.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 2 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>2</title>\n", + "<polygon fill=\"none\" stroke=\"green\" points=\"374.62,-1049.75 374.62,-1094.25 508.88,-1094.25 508.88,-1049.75 374.62,-1049.75\"/>\n", + "<text text-anchor=\"middle\" x=\"384.12\" y=\"-1067.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"393.62,-1049.75 393.62,-1094.25\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-1078.85\" font-family=\"Times,serif\" font-size=\"12.00\"><< undefined >></text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"393.62,-1072 489.88,-1072\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-1056.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"489.88,-1049.75 489.88,-1094.25\"/>\n", + "<text text-anchor=\"middle\" x=\"499.38\" y=\"-1067.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 1->2 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>1->2</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M441.75,-1255.55C441.75,-1219.65 441.75,-1147.18 441.75,-1105.15\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"445.25,-1105.16 441.75,-1095.16 438.25,-1105.16 445.25,-1105.16\"/>\n", + "<text text-anchor=\"middle\" x=\"499.12\" y=\"-1169.72\" font-family=\"Times,serif\" font-size=\"12.00\">SETUP_CONSTANTS</text>\n", + "</g>\n", + "<!-- 3 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>3</title>\n", + "<polygon fill=\"none\" stroke=\"green\" points=\"391.5,-844.75 391.5,-889.25 492,-889.25 492,-844.75 391.5,-844.75\"/>\n", + "<text text-anchor=\"middle\" x=\"401\" y=\"-862.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"410.5,-844.75 410.5,-889.25\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-873.85\" font-family=\"Times,serif\" font-size=\"12.00\">"S"</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"410.5,-867 473,-867\"/>\n", + "<text text-anchor=\"middle\" x=\"441.75\" y=\"-851.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"473,-844.75 473,-889.25\"/>\n", + "<text text-anchor=\"middle\" x=\"482.5\" y=\"-862.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 2->3 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>2->3</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M441.75,-1050.04C441.75,-1014.48 441.75,-942.12 441.75,-900.13\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"445.25,-900.15 441.75,-890.15 438.25,-900.15 445.25,-900.15\"/>\n", + "<text text-anchor=\"middle\" x=\"487.5\" y=\"-965.73\" font-family=\"Times,serif\" font-size=\"12.00\">INITIALISATION</text>\n", + "</g>\n", + "<!-- 4 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>4</title>\n", + "<polygon fill=\"none\" stroke=\"orange\" points=\"346.75,-640.75 346.75,-685.25 460.75,-685.25 460.75,-640.75 346.75,-640.75\"/>\n", + "<text text-anchor=\"middle\" x=\"356.25\" y=\"-658.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"365.75,-640.75 365.75,-685.25\"/>\n", + "<text text-anchor=\"middle\" x=\"403.75\" y=\"-669.85\" font-family=\"Times,serif\" font-size=\"12.00\">"(z0,`#`,z0)"</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"365.75,-663 441.75,-663\"/>\n", + "<text text-anchor=\"middle\" x=\"403.75\" y=\"-647.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"441.75,-640.75 441.75,-685.25\"/>\n", + "<text text-anchor=\"middle\" x=\"451.25\" y=\"-658.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 3->4 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>3->4</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M437.76,-844.76C431.05,-809.13 417.51,-737.14 409.69,-695.57\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"412.98,-695.13 407.69,-685.95 406.1,-696.43 412.98,-695.13\"/>\n", + "<text text-anchor=\"middle\" x=\"451\" y=\"-760.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 5 -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>5</title>\n", + "<polygon fill=\"none\" stroke=\"green\" points=\"478.75,-640.75 478.75,-685.25 592.75,-685.25 592.75,-640.75 478.75,-640.75\"/>\n", + "<text text-anchor=\"middle\" x=\"488.25\" y=\"-658.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"497.75,-640.75 497.75,-685.25\"/>\n", + "<text text-anchor=\"middle\" x=\"535.75\" y=\"-669.85\" font-family=\"Times,serif\" font-size=\"12.00\">"(z0,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"497.75,-663 573.75,-663\"/>\n", + "<text text-anchor=\"middle\" x=\"535.75\" y=\"-647.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"573.75,-640.75 573.75,-685.25\"/>\n", + "<text text-anchor=\"middle\" x=\"583.25\" y=\"-658.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 3->5 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>3->5</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M451.63,-844.76C468.32,-808.91 502.14,-736.22 521.43,-694.77\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"524.95,-696.49 526,-685.95 518.61,-693.54 524.95,-696.49\"/>\n", + "<text text-anchor=\"middle\" x=\"518\" y=\"-760.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 6 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>6</title>\n", + "<polygon fill=\"none\" stroke=\"orange\" points=\"389.62,-435.75 389.62,-480.25 553.88,-480.25 553.88,-435.75 389.62,-435.75\"/>\n", + "<text text-anchor=\"middle\" x=\"399.12\" y=\"-453.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"408.62,-435.75 408.62,-480.25\"/>\n", + "<text text-anchor=\"middle\" x=\"471.75\" y=\"-464.85\" font-family=\"Times,serif\" font-size=\"12.00\">"a(z0,A,z0)(z0,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"408.62,-458 534.88,-458\"/>\n", + "<text text-anchor=\"middle\" x=\"471.75\" y=\"-442.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"534.88,-435.75 534.88,-480.25\"/>\n", + "<text text-anchor=\"middle\" x=\"544.38\" y=\"-453.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 5->6 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>5->6</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M529.14,-641.04C517.88,-605.33 494.92,-532.5 481.71,-490.6\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"484.76,-489.63 478.42,-481.15 478.09,-491.74 484.76,-489.63\"/>\n", + "<text text-anchor=\"middle\" x=\"532\" y=\"-555.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 7 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>7</title>\n", + "<polygon fill=\"none\" stroke=\"green\" points=\"571.62,-435.75 571.62,-480.25 735.88,-480.25 735.88,-435.75 571.62,-435.75\"/>\n", + "<text text-anchor=\"middle\" x=\"581.12\" y=\"-453.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"590.62,-435.75 590.62,-480.25\"/>\n", + "<text text-anchor=\"middle\" x=\"653.75\" y=\"-464.85\" font-family=\"Times,serif\" font-size=\"12.00\">"a(z0,A,z1)(z1,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"590.62,-458 716.88,-458\"/>\n", + "<text text-anchor=\"middle\" x=\"653.75\" y=\"-442.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"716.88,-435.75 716.88,-480.25\"/>\n", + "<text text-anchor=\"middle\" x=\"726.38\" y=\"-453.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 5->7 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>5->7</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M547.93,-641.04C568.87,-605.03 611.75,-531.26 636,-489.53\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"639.46,-491.55 641.46,-481.15 633.4,-488.04 639.46,-491.55\"/>\n", + "<text text-anchor=\"middle\" x=\"625\" y=\"-555.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 8 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>8</title>\n", + "<polygon fill=\"none\" stroke=\"green\" points=\"403.12,-230.75 403.12,-275.25 528.38,-275.25 528.38,-230.75 403.12,-230.75\"/>\n", + "<text text-anchor=\"middle\" x=\"412.62\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"422.12,-230.75 422.12,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"465.75\" y=\"-259.85\" font-family=\"Times,serif\" font-size=\"12.00\">"ab(z1,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"422.12,-253 509.38,-253\"/>\n", + "<text text-anchor=\"middle\" x=\"465.75\" y=\"-237.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" points=\"509.38,-230.75 509.38,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"518.88\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 7->8 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>7->8</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M634.34,-436.04C600.57,-399.57 530.94,-324.39 492.57,-282.96\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"495.7,-281.11 486.34,-276.15 490.56,-285.87 495.7,-281.11\"/>\n", + "<text text-anchor=\"middle\" x=\"592\" y=\"-351.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 9 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>9</title>\n", + "<polygon fill=\"none\" stroke=\"orange\" points=\"546.5,-230.75 546.5,-275.25 761,-275.25 761,-230.75 546.5,-230.75\"/>\n", + "<text text-anchor=\"middle\" x=\"556\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"565.5,-230.75 565.5,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"653.75\" y=\"-259.85\" font-family=\"Times,serif\" font-size=\"12.00\">"aa(z0,A,z0)(z0,A,z1)(z1,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"565.5,-253 742,-253\"/>\n", + "<text text-anchor=\"middle\" x=\"653.75\" y=\"-237.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"742,-230.75 742,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"751.5\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 7->9 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>7->9</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M653.75,-436.04C653.75,-400.48 653.75,-328.12 653.75,-286.13\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"657.25,-286.15 653.75,-276.15 650.25,-286.15 657.25,-286.15\"/>\n", + "<text text-anchor=\"middle\" x=\"680\" y=\"-351.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 10 -->\n", + "<g id=\"node10\" class=\"node\">\n", + "<title>10</title>\n", + "<polygon fill=\"none\" stroke=\"orange\" points=\"779.5,-230.75 779.5,-275.25 994,-275.25 994,-230.75 779.5,-230.75\"/>\n", + "<text text-anchor=\"middle\" x=\"789\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"798.5,-230.75 798.5,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"886.75\" y=\"-259.85\" font-family=\"Times,serif\" font-size=\"12.00\">"aa(z0,A,z1)(z1,A,z1)(z1,`#`,z1)"</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"798.5,-253 975,-253\"/>\n", + "<text text-anchor=\"middle\" x=\"886.75\" y=\"-237.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"orange\" points=\"975,-230.75 975,-275.25\"/>\n", + "<text text-anchor=\"middle\" x=\"984.5\" y=\"-248.72\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 7->10 -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>7->10</title>\n", + "<path fill=\"none\" stroke=\"#806040\" d=\"M677.81,-436.04C719.93,-399.34 807.04,-323.45 854.39,-282.19\"/>\n", + "<polygon fill=\"#806040\" stroke=\"#806040\" points=\"856.23,-284.36 861.47,-275.15 851.64,-279.08 856.23,-284.36\"/>\n", + "<text text-anchor=\"middle\" x=\"804\" y=\"-351.73\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "<!-- 11 -->\n", + "<g id=\"node11\" class=\"node\">\n", + "<title>11</title>\n", + "<polygon fill=\"none\" stroke=\"green\" stroke-width=\"2\" points=\"415.5,-26.75 415.5,-71.25 516,-71.25 516,-26.75 415.5,-26.75\"/>\n", + "<text text-anchor=\"middle\" x=\"425\" y=\"-44.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "<polyline fill=\"none\" stroke=\"green\" stroke-width=\"2\" points=\"434.5,-26.75 434.5,-71.25\"/>\n", + "<text text-anchor=\"middle\" x=\"465.75\" y=\"-55.85\" font-family=\"Times,serif\" font-size=\"12.00\">"ab"</text>\n", + "<polyline fill=\"none\" stroke=\"green\" stroke-width=\"2\" points=\"434.5,-49 497,-49\"/>\n", + "<text text-anchor=\"middle\" x=\"465.75\" y=\"-33.6\" font-family=\"Times,serif\" font-size=\"12.00\"># states: 1</text>\n", + "<polyline fill=\"none\" stroke=\"green\" stroke-width=\"2\" points=\"497,-26.75 497,-71.25\"/>\n", + "<text text-anchor=\"middle\" x=\"506.5\" y=\"-44.73\" font-family=\"Times,serif\" font-size=\"12.00\"> </text>\n", + "</g>\n", + "<!-- 8->11 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>8->11</title>\n", + "<path fill=\"none\" stroke=\"black\" d=\"M465.75,-230.76C465.75,-195.21 465.75,-123.45 465.75,-81.83\"/>\n", + "<polygon fill=\"black\" stroke=\"black\" points=\"469.25,-81.95 465.75,-71.95 462.25,-81.95 469.25,-81.95\"/>\n", + "<text text-anchor=\"middle\" x=\"492\" y=\"-146.72\" font-family=\"Times,serif\" font-size=\"12.00\">ApplyRule</text>\n", + "</g>\n", + "</g>\n", + "</svg>\n" + ], + "text/plain": [ + "<Dot visualization: transition_diagram [CURS]>" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":dot transition_diagram CURS" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/info4/kapitel-4/DPDA.ipynb b/info4/kapitel-4/DPDA.ipynb index 28c43b8853f836ea9da6c880ab4cf8dfb595e9a3..e34d37b67ea363011b7cbff4e4f96c37eb637376 100644 --- a/info4/kapitel-4/DPDA.ipynb +++ b/info4/kapitel-4/DPDA.ipynb @@ -29,7 +29,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -38,7 +38,7 @@ "Loaded machine: DPDA" ] }, - "execution_count": 27, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } @@ -49,24 +49,37 @@ "/* B Modell eines PDA */\n", "SETS\n", " Z = {z0,z1,ze}; // die Zustände des Automaten, z0 ist der Startzustand\n", - " SYMBOLE={a,b, A, BOT, lambda} /* BOT = # = Bottom-Symbol im Keller*/\n", + " SYMBOLE={a,b, A, `#`, `λ`} /* BOT = # = Bottom-Symbol im Keller*/\n", "DEFINITIONS\n", " ANIMATION_FUNCTION_DEFAULT == {(1,1,z)};\n", " ANIMATION_FUNCTION == {2}*α ∪ {3}*(γ);\n", " ANIMATION_FUNCTION1 == {(1,0,\"z: \"),(2,0,\"α:\"),(3,0,\"γ:\")};\n", " ANIMATION_STR_JUSTIFY_LEFTx == TRUE;\n", - " SET_PREF_PP_SEQUENCES == TRUE\n", + " SET_PREF_PP_SEQUENCES == TRUE;\n", + " \"LibraryStrings.def\";\n", + " dot_fields(seqval) == IF seqval=[] THEN \"λ\" ELSE \n", + " conc( %i.(i:1..size(seqval)-1| TO_STRING(seqval(i)) ^ \"|\") ) ^ TO_STRING(last(seqval))\n", + " END;\n", + " CUSTOM_GRAPH_NODES1 == rec(label:\"{Eingabe α|{\"^dot_fields(α)^\"}}\",\n", + " shape:\"record\", style:\"filled\", fillcolor:\"gray\");\n", + " CUSTOM_GRAPH_NODES2 == rec(label:\"{Keller γ|\"^dot_fields(γ)^\"}\",\n", + " shape:\"record\", style:\"filled\", fillcolor:\"gray\");\n", + " CUSTOM_GRAPH_NODES == {s•s:Z|rec(label:s,\n", + " shape: IF s:F THEN \"doublecircle\" ELSE \"circle\" END,\n", + " style:\"filled\",\n", + " fillcolor: IF s=z THEN \"gray\" ELSE \"white\" END)};\n", + " CUSTOM_GRAPH_EDGES == {z1,aa,bb,z2,G2•(z1,aa,bb)|->(z2,G2):δ| rec(from:z1,to:z2,label:aa)};\n", "CONSTANTS δ, F, Σ, Γ\n", "PROPERTIES\n", " Σ = {a,b} // das Eingabe-Alphabet\n", " ∧\n", - " Γ = {A,BOT} // das Kelleralphabet\n", + " Γ = {A,`#`} // das Kelleralphabet\n", " ∧\n", " /* Der PDA für {a^m b^m| m>=1} ; Beispiel von Info 4 (Folie 95ff) */\n", - " δ = { (z0,a,BOT) ↦ (z0,[A,BOT]),\n", + " δ = { (z0,a,`#`) ↦ (z0,[A,`#`]),\n", " (z0,a,A) ↦ (z0,[A,A]),\n", " (z0,b,A) ↦ (z1,[]),\n", - " (z1,lambda,BOT) ↦ (ze,[]),\n", + " (z1,`λ`,`#`) ↦ (ze,[]),\n", " (z1,b,A) ↦ (z1,[]) } ∧\n", " F = {ze} // die Endzustände\n", " // Anmerkung: δ ist hier als Relation anstatt als Funktion zu Mengen definiert\n", @@ -82,7 +95,7 @@ " γ ∈ seq(Γ) // aktuelle Kellerinhalt\n", "INITIALISATION\n", " z := z0 ||\n", - " γ := [BOT] || // Initialisierung des Stapels\n", + " γ := [`#`] || // Initialisierung des Stapels\n", " α := [a,a,b,b] // das Eingabewort\n", "OPERATIONS\n", " // die Operationen Schritt und LambdaSchritt modellieren\n", @@ -94,7 +107,7 @@ " γ := s^tail(γ) // s auf den Stapel packen\n", " END;\n", " LambdaSchritt(z‘,s) = PRE γ ≠ ∅ ∧\n", - " z‘↦s ∈ δ[{(z,lambda,first(γ))}] THEN\n", + " z‘↦s ∈ δ[{(z,`λ`,first(γ))}] THEN\n", " z := z‘ || // in den neuen Zustand wechseln\n", " γ := s^tail(γ) // s auf den Stapel packen\n", " END;\n", @@ -111,16 +124,16 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Machine constants set up using operation 0: $setup_constants()" + "Executed operation: SETUP_CONSTANTS()" ] }, - "execution_count": 28, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -131,16 +144,16 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Machine initialised using operation 1: $initialise_machine()" + "Executed operation: INITIALISATION()" ] }, - "execution_count": 29, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -158,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -170,13 +183,13 @@ "TRUE" ] }, - "execution_count": 30, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "!(a,A,z).(a∈Σ ∧ A∈Γ ∧ z∈Z => card(δ[{(z,a,A)}]) + card(δ[{(z,lambda,A)}]) ≤ 1)" + "!(a,A,z).(a∈Σ ∧ A∈Γ ∧ z∈Z => card(δ[{(z,a,A)}]) + card(δ[{(z,`λ`,A)}]) ≤ 1)" ] }, { @@ -188,7 +201,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -196,47 +209,47 @@ "text/markdown": [ "|a|A|z|ca|cl|\n", "|---|---|---|---|---|\n", - "|$\\mathit{a}$|$\\mathit{A}$|$\\mathit{z0}$|$1$|$0$|\n", - "|$\\mathit{a}$|$\\mathit{A}$|$\\mathit{z1}$|$0$|$0$|\n", - "|$\\mathit{a}$|$\\mathit{A}$|$\\mathit{ze}$|$0$|$0$|\n", - "|$\\mathit{a}$|$\\mathit{BOT}$|$\\mathit{z0}$|$1$|$0$|\n", - "|$\\mathit{a}$|$\\mathit{BOT}$|$\\mathit{z1}$|$0$|$1$|\n", - "|$\\mathit{a}$|$\\mathit{BOT}$|$\\mathit{ze}$|$0$|$0$|\n", - "|$\\mathit{b}$|$\\mathit{A}$|$\\mathit{z0}$|$1$|$0$|\n", - "|$\\mathit{b}$|$\\mathit{A}$|$\\mathit{z1}$|$1$|$0$|\n", - "|$\\mathit{b}$|$\\mathit{A}$|$\\mathit{ze}$|$0$|$0$|\n", - "|$\\mathit{b}$|$\\mathit{BOT}$|$\\mathit{z0}$|$0$|$0$|\n", - "|$\\mathit{b}$|$\\mathit{BOT}$|$\\mathit{z1}$|$0$|$1$|\n", - "|$\\mathit{b}$|$\\mathit{BOT}$|$\\mathit{ze}$|$0$|$0$|\n" + "|a|A|z0|1|0|\n", + "|a|A|z1|0|0|\n", + "|a|A|ze|0|0|\n", + "|a|`#`|z0|1|0|\n", + "|a|`#`|z1|0|1|\n", + "|a|`#`|ze|0|0|\n", + "|b|A|z0|1|0|\n", + "|b|A|z1|1|0|\n", + "|b|A|ze|0|0|\n", + "|b|`#`|z0|0|0|\n", + "|b|`#`|z1|0|1|\n", + "|b|`#`|ze|0|0|\n" ], "text/plain": [ "a\tA\tz\tca\tcl\n", "a\tA\tz0\t1\t0\n", "a\tA\tz1\t0\t0\n", "a\tA\tze\t0\t0\n", - "a\tBOT\tz0\t1\t0\n", - "a\tBOT\tz1\t0\t1\n", - "a\tBOT\tze\t0\t0\n", + "a\t`#`\tz0\t1\t0\n", + "a\t`#`\tz1\t0\t1\n", + "a\t`#`\tze\t0\t0\n", "b\tA\tz0\t1\t0\n", "b\tA\tz1\t1\t0\n", "b\tA\tze\t0\t0\n", - "b\tBOT\tz0\t0\t0\n", - "b\tBOT\tz1\t0\t1\n", - "b\tBOT\tze\t0\t0\n" + "b\t`#`\tz0\t0\t0\n", + "b\t`#`\tz1\t0\t1\n", + "b\t`#`\tze\t0\t0\n" ] }, - "execution_count": 31, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ - ":table {a,A,z,ca,cl| a∈Σ ∧ A∈Γ ∧ z∈Z ∧ ca=card(δ[{(z,a,A)}]) & cl = card(δ[{(z,lambda,A)}])}" + ":table {a,A,z,ca,cl| a∈Σ ∧ A∈Γ ∧ z∈Z ∧ ca=card(δ[{(z,a,A)}]) & cl = card(δ[{(z,`λ`,A)}])}" ] }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -247,10 +260,10 @@ "Constants: δ, F, Σ, Γ\n", "Variables: z, α, γ\n", "Operations: \n", - "Schritt(z0,[A,BOT])" + "Schritt(z0,[A,`#`])" ] }, - "execution_count": 32, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -261,16 +274,16 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: Schritt(z0,[A,BOT])" + "Executed operation: Schritt(z0,[A,`#`])" ] }, - "execution_count": 33, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -281,7 +294,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -303,7 +316,7 @@ "<tr>\n", "<td style=\"padding:10px\">γ:</td>\n", "<td style=\"padding:10px\">A</td>\n", - "<td style=\"padding:10px\">BOT</td>\n", + "<td style=\"padding:10px\">`#`</td>\n", "<td style=\"padding:0px\"></td>\n", "</tr>\n", "</tbody></table>" @@ -312,7 +325,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 34, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -323,7 +336,111 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", + "<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n", + " -->\n", + "<!-- Title: prob_graph Pages: 1 -->\n", + "<svg width=\"540pt\" height=\"717pt\"\n", + " viewBox=\"0.00 0.00 540.00 717.07\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(0.983286 0.983286) rotate(0) translate(4 725.26)\">\n", + "<title>prob_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-725.26 545.18,-725.26 545.18,4 -4,4\"/>\n", + "<!-- 0 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>0</title>\n", + "<polygon fill=\"gray\" stroke=\"black\" points=\"48.55,-593.5 48.55,-642.5 120.05,-642.5 120.05,-593.5 48.55,-593.5\"/>\n", + "<text text-anchor=\"middle\" x=\"84.3\" y=\"-625.2\" font-family=\"Times,serif\" font-size=\"14.00\">Eingabe α</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"48.55,-618 120.05,-618\"/>\n", + "<text text-anchor=\"middle\" x=\"60.05\" y=\"-600.7\" font-family=\"Times,serif\" font-size=\"14.00\">a</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"71.55,-593.5 71.55,-618\"/>\n", + "<text text-anchor=\"middle\" x=\"83.43\" y=\"-600.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"95.3,-593.5 95.3,-618\"/>\n", + "<text text-anchor=\"middle\" x=\"107.68\" y=\"-600.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "</g>\n", + "<!-- 1 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>1</title>\n", + "<ellipse fill=\"gray\" stroke=\"black\" cx=\"256.3\" cy=\"-618\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"256.3\" y=\"-612.95\" font-family=\"Times,serif\" font-size=\"14.00\">z0</text>\n", + "</g>\n", + "<!-- 1->1 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>1->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M263.69,-636.47C276.72,-659.97 293.92,-653.82 293.92,-618 293.92,-587.78 281.68,-578.68 270.02,-590.69\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"266.66,-588.36 263.69,-598.53 272.35,-592.44 266.66,-588.36\"/>\n", + "<text text-anchor=\"middle\" x=\"296.55\" y=\"-613.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 2 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>2</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"256.3\" cy=\"-321\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"256.3\" y=\"-315.95\" font-family=\"Times,serif\" font-size=\"14.00\">z1</text>\n", + "</g>\n", + "<!-- 1->2 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>1->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M256.3,-598.1C256.3,-548.04 256.3,-411.76 256.3,-351.42\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"259.8,-351.74 256.3,-341.74 252.8,-351.74 259.8,-351.74\"/>\n", + "<text text-anchor=\"middle\" x=\"259.3\" y=\"-440.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 2->2 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>2->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M267.08,-337.93C279.52,-349.95 293.92,-344.3 293.92,-321 293.92,-303.34 285.65,-295.82 276.23,-298.45\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"274.77,-295.85 268.08,-304.07 278.44,-301.81 274.77,-295.85\"/>\n", + "<text text-anchor=\"middle\" x=\"296.92\" y=\"-316.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 3 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>3</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"256.3\" cy=\"-64\" rx=\"19.11\" ry=\"19.11\"/>\n", + "<ellipse fill=\"none\" stroke=\"black\" cx=\"256.3\" cy=\"-64\" rx=\"23.11\" ry=\"23.11\"/>\n", + "<text text-anchor=\"middle\" x=\"256.3\" y=\"-58.95\" font-family=\"Times,serif\" font-size=\"14.00\">ze</text>\n", + "</g>\n", + "<!-- 2->3 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>2->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M256.3,-301.25C256.3,-258.3 256.3,-152.32 256.3,-98.11\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"259.8,-98.36 256.3,-88.36 252.8,-98.36 259.8,-98.36\"/>\n", + "<text text-anchor=\"middle\" x=\"263.05\" y=\"-193.72\" font-family=\"Times,serif\" font-size=\"12.00\">`λ`</text>\n", + "</g>\n", + "<!-- 4 -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>4</title>\n", + "<polygon fill=\"gray\" stroke=\"black\" points=\"441.55,-581.25 441.55,-654.75 501.05,-654.75 501.05,-581.25 441.55,-581.25\"/>\n", + "<text text-anchor=\"middle\" x=\"471.3\" y=\"-637.45\" font-family=\"Times,serif\" font-size=\"14.00\">Keller γ</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"441.55,-630.25 501.05,-630.25\"/>\n", + "<text text-anchor=\"middle\" x=\"471.3\" y=\"-612.95\" font-family=\"Times,serif\" font-size=\"14.00\">A</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"441.55,-605.75 501.05,-605.75\"/>\n", + "<text text-anchor=\"middle\" x=\"471.3\" y=\"-588.45\" font-family=\"Times,serif\" font-size=\"14.00\">`#`</text>\n", + "</g>\n", + "</g>\n", + "</svg>\n" + ], + "text/plain": [ + "<Dot visualization: custom_graph []>" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":dot custom_graph" + ] + }, + { + "cell_type": "code", + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -332,7 +449,7 @@ "Executed operation: Schritt(z0,[A,A])" ] }, - "execution_count": 35, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } @@ -343,7 +460,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -366,7 +483,7 @@ "<td style=\"padding:10px\">γ:</td>\n", "<td style=\"padding:10px\">A</td>\n", "<td style=\"padding:10px\">A</td>\n", - "<td style=\"padding:10px\">BOT</td>\n", + "<td style=\"padding:10px\">`#`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -374,7 +491,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 36, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -385,7 +502,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -394,7 +511,7 @@ "Executed operation: Schritt(z1,[])" ] }, - "execution_count": 37, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -405,7 +522,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -425,7 +542,7 @@ "<tr>\n", "<td style=\"padding:10px\">γ:</td>\n", "<td style=\"padding:10px\">A</td>\n", - "<td style=\"padding:10px\">BOT</td>\n", + "<td style=\"padding:10px\">`#`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -433,7 +550,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 38, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -444,7 +561,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -453,7 +570,7 @@ "Executed operation: Schritt(z1,[])" ] }, - "execution_count": 39, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -464,7 +581,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -481,7 +598,7 @@ "</tr>\n", "<tr>\n", "<td style=\"padding:10px\">γ:</td>\n", - "<td style=\"padding:10px\">BOT</td>\n", + "<td style=\"padding:10px\">`#`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -489,7 +606,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 40, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -500,7 +617,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -514,7 +631,7 @@ "LambdaSchritt(ze,[])" ] }, - "execution_count": 41, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -525,7 +642,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -534,7 +651,7 @@ "Executed operation: LambdaSchritt(ze,[])" ] }, - "execution_count": 42, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -545,7 +662,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -570,7 +687,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 43, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -581,7 +698,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -596,7 +713,7 @@ "AkzeptierenMitLeeremKeller()" ] }, - "execution_count": 44, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -607,7 +724,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -616,7 +733,7 @@ "Executed operation: Akzeptieren()" ] }, - "execution_count": 45, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } diff --git a/info4/kapitel-5/TuringMaschine.ipynb b/info4/kapitel-5/TuringMaschine.ipynb index bbe7e86371211474cd32a436711bef0d15d2b956..69e6e67a4fc1fe95705ac3ca5fa24f34f3ce2fee 100644 --- a/info4/kapitel-5/TuringMaschine.ipynb +++ b/info4/kapitel-5/TuringMaschine.ipynb @@ -10,7 +10,7 @@ }, { "cell_type": "code", - "execution_count": 64, + "execution_count": 1, "metadata": {}, "outputs": [ { @@ -19,7 +19,7 @@ "Loaded machine: TuringMachine_2" ] }, - "execution_count": 64, + "execution_count": 1, "metadata": {}, "output_type": "execute_result" } @@ -31,16 +31,30 @@ "/* by Michael Leuschel, 2012 */\n", "/* Akzeptiert die Sprache a^n b^n c^n (siehe Folien 14ff von folien-kapitel-5 */\n", "SETS\n", - " Alphabet={a,b,c,X,Blank};\n", + " Alphabet={a,b,c,X,`◻︎`};\n", " States = {z0,z1,z2,z3,z4,z5,z6};\n", " Direction = {L,R,N}\n", "DEFINITIONS\n", " Σ == {a,b,c};\n", " Γ == Σ \\/ {X};\n", - " CurSymbol == (Right<-Blank)(1);\n", + " CurSymbol == (Right<-`◻︎`)(1);\n", " ANIMATION_FUNCTION_DEFAULT == {(1,0,cur)};\n", " /* ANIMATION_FUNCTION__xx == {(1,1,Left), (1,3,Right)}; */\n", - " ANIMATION_FUNCTION1 == {1} *( (%i.(i:-size(Left)..-1|i+size(Left)+1) ; Left) \\/ Right)\n", + " ANIMATION_FUNCTION1 == {1} *( (%i.(i:-size(Left)..-1|i+size(Left)+1) ; Left) \\/ Right);\n", + " \n", + " \"LibraryStrings.def\";\n", + " dot_fields(seqval) == IF seqval=[] THEN \"λ\" ELSE \n", + " conc( %i.(i:1..size(seqval)-1| TO_STRING(seqval(i)) ^ \"|\") ) ^ TO_STRING(last(seqval))\n", + " END;\n", + " CUSTOM_GRAPH_NODES1 == rec(label:\"{left|{\"^dot_fields(Left)^\"}}\",\n", + " shape:\"record\", style:\"filled\", fillcolor:\"gray90\");\n", + " CUSTOM_GRAPH_NODES2 == rec(label:\"{right|{\"^dot_fields(Right)^\"}}\",\n", + " shape:\"record\", style:\"filled\", fillcolor:\"gray90\");\n", + " CUSTOM_GRAPH_NODES == {s•s:States|rec(label:s,\n", + " shape: IF s:Final THEN \"doublecircle\" ELSE \"circle\" END,\n", + " style:\"filled\",\n", + " fillcolor: IF s=cur THEN \"gray\" ELSE \"white\" END)};\n", + " CUSTOM_GRAPH_EDGES == {z,a,z2,b,DIR•(z,a)|->(z2,b,DIR):δ| rec(from:z,to:z2,label:a)};\n", "CONSTANTS Final, δ\n", "PROPERTIES\n", " Final <: States &\n", @@ -62,16 +76,16 @@ " \n", " /* ein a,b,c getilgt (X), rechten Rand suchen */\n", " (z3,c) ↦ (z3,c,R),\n", - " (z3,Blank) ↦ (z4,Blank,L),\n", + " (z3,`◻︎`) ↦ (z4,`◻︎`,L),\n", " \n", " /* Zurücklaufen und testen ob alle a,b,c getilgt */\n", " (z4,X) ↦ (z4,X,L),\n", - " (z4,Blank) ↦ (z6,Blank,R), /* Erfolg ! */\n", + " (z4,`◻︎`) ↦ (z6,`◻︎`,R), /* Erfolg ! */\n", " (z4,c) ↦ (z5,c,L), \n", " \n", " /* Test nicht erfolgreich; zum linken Rand zurücklaufen und neuer Zyklus */\n", " (z5,X) ↦ (z5,X,L),\n", - " (z5,Blank) ↦ (z0,Blank,R),\n", + " (z5,`◻︎`) ↦ (z0,`◻︎`,R),\n", " (z5,a) ↦ (z5,a,L),\n", " (z5,b) ↦ (z5,b,L),\n", " (z5,c) ↦ (z5,c,L)\n", @@ -95,7 +109,7 @@ " ELSIF Dir = R THEN\n", " Left,Right := Left <- NewSymbol, tail_Right\n", " ELSIF Left=[] THEN\n", - " Left,Right := [], Blank -> (NewSymbol -> tail_Right)\n", + " Left,Right := [], `◻︎` -> (NewSymbol -> tail_Right)\n", " ELSE\n", " Left,Right := front(Left), last(Left) -> (NewSymbol -> tail_Right)\n", " END\n", @@ -112,7 +126,7 @@ { "data": { "text/plain": [ - "Machine constants set up using operation 0: $setup_constants()" + "Executed operation: SETUP_CONSTANTS()" ] }, "execution_count": 2, @@ -132,7 +146,7 @@ { "data": { "text/plain": [ - "Machine initialised using operation 1: $initialise_machine()" + "Executed operation: INITIALISATION()" ] }, "execution_count": 3, @@ -152,10 +166,10 @@ { "data": { "text/markdown": [ - "$\\{(\\mathit{z0}\\mapsto \\mathit{a}\\mapsto(\\mathit{z1}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z0}\\mapsto \\mathit{X}\\mapsto(\\mathit{z0}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z1}\\mapsto \\mathit{a}\\mapsto(\\mathit{z1}\\mapsto \\mathit{a}\\mapsto \\mathit{R})),(\\mathit{z1}\\mapsto \\mathit{b}\\mapsto(\\mathit{z2}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z1}\\mapsto \\mathit{X}\\mapsto(\\mathit{z1}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z2}\\mapsto \\mathit{b}\\mapsto(\\mathit{z2}\\mapsto \\mathit{b}\\mapsto \\mathit{R})),(\\mathit{z2}\\mapsto \\mathit{c}\\mapsto(\\mathit{z3}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z2}\\mapsto \\mathit{X}\\mapsto(\\mathit{z2}\\mapsto \\mathit{X}\\mapsto \\mathit{R})),(\\mathit{z3}\\mapsto \\mathit{c}\\mapsto(\\mathit{z3}\\mapsto \\mathit{c}\\mapsto \\mathit{R})),(\\mathit{z3}\\mapsto \\mathit{Blank}\\mapsto(\\mathit{z4}\\mapsto \\mathit{Blank}\\mapsto \\mathit{L})),(\\mathit{z4}\\mapsto \\mathit{c}\\mapsto(\\mathit{z5}\\mapsto \\mathit{c}\\mapsto \\mathit{L})),(\\mathit{z4}\\mapsto \\mathit{X}\\mapsto(\\mathit{z4}\\mapsto \\mathit{X}\\mapsto \\mathit{L})),(\\mathit{z4}\\mapsto \\mathit{Blank}\\mapsto(\\mathit{z6}\\mapsto \\mathit{Blank}\\mapsto \\mathit{R})),(\\mathit{z5}\\mapsto \\mathit{a}\\mapsto(\\mathit{z5}\\mapsto \\mathit{a}\\mapsto \\mathit{L})),(\\mathit{z5}\\mapsto \\mathit{b}\\mapsto(\\mathit{z5}\\mapsto \\mathit{b}\\mapsto \\mathit{L})),(\\mathit{z5}\\mapsto \\mathit{c}\\mapsto(\\mathit{z5}\\mapsto \\mathit{c}\\mapsto \\mathit{L})),(\\mathit{z5}\\mapsto \\mathit{X}\\mapsto(\\mathit{z5}\\mapsto \\mathit{X}\\mapsto \\mathit{L})),(\\mathit{z5}\\mapsto \\mathit{Blank}\\mapsto(\\mathit{z0}\\mapsto \\mathit{Blank}\\mapsto \\mathit{R}))\\}$" + "$\\{(\\mathit{z0}\\mapsto\\mathit{a}\\mapsto(\\mathit{z1}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z0}\\mapsto\\mathit{X}\\mapsto(\\mathit{z0}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z1}\\mapsto\\mathit{a}\\mapsto(\\mathit{z1}\\mapsto\\mathit{a}\\mapsto\\mathit{R})),(\\mathit{z1}\\mapsto\\mathit{b}\\mapsto(\\mathit{z2}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z1}\\mapsto\\mathit{X}\\mapsto(\\mathit{z1}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z2}\\mapsto\\mathit{b}\\mapsto(\\mathit{z2}\\mapsto\\mathit{b}\\mapsto\\mathit{R})),(\\mathit{z2}\\mapsto\\mathit{c}\\mapsto(\\mathit{z3}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z2}\\mapsto\\mathit{X}\\mapsto(\\mathit{z2}\\mapsto\\mathit{X}\\mapsto\\mathit{R})),(\\mathit{z3}\\mapsto\\mathit{c}\\mapsto(\\mathit{z3}\\mapsto\\mathit{c}\\mapsto\\mathit{R})),(\\mathit{z3}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto(\\mathit{z4}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto\\mathit{L})),(\\mathit{z4}\\mapsto\\mathit{c}\\mapsto(\\mathit{z5}\\mapsto\\mathit{c}\\mapsto\\mathit{L})),(\\mathit{z4}\\mapsto\\mathit{X}\\mapsto(\\mathit{z4}\\mapsto\\mathit{X}\\mapsto\\mathit{L})),(\\mathit{z4}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto(\\mathit{z6}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto\\mathit{R})),(\\mathit{z5}\\mapsto\\mathit{a}\\mapsto(\\mathit{z5}\\mapsto\\mathit{a}\\mapsto\\mathit{L})),(\\mathit{z5}\\mapsto\\mathit{b}\\mapsto(\\mathit{z5}\\mapsto\\mathit{b}\\mapsto\\mathit{L})),(\\mathit{z5}\\mapsto\\mathit{c}\\mapsto(\\mathit{z5}\\mapsto\\mathit{c}\\mapsto\\mathit{L})),(\\mathit{z5}\\mapsto\\mathit{X}\\mapsto(\\mathit{z5}\\mapsto\\mathit{X}\\mapsto\\mathit{L})),(\\mathit{z5}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto(\\mathit{z0}\\mapsto\\mathit{\\text{`}◻︎\\text{`}}\\mapsto\\mathit{R}))\\}$" ], "text/plain": [ - "{(z0↦a↦(z1↦X↦R)),(z0↦X↦(z0↦X↦R)),(z1↦a↦(z1↦a↦R)),(z1↦b↦(z2↦X↦R)),(z1↦X↦(z1↦X↦R)),(z2↦b↦(z2↦b↦R)),(z2↦c↦(z3↦X↦R)),(z2↦X↦(z2↦X↦R)),(z3↦c↦(z3↦c↦R)),(z3↦Blank↦(z4↦Blank↦L)),(z4↦c↦(z5↦c↦L)),(z4↦X↦(z4↦X↦L)),(z4↦Blank↦(z6↦Blank↦R)),(z5↦a↦(z5↦a↦L)),(z5↦b↦(z5↦b↦L)),(z5↦c↦(z5↦c↦L)),(z5↦X↦(z5↦X↦L)),(z5↦Blank↦(z0↦Blank↦R))}" + "{(z0↦a↦(z1↦X↦R)),(z0↦X↦(z0↦X↦R)),(z1↦a↦(z1↦a↦R)),(z1↦b↦(z2↦X↦R)),(z1↦X↦(z1↦X↦R)),(z2↦b↦(z2↦b↦R)),(z2↦c↦(z3↦X↦R)),(z2↦X↦(z2↦X↦R)),(z3↦c↦(z3↦c↦R)),(z3↦`◻︎`↦(z4↦`◻︎`↦L)),(z4↦c↦(z5↦c↦L)),(z4↦X↦(z4↦X↦L)),(z4↦`◻︎`↦(z6↦`◻︎`↦R)),(z5↦a↦(z5↦a↦L)),(z5↦b↦(z5↦b↦L)),(z5↦c↦(z5↦c↦L)),(z5↦X↦(z5↦X↦L)),(z5↦`◻︎`↦(z0↦`◻︎`↦R))}" ] }, "execution_count": 4, @@ -211,7 +225,7 @@ "Machine: TuringMachine_2\n", "Sets: Alphabet, States, Direction\n", "Constants: Final, δ\n", - "Variables: Left, cur, Right\n", + "Variables: Left, Right, cur\n", "Operations: \n", "GoTo(z0,a,z1,X,R)" ] @@ -232,8 +246,218 @@ "outputs": [ { "data": { + "image/svg+xml": [ + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", + "<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n", + " -->\n", + "<!-- Title: prob_graph Pages: 1 -->\n", + "<svg width=\"540pt\" height=\"716pt\"\n", + " viewBox=\"0.00 0.00 540.00 716.16\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(0.982888 0.982888) rotate(0) translate(4 724.63)\">\n", + "<title>prob_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-724.63 545.4,-724.63 545.4,4 -4,4\"/>\n", + "<!-- 0 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>0</title>\n", + "<polygon fill=\"#e5e5e5\" stroke=\"black\" points=\"23.58,-660.5 23.58,-709.5 77.58,-709.5 77.58,-660.5 23.58,-660.5\"/>\n", + "<text text-anchor=\"middle\" x=\"50.58\" y=\"-692.2\" font-family=\"Times,serif\" font-size=\"14.00\">left</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"23.58,-685 77.58,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"50.46\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">λ</text>\n", + "</g>\n", + "<!-- 1 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>1</title>\n", + "<ellipse fill=\"gray\" stroke=\"black\" cx=\"171.58\" cy=\"-685\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"171.58\" y=\"-679.95\" font-family=\"Times,serif\" font-size=\"14.00\">z0</text>\n", + "</g>\n", + "<!-- 1->1 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>1->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M187.43,-697.01C198.4,-700.65 209.2,-696.65 209.2,-685 209.2,-677.36 204.55,-673 198.25,-671.94\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"198.05,-668.54 188.43,-672.99 198.72,-675.51 198.05,-668.54\"/>\n", + "<text text-anchor=\"middle\" x=\"213.7\" y=\"-680.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 2 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>2</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"42.58\" cy=\"-550\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"42.58\" y=\"-544.95\" font-family=\"Times,serif\" font-size=\"14.00\">z1</text>\n", + "</g>\n", + "<!-- 1->2 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>1->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M158.27,-670.27C135.77,-647.07 90.08,-599.97 63.35,-572.41\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"66.5,-570.6 57.02,-565.86 61.47,-575.47 66.5,-570.6\"/>\n", + "<text text-anchor=\"middle\" x=\"110.21\" y=\"-609.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 2->2 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>2->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M61.55,-555.79C71.36,-556.68 80.2,-554.75 80.2,-550 80.2,-547.18 77.09,-545.35 72.5,-544.52\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"72.65,-541 62.55,-544.21 72.45,-547.99 72.65,-541\"/>\n", + "<text text-anchor=\"middle\" x=\"82.83\" y=\"-545.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 2->2 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>2->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M60.24,-559.36C78.21,-564.87 98.2,-561.75 98.2,-550 98.2,-540.54 85.26,-536.68 70.84,-538.4\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"70.3,-535.14 61.24,-540.64 71.75,-541.99 70.3,-535.14\"/>\n", + "<text text-anchor=\"middle\" x=\"102.7\" y=\"-545.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 3 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>3</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"41.58\" cy=\"-422\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"41.58\" y=\"-416.95\" font-family=\"Times,serif\" font-size=\"14.00\">z2</text>\n", + "</g>\n", + "<!-- 2->3 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>2->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M42.44,-530.14C42.27,-509.72 42.01,-476.89 41.82,-452.94\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"45.31,-452.96 41.74,-442.99 38.32,-453.02 45.31,-452.96\"/>\n", + "<text text-anchor=\"middle\" x=\"45.58\" y=\"-481.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 3->3 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>3->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M60.55,-427.79C70.36,-428.68 79.2,-426.75 79.2,-422 79.2,-419.18 76.09,-417.35 71.5,-416.52\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"71.65,-413 61.55,-416.21 71.45,-419.99 71.65,-413\"/>\n", + "<text text-anchor=\"middle\" x=\"82.2\" y=\"-417.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 3->3 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>3->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M59.24,-431.36C77.21,-436.87 97.2,-433.75 97.2,-422 97.2,-412.54 84.26,-408.68 69.84,-410.4\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"69.3,-407.14 60.24,-412.64 70.75,-413.99 69.3,-407.14\"/>\n", + "<text text-anchor=\"middle\" x=\"101.7\" y=\"-417.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 4 -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>4</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"57.58\" cy=\"-295\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"57.58\" y=\"-289.95\" font-family=\"Times,serif\" font-size=\"14.00\">z3</text>\n", + "</g>\n", + "<!-- 3->4 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>3->4</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M43.98,-402.29C46.57,-382.04 50.74,-349.46 53.78,-325.7\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"57.37,-326.21 55.17,-315.84 50.43,-325.32 57.37,-326.21\"/>\n", + "<text text-anchor=\"middle\" x=\"53.21\" y=\"-353.73\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 4->4 -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>4->4</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M74.22,-305.88C84.91,-308.72 95.2,-305.09 95.2,-295 95.2,-288.54 90.98,-284.73 85.13,-283.57\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"85.03,-280.12 75.22,-284.12 85.38,-287.11 85.03,-280.12\"/>\n", + "<text text-anchor=\"middle\" x=\"97.83\" y=\"-290.73\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 5 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>5</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"83.58\" cy=\"-167\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"83.58\" y=\"-161.95\" font-family=\"Times,serif\" font-size=\"14.00\">z4</text>\n", + "</g>\n", + "<!-- 4->5 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>4->5</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M61.42,-275.41C65.66,-254.84 72.56,-221.43 77.53,-197.33\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"81.14,-198.17 79.73,-187.67 74.28,-196.75 81.14,-198.17\"/>\n", + "<text text-anchor=\"middle\" x=\"81.33\" y=\"-226.72\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 5->5 -->\n", + "<g id=\"edge12\" class=\"edge\">\n", + "<title>5->5</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M100.22,-178.05C110.91,-180.93 121.2,-177.25 121.2,-167 121.2,-160.43 116.98,-156.56 111.13,-155.39\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"111.02,-151.94 101.22,-155.95 111.38,-158.93 111.02,-151.94\"/>\n", + "<text text-anchor=\"middle\" x=\"125.7\" y=\"-162.72\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 6 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>6</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"211.58\" cy=\"-34\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"211.58\" y=\"-28.95\" font-family=\"Times,serif\" font-size=\"14.00\">z5</text>\n", + "</g>\n", + "<!-- 5->6 -->\n", + "<g id=\"edge11\" class=\"edge\">\n", + "<title>5->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M96.8,-152.47C119.03,-129.72 164.07,-83.63 190.64,-56.43\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"192.76,-59.25 197.25,-49.65 187.76,-54.36 192.76,-59.25\"/>\n", + "<text text-anchor=\"middle\" x=\"153.21\" y=\"-98.72\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 7 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>7</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"83.58\" cy=\"-34\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<ellipse fill=\"none\" stroke=\"black\" cx=\"83.58\" cy=\"-34\" rx=\"23.62\" ry=\"23.62\"/>\n", + "<text text-anchor=\"middle\" x=\"83.58\" y=\"-28.95\" font-family=\"Times,serif\" font-size=\"14.00\">z6</text>\n", + "</g>\n", + "<!-- 5->7 -->\n", + "<g id=\"edge13\" class=\"edge\">\n", + "<title>5->7</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M83.58,-146.95C83.58,-126.52 83.58,-93.67 83.58,-68.82\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"87.08,-69.05 83.58,-59.05 80.08,-69.05 87.08,-69.05\"/>\n", + "<text text-anchor=\"middle\" x=\"93.33\" y=\"-98.72\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 6->1 -->\n", + "<g id=\"edge18\" class=\"edge\">\n", + "<title>6->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M215.06,-53.58C219.49,-78.9 226.58,-125.71 226.58,-166 226.58,-551 226.58,-551 226.58,-551 226.58,-591.32 204.73,-633.66 188.57,-659.45\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"185.22,-657.19 182.71,-667.48 191.09,-661 185.22,-657.19\"/>\n", + "<text text-anchor=\"middle\" x=\"236.33\" y=\"-353.73\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge14\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M231.33,-37.16C240.82,-37.54 249.2,-36.49 249.2,-34 249.2,-32.56 246.4,-31.6 242.2,-31.12\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"242.41,-27.6 232.33,-30.84 242.23,-34.6 242.41,-27.6\"/>\n", + "<text text-anchor=\"middle\" x=\"251.83\" y=\"-29.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge15\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M230.97,-39.32C248.46,-41.9 267.2,-40.13 267.2,-34 267.2,-29.11 255.3,-27 241.61,-27.65\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"241.58,-24.23 231.97,-28.68 242.26,-31.2 241.58,-24.23\"/>\n", + "<text text-anchor=\"middle\" x=\"270.2\" y=\"-29.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge16\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M230.44,-40.63C255.25,-46.32 285.2,-44.11 285.2,-34 285.2,-25.31 263.08,-22.46 241.11,-25.44\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"240.66,-22.14 231.44,-27.37 241.9,-29.03 240.66,-22.14\"/>\n", + "<text text-anchor=\"middle\" x=\"287.83\" y=\"-29.73\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge17\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M230.02,-41.5C261.71,-50.72 303.2,-48.22 303.2,-34 303.2,-21.34 270.29,-17.97 240.71,-23.9\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"239.91,-20.73 231.02,-26.5 241.57,-27.53 239.91,-20.73\"/>\n", + "<text text-anchor=\"middle\" x=\"307.7\" y=\"-29.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 8 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>8</title>\n", + "<polygon fill=\"#e5e5e5\" stroke=\"black\" points=\"349.83,-660.5 349.83,-709.5 483.33,-709.5 483.33,-660.5 349.83,-660.5\"/>\n", + "<text text-anchor=\"middle\" x=\"416.58\" y=\"-692.2\" font-family=\"Times,serif\" font-size=\"14.00\">right</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"349.83,-685 483.33,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"360.83\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">a</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"371.83,-660.5 371.83,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"382.83\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">a</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"393.83,-660.5 393.83,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"405.21\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"416.58,-660.5 416.58,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"427.96\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"439.33,-660.5 439.33,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"450.33\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">c</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"461.33,-660.5 461.33,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"472.33\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">c</text>\n", + "</g>\n", + "</g>\n", + "</svg>\n" + ], "text/plain": [ - "Executed operation: GoTo(z0,a,z1,X,R)" + "<Dot visualization: custom_graph []>" ] }, "execution_count": 7, @@ -242,7 +466,7 @@ } ], "source": [ - ":exec GoTo" + ":dot custom_graph" ] }, { @@ -252,21 +476,8 @@ "outputs": [ { "data": { - "text/markdown": [ - "<table style=\"font-family:monospace\"><tbody>\n", - "<tr>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z1</td>\n", - "<td style=\"padding:10px\">a</td>\n", - "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">c</td>\n", - "</tr>\n", - "</tbody></table>" - ], "text/plain": [ - "<Animation function visualisation>" + "Executed operation: GoTo(z0,a,z1,X,R)" ] }, "execution_count": 8, @@ -275,7 +486,7 @@ } ], "source": [ - ":show" + ":exec GoTo" ] }, { @@ -285,8 +496,21 @@ "outputs": [ { "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">a</td>\n", + "<td style=\"padding:10px\">b</td>\n", + "<td style=\"padding:10px\">b</td>\n", + "<td style=\"padding:10px\">c</td>\n", + "<td style=\"padding:10px\">c</td>\n", + "</tr>\n", + "</tbody></table>" + ], "text/plain": [ - "Executed operation: GoTo(z1,a,z1,a,R)" + "<Animation function visualisation>" ] }, "execution_count": 9, @@ -295,7 +519,7 @@ } ], "source": [ - ":exec GoTo" + ":show" ] }, { @@ -305,21 +529,216 @@ "outputs": [ { "data": { - "text/markdown": [ - "<table style=\"font-family:monospace\"><tbody>\n", - "<tr>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">a</td>\n", - "<td style=\"padding:10px\">z1</td>\n", - "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">c</td>\n", - "</tr>\n", - "</tbody></table>" + "image/svg+xml": [ + "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n", + "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n", + " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", + "<!-- Generated by graphviz version 8.0.5 (20230430.1635)\n", + " -->\n", + "<!-- Title: prob_graph Pages: 1 -->\n", + "<svg width=\"540pt\" height=\"717pt\"\n", + " viewBox=\"0.00 0.00 540.00 717.34\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", + "<g id=\"graph0\" class=\"graph\" transform=\"scale(0.984506 0.984506) rotate(0) translate(4 724.63)\">\n", + "<title>prob_graph</title>\n", + "<polygon fill=\"white\" stroke=\"none\" points=\"-4,4 -4,-724.63 544.5,-724.63 544.5,4 -4,4\"/>\n", + "<!-- 0 -->\n", + "<g id=\"node1\" class=\"node\">\n", + "<title>0</title>\n", + "<polygon fill=\"#e5e5e5\" stroke=\"black\" points=\"156.34,-660.5 156.34,-709.5 210.34,-709.5 210.34,-660.5 156.34,-660.5\"/>\n", + "<text text-anchor=\"middle\" x=\"183.34\" y=\"-692.2\" font-family=\"Times,serif\" font-size=\"14.00\">left</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"156.34,-685 210.34,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"183.21\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">X</text>\n", + "</g>\n", + "<!-- 1 -->\n", + "<g id=\"node2\" class=\"node\">\n", + "<title>1</title>\n", + "<ellipse fill=\"gray\" stroke=\"black\" cx=\"271.34\" cy=\"-685\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"271.34\" y=\"-679.95\" font-family=\"Times,serif\" font-size=\"14.00\">z1</text>\n", + "</g>\n", + "<!-- 1->1 -->\n", + "<g id=\"edge3\" class=\"edge\">\n", + "<title>1->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M290.31,-691.42C300.11,-692.41 308.96,-690.27 308.96,-685 308.96,-681.87 305.84,-679.85 301.25,-678.92\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"301.41,-675.39 291.31,-678.58 301.19,-682.39 301.41,-675.39\"/>\n", + "<text text-anchor=\"middle\" x=\"311.58\" y=\"-680.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 1->1 -->\n", + "<g id=\"edge5\" class=\"edge\">\n", + "<title>1->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M288.42,-695.19C306.53,-701.57 326.96,-698.17 326.96,-685 326.96,-674.3 313.47,-670.05 298.7,-672.25\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"298.28,-669 289.42,-674.81 299.97,-675.79 298.28,-669\"/>\n", + "<text text-anchor=\"middle\" x=\"331.46\" y=\"-680.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 3 -->\n", + "<g id=\"node4\" class=\"node\">\n", + "<title>3</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"177.34\" cy=\"-550\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"177.34\" y=\"-544.95\" font-family=\"Times,serif\" font-size=\"14.00\">z2</text>\n", + "</g>\n", + "<!-- 1->3 -->\n", + "<g id=\"edge4\" class=\"edge\">\n", + "<title>1->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M260.37,-668.48C244.17,-645.56 213.69,-602.43 194.5,-575.29\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"196.86,-573.56 188.23,-567.42 191.15,-577.6 196.86,-573.56\"/>\n", + "<text text-anchor=\"middle\" x=\"227.34\" y=\"-609.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 2 -->\n", + "<g id=\"node3\" class=\"node\">\n", + "<title>2</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"168.34\" cy=\"-28\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"168.34\" y=\"-22.95\" font-family=\"Times,serif\" font-size=\"14.00\">z0</text>\n", + "</g>\n", + "<!-- 2->1 -->\n", + "<g id=\"edge1\" class=\"edge\">\n", + "<title>2->1</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M186.74,-35.74C225.36,-51.22 311.34,-93.17 311.34,-160 311.34,-551 311.34,-551 311.34,-551 311.34,-588.93 296.23,-630.47 284.58,-656.86\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"280.99,-655.31 280.02,-665.86 287.36,-658.21 280.99,-655.31\"/>\n", + "<text text-anchor=\"middle\" x=\"313.96\" y=\"-353.73\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 2->2 -->\n", + "<g id=\"edge2\" class=\"edge\">\n", + "<title>2->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M184.97,-39.05C195.66,-41.93 205.96,-38.25 205.96,-28 205.96,-21.43 201.73,-17.56 195.88,-16.39\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"195.77,-12.94 185.97,-16.95 196.14,-19.93 195.77,-12.94\"/>\n", + "<text text-anchor=\"middle\" x=\"210.46\" y=\"-23.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 3->3 -->\n", + "<g id=\"edge6\" class=\"edge\">\n", + "<title>3->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M196.31,-555.79C206.11,-556.68 214.96,-554.75 214.96,-550 214.96,-547.18 211.84,-545.35 207.25,-544.52\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"207.4,-541 197.31,-544.21 207.2,-547.99 207.4,-541\"/>\n", + "<text text-anchor=\"middle\" x=\"217.96\" y=\"-545.73\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 3->3 -->\n", + "<g id=\"edge8\" class=\"edge\">\n", + "<title>3->3</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M194.99,-559.36C212.96,-564.87 232.96,-561.75 232.96,-550 232.96,-540.54 220.01,-536.68 205.59,-538.4\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"205.05,-535.14 195.99,-540.64 206.5,-541.99 205.05,-535.14\"/>\n", + "<text text-anchor=\"middle\" x=\"237.46\" y=\"-545.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 4 -->\n", + "<g id=\"node5\" class=\"node\">\n", + "<title>4</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"177.34\" cy=\"-422\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"177.34\" y=\"-416.95\" font-family=\"Times,serif\" font-size=\"14.00\">z3</text>\n", + "</g>\n", + "<!-- 3->4 -->\n", + "<g id=\"edge7\" class=\"edge\">\n", + "<title>3->4</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M177.34,-530.14C177.34,-509.72 177.34,-476.89 177.34,-452.94\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"180.84,-452.99 177.34,-442.99 173.84,-452.99 180.84,-452.99\"/>\n", + "<text text-anchor=\"middle\" x=\"179.96\" y=\"-481.73\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 4->4 -->\n", + "<g id=\"edge9\" class=\"edge\">\n", + "<title>4->4</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M193.97,-433.05C204.66,-435.93 214.96,-432.25 214.96,-422 214.96,-415.43 210.73,-411.56 204.88,-410.39\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"204.77,-406.94 194.97,-410.95 205.14,-413.93 204.77,-406.94\"/>\n", + "<text text-anchor=\"middle\" x=\"217.58\" y=\"-417.73\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 5 -->\n", + "<g id=\"node6\" class=\"node\">\n", + "<title>5</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"177.34\" cy=\"-295\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"177.34\" y=\"-289.95\" font-family=\"Times,serif\" font-size=\"14.00\">z4</text>\n", + "</g>\n", + "<!-- 4->5 -->\n", + "<g id=\"edge10\" class=\"edge\">\n", + "<title>4->5</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M177.34,-402.02C177.34,-381.71 177.34,-349.23 177.34,-325.57\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"180.84,-325.75 177.34,-315.75 173.84,-325.75 180.84,-325.75\"/>\n", + "<text text-anchor=\"middle\" x=\"187.09\" y=\"-353.73\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 5->5 -->\n", + "<g id=\"edge12\" class=\"edge\">\n", + "<title>5->5</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M193.97,-305.88C204.66,-308.72 214.96,-305.09 214.96,-295 214.96,-288.54 210.73,-284.73 204.88,-283.57\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"204.78,-280.12 194.97,-284.12 205.13,-287.11 204.78,-280.12\"/>\n", + "<text text-anchor=\"middle\" x=\"219.46\" y=\"-290.73\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 6 -->\n", + "<g id=\"node7\" class=\"node\">\n", + "<title>6</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"26.34\" cy=\"-161\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<text text-anchor=\"middle\" x=\"26.34\" y=\"-155.95\" font-family=\"Times,serif\" font-size=\"14.00\">z5</text>\n", + "</g>\n", + "<!-- 5->6 -->\n", + "<g id=\"edge11\" class=\"edge\">\n", + "<title>5->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M162.86,-281.34C136.41,-258.22 80.12,-209.01 48.7,-181.55\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"51.38,-178.37 41.55,-174.43 46.78,-183.64 51.38,-178.37\"/>\n", + "<text text-anchor=\"middle\" x=\"113.96\" y=\"-226.72\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 7 -->\n", + "<g id=\"node8\" class=\"node\">\n", + "<title>7</title>\n", + "<ellipse fill=\"white\" stroke=\"black\" cx=\"241.34\" cy=\"-161\" rx=\"19.62\" ry=\"19.62\"/>\n", + "<ellipse fill=\"none\" stroke=\"black\" cx=\"241.34\" cy=\"-161\" rx=\"23.62\" ry=\"23.62\"/>\n", + "<text text-anchor=\"middle\" x=\"241.34\" y=\"-155.95\" font-family=\"Times,serif\" font-size=\"14.00\">z6</text>\n", + "</g>\n", + "<!-- 5->7 -->\n", + "<g id=\"edge13\" class=\"edge\">\n", + "<title>5->7</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M185.7,-276.74C196.05,-255.4 213.85,-218.68 226.53,-192.53\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"230.07,-194.26 231.28,-183.74 223.77,-191.21 230.07,-194.26\"/>\n", + "<text text-anchor=\"middle\" x=\"221.09\" y=\"-226.72\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 6->2 -->\n", + "<g id=\"edge18\" class=\"edge\">\n", + "<title>6->2</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M40.47,-146.96C65.24,-124.11 116.67,-76.66 146.2,-49.42\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"148.28,-52.34 153.26,-42.99 143.54,-47.2 148.28,-52.34\"/>\n", + "<text text-anchor=\"middle\" x=\"116.09\" y=\"-87.72\" font-family=\"Times,serif\" font-size=\"12.00\">`◻︎`</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge14\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M46.08,-164.16C55.57,-164.54 63.96,-163.49 63.96,-161 63.96,-159.56 61.15,-158.6 56.96,-158.12\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"57.16,-154.6 47.08,-157.84 56.99,-161.6 57.16,-154.6\"/>\n", + "<text text-anchor=\"middle\" x=\"66.58\" y=\"-156.72\" font-family=\"Times,serif\" font-size=\"12.00\">a</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge15\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M45.72,-166.32C63.21,-168.9 81.96,-167.13 81.96,-161 81.96,-156.11 70.05,-154 56.37,-154.65\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"56.33,-151.23 46.72,-155.68 57.01,-158.2 56.33,-151.23\"/>\n", + "<text text-anchor=\"middle\" x=\"84.96\" y=\"-156.72\" font-family=\"Times,serif\" font-size=\"12.00\">b</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge16\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M45.19,-167.63C70,-173.32 99.96,-171.11 99.96,-161 99.96,-152.31 77.83,-149.46 55.87,-152.44\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"55.41,-149.14 46.19,-154.37 56.66,-156.03 55.41,-149.14\"/>\n", + "<text text-anchor=\"middle\" x=\"102.58\" y=\"-156.72\" font-family=\"Times,serif\" font-size=\"12.00\">c</text>\n", + "</g>\n", + "<!-- 6->6 -->\n", + "<g id=\"edge17\" class=\"edge\">\n", + "<title>6->6</title>\n", + "<path fill=\"none\" stroke=\"blue\" d=\"M44.77,-168.5C76.46,-177.72 117.96,-175.22 117.96,-161 117.96,-148.34 85.04,-144.97 55.46,-150.9\"/>\n", + "<polygon fill=\"blue\" stroke=\"blue\" points=\"54.66,-147.73 45.77,-153.5 56.32,-154.53 54.66,-147.73\"/>\n", + "<text text-anchor=\"middle\" x=\"122.46\" y=\"-156.72\" font-family=\"Times,serif\" font-size=\"12.00\">X</text>\n", + "</g>\n", + "<!-- 8 -->\n", + "<g id=\"node9\" class=\"node\">\n", + "<title>8</title>\n", + "<polygon fill=\"#e5e5e5\" stroke=\"black\" points=\"409.59,-660.5 409.59,-709.5 521.09,-709.5 521.09,-660.5 409.59,-660.5\"/>\n", + "<text text-anchor=\"middle\" x=\"465.34\" y=\"-692.2\" font-family=\"Times,serif\" font-size=\"14.00\">right</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"409.59,-685 521.09,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"420.59\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">a</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"431.59,-660.5 431.59,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"442.96\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"454.34,-660.5 454.34,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"465.71\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">b</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"477.09,-660.5 477.09,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"488.09\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">c</text>\n", + "<polyline fill=\"none\" stroke=\"black\" points=\"499.09,-660.5 499.09,-685\"/>\n", + "<text text-anchor=\"middle\" x=\"510.09\" y=\"-667.7\" font-family=\"Times,serif\" font-size=\"14.00\">c</text>\n", + "</g>\n", + "</g>\n", + "</svg>\n" ], "text/plain": [ - "<Animation function visualisation>" + "<Dot visualization: custom_graph []>" ] }, "execution_count": 10, @@ -328,7 +747,7 @@ } ], "source": [ - ":show" + ":dot custom_graph" ] }, { @@ -339,7 +758,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z1,b,z2,X,R)" + "Executed operation: GoTo(z1,a,z1,a,R)" ] }, "execution_count": 11, @@ -363,8 +782,8 @@ "<tr>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">c</td>\n", "<td style=\"padding:10px\">c</td>\n", @@ -392,7 +811,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z2,b,z2,b,R)" + "Executed operation: GoTo(z1,b,z2,X,R)" ] }, "execution_count": 13, @@ -417,8 +836,8 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">c</td>\n", "<td style=\"padding:10px\">c</td>\n", "</tr>\n", @@ -445,7 +864,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z2,c,z3,X,R)" + "Executed operation: GoTo(z2,b,z2,b,R)" ] }, "execution_count": 15, @@ -471,8 +890,8 @@ "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z3</td>\n", + "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">c</td>\n", "<td style=\"padding:10px\">c</td>\n", "</tr>\n", "</tbody></table>" @@ -498,7 +917,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z3,c,z3,c,R)" + "Executed operation: GoTo(z2,c,z3,X,R)" ] }, "execution_count": 17, @@ -525,8 +944,8 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">c</td>\n", "<td style=\"padding:10px\">z3</td>\n", + "<td style=\"padding:10px\">c</td>\n", "</tr>\n", "</tbody></table>" ], @@ -551,7 +970,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z3,Blank,z4,Blank,L)" + "Executed operation: GoTo(z3,c,z3,c,R)" ] }, "execution_count": 19, @@ -578,9 +997,8 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z4</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">z3</td>\n", "</tr>\n", "</tbody></table>" ], @@ -605,7 +1023,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z4,c,z5,c,L)" + "Executed operation: GoTo(z3,`◻︎`,z4,`◻︎`,L)" ] }, "execution_count": 21, @@ -631,10 +1049,10 @@ "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", - "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">z4</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -659,7 +1077,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,X,z5,X,L)" + "Executed operation: GoTo(z4,c,z5,c,L)" ] }, "execution_count": 23, @@ -684,11 +1102,11 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">b</td>\n", + "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -713,7 +1131,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,b,z5,b,L)" + "Executed operation: GoTo(z5,X,z5,X,L)" ] }, "execution_count": 25, @@ -737,12 +1155,12 @@ "<tr>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", - "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -767,7 +1185,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,X,z5,X,L)" + "Executed operation: GoTo(z5,b,z5,b,L)" ] }, "execution_count": 27, @@ -790,13 +1208,13 @@ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">a</td>\n", + "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -821,7 +1239,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,a,z5,a,L)" + "Executed operation: GoTo(z5,X,z5,X,L)" ] }, "execution_count": 29, @@ -843,14 +1261,14 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">z5</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -875,7 +1293,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,X,z5,X,L)" + "Executed operation: GoTo(z5,a,z5,a,L)" ] }, "execution_count": 31, @@ -898,14 +1316,13 @@ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", "<td style=\"padding:10px\">z5</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -930,7 +1347,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z5,Blank,z0,Blank,R)" + "Executed operation: GoTo(z5,X,z5,X,L)" ] }, "execution_count": 33, @@ -952,15 +1369,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", - "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">z5</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -985,7 +1402,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z0,X,z0,X,R)" + "Executed operation: GoTo(z5,`◻︎`,z0,`◻︎`,R)" ] }, "execution_count": 35, @@ -1007,15 +1424,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", - "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1040,7 +1457,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z0,a,z1,X,R)" + "Executed operation: GoTo(z0,X,z0,X,R)" ] }, "execution_count": 37, @@ -1062,15 +1479,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">a</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1095,7 +1512,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z1,X,z1,X,R)" + "Executed operation: GoTo(z0,a,z1,X,R)" ] }, "execution_count": 39, @@ -1117,15 +1534,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", - "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1150,7 +1567,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z1,b,z2,X,R)" + "Executed operation: GoTo(z1,X,z1,X,R)" ] }, "execution_count": 41, @@ -1172,15 +1589,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", - "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">b</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1205,7 +1622,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z2,X,z2,X,R)" + "Executed operation: GoTo(z1,b,z2,X,R)" ] }, "execution_count": 43, @@ -1227,15 +1644,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", - "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">c</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1260,7 +1677,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z2,c,z3,X,R)" + "Executed operation: GoTo(z2,X,z2,X,R)" ] }, "execution_count": 45, @@ -1282,15 +1699,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z3</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">c</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1315,7 +1732,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z3,Blank,z4,Blank,L)" + "Executed operation: GoTo(z2,c,z3,X,R)" ] }, "execution_count": 47, @@ -1337,15 +1754,15 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">z4</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">z3</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1370,7 +1787,7 @@ { "data": { "text/plain": [ - "Executed operation: GoTo(z4,X,z4,X,L)" + "Executed operation: GoTo(z3,`◻︎`,z4,`◻︎`,L)" ] }, "execution_count": 49, @@ -1389,8 +1806,23 @@ "outputs": [ { "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">z4</td>\n", + "<td style=\"padding:10px\">X</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", + "</tr>\n", + "</tbody></table>" + ], "text/plain": [ - "Executed operation: GoTo(z4,X,z4,X,L)" + "<Animation function visualisation>" ] }, "execution_count": 50, @@ -1399,20 +1831,60 @@ } ], "source": [ - ":exec GoTo" + ":show" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z4,X,z4,X,L)" + ] + }, + "execution_count": 51, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z4,X,z4,X,L)" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", @@ -1420,7 +1892,7 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1428,7 +1900,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 51, + "execution_count": 53, "metadata": {}, "output_type": "execute_result" } @@ -1439,7 +1911,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 54, "metadata": {}, "outputs": [ { @@ -1448,7 +1920,7 @@ "Executed operation: GoTo(z4,X,z4,X,L)" ] }, - "execution_count": 52, + "execution_count": 54, "metadata": {}, "output_type": "execute_result" } @@ -1459,7 +1931,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 55, "metadata": {}, "outputs": [ { @@ -1468,7 +1940,7 @@ "Executed operation: GoTo(z4,X,z4,X,L)" ] }, - "execution_count": 53, + "execution_count": 55, "metadata": {}, "output_type": "execute_result" } @@ -1479,7 +1951,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 56, "metadata": {}, "outputs": [ { @@ -1487,7 +1959,7 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">z4</td>\n", "<td style=\"padding:10px\">X</td>\n", @@ -1495,7 +1967,7 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1503,7 +1975,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 54, + "execution_count": 56, "metadata": {}, "output_type": "execute_result" } @@ -1514,7 +1986,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 57, "metadata": {}, "outputs": [ { @@ -1523,7 +1995,7 @@ "Executed operation: GoTo(z4,X,z4,X,L)" ] }, - "execution_count": 55, + "execution_count": 57, "metadata": {}, "output_type": "execute_result" } @@ -1534,7 +2006,7 @@ }, { "cell_type": "code", - "execution_count": 56, + "execution_count": 58, "metadata": {}, "outputs": [ { @@ -1542,7 +2014,7 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">z4</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", @@ -1550,7 +2022,7 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1558,7 +2030,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 56, + "execution_count": 58, "metadata": {}, "output_type": "execute_result" } @@ -1569,7 +2041,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": 59, "metadata": {}, "outputs": [ { @@ -1578,7 +2050,7 @@ "Executed operation: GoTo(z4,X,z4,X,L)" ] }, - "execution_count": 57, + "execution_count": 59, "metadata": {}, "output_type": "execute_result" } @@ -1589,7 +2061,7 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": 60, "metadata": {}, "outputs": [ { @@ -1598,14 +2070,14 @@ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", "<td style=\"padding:10px\">z4</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1613,7 +2085,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 58, + "execution_count": 60, "metadata": {}, "output_type": "execute_result" } @@ -1624,16 +2096,16 @@ }, { "cell_type": "code", - "execution_count": 59, + "execution_count": 61, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Executed operation: GoTo(z4,Blank,z6,Blank,R)" + "Executed operation: GoTo(z4,`◻︎`,z6,`◻︎`,R)" ] }, - "execution_count": 59, + "execution_count": 61, "metadata": {}, "output_type": "execute_result" } @@ -1644,7 +2116,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": 62, "metadata": {}, "outputs": [ { @@ -1652,7 +2124,7 @@ "text/markdown": [ "<table style=\"font-family:monospace\"><tbody>\n", "<tr>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "<td style=\"padding:10px\">z6</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", @@ -1660,7 +2132,7 @@ "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", "<td style=\"padding:10px\">X</td>\n", - "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">`◻︎`</td>\n", "</tr>\n", "</tbody></table>" ], @@ -1668,7 +2140,7 @@ "<Animation function visualisation>" ] }, - "execution_count": 60, + "execution_count": 62, "metadata": {}, "output_type": "execute_result" } @@ -1679,7 +2151,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": 63, "metadata": {}, "outputs": [ { @@ -1688,12 +2160,12 @@ "Machine: TuringMachine_2\n", "Sets: Alphabet, States, Direction\n", "Constants: Final, δ\n", - "Variables: Left, cur, Right\n", + "Variables: Left, Right, cur\n", "Operations: \n", "Accept()" ] }, - "execution_count": 62, + "execution_count": 63, "metadata": {}, "output_type": "execute_result" } @@ -1704,7 +2176,7 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": 64, "metadata": {}, "outputs": [ { @@ -1713,7 +2185,7 @@ "Executed operation: Accept()" ] }, - "execution_count": 63, + "execution_count": 64, "metadata": {}, "output_type": "execute_result" }