TuringMachine[rule,init,t]
指定されたルールで初期条件 init から t ステップ進んだチューリングマシンの進化を表すリストを生成する.
TuringMachine[rule,init]
init を1ステップ進化させた結果を与える.
TuringMachine[rule]
進化の1ステップに相当するTuringMachineの演算子形である.
TuringMachine
TuringMachine[rule,init,t]
指定されたルールで初期条件 init から t ステップ進んだチューリングマシンの進化を表すリストを生成する.
TuringMachine[rule,init]
init を1ステップ進化させた結果を与える.
TuringMachine[rule]
進化の1ステップに相当するTuringMachineの演算子形である.
詳細
- 一次元のチューリングマシンの場合,TuringMachineで生成された進化の各ステップは{{s,x,dx},{a1,a2,…}}の形で与えられる.ここで,頭部の状態は s であり,テープ上のセルは値 aiを持ち,頭部は aiと相対的な位置 x にあり,初期位置と比べて dx 動いている.
- dx がチューリングマシンの初期条件から省略された場合,dx は0とみなされる.
- d 次元のチューリングマシンでは,テープは d 次元の配列で指定され,位置 x と相対的位置 dx は長さ d のリストになる.
- チューリングマシンのルールは{si,ai}->{spi,api,offi}の形の置換のリストで与えられる.その要素は次のようになる.
-
si 頭部の状態 ai 頭部の下のセルの値 spi 頭部の新しい状態 api 頭部の下のセルの新しい値 offi 頭部が動くオフセット - 状態とセルの値は整数,パターン,任意の式のいずれでもよい.個々のセルの値はリストにはできない.
- 一次元では,各オフセット offiは1個の整数である.次元が高くなると整数のリストになる.
- 状態とセルの値が,それぞれ1から
までと0から
までの範囲の整数であるとされる場合,rule として次の形を与えることができる. -
n 数 n の状態が2つで色も2色のマシン {n,s} 数 n の状態が s 個で色が2色のマシン {n,s,k} 数 n の状態が s 個で色が k 色のマシン {n,s,k,r}
から
の範囲(0を除く)で offiを許容する {n,s,k,{r1,r2,…,rd}} オフセット
,
, …の
次元マシン{n,s,k,{{off1},{off2},…}} 指定された明示的オフセットを許容するマシン {rule,s,k} 明示的なルールを与えられたマシン rule 明示的なルールを与えられたマシン(s と k は推測される) - 可能なチューリングマシンルールの数は次の通りである.
-
2状態2色のマシン 4096 s 状態 k 色のマシン (2 s k)^(s k) s 状態 k 色で範囲 r のマシン (2 r s k)^(s k) 二次元で s 状態 k 色のマシン (8 s k)^(s k) - マシンがそれ自身が置かれている構造についてのルールを持たない場合,その構造は変化しない.
- TuringMachineは,与えられた構成に対してルールが複数の指定を持っている場合はリストの先頭の物を使う.
- {rule,s,k}の形を使って,指定された構成に対してルールに必ずしも1つの例しかない訳ではない,多方向,非決定性,あるいはその他のチューリングマシンが指定できる.
- 典型的な初期条件 init の形は次の通りである.
-
{s,{{},0}} 頭部の状態 s,0で埋められた一次元テープ上 {s,{{a1,a2,…},0}} 無限テープ上の値 aiで区切られた範囲 {{s,x},{{a1,a2,…},0}} 頭部が最初は位置 xにある有限範囲 {{s,…},{{a1,…},{b1,…}}} 値 biの反復する背景 {{s,…},{a1,a2,…}} 有限テープ,循環を仮定 - TuringMachine[rule,init,t]は,長さ
の進化リストを生成する. - TuringMachine[rule][init]はTuringMachine[rule,init]に等しい.
例題
すべて開く すべて閉じる例 (5)
初期テープが4つの0からなり3ステップ進化する,2状態,2色のマシン2506:
TuringMachine[2506, {1, {0, 0, 0, 0}}, 3]無限の0のテープの4ステップ進化する,2状態,2色のマシン2506:
TuringMachine[2506, {1, {{}, 0}}, 4]ArrayPlot[Last /@ TuringMachine[2506, {1, {{}, 0}}, 30]]RulePlot[TuringMachine[2506]]RulePlot[TuringMachine[2506], {1, {{}, 0}}, 20]明示的な遷移で指定されたチューリングマシンのルールアイコンを示す:
RulePlot[TuringMachine[{{1, 1} -> {2, 0, -1}, {1, 0} -> {2, 1, 1}, {2, 1} -> {1, 0, 1}, {2, 0} -> {1, 1, -1}}]]RulePlot[TuringMachine[{{1, 1} -> {2, 0, -1}, {1, 0} -> {2, 1, 1}, {2, 1} -> {1, 0, 1}, {2, 0} -> {1, 1, -1}}], {1, {{}, 0}}, 20]TuringMachine[{
{state_, color_ ? EvenQ} :> {state, color / 2, -1}, {state_, color_ ? OddQ} :> {state, 3color + 1, 1}},
{1, {1, 2, 3, 4, 5}}, 5]スコープ (17)
一次元ルール (6)
TuringMachine[2506, {1, {{}, 0}}, 4]//GridArrayPlot[Last /@ TuringMachine[2506, {1, {{}, 0}}, 20]]RulePlot[TuringMachine[2506], {1, {{}, 0}}, 20]RulePlot[TuringMachine[{2139050, 3}], {1, {{}, 0}}, 30]RulePlot[TuringMachine[{2139050, 3}]]ArrayPlot[Last /@ TuringMachine[{16220, 2, 2, 2}, {1, {{}, 0}}, 50]]ジャンプのオフセットが
と2の,3状態2色のマシン2139050:
evolution = TuringMachine[{2139050, 3, 2, {{-1}, {2}}}, {1, {{}, 0}}, 45];ArrayPlot[Last /@ evolution]evolution = TuringMachine[
{{state_, color_} :> {color * state, color / state, 1}},
{1, {2, 3, 4, 5}}, 4];evolution//Grid同じ遷移規則に対して状態数 s と色数 k の値を明示的に指定する:
rules = {{1, 1} -> {2, 0, -1}, {1, 0} -> {2, 1, 1}, {2, 1} -> {1, 0, 1}, {2, 0} -> {1, 1, -1}};RulePlot[TuringMachine[{rules, 2, 2}]]RulePlot[TuringMachine[{rules, 3, 3}]]初期条件 (9)
ヘッドの指定 (4)
TuringMachine[2506, {{1}, {{}, 0}}, 4]//GridRulePlot[TuringMachine[2506], {{1}, {{}, 0}}, 20, PlotLegends -> "Icon"]TuringMachine[2506, {{2}, {{}, 0}}, 4]//GridRulePlot[TuringMachine[2506], {{2}, {{}, 0}}, 10, PlotLegends -> "Icon"]RulePlot[TuringMachine[2506], {{1, 3}, {0, 0, 0, 0, 1, 0, 0}}, 10, PlotLegends -> "Icon"]RulePlot[TuringMachine[2506], {{1, 5}, {0, 0, 0, 0, 1, 0, 0}}, 10, PlotLegends -> "Icon"]テープの指定 (5)
TuringMachine[2506, {1, {0, 0, 0, 0}}, 5]//Grid最も左のセルの左近傍は最も右のセルであり,逆もまた真である:
RulePlot[TuringMachine[2506], {1, {0, 0, 0, 0}}, 10]RulePlot[TuringMachine[2506], {1, {{}, 0}}, 18]RulePlot[TuringMachine[{956440, 3}], {1, {{1}, 0}}, 20]RulePlot[TuringMachine[{596440, 2, 3}], {1, {{2, 1, 1}, 0}}, 10]RulePlot[TuringMachine[{596440, 2, 3}], {1, {{2, 1, 1}, {0, 2}}}, 10]多次元ルール (2)
rule = {977401, 2, 2, {1, 1}};TuringMachine[rule, {1, {{{}}, 0}}, 4]ic = {1, Table[0, {10}, {10}]};
steps = 30;Graphics3D[Cuboid /@ Position[Last /@ TuringMachine[rule, ic, steps], 1]]rules = {
{1, 0} -> {2, 1, {0, 1}}, {1, 1} -> {2, 0, {0, -1}},
{2, 0} -> {4, 1, {0, -1}}, {2, 1} -> {3, 0, {0, 1}},
{3, 0} -> {1, 1, {-1, 0}}, {3, 1} -> {2, 1, {0, 1}},
{4, 0} -> {3, 1, {0, -1}}, {4, 1} -> {2, 0, {1, 0}}};ArrayPlot[TuringMachine[rules, {1, {{{}}, 0}}, 8000][[-1, -1]]]アプリケーション (12)
無限の0のテープからのWolframの単純なユニバーサルチューリングマシンの進化:
RulePlot[TuringMachine[{596440, 2, 3}], {1, {{}, 0}}, 80]rules = {{1, 2} -> {1, 1, -1}, {1, 1} -> {1, 2, -1}, {1, 0} -> {2, 1, 1}, {2, 2} -> {1, 0, 1}, {2, 1} -> {2, 2, 1}, {2, 0} -> {1, 2, -1}};RulePlot[TuringMachine[rules], {1, {{}, 0}}, 80]Table[RulePlot[TuringMachine[n], {1, {{}, 0}}, 40, ImageSize -> {Automatic, 100}], {n, 2500, 2510}]ic[n_] := {{1, -2, 0}, {IntegerDigits[n, 2, 20], 0}};ListLinePlot[Table[#[[1, 3]]& /@ TuringMachine[1507, ic[i], 180], {i, 1, 40}]]rules = {
{1, 0} -> {2, 1, {0, 1}}, {1, 1} -> {2, 0, {0, -1}},
{2, 0} -> {4, 1, {0, -1}}, {2, 1} -> {3, 0, {0, 1}},
{3, 0} -> {1, 1, {-1, 0}}, {3, 1} -> {2, 1, {0, 1}},
{4, 0} -> {3, 1, {0, -1}}, {4, 1} -> {2, 0, {1, 0}}};evolution = TuringMachine[rules, {1, {{{}}, 0}}, 200];arrow = Arrow[#[[1, 3]]& /@ evolution];
initpoint = Point[First[evolution][[1, 3]]];Graphics[{Arrowheads[.1], arrow, PointSize[Large], Gray, initpoint}]rules = {27726, 2, 2, {1, 1}};
ic = {1, Table[0, {50}, {50}]};ArrayPlot[Total[Last /@ TuringMachine[rules, ic, 5000]]]ic[n_] := {1, {IntegerDigits[n, 2, 20], 0}};ArrayPlot[Table[#[[1, 1]]& /@ TuringMachine[1507, ic[i], 100], {i, 1, 100}] - 1]ic[n_] := {1, {IntegerDigits[n, 2, 20], 0}};ArrayPlot[Table[Differences[#[[1, 3]]& /@ TuringMachine[1507, ic[i], 100]], {i, 1, 100}] /. -1 -> 0]TuringPlot[evolution_, opts___] := ArrayPlot[MapAt[Blend[{If[# === Orange, #, GrayLevel[#]], Red}]&, #[[2]], #[[1, 2]]]& /@ (evolution /. Null -> Orange), opts]Row[Table[TuringPlot[TuringMachine[1507, {{1, -2, 0}, Append[IntegerDigits[i, 2, 10], Null]}, 15], Mesh -> True, ImageSize -> Tiny], {i, 10}], Spacer[10]]ListPlot[Table[Last@TuringMachine[1507, {{1, -2, 0}, Append[IntegerDigits[i, 2, 20], Null]}, 50] /. {{{_, z_, _}, y_} /; y[[z]] === Null :> FromDigits[Most[y], 2], _ -> Null}, {i, 1, 1000}], Filling -> Axis]Module[{new}, new[x_] := (new[x] = False;True);
RulePlot[TuringMachine[{2791284850, 4}],
Cases[
TuringMachine[{2791284850, 4}, {1, {{}, 0}}, 200], {{_, _, _ ? new}, _}],
Mesh -> True]
]RulePlot[TuringMachine[1413], Select[TuringMachine[1413, {1, RandomInteger[1, 100]}, 6000], #[[1, 2]] === 1&]]GraphPlot[With[{rules = MapIndexed[{First[#2], #[[1, 2]], #[[2, #[[1, 2]]]]}&, TuringMachine[1507, {1, RandomInteger[1, 30]}, 200]]}, Join[Rule@@@Partition[rules, 2, 1], Flatten[Rule@@@Partition[#, 2, 1]& /@ Last@Reap[Sow[#, #[[2]]]& /@ rules], 1]]]]特性と関係 (5)
初期テープが4つの0で1ステップ進化する,2状態,2色のマシン2506:
TuringMachine[2506, {1, {0, 0, 0, 0}}]TuringMachine[2506][{1, {0, 0, 0, 0}}]TuringMachine[2506, {1, {0, 0, 0, 0}}, 1]{n,s,k,…}の形式の規則のときは,ヘッドの状態とセルの値は,それぞれ1から s と0から k-1の整数でよい:
rule = {596440, 2, 4};
inithstate = 2;
initcvalues = {{}, {2, 1, 3}};TuringMachine[rule, {inithstate, initcvalues}, 5]//Grid{n,s,k,…}の形式の規則のときは,0から k-1までの範囲外の値を持つセルにヘッドが到達するとマシンの進化が停止する:
rule = {596440, 2, 4};
inithstate = 2;
initcvalues = {{}, {2, 1, 8}};TuringMachine[rule, {inithstate, initcvalues}, 5]//GridArrayPlot[Last /@ TuringMachine[2506, {1, {{0, 0, 0, 0, 0, x, 0}, 0}}, 40]]rules = {
{1, 0} -> {1, 1, 1}, {1, 1} -> {2, 1, -1},
{2, 0} -> {1, 1, 1}, {2, 1} -> {2, 1, 0}};RulePlot[TuringMachine[rules]]RulePlot[TuringMachine[rules], {1, {{1, 0}, 0}}, 8]TuringMachine[2506, {1, {{}, 0}}, 6]Function[u, MapAt[{u[[1, 1]], #}&, u[[2]], u[[1, 2]]]] /@ TuringMachine[2506, {1, {{}, 0}}, 6]ArrayPlot[Function[u, MapAt[Red&, u[[2]], u[[1, 2]]]] /@ TuringMachine[2506, {1, {{}, 0}}, 50]]RulePlotを使って完全な進化の図を生成する:
RulePlot[TuringMachine[2506], {1, {{}, 0}}, 50]テキスト
Wolfram Research (2007), TuringMachine, Wolfram言語関数, https://reference.wolfram.com/language/ref/TuringMachine.html (2021年に更新).
CMS
Wolfram Language. 2007. "TuringMachine." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/TuringMachine.html.
APA
Wolfram Language. (2007). TuringMachine. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TuringMachine.html
BibTeX
@misc{reference.wolfram_2026_turingmachine, author="Wolfram Research", title="{TuringMachine}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/TuringMachine.html}", note=[Accessed: 12-November-2026]}
BibLaTeX
@online{reference.wolfram_2026_turingmachine, organization={Wolfram Research}, title={TuringMachine}, year={2021}, url={https://reference.wolfram.com/language/ref/TuringMachine.html}, note=[Accessed: 12-November-2026]}