TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

A better Turing machine tape model

23 点作者 nickdrozd超过 3 年前

9 条评论

ogogmad超过 3 年前
This is a summary of what the article says:<p>To represent the tape of a Turing Machine, you need a doubly linked list. In imperative languages, it&#x27;s obvious how to implement doubly linked lists efficiently and simply, but in functional languages it&#x27;s not. The author proposes using two stacks to represent a doubly linked list in a functional language: The first stack is for the part of the list to the left of the current node, and the second stack is for the part of the list to the right of the current node (including the current node). A generalisation of this idea for representing doubly-linked data structures in functional programming is called a Zipper [1].<p>[1] - <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Zipper_(data_structure)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Zipper_(data_structure)</a>
thethirdone超过 3 年前
&gt; And that’s it! The Scan ‘n’ Span model is dramatically simpler than the pointer model. As an added bonus, it’s also way faster on account of not needing to bother with constant array-indexing and bounds-checking.<p>I believe there should be an asterisk saying &quot;in Idris&quot;. I don&#x27;t believe this method removes any extra bounds checking or array-indexing at the assembly level.<p>I completely agree that in functional programing a dual list method makes more sense than an index into a list. I wouldn&#x27;t be surprised if the compiler just optimizes better with the more functional code.<p>&gt; Instead of a list, a single number can be used as a span. Implement Tape (ScanNSpan Nat). (Hint: this amounts to a sort of Gödel numbering.)<p>If you can restrict the `Color` to a finite set (which is necessary for any turing machine), you can just use multiplication and division which should be vastly faster than encoding based on primes.
a-dub超过 3 年前
right but, wouldn&#x27;t a &quot;better&quot; turing machine be one that is somehow easier to reason about in the abstract or otherwise prove properties about rather than one that can be simulated faster or has simpler simulation implementation?
drpixie超过 3 年前
Rather misses the whole point of Turing&#x27;s machine - it was the SIMPLEST machine he could devise that could be said to &quot;calculate&quot;.<p>Turning never made and never intended to make such a machine - it&#x27;s a mathematical abstraction.<p>All calculation that could be performed on Turning&#x27;s most simple machine, can also be performed by all equivalent or better machines. The point of Turing&#x27;s machine is that as long as your fancy new device can model that minimal behavior, your device can be said to calculate and all conclusions about computability apply to your device.
评论 #30175356 未加载
fjfaase超过 3 年前
I wonder if this is new. Some weeks ago Nick Drozd, who found a new 4 color, 2 state BLB TM, used this in combination with another optimization (a counter for repeated cells with the same color). This was reported on HN: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29888388" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=29888388</a>. To analyze this TM, I made an implementation in C++. (See my home page for the details.)<p>(Edit: Added name and link to HN article)
评论 #30175224 未加载
mettamage超过 3 年前
Can’t find it anymore but there was a whole wiki page on what Turing machines you could have.<p>I once was working with an xml-like language and asking myself if it was turing complete. You could create scores in that language which were basically integer variables.<p>The trick is to then only have 0 and 1 as a valid alphabet. That meant that an integer can be represented as a stack of 0’s and 1’s. Add another integer and now you have two stacks.<p>You could also make a Turing Machine just by using prime numbers.
kd5bjo超过 3 年前
To show the Turing-completeness of a functional programming language, it&#x27;s usually easier to implement the S and K combinators [1] than to directly implement a Turing machine.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;SKI_combinator_calculus" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;SKI_combinator_calculus</a>
galaxyLogic超过 3 年前
Interesting. Are there actual physical working Turing machines anywhere? Can I buy one?
评论 #30175944 未加载
评论 #30175212 未加载
raldi超过 3 年前
What&#x27;s the language being used here to define the interface? I don&#x27;t understand what&#x27;s intended by terms like &quot;Nat&quot; or &quot;Fin&quot; or &quot;**&quot; or &quot;-&gt;&quot; and don&#x27;t see any link to documentation or even a name I can google.
评论 #30186062 未加载