diff --git a/info4/kapitel-5/TuringMaschine.ipynb b/info4/kapitel-5/TuringMaschine.ipynb index b70358a1f9f228301f56fadc8e2133801fe75fd4..bbe7e86371211474cd32a436711bef0d15d2b956 100644 --- a/info4/kapitel-5/TuringMaschine.ipynb +++ b/info4/kapitel-5/TuringMaschine.ipynb @@ -47,34 +47,34 @@ " δ : (States * Alphabet) <-> (States * Alphabet * Direction) &\n", "\n", " δ = { /* Neuer Zyklus */\n", - " (z0,a) |-> (z1,X,R),\n", - " (z0,X) |-> (z0,X,R),\n", + " (z0,a) ↦ (z1,X,R),\n", + " (z0,X) ↦ (z0,X,R),\n", " \n", " /* ein a getilgt (X), nächstes b suchen */\n", - " (z1,a) |-> (z1,a,R),\n", - " (z1,b) |-> (z2,X,R),\n", - " (z1,X) |-> (z1,X,R),\n", + " (z1,a) ↦ (z1,a,R),\n", + " (z1,b) ↦ (z2,X,R),\n", + " (z1,X) ↦ (z1,X,R),\n", " \n", " /* ein a,b getilgt (X), nächstes c suchen */\n", - " (z2,b) |-> (z2,b,R),\n", - " (z2,c) |-> (z3,X,R),\n", - " (z2,X) |-> (z2,X,R),\n", + " (z2,b) ↦ (z2,b,R),\n", + " (z2,c) ↦ (z3,X,R),\n", + " (z2,X) ↦ (z2,X,R),\n", " \n", " /* ein a,b,c getilgt (X), rechten Rand suchen */\n", - " (z3,c) |-> (z3,c,R),\n", - " (z3,Blank) |-> (z4,Blank,L),\n", + " (z3,c) ↦ (z3,c,R),\n", + " (z3,Blank) ↦ (z4,Blank,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,c) |-> (z5,c,L), \n", + " (z4,X) ↦ (z4,X,L),\n", + " (z4,Blank) ↦ (z6,Blank,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,a) |-> (z5,a,L),\n", - " (z5,b) |-> (z5,b,L),\n", - " (z5,c) |-> (z5,c,L)\n", + " (z5,X) ↦ (z5,X,L),\n", + " (z5,Blank) ↦ (z0,Blank,R),\n", + " (z5,a) ↦ (z5,a,L),\n", + " (z5,b) ↦ (z5,b,L),\n", + " (z5,c) ↦ (z5,c,L)\n", " } &\n", " Final = {z6}\n", "VARIABLES Left,cur,Right\n", @@ -86,9 +86,9 @@ " Accept = PRE cur : Final THEN skip END;\n", " GoTo(z,S,znew,NewSymbol,Dir) =\n", " PRE z=cur & S=CurSymbol &\n", - " (z, S) |-> (znew,NewSymbol,Dir) : δ THEN\n", + " (z, S) ↦ (znew,NewSymbol,Dir) : δ THEN\n", " ANY tail_Right \n", - " WHERE (Right=[] => tail_Right=[]) & (Right/=[] => tail_Right = tail(Right)) THEN\n", + " WHERE (Right=[] ⇒ tail_Right=[]) & (Right/=[] ⇒ tail_Right = tail(Right)) THEN\n", " cur := znew ||\n", " IF Dir = N THEN\n", " Right := NewSymbol -> tail_Right\n", diff --git a/info4/kapitel-7/TuringMaschineBerechenbarkeit.ipynb b/info4/kapitel-7/TuringMaschineBerechenbarkeit.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..7584e7525c6ba9af4dc5847be48a331bdef8d159 --- /dev/null +++ b/info4/kapitel-7/TuringMaschineBerechenbarkeit.ipynb @@ -0,0 +1,1389 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Turing Maschinen und Berechenbarkeit\n", + "\n", + "Bisher wurden Turingmaschinen als Akzeptoren definiert. \n", + "\n", + "Nun wollen wir Turingmaschinen als Maschinen zur Berechnung von\n", + "Funktionen auffassen.\n", + "\n", + "\n", + " Eine Funktion $f: \\nats^k \\rightarrow \\nats$ heißt \n", + " __Turing-berechenbar__, falls es eine deterministische\n", + " Turingmaschine $M=(\\Sigma, \\Gamma, Z, \\delta ,z_0, \\Box, F)$ \n", + " mit $\\Sigma = \\{0,1\\}$ \n", + " gibt,\n", + " so dass für alle $n_1, n_2, \\ldots , n_k, m \\in \\nats$:\n", + " \n", + "* $f(n_1, n_2, \\ldots , n_k) = m$ $\\Leftrightarrow$\n", + "* $\\exists z\\in F . z_0 \\mbox{bin}(n_1) \\#\n", + "\\mbox{bin}(n_2) \\# \\cdots \\# \\mbox{bin}(n_k) \\vdash_{M}^{\\ast} z\n", + "\\mbox{bin}(m)$\n", + "\n", + "Falls $f(n_1, n_2, \\ldots , n_k)$ nicht definiert ist, läuft $M$ in\n", + "eine unendliche Schleife oder stoppt in einem Zustand $z\\not\\in F$." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + " Die (total definierte) \\alert{\\em Nachfolgerfunktion} $f: \\nats \\rightarrow \\nats$ mit\n", + "* $f:n\\rightarrow n+1$\n", + "ist Turing-berechenbar." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Loaded machine: TuringMachine_2" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "::load\n", + "MACHINE TuringMachine_2\n", + "/* B Modell einer 1-band Turing Maschine */\n", + "/* by Michael Leuschel, 2012 */\n", + "/* The turing machine implements the +1 function on binary numbers */\n", + "/* See Slide 2 from folien-kapitel-7.pdf (Info 4) */\n", + "SETS\n", + " Alphabet ={O,I,Blank};\n", + " Z = {z0,z1,z2,ze};\n", + " Direction = {L,R,N}\n", + "DEFINITIONS\n", + " Σ == {O,I};\n", + " Γ == Σ;\n", + " CurSymbol == (Right<-Blank)(1);\n", + " ANIMATION_FUNCTION_DEFAULT == {(1,0,cur)};\n", + " ANIMATION_FUNCTION1 == {1} *( (%i.(i∈-size(Left)..-1|i+size(Left)+1) ; Left) \\/ Right)\n", + "CONSTANTS Final, δ\n", + "PROPERTIES\n", + " Final ⊆ Z ∧\n", + " δ ∈ (Z * Alphabet) <-> (Z * Alphabet * Direction) ∧\n", + "\n", + " δ = { (z0,O) ↦ (z0,O,R), (z0,I) ↦ (z0,I,R), (z0,Blank) ↦ (z1,Blank,L),\n", + " (z1,O) ↦ (z2,I,L), (z1,I) ↦ (z1,O,L), (z1,Blank) ↦ (ze,I,N),\n", + " (z2,O) ↦ (z2,O,L), (z2,I) ↦ (z2,I,L), (z2,Blank) ↦ (ze,Blank,R)\n", + " } ∧\n", + " Final = {ze}\n", + "VARIABLES Left,cur,Right\n", + "INVARIANT\n", + " cur ∈ Z ∧\n", + " Left ∈ seq(Alphabet) ∧ Right ∈ seq(Alphabet)\n", + "INITIALISATION Left,cur,Right := [],z0,[I,I,I,I,I] // [I,O,I]\n", + "OPERATIONS\n", + " Accept = PRE cur : Final THEN\n", + " Left,cur,Right := [],z0,Right /* restart machine with previous number */\n", + " END;\n", + " GoTo(z,S,znew,NewSymbol,Dir) =\n", + " PRE z=cur ∧ S=CurSymbol ∧\n", + " (z, S) ↦ (znew,NewSymbol,Dir) ∈ δ THEN\n", + " ANY tail_Right \n", + " WHERE (Right=[] ⇒ tail_Right=[]) ∧\n", + " (Right/=[] ⇒ tail_Right = tail(Right)) THEN\n", + " cur := znew ||\n", + " IF Dir = N THEN\n", + " Right := NewSymbol -> tail_Right\n", + " ELSIF Dir = R THEN\n", + " Left,Right := Left <- NewSymbol, tail_Right\n", + " ELSIF Left=[] THEN\n", + " Left,Right := [], Blank -> (NewSymbol -> tail_Right)\n", + " ELSE\n", + " Left,Right := front(Left), last(Left) -> (NewSymbol -> tail_Right)\n", + " END\n", + " END\n", + " END\n", + "END\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Machine constants set up using operation 0: $setup_constants()" + ] + }, + "execution_count": 14, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":constants" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Machine initialised using operation 1: $initialise_machine()" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":init" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Die Turing Maschine wird mit der Binärzahl 11111 (31 als Dezimalzahl) aufgerufen." + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,Blank,z1,Blank,L)" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 29, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,I,z1,O,L)" + ] + }, + "execution_count": 30, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 31, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,I,z1,O,L)" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 34, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,I,z1,O,L)" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,I,z1,O,L)" + ] + }, + "execution_count": 37, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 38, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,I,z1,O,L)" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,Blank,ze,I,N)" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">ze</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: Accept()" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec Accept" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Die Turing Maschine hat 32 als Ergebnis ausgerechnet. Wir können die Maschine wieder mit 32 als Eingabe starten:" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,I,z0,I,R)" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,O,z0,O,R)" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">z0</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 50, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,O,z0,O,R)" + ] + }, + "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(z0,O,z0,O,R)" + ] + }, + "execution_count": 52, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,O,z0,O,R)" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,O,z0,O,R)" + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z0,Blank,z1,Blank,L)" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">z1</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z1,O,z2,I,L)" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 59, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 59, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,O,z2,O,L)" + ] + }, + "execution_count": 60, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,O,z2,O,L)" + ] + }, + "execution_count": 61, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,O,z2,O,L)" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,O,z2,O,L)" + ] + }, + "execution_count": 63, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,I,z2,I,L)" + ] + }, + "execution_count": 64, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": {}, + "outputs": [ + { + "data": { + "text/markdown": [ + "<table style=\"font-family:monospace\"><tbody>\n", + "<tr>\n", + "<td style=\"padding:10px\">z2</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 65, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: GoTo(z2,Blank,ze,Blank,R)" + ] + }, + "execution_count": 66, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec GoTo" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "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\">ze</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">O</td>\n", + "<td style=\"padding:10px\">I</td>\n", + "<td style=\"padding:10px\">Blank</td>\n", + "</tr>\n", + "</tbody></table>" + ], + "text/plain": [ + "<Animation function visualisation>" + ] + }, + "execution_count": 67, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":show" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Die Turing Maschine at 33 als Ergebnis zurückgegeben." + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Executed operation: Accept()" + ] + }, + "execution_count": 68, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + ":exec Accept" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "ProB 2", + "language": "prob", + "name": "prob2" + }, + "language_info": { + "codemirror_mode": "prob2_jupyter_repl", + "file_extension": ".prob", + "mimetype": "text/x-prob2-jupyter-repl", + "name": "prob" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}