esolang

Post Dominos

A program is a box of dominos, and a string is accepted if some row of them spells it twice.

Orby, 2019 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 5 known programs · Test method

Run it

Expected: accept

The idea

Orby made Post Dominos in 2019 out of Emil Post's correspondence problem from 1946. Each domino has a left string and a right string. Lay dominos in a row, as many of each as you like. If the left strings joined make the same text as the right strings joined, the program accepts that text. Everything else is rejected.

Read the story

Whether a set of dominos accepts anything at all is undecidable, which is what Post proved. For one given string the question can be settled, since all that matters is how far along it each edge has got, and there are only so many places to be.

The machine

A program is one domino a line, the left string, a space and the right string. A string in quotes can hold spaces, and "" is empty.

The specification names no input or output. The input is the string to test, and the program prints accept or reject. The search tries every way to lay the dominos, keeping only how far the left edge and the right edge have got along the input.

Example

The program of four dominos and the string of 23 bits it accepts.

The program of four dominos and the string of 23 bits it accepts. The specification gives the row of ten dominos that spells it, 101 10, 1 1101, 01 1, 1 1101, 1 1101, 101 10, 1101 1, 101 10, 101 10 and 01 1.

The same program rejects 1. Of the four left strings only 1 fits in it, and that domino's right string 1101 does not.

Expected: reject

Hello World is one domino with the same text on both sides. It accepts the greeting, and the greeting any number of times over.

Expected: accept

Patterns it teaches

  • String rewriting: a cousin of Thue, where strings grow by pieces until both sides agree.
  • Nondeterminism: the program states what counts as a match and the machine has to search for a row.

Further

Declarative paradigm

Write your own in Run Convert a program from Post Dominos

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: post-dominos.

Command line

shib run post-dominos -e '1 1101
101 10
01 1
1101 1' --input '10110111101110110110101'
shib manual post-dominos

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/post-dominos.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org