42

From Esolang
Jump to: navigation, search

42 is a Gödel numbering language, or set of languages, where the self-interpreter is represented by the number 42.

Bootstrapping

Input the number 42 into 42, then input any other number to have it execute the corresponding 42 program.

Properties

Not all numbers are necessarily cleanly executable as 42.

42 (when discovered) is necessarily Turing complete.

There may be many 42 languages to discover.

Examples

Self-interpreter

42

Practical implementation

Even though this is a joke-language, where the joke is that a Turing complete language can bootstrap itself ex-nihilo from its Gödel number if the program represented by that number is a Turing complete language self-interpreter which contains a Gödel number mapping that ensures the value of its own code is 42 (similar to how Quines are constructed), it should nevertheless be possible to implement.

Suggested procedure

  • Start with a bf self-interpreter
  • Modify it so that it accepts Brainfoctal like Gödel numbers as input and converts to bf to execute
  • Add bf code which maps the number 42 to the Brainfoctal value of itself + resulting interpreter

Trivial examples:

{mapped Gödel number} = 42 - {input program's Brainfoctal value} + {interpreter's Brainfoctal value}
{mapped Gödel number} = 42 if {input program's Brainfoctal value} == {interpreter's Brainfoctal value},
                             {interpreter's Brainfoctal value} if {input program's Brainfoctal value} == 42,
                             else {input program's Brainfoctal value}

or some other more or less silly transform.

  • Adjust by iteration / experimentation so that the resulting Gödel number is still 42

The result will be a bf program that executes 42 Gödel numbers. Feeding it 42 executes an identical program in 42 that accepts and executes 42 programs (which will be Gödel encoded bf, in this implementation).

Implications / Speculation verging on the mystical

There is possibly something profound hidden in this joke, that may explain how anything exists. Numbers can encode systems to self-interpret themselves and everything other possible algorithm, because: mathematics... woo!

Alternatively, information theory may provide some insight into how the 6 bits 101010 is not sufficient to store a self-interpreter for a Turing complete programming language...