图灵机 - 学习技巧

发布于 2024-10-01 03:53:35 字数 481 浏览 7 评论 0原文

我花了整整一个月的时间来解决这个问题,因为我是从练习一书中得到的,我很想知道如何在图灵机中编写这个问题;我真的很想学这个。请问有人可以提供帮助吗?

考虑您登录名的最后两个字母(如果两个字母相同,请选择 拉丁字母表中的下一个字母作为第二个符号)。编写一个图灵机 它将识别语言 Stretch(x+1)。这是所有字符串的语言 包含连续出现的两个字母的字符串,后跟“*”, 后跟另一串字母,每个字母出现 x+1 次,其中 第一个字母串中只出现了一个。这里,x = 1。机器的输入是a、b、*的非空字符串。作为一个 例如,其中字母为“a”和“b”(且 x=1)aba*aabbaa、bb*bbbb 和 baab*bbaaaabb 在该语言中,但 abb*abbb 不在该语言中。你可能会认为你 有在第一个单元格中写入 0 并删除磁带其余部分的子例程 在第一个单元格中写入 1 并删除磁带的其余部分。

如果您能帮助我,我将非常感激。

It took me the whole month to solve this problem, as I got it from the book one of exercise, and I'd love to know how to write this in a turing machine; I would really love to learn this. Please could anyone offer a help?

Consider the last two letters of your login (if both letters are the same, please pick
the next letter in the Latin alphabet as your second symbol). Write a Turing Machine
that will recognise the language Stretch(x+1). This is the language of all strings that
contain a continuous string of occurrences of the two letters, followed by ‘*’,
followed by another string of letters with x+1 occurrences of the each letter where
there was a single occurrence in the first string of letters. Here, x = 1. Input to the machine is non-null strings of a, b, *. As an
example, where the letters are ‘a’ and ‘b’ (and x=1) aba*aabbaa, bb*bbbb and
baab*bbaaaabb are in the language, but abb*abbb is not. You may assume that you
have subroutines for writing 0 in the first cell and deleting the rest of the tape and for
writing 1 in the first cell and deleting the rest of the tape.

I would totally appreciate it if you could help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦在深巷 2024-10-08 03:53:38

对每个唯一的字母使用一个堆栈(在您的示例中是两个堆栈)。这没有正式编写或任何内容,但您所要做的就是提供一个算法来证明 TM 可以解决问题。

F1:
FOREACH letter DO
  IF letter = '*' THEN F2
  ELSE push letter twice onto its respective stack

F2:
FOREACH letter DO
  IF tape is empty THEN F3
  IF respective stack is empty THEN *fail state*
  ELSE pop respective stack

F3:
IF both stacks are empty THEN *accept state*
ELSE *fail state*

明白了吗? TM 证明很有趣。

编辑:作为对您其他帖子的回应,如果您不了解如何构建 TM 证明,您需要阅读一些有关一般证明的内容。我建议迈克尔·西普瑟的简介到计算理论。当你为该文本付出了巨大的努力后,你可以翻到第 137 页来了解有关 TM 的所有内容。

Use a stack for each unique letter (two stacks, in your examples). This isn't formally written or anything, but all you have to do is provide an algorithm to prove a TM can solve the problem.

F1:
FOREACH letter DO
  IF letter = '*' THEN F2
  ELSE push letter twice onto its respective stack

F2:
FOREACH letter DO
  IF tape is empty THEN F3
  IF respective stack is empty THEN *fail state*
  ELSE pop respective stack

F3:
IF both stacks are empty THEN *accept state*
ELSE *fail state*

Get the idea? TM proofs are fun.

EDIT: In response to your other posts, if you don't understand how to build a TM proof you'll need to do some reading about proofs in general. I would suggest Michael Sipser's Intro to Theory of Computing. After you shell out an arm and a leg for that text, you can turn to page 137 to learn all about TMs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文