302 points · by LegionMammal978 · 2y ago · 107 comments
There are three states: A, B, C. (States are just like goto targets in C.) State B passes control to A and C, but states A and C don't "know about" each other; they only pass control back to B. This is a sort of modular construction, whereas in true spaghetti code each state would be able to pass to all the others.
This program has some other interesting features. It never prints a blank (that is, whenever it scans a 0, it prints 1, 2, or 3). Additionally, every instruction changes either the state or the color -- there are no "lazy instructions" like B1 -> 1LB that just move position without changing anything else.
Though I suspect that no long-running machine can be utterly chaotic, at least when you look at the patterns it produces on the tape. To run for a long time, a machine must simulate some sort of higher-level rule: if it were dumping symbols on the tape at random, then it would very soon reach a halting configuration, a cyclical configuration, or some other simplified pattern. Still, one can have long-running machines that do simulate something chaotic on a higher level, spending an inordinate amount of time between each high-level step until it halts.
I agree completely, all of these kinds of conjectures are shaped by what is detectable. If there are any "dark matter" programs out there, they by definition will be difficult to find. That said, I find it entirely plausible that the champions will win by exploiting complex and exotic mathematical facts, while the implementations of the math do not themselves need to be complex or exotic at the code level.
More rambling thoughts about this: https://nickdrozd.github.io/2021/09/25/spaghetti-code-conjec...
Rough sketch of an argument:
Let's construct a number from all intermediate states of the machine concatenated. The number of digits of this number should correspond to the runtime (sketchy). We only care about the halting machines, so it's finite. We know that it must be unique because if a smaller machine computes the same number, we could get a bigger number by simply running the smaller program and doing other nonsense. That means the biggest programs are komolgorov optimal, and the numbers themselves should be k-trivial and thus nearly but not quite computable. Since they're not computable, the programs themselves can't follow a structure to generate them (since that would be computable in turn for larger values).
An n-state s-symbol TM can transition to n other states at most (or halt). Thus, for s=4 or s=2, only the smallest of TMs could be spaghetti like.
0 1 2 3
A 1RB 3LB 1RZ 2RA
B 2LC 3RB 1LC 2RA
C 3RB 1LB 3LC 2RC
with the triple (t',d, s') in row s column t specifying the transition from state s with symbol t under the tape head. the machine overwrites symbol t with t', moves the tape Left/Right according to direction d, and changes state from s to s', halting if s'==Z.This is 3*4*log2(4*2*log2(4+1)) or about 64 bits of information. Meanwhile, in only 49 bits, BBλ(49) far exceeds Graham's number [1].
If the Halting problem could be solved by intuition, it wouldn't be much of a problem.
(Even writing of the 1 doesn't matter, though a 0 would have been suboptimal I guess. A 2 was already written on the tape there, it's being replaced by a 1 but the 2 counted just as much for 'number of symbols on the tape')
I calculate 3*4*log2(4*2*log2(4+1)) ≈ 51.
I (a layperson) would have thought the calculation would be 3*4*log2(4*2*4) = 60.
Is it perhaps 3*4*log2(4*2*log2(3*3*4-1)) ≈ 64?
Like you can mirror the tape. You can relabel states B and C. And you can relabel symbols 1, 2, 3. Though the analysis is complicated a little bit by the fact that some (combinations) of those operations may yield the exact same machine.
If you run it for a bit you see what's going on, State B turns 0's into 2's and 1's into 1's transitioning to C and state C turns 3 -> 2's and transitions to A. So you just iteratively lengthen your run of 3's exponentially since it requires a full pass through all the 3's to fix a 2->1.
But the really tricky part to understand is why it eventually stops. After an unimaginably high number of steps.
Here's a tangent to explore:
A BitGrid[1] (my personal hobby horse) only has 4 bits of state per cell, so a 4x4 grid of cells can't count more than 2^64, no matter what. Finding the highest it could count would be interesting. For small grids, the edge connections would dominate the outcome.
#include "machine.h"
int main(void)
{
A:
switch (SCAN) {
case 0:
WRITE(1); RIGHT; goto B;
case 1:
WRITE(3); LEFT; goto B;
case 2:
WRITE(1); RIGHT; goto H;
case 3:
WRITE(2); RIGHT; goto A;
}
B:
switch (SCAN) {
case 0:
WRITE(2); LEFT; goto C;
case 1:
WRITE(3); RIGHT; goto B;
case 2:
WRITE(1); LEFT; goto C;
case 3:
WRITE(2); RIGHT; goto A;
}
C:
switch (SCAN) {
case 0:
WRITE(3); RIGHT; goto B;
case 1:
WRITE(1); LEFT; goto B;
case 2:
WRITE(3); LEFT; goto C;
case 3:
WRITE(2); RIGHT; goto C;
}
H:
HALT;
}
Question: are there any opportunities to rewrite this logic in a more "structured" style, or to make any other optimizations? int main(void) {
void* A[] = {&&A0, &&A1, &&A2, &&A3};
void* B[] = {&&B0, &&B1, &&B2, &&B3};
void* C[] = {&&C0, &&C1, &&C2, &&C3};
goto *A[SCAN];
A0: WRITE(1); RIGHT; goto *B[SCAN];
A1: WRITE(3); LEFT ; goto *B[SCAN];
A2: WRITE(1); RIGHT; HALT; return 0;
A3: WRITE(2); RIGHT; goto *A[SCAN];
B0: WRITE(2); LEFT ; goto *C[SCAN];
B1: WRITE(3); RIGHT; goto *B[SCAN];
B2: WRITE(1); LEFT ; goto *C[SCAN];
B3: WRITE(2); RIGHT; goto *A[SCAN];
C0: WRITE(3); RIGHT; goto *B[SCAN];
C1: WRITE(1); LEFT ; goto *B[SCAN];
C2: WRITE(3); LEFT ; goto *C[SCAN];
C3: WRITE(2); RIGHT; goto *C[SCAN];
}Why doesn't any modern C standard like C23 include this? Seems like a glaring omission.
Because A and C only jump to B it is possible to structure this using only loops and one boolean. Let us use Rust to demonstrate as it lacks GOTO:
let mut a = true;
loop {
loop {
if a { // state A
match scan() {
0 => { write(1); right(); break }
1 => { write(3); left(); break }
2 => { write(1); right(); return }
3 => { write(2); right() }
}
} else { // state C
match scan() {
0 => { write(3); right(); break }
1 => { write(1); left(); break }
2 => { write(3); left() }
3 => { write(2); right() }
}
}
}
a = loop { // state B
match scan() {
0 => { write(2); left(); break false }
1 => { write(3); right() }
2 => { write(1); left(); break false }
3 => { write(2); right(); break true }
}
}
}
Of course it is possible to rewrite this as a single loop if you are willing to accept two bits of extra state rather than one.> A TM string is in lexical normal form iff the following conditions obtain: …The non-initial active states first occur in ascending order…
The cell in the table describes which actions to perform. The first row & first column has "1RB" which means: "replace the symbol on the tape with '1', shift 1 symbol to the right on the tape and switch to state 'B'".
The state 'Z' corresponds to the halting state.
def L():
global index, tape
if index: index -= 1
else: tape.insert(0, 0)
def R():
global index, tape
index += 1
if index >= len(tape): tape.append(0)
table = {
('A', 0): (1, R, 'B'),
('A', 1): (3, L, 'B'),
('A', 2): (1, R, 'Z'),
('A', 3): (2, R, 'A'),
('B', 0): (2, L, 'C'),
('B', 1): (3, R, 'B'),
('B', 2): (1, L, 'C'),
('B', 3): (2, R, 'A'),
('C', 0): (3, R, 'B'),
('C', 1): (1, L, 'B'),
('C', 2): (3, L, 'C'),
('C', 3): (2, R, 'C'),
}
state = 'A'
tape = [0]
index = 0
while state != 'Z':
tape[index], direction, state = table[state, tape[index]]
direction()[0] https://bbchallenge.org/story#turing-machines
[1] https://en.wikipedia.org/wiki/Turing_machine#Formal_definiti...
[2] https://bbchallenge.org/1RB3LB1RZ2RA_2LC3RB1LC2RA_3RB1LB3LC2...
Despite a CS undergrad I don’t recall really learning any of these canonical representations of TMs before.
Collaborating on Discord is fine. Important results, including citations backing them, should really be published or at least replicated in more durable medium that's less susceptible to link rot, and easier to archive. Today, that's PDFs in paper repositories, or even regular blog posts.
The right way to reference scientific publications is by URN [1], not URL. That makes the location irrelevant, as it should be.
so clearly discord is inherently different and here to stay forever! /s
feels like time is a circle sometimes ha
1. Outright fraud
2. Lack of independent verification of results before building up a body of work resulting in a bunch of garbage. Contributes to making #1 “easy”.
3. Financial pressures to publish or perish contributing to 1 & 2. If peer review didn’t exist you’d still something similar about producing “recognized” results. This is also probably why we haven’t done any major breakthroughs in particle physics which now has a much longer term thinking phase to come up with anything.
The biggest problem with peer review is actually the establishment of an orthodoxy which discourages itself being upended by controlling the career success of anyone who dare challenge it - you have to support the orthodoxy to get career success and you fail to get recognition if your idea challenges the peer reviewers ideas and careers. That being said, such pressures existed before, but at least you could try to build your own following and it was competing orthodoxies instead of a single one winning out.
But those only exist because of the current peer-review model. There is a huge non-linearity built in to the publication process that provides disproportionate rewards for conning a small number of people, fewer than half a dozen. That, combined with a presumption of trustworthiness, produces a perverse incentive for attempting such cons because they are very easy to pull off, much easier than actually doing good science.
Also, I'd consider these more as attributions than citations. All the major arguments supporting the results have been replicated in the blog post (in a more rigorous form), so it can stand on its own: the Discord links just provide historical context for those interested.
I don't like discord but... The people doing research have chosen this method of collaboration. I like their research. Let's not be choosing beggars and tell them how to conduct their research.
What I think you are doing here is to DEFINE "foundational work" as something that gets published in a journal.
I don't mind if you use that definition, but if you do then the fact that all foundational work is published in journals is not insightful or informative, it is merely the definition.
If, on the other hand, you intended for the statement to say something meaningful about how important scientific and mathematical work is communicated, then you need a different definition of "foundational". And you would have to look to that definition to decide whether this work was foundational, because if it was then it disproves your hypothesis: it would be a counter example that illustrates that some foundational work is shared in places other than journals.
Like it sounds like it could end up being useful somehow.
[1] https://en.wikipedia.org/wiki/Superpermutation#Lower_bounds,...
This is related to the linear speed-up theorem, which roughly states that you can speed up any TM by expanding its alphabet. And speed-up is not what BB is about.
So actually, it would make sense to limit the the busy beavers to BB(n, 2) only.
https://en.wikipedia.org/wiki/Busy_beaver
https://en.wikipedia.org/wiki/Ackermann_function
As I understand it, the game around functions like this is to get as close to infinity as you can, but not quite, and then to try to uncover properties about what you find there.
I'm under the impression that it's a certain kind of fun because the results are all way too large to work with computationally, so rather than comparing the values (which you can't calculate directly) you have to reason about the various algorithms that yield them.
That's all I got. The gust of the post is greek to me. I wish I had more computer science and less software engineering under my belt. Then maybe this could be my kind of fun too.
In this case, we can actually name the number of symbols in terms of Knuth's up-arrow notation [0], which describes the sequence of operations starting with multiplication, exponentiation, repeated exponentiation (called tetration, e.g., 2↑↑5 = 2^[2^[2^[2^2]]]), repeated tetration (called pentation, e.g., 2↑↑↑5 = 2↑↑[2↑↑[2↑↑[2↑↑2]]]), and so on. This number is big enough that it needs 15 arrows in a row to describe it reasonably. So it's not just that the number is very large, it's that we can also put a neat lid over its value. For instance, we know it's still nothing compared to Graham's number, which can't be described with any reasonable number of up-arrows.
[0] https://en.wikipedia.org/wiki/Knuth%27s_up-arrow_notation