On the far right is the Turing “complete configuration” (Kleene “situation”, Hopcroft–Ullman “instantaneous description”) at each step. If the machine were to be stopped and cleared to blank both the “state register” and entire tape, these “configurations” could be used to rekindle a computation anywhere in its progress (cf. Turing (1936) The Undecidable, pp. 139–140). They are more readily simulated by computer in tabular form (Booth, p. 74). Machines with “reset” states and machines with repeating patterns (cf. Hill and Peterson p. 244ff)—can be more readily seen when viewed as a drawing. Thus the state of progress of the computation at any stage is completely determined by the note of instructions and the symbols on the tape.

A Turing complete system is capable of performing any computation or algorithm, given enough resources and time. A smart contract is a digital agreement that executes predefined conditions without the need for intermediaries. Its programming language automatically triggers actions under specific conditions. The principle of Turing completeness plays a significant role in the design and operation of these smart contracts.

- It goes without saying that it only succeeds if the problem is computable, but if it is computable, it will succeed (halt).
- For instance, modern stored-program computers are actually instances of a more specific form of abstract machine known as the random-access stored-program machine or RASP machine model.
- If you can write a Brainf$&# interpreter in your language, it is Turing-complete.
- Only in the related area of analysis of algorithms this role is taken over by the RAM model.

But a buggy or poorly designed printer driver can certainly generate programs that hang forever or that take inordinately long times to prepare a page. Postscript is powerful enough to compute some very complicated graphics, e.g., fractals. But, on the slow cheap CPUs embedded into many printers, such calculations could take a long time, giving an impression that the printer was no longer working. As noted earlier, FORTRAN was the first high-level programming language. Once you are turing complete, you can do things like interpret other Turing Complete languages, including your own.

## Turing Completeness in Blockchain

A Turing machine that is able to simulate any other Turing machine is called a universal Turing machine (UTM, or simply a universal machine). Another mathematical formalism, lambda calculus, with a similar “universal” nature was introduced by Alonzo Church. Church’s work intertwined with Turing’s to form the basis for the Church–Turing thesis. Studying the abstract properties of Turing machines has yielded many insights into computer science, computability theory, and complexity theory.

## Ethereum – the first Turing complete blockchain

At the other extreme, some very simple models turn out to be Turing-equivalent, i.e. to have the same computational power as the Turing machine model. In the context of formal language theory, a Turing machine (automaton) is capable of enumerating some arbitrary subset of valid strings of an alphabet. A set of strings which can be enumerated in this manner is called a recursively enumerable language. The Turing machine can equivalently be defined as a model that recognises valid input strings, rather than enumerating output strings.

## The Role of Turing Completeness in Smart Contracts

A limitation of Turing machines is that they do not model the strengths of a particular arrangement well. For instance, modern stored-program computers are actually instances of a more specific form of abstract machine known as the random-access stored-program machine or RASP machine model. Like the universal Turing machine, the RASP stores its “program” in “memory” external to its finite-state machine’s “instructions”. The RASP’s finite-state machine is equipped with the capability for indirect addressing (e.g., the contents of one register can be used as an address to specify another register); thus the RASP’s “program” can address any register in the register-sequence.

## Implications on Blockchain Technology

In total functional programming languages, such as Charity and Epigram, all functions are total and must terminate. Charity uses a type system and control constructs based on category theory, whereas Epigram uses dependent types. The LOOP language is designed so that it computes only the functions that are primitive recursive. All of these compute proper subsets of the total computable functions, since the full set of total computable functions is not computably enumerable. Also, since all functions in these languages are total, algorithms for recursively enumerable sets cannot be written in these languages, in contrast with Turing machines. In 1937, while at Princeton working on his PhD thesis, Turing built a digital (Boolean-logic) multiplier from scratch, making his own electromechanical relays (Hodges p. 138).

An important aspect of this technology is a unique property referred to as ‘Turing Completeness’. Despite the name, this incident wasn’t a hack in the true sense of the word. The attacker exploited a then-little-known vulnerability in the way the underlying code was written to execute a move now known as a reentrancy attack, calling upon an untrusted contract to drain funds.

Arrays can be joined to form matrices, which are key elements in many graphics calculations as ways to perform rotation and scaling. It has arrays, which are created by using a special operator [ that pushes a “start of array mark”. This is followed by pushing an number of items onto the stack, then executing the end-of-array operator ‘]’, which collects all the items on that stack down to the ‘[’ into an array, leaving the reference to the array at the top of the stack. The mul operator multiplies the two numbers on the top of the stack, replacing them by their product.

For this reason, every transaction on Ethereum requires a gas limit which specifies the maximum amount of computing power that can be allocated to the transaction. If the transaction isn’t completed once the limit is reached, it is rejected. It was stated above that ‘a function is effectively calculable if its values can be found by some purely mechanical process’.

The same thing can be achieved with recursion, GOTO-statements or a thing called the Y combinator, which is maybe the most primitive concept that can still deliver Turing completeness. Our programming language is very capable but notice that it’s impossible to make infinite loops. We can use multiple loops, we can use nested loops but each loop will always have a fixed and finite number of iterations. We have to speculate a bit on what Adobe’s motivations were in designing PDF, but it seems clear to me that one of the things they were looking for was predictability – the running time of a program on a printer needed to be bounded and predictable. In practical terms, if a programming language permits straight-line sequences of code, some form of if-then-else, and some form of unbounded iteration (e.g., while loops), it is Turing complete. Note that most if not all all practical SQL dialects extend the pure relational model with procedural constructs to the extent that they are Turing Complete by the definition as normally applied to programming languages.

However, most programming languages out there are Turing complete and if you were to create your own programming language you would probably make it Turing complete by accident. We can set aside any idea that it relies on powerful arithmetic or logical computations embedded in the ALU. We’re seen that Turing machines have nothing like that – they rely simply liabilities on balance sheet on symbol matching and storage. Writing a Turing machine simulator in most programming languages is a pretty straightforward task. To understand the role of Turing Completeness in cryptocurrency scalability, we need to define this term. Turing Completeness is a concept from computer science, named after the British mathematician Alan Turing.