Antihydra: Difference between revisions
(→Code) |
(Combined introduction with link to bbch) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{machine|1RB1RA_0LC1LE_1LD1LC_1LA0LB_1LF1RE_---0RA}}{{unsolved|Does Antihydra run forever?}}{{TM|1RB1RA_0LC1LE_1LD1LC_1LA0LB_1LF1RE_---0RA|undecided}} | {{machine|1RB1RA_0LC1LE_1LD1LC_1LA0LB_1LF1RE_---0RA}}{{unsolved|Does Antihydra run forever?}} | ||
'''Antihydra''' is a [[BB(6)]] [[Cryptid]]. Its pseudo-random behaviour was first reported [https://discord.com/channels/960643023006490684/1026577255754903572/1256223215206924318 on Discord] by mxdys on 28 June 2024, and Racheline discovered the high-level rules soon after. It was named after the 2-state, 5-symbol [[Turing machine]] called [[Hydra]] for sharing many similarities to it.<ref>[https://discord.com/channels/960643023006490684/960643023530762341/1257053002859286701 Discord conversation where the machine was named]</ref> | {{TM|1RB1RA_0LC1LE_1LD1LC_1LA0LB_1LF1RE_---0RA|undecided}}, called '''Antihydra''', is a [[BB(6)]] [[Cryptid]]. Its pseudo-random behaviour was first reported [https://discord.com/channels/960643023006490684/1026577255754903572/1256223215206924318 on Discord] by mxdys on 28 June 2024, and Racheline discovered the high-level rules soon after. It was named after the 2-state, 5-symbol [[Turing machine]] called [[Hydra]] for sharing many similarities to it.<ref>[https://discord.com/channels/960643023006490684/960643023530762341/1257053002859286701 Discord conversation where the machine was named]</ref> | ||
Antihydra is known to not generate Sturmian words<ref>DUBICKAS A. ON INTEGER SEQUENCES GENERATED BY LINEAR MAPS. ''Glasgow Mathematical Journal''. 2009;51(2):243-252. doi:[https://doi.org/10.1017/S0017089508004655 10.1017/S0017089508004655]</ref> (Corollary 4). | Antihydra is known to not generate Sturmian words<ref>DUBICKAS A. ON INTEGER SEQUENCES GENERATED BY LINEAR MAPS. ''Glasgow Mathematical Journal''. 2009;51(2):243-252. doi:[https://doi.org/10.1017/S0017089508004655 10.1017/S0017089508004655]</ref> (Corollary 4). | ||
Line 65: | Line 65: | ||
== Code == | == Code == | ||
The following Python program implements the abstracted behavior of the Antihydra. Proving whether it halts or not would also solve the Antihydra problem:<syntaxhighlight lang="python" line="1"> | The following Python program implements the abstracted behavior of the Antihydra. Proving whether it halts or not would also solve the Antihydra problem:<syntaxhighlight lang="python" line="1"> | ||
# Current value of the iterated Hydra function starting with initial value 8 | # Current value of the iterated Hydra function starting with initial value 8 (the values do not overflow) | ||
h = 8 | h = 8 | ||
# (Collatz-like) condition counter that keeps track of how many odd and even numbers have been encountered | # (Collatz-like) condition counter that keeps track of how many odd and even numbers have been encountered | ||
Line 81: | Line 81: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The variable values of this iteration have been put into the On-Line Encyclopedia of Integer Sequences (OEIS): | |||
* Hydra function values with Antihydra's starting value 8: https://oeis.org/A386792 | |||
* Antihydra's condition values: https://oeis.org/A385902 | |||
Fast [[Hydra]]/Antihydra simulation code by Greg Kuperberg (who said it could be made faster using FLINT):<syntaxhighlight lang="python2" line="1"> | Fast [[Hydra]]/Antihydra simulation code by Greg Kuperberg (who said it could be made faster using FLINT):<syntaxhighlight lang="python2" line="1"> | ||
Line 118: | Line 122: | ||
# % (1<<e,hash(simple(n,1<<e)),elapsed())) | # % (1<<e,hash(simple(n,1<<e)),elapsed())) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==References== | ==References== | ||
[[Category:Individual machines]][[Category:Cryptids]] | [[Category:Individual machines]][[Category:Cryptids]] |
Latest revision as of 21:23, 10 August 2025
1RB1RA_0LC1LE_1LD1LC_1LA0LB_1LF1RE_---0RA
(bbch), called Antihydra, is a BB(6) Cryptid. Its pseudo-random behaviour was first reported on Discord by mxdys on 28 June 2024, and Racheline discovered the high-level rules soon after. It was named after the 2-state, 5-symbol Turing machine called Hydra for sharing many similarities to it.[1]
Antihydra is known to not generate Sturmian words[2] (Corollary 4).
Analysis
Let . Then,[3]
Consider the partial configuration . The configuration after two steps is . We note the following shift rule:
- If , then in steps we arrive at . The matching complete configuration is . After steps this is , which then leads to in steps. After five more steps, we reach , from which another shift rule must be applied:Doing so allows us to get the configuration in steps. In six steps we have , so we use the shift rule again, ending at , equal to , steps later. This gives a total of steps.
- If , then in steps we arrive at . The matching complete configuration is . After steps this becomes . If then we have reached the undefined
F0
transition with a total of steps. Otherwise, continuing for six steps gives us . We conclude with the configuration , equal to , in steps. This gives a total of steps.
The information above can be summarized as
In effect, the halting problem for Antihydra is about whether repeatedly applying the function will at some point produce more odd values of than twice the number of even values.
These rules can be modified to use the function , or the Hydra function, which strengthens Antihydra's similarities to Hydra.
Trajectory
11 steps are required to enter the configuration before the rules are repeatedly applied. So far, Antihydra has been simulated to rule steps, at which point . Here are the first few:
Code
The following Python program implements the abstracted behavior of the Antihydra. Proving whether it halts or not would also solve the Antihydra problem:
# Current value of the iterated Hydra function starting with initial value 8 (the values do not overflow)
h = 8
# (Collatz-like) condition counter that keeps track of how many odd and even numbers have been encountered
c = 0
# If c equals -1 there have been (strictly) more than twice as many odd as even numbers and the program halts
while c != -1:
# If h is even, add 2 to c so even numbers count twice
if h % 2 == 0:
c += 2
else:
c -= 1
# Add the current hydra value divided by two (integer division, rounding down) to itself (Hydra function)
# Note that integer division by 2 is equivalent to one bit shift to the right (h >> 1)
h += h//2
The variable values of this iteration have been put into the On-Line Encyclopedia of Integer Sequences (OEIS):
- Hydra function values with Antihydra's starting value 8: https://oeis.org/A386792
- Antihydra's condition values: https://oeis.org/A385902
Fast Hydra/Antihydra simulation code by Greg Kuperberg (who said it could be made faster using FLINT):
# Python script to demonstrate almost linear time hydra simulation
# using fast multiplication.
# by Greg Kuperberg
import time
from gmpy2 import mpz,bit_mask
# Straight computation of t steps of hydra
def simple(n,t):
for s in range(t): n += n>>1
return n
# Accelerated computation of 2**e steps of hydra
def hydra(n,e):
if e < 9: return simple(n,1<<e)
t = 1<<(e-1)
(p3t,m) = (mpz(3)**t,bit_mask(t))
n = p3t*(n>>t) + hydra(n&m,e-1)
return p3t*(n>>t) + hydra(n&m,e-1)
def elapsed():
(last,elapsed.mark) = (elapsed.mark,time.process_time())
return elapsed.mark-last
elapsed.mark = 0
(n,e) = (mpz(3),25)
elapsed()
print('hydra: steps=%d hash=%016x time=%.6fs'
% (1<<e,hash(hydra(n,e)),elapsed()))
# Quadratic time algorithm for comparison
# print('simple: steps=%d hash=%016x time=%.6fs'
# % (1<<e,hash(simple(n,1<<e)),elapsed()))
References
- ↑ Discord conversation where the machine was named
- ↑ DUBICKAS A. ON INTEGER SEQUENCES GENERATED BY LINEAR MAPS. Glasgow Mathematical Journal. 2009;51(2):243-252. doi:10.1017/S0017089508004655
- ↑ S. Ligocki, "BB(6) is Hard (Antihydra)" (2024). Accessed 22 July 2024.