图灵机与冯诺依曼机

发布于 2024-08-31 09:22:39 字数 408 浏览 9 评论 0原文

背景

冯诺依曼架构描述了存储程序计算机,其中指令和数据存储在存储器中,机器通过改变其内部状态来工作,即指令对某些数据进行操作并修改数据。因此,本质上,系统中维护着状态。

图灵机架构通过操作磁带上的符号来工作。即存在具有无限个槽的磁带,并且在任何一个时间点,图灵机都位于特定的槽中。根据在该插槽读取的符号,机器可以更改符号并移动到不同的插槽。所有这一切都是确定性的。


问题

  1. 这两个模型之间有什么关系吗?冯·诺依曼模型是基于图灵模型还是受其启发?

  2. 我们可以说图灵模型是冯纽曼模型的超集吗?

  3. 函数式编程适合图灵模型吗?如果是这样,怎么办?我假设 函数式编程不太适合冯·诺依曼模型。

Background

The Von-Neumann architecture describes the stored-program computer where instructions and data are stored in memory and the machine works by changing its internal state, i.e an instruction operates on some data and modifies the data. So inherently, there is state maintained in the system.

The Turing machine architecture works by manipulating symbols on a tape. i.e A tape with infinite number of slots exists, and at any one point in time, the Turing machine is in a particular slot. Based on the symbol read at that slot, the machine can change the symbol and move to a different slot. All of this is deterministic.


Questions

  1. Is there any relation between these two models? Was the Von Neuman model based on or inspired by the Turing model?

  2. Can we say that Turing model is a superset of Von Newman model?

  3. Does functional Programming fit into Turing model? If so, how? I assume
    functional programing does not lend itself nicely to the Von Neuman model.

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

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

发布评论

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

评论(7

冬天的雪花 2024-09-07 09:22:39

图灵机是为了以数学方式探索可计算问题领域并获得描述这些计算的方法而发明的理论概念

冯诺依曼架构是一种用于构建实际计算机的架构(它实现图灵机理论上描述的内容)。

函数式编程基于lambda-calculus,这是另一种描述计算的方法或 - 更多精确 - 可计算的函数。尽管它使用完全不同的方法,但它与图灵机同样强大(据说是图灵完备)。

每个 lambda 演算程序(术语)T 都是使用变量组合

  • (如 x
  • 匿名函数(如 λx))编写的。 T
  • 函数应用 T T

尽管是无状态的,但这已经足够了 对于计算机可以完成的每项计算。图灵机和 lambda 项可以相互模拟,并且冯诺依曼计算机可以执行这两者(除了图灵机可能需要的提供无限存储等技术限制)。

但由于其无状态和更抽象的性质,与遵循二进制、内存和更新风格的命令式程序相比,函数式程序在冯诺依曼计算机上可能效率较低且不太“直观”。

Turing machines are theoretical concepts invented to explore the domain of computable problems mathematically and to obtain ways of describing these computations.

The Von-Neumann architecture is an architecture for constructing actual computers (which implement what the Turing machine describes theoretically).

Functional programming is based on the lambda-calculus, which is a another method of describing computations or - more precisely - computable functions. Though it uses a completely different approach, it is equally powerful to Turing machine (it's said to be turing complete).

Every lambda-calculus program (term) T is written just using a combination of

  • variables like x
  • anonymous functions like λx. T
  • function applications T T

Despite being stateless, this is sufficient for every computation a computer can do. Turing machines and lambda terms can emulate each other, and a Von-Neumann computer can execute both (apart from technical restrictions like providing infinite storage, which a turing machine could require).

But due to their stateless and more abstract nature, functional programs might be less efficient and less "intuitive" on Von-Neumann computers compared to imperative programs which follow it's style of binary, memory and update.

Oo萌小芽oO 2024-09-07 09:22:39

一般来说,我们指的是冯诺依曼架构,与哈佛架构。前者以相同的方式存储代码和数据,而后者具有用于代码和数据的单独的存储器和总线路径。所有现代台式电脑都是冯诺依曼的,大多数微控制器都是哈佛的。两者都是试图模拟理论图灵机的现实设计示例(这是不可能的,因为真正的图灵机需要无限的内存)。

Generally one refers to the Von Neumann architecture, as contrasted with the Harvard architecture. The former has code and data stored in the same way, whereas the latter has separate memory and bus pathways for code and data. All modern desktop PCs are Von Neumann, most microcontrollers are Harvard. Both are examples of real-world designs that attempt to emulate a theoretical Turing machine (which is impossible because a true Turing machine requires infinite memory).

憧憬巴黎街头的黎明 2024-09-07 09:22:39

图灵模型定义了计算能力,但没有深入实现,没有人会创造出字面上看起来像图灵机的计算机。 (爱好者除外 http://www.youtube.com/watch?v=E3keLeMwfHY ) 。

图灵模型不是架构

冯·诺依曼指导如何建造计算机。它没有提到计算能力。根据指令集,生成的计算机可能是图灵完备的,也可能不是图灵完备的(意味着可以解决与图灵机相同的任务)。

函数式编程(lambda 演算)是另一种计算模型,它是图灵完备的,但不能原生地适合冯·诺依曼架构。

Turing model defines computational capabilities without getting deep into implementation, no one will ever create computer that will look like Turing Machine literally. (Except enthusiasts http://www.youtube.com/watch?v=E3keLeMwfHY ).

Turing model is not architecture.

Von Neuman is guidance how to build computers. It says nothing about the computation capabilities. Depending on instruction set the produced computer may or may not be Turing complete (means can solve same tasks as Turing Machine)

Functional programming (lambda calculus) is another computational model that is Turing complete but can't be natively fit into Von Neumann architecture.

只有一腔孤勇 2024-09-07 09:22:39

我不知道图灵机和冯诺依曼架构之间有什么历史关系。然而,我确信冯·诺依曼在开发冯·诺依曼架构时就意识到了图灵机。

然而,就计算能力而言,图灵机和冯诺依曼机是等效的。任何一个都可以模拟另一个(IIRC,在图灵机上模拟冯诺依曼程序是一个 O(n^6) 操作)。 lambda 演算形式的函数式编程也是等效的。事实上,所有已知的至少与图灵机一样强大的计算框架都是等效的:

  • 图灵机
  • Lambda 演算(函数式编程)
  • 冯·诺伊曼机
  • 部分递归函数

使用这些模型中的任何模型计算的函数集没有区别。

函数式编程源自 lambda 演算,因此它不直接映射到图灵机或冯·尼穆安机。然而,它们中的任何一个都可以通过仿真来运行功能程序。我认为图灵机的映射可能比冯诺依曼机的映射更乏味,所以我对第三个问题的回答是“不,事实上更糟糕”。

I do not know what historical relationship there is between Turing machines and von Neuman architectures. I am sure, however, that von Neuman was aware of Turing machines when he developed the von Neuman architecture.

As far as computational capability, however, Turing machines and von Neuman machines are equivalent. Either one can emulate the other (IIRC, emulating a von Neuman program on a Turing machine is an O(n^6) operation). Functional programming, in the form of the lambda calculus, is also equivalent. In fact, all known computational frameworks at least as powerful as Turing machines are equivalent:

  • Turing machines
  • Lambda calculus (functional programming)
  • von Neuman machines
  • Partial recursive functions

There is no difference in the set of functions that can be computed with any of these models.

Functional programming is derived from the lambda calculus, so it doesn't map directly to either Turing or von Nemuan machines. Either of them can run functional programs, hoewver, via emulation. I think that the mapping for Turing machines is likely more tedious than the mapping for von Neuman machines, so my answer to the 3rd question would be "no, in fact it's worse."

So尛奶瓶 2024-09-07 09:22:39

图灵“模型”根本不是一个架构模型。这只是图灵假设的一台不存在的机器,作为他证明决策问题的工具< /a>.

The Turing "model" is not an architectural model at all. It was just a non-existent machine that Turing hypothesized to serve as the vehicle for his proof of the decision problem.

紫竹語嫣☆ 2024-09-07 09:22:39

理解差异的简单方法是……冯·诺依曼扩展了图灵的阿尔法机概念,以支持共享、集中、不受保护的内存中的多种算法。这导致从 Alonzo Church 的 Lambda 微积分和函数式编程转向 RISC 指令、危险的共享静态寻址、独裁的超级用户、中央操作系统、虚拟内存、虚拟机和无休止的网络犯罪。
相反,图灵机的目的是作为 Lambda 演算的 Lambda 引擎,创建虚拟函数(而不是虚拟机)。请记住,艾伦·图灵 (Alan Turing) 在 1936 年和 1937 年是阿朗佐·丘奇 (Alonzo Church) 的博士生。他们希望阿隆佐·丘奇 (Alonzo Church) 的符号功能模块化将单个算法封装和保护为简单的二进制计算机,以实现他们的丘奇-图灵论文。
Lambda 机器代码使用不可变名称、面向对象程序和基于功能的寻址,将函数式编程作为更好、更强大的计算机来实施。二进制计算机(图灵或冯·诺依曼的)以这种方式封装时,会创建一个带有六个附加 Church 指令的 Church-Turing 机器,以编程方式控制应用程序命名空间、执行线程、安全调用和返回子例程抽象、编程函数、和二进制对象,如文明网络空间:数字民主之战中所述

The easy way to understand the difference is... von Neumann stretched Turing's alpha-machine concept to support more than one algorithm in shared, centralized, unprotected memory. This led away from Alonzo Church's Lambda Calculus and functional programming to RISC instructions, dangerously shared static addressing, the dictatorial superuser, central operating systems, virtual memory, virtual machine, and endless cybercrime.
Instead, the Turing Machine was intended as the Lambda engine of the Lambda Calculus, creating virtual functions (instead of virtual machines). Remember, Alan Turing was Alonzo Church's doctoral student in 1936 and 1937. They intended Alonzo Church's symbolic, functional modularity to encapsulate and protect the single algorithm as a simple binary computer to implement their Church-Turing Thesis.
Lambda machine code enforces functional programming as a better and more powerful computer using immutable names, object-oriented programs, and Capability-Based Addressing. The binary computer (either Turing's or von Neumann's), when encapsulated this way, creates a Church-Turing Machine with six additional Church Instructions to programmatically control an application namespace, a thread of execution, secure call and return to subroutine abstractions, programmed functions, and binary objects, as explained in Civilizing Cyberspace: The Fight For Digital Democracy

往日 2024-09-07 09:22:39

拥有安全且受保护的硬件来保护丘奇图灵风格的编程环境确实很有吸引力,但我想问的是,业界如何才能过渡到这种想法?无论红旗如何挥舞,恐吓策略都起不到作用。

目前的设计投入太多。需要有一种商业上有吸引力的方式来引入它,同时替换不安全的架构,但仍然允许使用当前的功能和大部分当前的软件投资。这包括对产品和员工培训的投资。如果可能的话,替换必须能够在硬件中几乎不可见的级别进行,并以最小的影响保护当前的软件。

如果做不到这一点,我认为它永远不会被广泛实施。

Having safe and protecting hardware that protects the programming environment in the Church Turing style is really attractive, but what I ask is how can the industry be transitioned to this idea? Scare tactics won't do it no matter how hard the red flag is waved.

There is just too much invested in the current designs. There needs to be a commercially attractive way to introduce it while replacing the unsafe architectures yet still allow use of current abilities and the majority of the current software investment. That includes investment in product and in staff training. The replacement has to be able to happen at an almost invisible level in the hardware if that is possible and protect the current software with minimal impact.

If that can't be done I don't think it will ever be implemented widely.

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