Gödelfish

From Esolang
(Redirected from Godelfish)
Jump to navigation Jump to search

Gödelfish is based on a Gödel numbering of the esoteric programming language Deadfish. It is also a Turing complete Zero-dimensional programming language in its own right, based on a specific translation to (and from) Brainfoctal.

A Gödelfish program, 𝜑̈, can be formed from Deadfish by making the following substitutions and interpreting the result as a base 4 integer:

Deadfish Gödelfish (Base 4)
d 0
i 1
s 2
o 3

Conversion to Brainfoctal

Any Gödelfish program, 𝜑̈, can be converted to a corresponding Brainfoctal value, β, using the bijective[1] continuous piecewise linear function bidso(x):

where

and

d = 32370779665404705561807609489961735142772450595278948496424386 66768114984669819898111048909997575431027847057652566964551746

o = 14405520897770861239295320965768628031155278608853989995878087 51039303575288379014650106747233088457451983932729811175340555 027052154015192163827170902870107520892608

g = 26754243754103765292330832085990828424744263601285353899531352 52873368656423787611508483038332610047342918664129411722483469 658221319869868861186264640741264481336638

The resulting value can be executed as Brainfoctal, and will produce the expected Deadfish output when 𝜑̈ ∈ ℕ, or Brainf*** output when 𝜑̈ ∉ ℕ ∧ β ∈ ℕ.

The crossover point for the two linear equations that make up bidso(x) is roughly 1.9

Variants

There are two variants of Gödelfish.

  1. 𝜑̈ ∈ ℕ: Natural Gödelfish.
  2. 𝜑̈ ∈ ℝ: Real Gödelfish.

Where 𝜑̈ ∈ (ℝ − ℕ) can be termed Unnatural Gödelfish.

All valid Deadfish programs are represented in Natural Gödelfish. All valid Brainfoctal programs can be represented by at least one equivalent Unnatural Gödelfish program (i.e. non-integer value). Not all Reals produce valid Brainfoctal. These values are deemed syntax errors (β ∉ ℕ ).

Gödelfish Code Generation

The following generates a Gödelfish program that sets the accumulator to i, where i ∈ ℕi ≠ 256 This function is undefined when i = 256.

where

and γ : ℕ → {0, 1}, given by

This is by no means an optimised conversion, but it does produce accurate output for all valid inputs. There are other possible code generation functions. To modify a program to output the accumulator value, simply multiply by 4, and add 3: 𝜑̈out = 4φ(i) + 3

Evaluation and output encoding

where

𝜑̈ = Natural Gödelfish value, 𝜑̈ ∈ ℕ

r = radix of output values

d = number of digits per output value in base r

Examples

Hello World (Natural)

hw = 220004154300346839601141697640197817404810450964612631879016141088612008430732504789405572021198350571970553520586755

O(hw, 16, 2) = 0x48656c6c6f20776f726c64 (i.e. 'Hello world' in ASCII)

O(hw, 10, 3) = 72101108108111032119111114108100 (base 10 version of the above. Same information, different output encoding)


See #External links for a Try It Online! link to the output of b(hw).

Hello World (Unnatural)

hw𝕌 = -0.02267050412500270959407579713247251696870738403389181782725188269749688319088642196836222187626319203264982082686924411902690

b(hw𝕌) = 228855768768422936408264393456423041692937029376710995071693817276469283765324982920591645725405 (in Brainfoctal)

which represents bf:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++., Output: Hello World!

Cat program

A notable example because Deadfish does not have any input ability, and neither does Natural Gödelfish. Unnatural Gödelfish however does support input and looping, as demonstrated by this code. -0.022670504125002709594075797134075282086978542505248915011217737915032694422870805248545387883658040503097960748512306158803077

Deadfish overflow test

One of the mandatory test cases for Deadfish arithmetic is diissisdo, to produce 288. In Gödelfish: 0d011221203, using a custom `0d` notation prefix for base 4 (d= 4th letter, and d=Deadfish), or 23139 in base 10.

O(23139, 10, 3) = 288

b(23139) = 1992383016428349379845507622404809953112874611861926515895523484704100169565280320846715649660189154160692239791778226306121802756581767877274244662399303495671723772618198640181726493099998422897294003276426465702182811842417559278638227066244354421033194410526449783769732849072628823136889528739121209015839000488795682675246514108752176227702793908289610150999450135418832560874409687851879319092072332109144798720273206158129513802909039262780743465844978721861502244168217079743493841505119880986566503697853499091509206772695008175788258561297441411606177281225180180093510826638501901080096493385844333703547878624301929687825312398581066719234186975850736749259170298477303649768062659142193389341897700256044528403897763101681597105296857074760171490523865079937455449993074674865404868638147157077294631471857215867519480707945364944621002983939712957287912867032309100052322811534536978440854749102465031414831196101671976346382463888623962187629355044934873788522944045314847727884853596071036481207346819004012449632131297026103248359413632478710300690032013059452103369673613851608185560775591029690750031864172533961702325600009914576626630402

Which is equivalent to bf ++-[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<++-[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>>>+<+<<-]>>[>[<<<+>+>>-]<<[>>+<<-]>-]>[-]<<<[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>>>+<+<<-]>>[>[<<<+>+>>-]<<[>>+<<-]>-]>[-]<<<[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<++-[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>>>+<+<<-]>>[>[<<<+>+>>-]<<[>>+<<-]>-]>[-]<<<[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<-[>+>+<<-]>>[<<+>>-]>-<<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>+>+<<-]>>[<<+>>-]>+>++>+[->+++[-<++++>]<<]<[->>-<<]+>>[<<->>[-]]<<[[-]<[-]>]<[>>+>+<<<-]>>>[<<<+>>>-]<<+>[<->[>++++++++++<[->-[>+>>]>[+[-<+>]>+>>]<<<<<]>[-]++++++++[<++++++>-]>[<<+>>-]>[<<+>>-]<<]>]<[->>++++++++[<++++++>-]]<[.[-]<]<>++++++++++.++++++++++++[-]<.

The above code does not produce the expected result on tio.run, or any other bf interpreter limited to 8 bit cells. See #External resources for a link to an online interpreter with a 16 bit cell option which does produce the expected ASCII character output of '288'.

Computational class

Gödelfish is TG.

External resources

  1. this is likely a lie, technically, and may need some qualification.