Hydra function: Difference between revisions

From BusyBeaverWiki
Jump to navigation Jump to search
(Added Hydra function rules for Hydra and Antihydra with step counts)
(Reworded content in the page)
Line 1: Line 1:
[[File:Hydra-function-bitmap-255iterations.svg|thumb|100px|A bitmap depiction of 255 iterations of the Hydra function, starting with 3 at the top.]]
[[File:Hydra-function-bitmap-255iterations.svg|thumb|100px|A bitmap depiction of 255 iterations of the Hydra function, starting with 3 at the top.]]
The '''Hydra function''' is a [[Collatz-like]] function whose behavior is connected to the unsolved halting problems for the [[Cryptids]] [[Hydra]] and [[Antihydra]]. It is defined as:
The '''Hydra function''' is a [[Collatz-like]] function defined as:
<math display="block">\textstyle H(n)\equiv n+\left\lfloor\frac{1}{2}n\right\rfloor=\Big\lfloor\frac{3}{2}n\Big\rfloor=\begin{cases}
<math display="block">\textstyle H(n)\equiv n+\left\lfloor\frac{1}{2}n\right\rfloor=\Big\lfloor\frac{3}{2}n\Big\rfloor=\begin{cases}
   \frac{3n}{2}    & \text{if } n\equiv0\pmod{2} \\
   \frac{3n}{2}    & \text{if } n\equiv0\pmod{2}, \\
   \frac{3n-1}{2}  & \text{if } n\equiv1\pmod{2} \\
   \frac{3n-1}{2}  & \text{if } n\equiv1\pmod{2}. \\
\end{cases}</math>
\end{cases}</math>
which can alternatively be written as
It is named as such due its connection to the unsolved halting problems for the [[Cryptids]] [[Hydra]] and [[Antihydra]]. Due to its simplicity, simulations for both of these [[Turing machines]] utilize this function instead of what can initially be proven.
<math display="block">\begin{array}{l}
  H(2n)  & = & 3n  \\
  H(2n+1) & = & 3n+1 \\
\end{array}</math>
It has some connections to [[wikipedia:Mahler's_3/2_problem|Mahler's 3/2 problem]].
== Relationship to Hydra and Antihydra==
== Relationship to Hydra and Antihydra==
Recall the high-level rules for Hydra and Antihydra:
Recall the high-level rules for Hydra and Antihydra:
Line 29: Line 24:
\end{array}</math>
\end{array}</math>
|}
|}
Already, both machines can be observed to have very similar functions. Both have one parameter that increases exponentially with growth factor <math display="inline">\frac{3}{2}</math>, and another that takes a pseudo-random walk that depends on the parity of the other variable. This relationship can be strengthened through a change of variables. This is easier to illustrate if these rules were written in the form of integer sequences:
Already, both machines appear to have very similar functions. They have one parameter that increases exponentially with growth factor <math display="inline">\frac{3}{2}</math> and another that effectively takes a pseudo-random walk. This relationship can be strengthened through a modification of the rules. Below, the exponentially increasing variables are described by integer sequences:
{|class="wikitable"
{|class="wikitable"
! Hydra !! Antihydra
! Hydra !! Antihydra
Line 36: Line 31:
|<math display="block">a_0=4,a_{n+1}=\begin{cases}\frac{3a_n+4}{2}&\text{if }a_n\equiv0\pmod{2}\\\frac{3a_n+3}{2}&\text{if }a_n\equiv1\pmod{2}\end{cases}</math>
|<math display="block">a_0=4,a_{n+1}=\begin{cases}\frac{3a_n+4}{2}&\text{if }a_n\equiv0\pmod{2}\\\frac{3a_n+3}{2}&\text{if }a_n\equiv1\pmod{2}\end{cases}</math>
|}
|}
Now, we will introduce a new integer sequence based on the old one and discover the recursive rules for that sequence. For Hydra, this new sequence is <math display="inline">b_n=\frac{1}{3}a_n+2</math>. For Antihydra, this new sequence is <math>b_n=a_n+4</math>. The new rules are found by using <math>b_{n+1}</math> instead and substituting <math>a_{n+1}</math> for its recursive formula. By doing so, we get:
Doing this makes illustrating the transformation easier. Now we will define a new integer sequence based on the old one and discover the recursive rules for that sequence. This new sequence is <math display="inline">b_n=\frac{1}{3}a_n+2</math> and <math>b_n=a_n+4</math> for Hydra and Antihydra respectively. We start by using <math>b_{n+1}</math> instead and substituting <math>a_{n+1}</math> for its recursive formula. By doing so, we get:
{|class="wikitable"
{|class="wikitable"
! Hydra !! Antihydra
! Hydra !! Antihydra
Line 43: Line 38:
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3a_n+12}{2}&\text{if }a_n\equiv0\pmod{2}\\\frac{3a_n+11}{2}&\text{if }a_n\equiv1\pmod{2}\end{cases}</math>
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3a_n+12}{2}&\text{if }a_n\equiv0\pmod{2}\\\frac{3a_n+11}{2}&\text{if }a_n\equiv1\pmod{2}\end{cases}</math>
|}
|}
After that, we must substitute <math>a_n</math> for its solution in terms of <math>b_n</math>. What results is the following:
After that, we can substitute <math>a_n</math> for its solution in terms of <math>b_n</math>. What results is the following:
{|class="wikitable"
{|class="wikitable"
! Hydra !! Antihydra
! Hydra !! Antihydra
Line 50: Line 45:
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3(b_n-4)+12}{2}&\text{if }b_n-4\equiv0\pmod{2}\\\frac{3(b_n-4)+11}{2}&\text{if }b_n-4\equiv1\pmod{2}\end{cases}</math>
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3(b_n-4)+12}{2}&\text{if }b_n-4\equiv0\pmod{2}\\\frac{3(b_n-4)+11}{2}&\text{if }b_n-4\equiv1\pmod{2}\end{cases}</math>
|}
|}
We finish by noting that the if statements simplify to simply checking if <math>b_n</math> is even or odd. After simplifying, we get
We note that the if statements simplify to checking if <math>b_n</math> is even or odd. After simplifying, we are done:
{|class="wikitable"
{|class="wikitable"
! Hydra !! Antihydra
! Hydra !! Antihydra
Line 57: Line 52:
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3b_n}{2}&\text{if }b_n\equiv0\pmod{2}\\\frac{3b_n-1}{2}&\text{if }b_n\equiv1\pmod{2}\end{cases}</math>
|<math display="block">b_0=8,b_{n+1}=\begin{cases}\frac{3b_n}{2}&\text{if }b_n\equiv0\pmod{2}\\\frac{3b_n-1}{2}&\text{if }b_n\equiv1\pmod{2}\end{cases}</math>
|}
|}
Now that we have demonstrated the relatedness between the behaviour of both [[Turing machines]], we can return to using the high-level rules. Once we do this, the result is:
Now that we have demonstrated a strong similarity in the behaviour of both Turing machines, we can return to using the high-level rules. Once we do that and update the step counts, the result is:
{|class="wikitable"
{|class="wikitable"
! Hydra !! Antihydra
! Hydra !! Antihydra
Line 67: Line 62:
C(2a+1,b)&\xrightarrow{4b+54a^2-3a+4}&C(3a+1,b+2).\\\hline
C(2a+1,b)&\xrightarrow{4b+54a^2-3a+4}&C(3a+1,b+2).\\\hline
\end{array}</math>
\end{array}</math>
|<math>A(a,b):=0^\infty\;1^a\;0\;1^{b-4}\;\textrm{E>}\;0^\infty</math>:<math display="block">\begin{array}{|lll|}\hline
|Let <math>A(a,b):=0^\infty\;1^a\;0\;1^{b-4}\;\textrm{E>}\;0^\infty</math>:<math display="block">\begin{array}{|lll|}\hline
0^\infty\;\textrm{A>}\;0^\infty&\xrightarrow{11}&A(0,8),\\
0^\infty\;\textrm{A>}\;0^\infty&\xrightarrow{11}&A(0,8),\\
A(a,2b)& \xrightarrow{2a+3b^2-1}& A(a+2,3b),\\
A(a,2b)& \xrightarrow{2a+3b^2-1}& A(a+2,3b),\\
Line 75: Line 70:
|}
|}
==Properties==
==Properties==
Here, <math>s</math> and <math>t</math> are positive integers with <math>t</math> odd. Let <math>0\le k\le s</math> be an integer and <math>H^k</math> is the <math>k</math>th iterate of <math>H</math>.
The Hydra function can be rewritten as follows:
<math display="block">\begin{array}{l}
  H(2n)& = & 3n  \\
  H(2n+1)& = & 3n+1\\
\end{array}</math>
From this comes a way to slightly optimize the calculation. Here, <math>s</math> and <math>t</math> are positive integers with <math>t</math> odd. Let <math>0\le k\le s</math> be an integer and <math>H^k</math> is the <math>k</math>th iterate of <math>H</math>.
<math display="block">\begin{array}{l}
<math display="block">\begin{array}{l}
   H^k(2^s t)  & = & 3^k2^{s-k}t  \\
   H^k(2^s t)  & = & 3^k2^{s-k}t  \\
   H^k(2^s t+1)  & = & 3^k2^{s-k}t+1 \\
   H^k(2^s t+1)  & = & 3^k2^{s-k}t+1 \\
\end{array}</math>
\end{array}</math>

Revision as of 04:19, 5 March 2025

A bitmap depiction of 255 iterations of the Hydra function, starting with 3 at the top.

The Hydra function is a Collatz-like function defined as:

It is named as such due its connection to the unsolved halting problems for the Cryptids Hydra and Antihydra. Due to its simplicity, simulations for both of these Turing machines utilize this function instead of what can initially be proven.

Relationship to Hydra and Antihydra

Recall the high-level rules for Hydra and Antihydra:

Hydra Antihydra
Let :
Let :

Already, both machines appear to have very similar functions. They have one parameter that increases exponentially with growth factor and another that effectively takes a pseudo-random walk. This relationship can be strengthened through a modification of the rules. Below, the exponentially increasing variables are described by integer sequences:

Hydra Antihydra

Doing this makes illustrating the transformation easier. Now we will define a new integer sequence based on the old one and discover the recursive rules for that sequence. This new sequence is and for Hydra and Antihydra respectively. We start by using instead and substituting for its recursive formula. By doing so, we get:

Hydra Antihydra

After that, we can substitute for its solution in terms of . What results is the following:

Hydra Antihydra

We note that the if statements simplify to checking if is even or odd. After simplifying, we are done:

Hydra Antihydra

Now that we have demonstrated a strong similarity in the behaviour of both Turing machines, we can return to using the high-level rules. Once we do that and update the step counts, the result is:

Hydra Antihydra
Let :
Let :

Properties

The Hydra function can be rewritten as follows:

From this comes a way to slightly optimize the calculation. Here, and are positive integers with odd. Let be an integer and is the th iterate of .