TransWikia.com

Why doesn't RulePlot understand the TuringMachine in the documentation?

Mathematica Asked on March 7, 2021

The documentation for TuringMachine gives the following example of a machine specified by explicit transitions:

t = TuringMachine[
    {{state_,color_?EvenQ}:>{state,color/2,-1},{state_,color_?OddQ}:>{state,3 color+1,1}},
    {1,{1,2,3,4,5}},5];

But attempting to plot this with RulePlot[t] results in:

{{{1, 1, 0}, {1, 2, 3, 4, 5}}, {{1, 2, 1}, {4, 2, 3, 4, 5}}, {{1, 1, 
   0}, {4, 1, 3, 4, 5}}, {{1, 5, -1}, {2, 1, 3, 4, 5}}, {{1, 1, 
   0}, {2, 1, 3, 4, 16}}, {{1, 5, -1}, {1, 1, 3, 4, 16}}}

Why doesn’t RulePlot understand the explicit transitions TuringMachine in the documentation?

One Answer

Unfortunately the following is not a solution, but an observation that grew too long for a comment. At first, I thought that the problem may be the fact that the initialization and number of steps should be given as arguments to RulePlot rather than to TuringMachine, so I tried:

Clear[separate]

separate := 
  RulePlot[
    TuringMachine[
      {{state_, color_?EvenQ} :> {state, color/2, -1},
       {state_, color_?OddQ} :> {state, 3 color + 1, 1}}
    ],
    {1, {1, 2, 3, 4, 5}}, 5
  ]

... but that failed as well.

Reading through the results of Trace@separate, it appears to me that the following check returning False causes RulePlot to decide to fail and return unevaluated:

NKSSpecialFunctions`RulePlot`Dump`ValidTuringMachineRulesQ[{
   {state_, color_?EvenQ} :> {state, color/2, -1}, 
   {state_, color_?OddQ} :> {state, 3 color + 1, 1}
}]

(* Out: False *)

None of these checks appear when one executes Trace@t using your definition of the TuringMachine.

Answered by MarcoB on March 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP