简体   繁体   English

如何搭建专用图灵机

[英]How to build special turing machine

Good day.再会。 I have a question.我有个问题。 Many people are familiar with the Turing machine.很多人都熟悉图灵机。 The following task arose, which I can't solve for a long time: there is an alphabet consisting of the letters "X", "Y" "Z", if the number of letters "Z" in the word is exactly 2 more than the letters "X", replace the second letter "Z" with "X".出现了以下任务,我解决了很长时间:有一个由字母“X”、“Y”、“Z”组成的字母表,如果单词中的字母“Z”的数量正好是 2 个以上除了字母“X”,将第二个字母“Z”替换为“X”。 Otherwise, leave the word unchanged.否则,保持单词不变。 Considering that I cannot change the original word and the tape is infinite (that is, I cannot write an infinite number of states for the machine), I do not understand how to do this.考虑到我无法更改原始单词并且磁带是无限的(即我无法为机器编写无限数量的状态),我不明白如何做到这一点。

Just to make it more clear, if the input is for example:只是为了更清楚,如果输入例如:

XXXYZZZZZ

then the output you need is:那么你需要的输出是:

XXXYZXZZZZ

And if the input is:如果输入是:

XXYZZ

Then everything needs to stay the same, since (number of Z's) - (number of X's) != 2然后一切都需要保持不变,因为(Z的数量)-(X的数量)!= 2

XXYZZ

If I understood the problem correctly, in the way I defined above, then here comes the solution with Morphett's TM Simulator, with $ sign as left-end marker:如果我按照上面定义的方式正确理解了问题,那么这里有 Morphett 的 TM 模拟器的解决方案,$ 符号作为左端标记:

1 $ $ r 1
1 X A r 2
1 Y Y r 4

2 X X r 2
2 B B r 2
2 Y Y r 2
2 Z B R 3

3 Y Y l 3
3 B B l 3
3 X X l 3
3 A A r 1
3 Z Z l 3

4 Y Y r 4
4 B B r 4
4 Z B r 5
4 _ _ l 7

5 Z B r 6
5 _ _ l 7

6 Z Z l 7
6 _ _ l 8

7 B Z l 7
7 Y Y l 7
7 A X l 7
7 $ $ r 12 

8 B Z l 8
8 Y Y l 8
8 A X l 8
8 $ $ r 9

9 X X r 9
9 Y Y r 9
9 Z Z r 10

10 Z X r 11

11 Z Z r 11
11 _ _ l halt

12 X X r 12
12 Y Y r 12
12 Z Z r 12
12 _ _ l halt

Copy this code and then paste it to http://morphett.info/turing/turing.html复制此代码,然后将其粘贴到http://morphett.info/turing/turing.html

From advanced options, set initial state to 1 from 0.在高级选项中,将初始状态从 0 设置为 1。

Do not forget to add a "$" to beginning of every input.不要忘记在每个输入的开头添加一个“$”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM