Smalltalk Turing is over

Completeness - Turing completeness

Ability of a computer system to simulate Turing machines
For the use of this term in the theory of relative predictability by oracle machines, see Turing Reduction.

In computability theory, a system of data manipulation rules (such as a computer's instruction set, a programming language, or a cellular automaton) is called Turing-complete or mathematically universally designated, if it can be used to simulate a Turing machine. This means that this system can recognize or decide other sets of rules for data manipulation. Completeness is used to express the power of such a data manipulation rule set. Almost all of today's programming languages ​​are Turing-complete. The concept is named after the English mathematician and computer scientist Alan Turing.

A related concept is that of Turing equivalence - two computers P and Q are said to be equivalent if P can simulate Q and Q can simulate P. The Church-Turing thesis suggests that any function whose values ​​can be calculated by an algorithm can be calculated by a Turing machine, and if a real computer can simulate a Turing machine, it is equivalent to a Turing machine. A universal Turing machine can be used to simulate any Turing machine, thereby expanding the computational aspects of any real computer.

To show that something is Turing-complete, it suffices to show that it can be used to simulate a Turing-complete system. For example, an imperative language is Turing complete if it has conditional branching (e.g., "if" and "goto" statements, or a "branch if zero" statement; see Computers with an Instruction Set) and ability to change any amount of memory (e.g. the ability to maintain any number of data items). Of course, no physical system can have infinite memory; However, if the finite memory limit is ignored, most programming languages ​​will otherwise be Turing-complete.

Not math use

In colloquial parlance, the terms "Turing-complete" and "Turing-equivalent" mean that any real general-purpose computer or computer language can roughly simulate the computational aspects of another real general-purpose computer or computer.

Real computers constructed so far can be functionally analyzed like a single-band Turing machine (the "band" corresponding to its memory). Thus, the associated math can be applied by abstracting its operation far enough. However, real computers have limited physical resources, so they are only complete as linearly limited automata. In contrast, a general-purpose computer is defined as a device with a Turing-complete set of instructions, infinite memory, and infinitely available time.

Formal definitions

In the theory of computability, several closely related terms are used to describe the computing power of a computing system (such as an abstract machine or a programming language):

A computing system that can compute any Turing-computable function is called Turing-complete (or Turing-efficient). Alternatively, such a system can simulate a universal Turing machine.
A Turing-complete system is called a Turing equivalent if every function that can compute it is also Turing computable. That is, it calculates exactly the same functional class as Turing machines. Alternatively, a Turing-equivalent system can simulate and be simulated by a universal Turing machine. (All known physically implementable Turing complete systems are Turing-equivalent, which supports the Church-Turing thesis.)
(Computer) universality
A system is said to be universal with respect to a class of systems if it can compute any function that systems in that class can compute (or simulate any of those systems). Typically, the term universality is used implicitly in relation to a Turing-complete class of systems. The term "weakly universal" is sometimes used to distinguish a system (e.g., a cellular automaton) whose universality can only be achieved by modifying the standard definition of the Turing machine to include input streams of infinitely many ones.


The completeness of the Turing is important in that any real-world design for a computing device can be simulated by a universal Turing machine. The Church-Turing thesis holds that this is a law of mathematics - that a universal Turing machine can, in principle, perform any calculation that any other programmable computer can. This does not say anything about the amount of effort required to write the program, or the time it may take for the machine to do the computation, or any skills that the machine may have that have nothing to do with computation.

Charles Babbage's (1830s) analytical engine would have been the first complete Turing machine if it had been built at the time of design. Babbage appreciated that the machine was capable of great computing power, including primitive reasoning, but little did not know that no other machine could do better. From the 1830s to the 1940s, mechanical adding machines such as adders and multipliers were built and improved, but they could not do conditional branching and so were not complete.

In the late 19th century, Leopold Kronecker formulated terms of predictability and defined primitive recursive functions. These functions can be calculated by heart, but they are insufficient to create a universal computer because the instructions that calculate them do not allow an infinite loop. At the beginning of the 20th century, David Hilbert ran a program to axiomatize all mathematics with precise axioms and precise logical rules of derivation that could be executed by a machine. It soon became clear that a small set of deduction rules is sufficient to produce the consequences of a set of axioms. These rules were proven sufficient by Kurt Gödel in 1930 to create any sentence.

The actual concept of computation was soon isolated, starting with Gödel's incompleteness theorem. This theorem showed that axiom systems were limited when thought about the computation that derives their theorems. Church and Turing independently showed that Hilberts Decision problem was unsolvable, and thus identified the computational core of the incompleteness theorem. This work, along with Gödel's work on general recursive functions, found that there are sets of simple statements that, taken together, can produce any computation. Gödel's work has shown that the concept of computation is essentially unique.

In 1941 Konrad Zuse completed the Z3 computer. Zuse was not familiar with Turing's work on predictability at the time. In particular, the Z3 lacked special facilities for a conditional jump, which prevented Turing from being complete. However, in 1998 it was demonstrated by Rojas that the Z3 is capable of conditional jumps, and therefore Turing, in full, by inadvertently using some of its functions.

Computability theory

Computability theory characterizes problems as computational solutions or not. The first result of computability theory is that there are problems for which it is impossible to predict what a (Turing-complete) system will do over an arbitrarily long period of time.

The classic example is the problem of stalling: create an algorithm that contains a program in a Turing-complete language and some data that this Program to be fed is used as input and determines whether the program that is working with the input will stop at some point or continue forever. It is trivial to create an algorithm to do this for some Input can do but is generally impossible. For a characteristic of the eventual output of the program, it cannot be determined whether this characteristic is valid.

This impossibility raises problems when analyzing real computer programs. For example, one cannot write a tool that completely protects programmers from writing infinite loops or users from providing input that would cause infinite loops.

Instead, you can limit a program to execute only for a specified period of time (timeout) or limit the performance of flow control instructions (e.g. only provide loops that iterate over the elements of an existing array). Another theorem shows, however, that there are problems that are solvable by Turing-complete languages ​​and that cannot be solved by any language with only finite loop capabilities (i.e. any language that guarantees that every program will at some point come to a standstill). So such a language is not complete. For example, a language in which programs are guaranteed to complete and pause cannot compute the computable function produced by Cantor's diagonal argument for all computable functions in that language.

Turing oracle

A computer with access to an infinite tape of data may be more powerful than a Turing machine: for example, the tape may contain the solution to the stopping problem or some other Turing-undecidable problem. Such an infinite band of data is known as a Turing oracle. Even a Turing oracle with random data cannot be calculated (with probability 1), since there are only a countable number of calculations, but innumerable oracles. So a computer with a random Turing oracle can calculate things that a Turing machine cannot.

Digital physics

All known laws of physics have consequences that can be calculated through a series of approximations on a digital computer. A hypothesis called digital physics states that this is not a coincidence, as the universe itself is computable on a universal Turing machine. This would mean that no computer more powerful than a universal Turing machine can be physically built.


The computer systems (algebras, calculi) that are discussed as Turing-complete systems are those that are intended for the study of theoretical computer science. They should be as simple as possible so that the limits of the calculation are easier to understand. Here are a few:

Most programming languages ​​(their abstract models, possibly with some specific constructs that omit finite memory), conventional and unconventional, are Turing-complete. This contains:

  • All widely used general purpose languages.
  • Most languages ​​use less common paradigms:

Some paraphrase systems are Turing-complete.

Completeness is more of an abstract statement about the ability than a prescription of specific language features that are used to implement this ability. The functions with which the completeness of Turing is achieved can be very different. Fortran systems would use looping constructs or possibly even goto statements to achieve an iteration. Haskell and Prolog, almost entirely lacking the loop, would use recursion. Most programming languages ​​describe calculations on von Neumann architectures that have memory (RAM and registers) and a control unit. These two elements make this architecture Turing complete. Even pure functional languages ​​are Turing-complete.

Completeness in declarative SQL is implemented through recursive common table expressions. Unsurprisingly, procedural extensions to SQL (PLSQL, etc.) are also complete. This reveals one reason why relatively powerful non-Turing-complete languages ​​are rare: the more powerful the language is initially, the more complex the tasks to which it is applied, and the more likely its lack of completeness is perceived as a disadvantage that promotes it Extension until it is Turing complete.

The untyped lambda calculus is Turing-complete, but many typed lambda calculi, including System F, are not. The value of typed systems is based on their ability to represent most typical computer programs while detecting more errors.

Rule 110 and Conway's Game of Life, both cellular automata, are complete.

Accidental completeness

Some games and other software are inadvertently Turing complete, that is, not intended.


Video games:

Social media:

Card games:

Zero person games (simulations):

Computer languages:

Computer hardware:

Non-Turing Complete Languages

There are many computer languages ​​that are incomplete. One such example is the set of regular languages ​​that are generated by regular expressions and recognized by finite automata. A more powerful, but still not Turing-complete, extension of finite automata is the category of push-down automata and context-free grammars, which parse trees are often used to generate in an early stage of the program, compilation. Other examples include some of the early versions of the pixel shader languages ​​embedded in Direct3D and OpenGL extensions.

In overall functional programming languages ​​such as Charity and Epigram, all functions are complete and must be terminated. Charity uses a type system and control constructs based on category theory, while Epigram uses dependent types. The LOOP language is designed to compute only those functions that are primitively recursive. All of these compute the correct subsets of the total computable functions, since the complete set of the total computable functions cannot be computably enumerated. Since all functions are complete in these languages, algorithms for recursively enumerable sets, unlike Turing machines, cannot be written in these languages.

Although the (untyped) lambda calculus is Turing-complete, the simply typed lambda calculus is not complete.

Data languages

The notion of Turing completeness does not apply to languages ​​such as XML, HTML, JSON, and YAML as they are typically used to represent structured data rather than to describe calculations. These are sometimes referred to as markup languages, or better known as "container languages" or "data description languages".

See also



further reading

External links