html5 图灵完备,Accidentally Turing-Complete

Some things were not supposed to be

Turing-complete.

This is a collection of such accidents.

Stuff which is somehow limited

(stack overflows, arbitrary configuration, etc)

is still considered Turing complete,

since all "physical" Turing machines are resource limited.

C++ Templates

Although they were initially not supposed to,

C++ templates are Turing-complete.

For proof look at this

paper (pdf).

TypeScript Type System

In a very similar fashion to C++,

the type system of TypeScript can be used to implement a prime check.

Java Generics

Although Java set out to fix the errors of C++,

it also fell into Turing-completeness eventually.

Radu Grigore built a parser generator for fluent interfaces.

X86 Mov

The paper mov is Turing-complete

starts as this:

It is well-known that the x86 instruction set is baroque,

overcomplicated, and redundantly redundant.

We show just how much fluff it has by demonstrating that it remains

Turing-complete when reduced to just one instruction.

It inspired movfuscator,

the single instruction C compiler.

Building on this,

there is a branchless, mov-only version of the classic DOOM video game.

This is thought to be entirely secure against the Meltdown and Spectre

CPU vulnerabilities, which require speculative execution

on branch instructions.

The mov-only DOOM renders approximately one frame every 7 hours,

so playing this version requires somewhat increased patience.

X86 MMU

The page fault handling in X86 can be used to implement

a simple machine.

Basically, a page fault pushes a word to the stack, which might underflow generating another trap.

This mechanism provides a "subtract and branch if less than or equal to zero" instruction.

Enough to implement a Turing machine.

Also see the talk.

Magic: The Gathering

Magic is a card game.

Apparently,

the rules are complex enough to reach Turing-completeness.

Magic: The Gathering is a popular and famously complicated trading card game about magical combat. In this paper we show that optimal play in real-world Magic is at least as hard as the Halting Problem, solving a problem that has been open for a decade. To do this, we present a methodology for embedding an arbitrary Turing machine into a game of Magic such that the first player is guaranteed to win the game if and only if the Turing machine halts. Our result applies to how real Magic is played, can be achieved using standard-size tournament-legal decks, and does not rely on stochasticity or hidden information. Our result is also highly unusual in that all moves of both players are forced in the construction. This shows that even recognising who will win a game in which neither player has a non-trivial decision to make for the rest of the game is undecidable. We conclude with a discussion of the implications for a unified computational theory of games and remarks about the playability of such a board in a tournament setting.

And here is someone actual doing it with real cards.

HTML5 + CSS3

While older HTML/CSS versions are not,

with some new additions, you can

write a

rule 110 automaton.

The original page has moved here

and there is also Github

and a video.

Minecraft

Maybe this one was intentional,

but the complexity of the computers people build in Minecraft is impressive.

Dwarf Fortress

In a similar vein,

the infamous Dwarf Fortress game provides various ways

to build logical AND, OR, or NAND gates for

computing.

A very impressive example is a space invaders game

in the following video.

SQL

SQL is usually not considered to be Turing-complete.

However, with the features Common Table Expressions and Windowing,

SQL is Turing Complete.

The proof is in these slides.

Also, look a Mandelbrot in SQL:2008.

A broader exploration of various SQL-turing-machines

was done by Fabien Coelho.

(C Preprocessor)

The C preprocessor is only Turing-complete

if executed in a loop

which feeds the output to the input ad infinitum.

An example has won the

IOCCC 2001 contest.

Look into the herrmann1 entry.

Nonetheless included in this list for coolness.

Apache Rewrite Rules

Apache comes with the mod_rewrite plugin to rewrite URLs.

These rules ultimately are a Turing complete

string rewrite system.

Though the default configuration sets very low limits to recursion.

(Pokemon Yellow)

A Pokemon game, which is finished in 1minute 36seconds.

The interesting point about this speedrun is the bug it exploits.

Turns out the game logic itself is Turing-complete in the sense

that you can write assembly by filling the player inventory appropriately.

Executing this assembly is not part of the (intended) game though.

I consider it close enough to keep it on this list.

For example, someone turned the game into a MIDI player.

Scala Type System

Apparently, you can implement the SKI calculus

(which is Turing complete)

in Scala types.

However, the compilers stack overflows at some point.

MediaWiki Templates

In MediaWiki you can define templates.

Since they provide recursion,

you can apparently implement lambda calculus.

Little Big Planet

Yet another game, where you can build a basic computer.

For example, Conways Game of Life:

Server Side Includes

While SSI

was design as a scripting language,

loops were not planned.

The trick was to find a way for recursion.

The recursion is limited in all web servers.

Sendmail

The venerable mail server is known for its arcane configuration.

Turns out

the configuration is also turing complete.

Vim Normal-Mode

Let me just quote verbatim from Github Readme:

Ever wish you could run your code in your editor? Tired of installing huge dependencies like bash or python to run your scripts?

Love Vim so much that you never want to leave it? Why not run your code... in your editor itself?

Enter vim_turing_machine:

a tool to allow you to run a Turing machine using only normal mode Vim commands.

And now you might ask, but what can we do on a Turing machine! To demonstrate its capabilities, we implemented a solution to the Merge Overlapping Intervals question and defined all the state transitions needed to solve this glorious problem.

So next time you need to merge some intervals, don't hand-write a 10-line python program.

Instead, take out your favorite editor and watch it solve the problem in less than a minute with 1400 state transitions!

But a simple naysayer may say, 'We already have vimscript!

Why in God's name would I want to use a Turing machine instead?'

To that, we retort: our Turing machine only uses normal mode.

So you could theoretically just type in the program and then execute it without running a single script!

No ex mode either! This project proves that normal mode in Vim is as powerful as any computer!

Border Gateway Protocol (BGP)

BGP is an internet backbone technology,

which manages the routes your data packages take.

The paper "Using Routers to Build Logic Circuits:

How Powerful is BGP?"

prove Turing-Completeness via logic gate comparison.

Excel

It is no surprise, since Excel includes a scripting language.

However,

there is a nice blog post,

which shows how to encode a Turing machine in Excel

using only formulas.

Super Mario World

There are glitches in Super Mario World,

such that you can write arbitrary values into some unused parts of the memory

and then execute them.

Here is a video,

where a human (not a script!)

creates a playable Flappy Bird clone this way.

PowerPoint

Tom Wildenhain made a hilarious presentation (see video below)

and also wrote a paper "On the Turing Completeness of MS PowerPoint.

It answers the question "whether any other applications are necessary at all,

or if all computational tasks can be accomplished through the creation of

dedicated .pptx files" with "Yes".

Of course, he does not use VBScript or Macros.

Wildenhain only used AutoShape, Animation, and hyperlinks.

Nevertheless, Powerpoint is not really Turing-complete

as the viewer is required to click for each step of the machine.

Font Shaping

Here is

how someone made a font which is adding numbers.

Well, there is slight cheating involved since it only works

with a shaping librarys where the hardcoded limitations are increased.

I decided to include it nonetheless,

because it is mostly meant for simple glyph replacements

but can be used for arbitrary computations.

The fact that it is contained in a very small box

instead of having an infinite tape does not change that fact.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值