10

Edit: Below, I establish this for $\{\log x,x^y,-1\}$. It occurs to me that you can trade the requirement of including $-1$ for the ability to use a log with any base. This follows because given an integer $n>1$, you have

$$\log_n { \log_{(n^n)}{n}}=-1.$$

Since any state $s_i$ in the domain is such an integer, we can use that as our $n$, allowing us to replace any instance of $-1$ with this expression.


I think I've got a constructive proof that a certain class of recursive function can be Turing-complete, and I am curious whether I am retreading old ground.

Using only the operations $\ln(x)$ and $x^y$ along with the constant $-1$, you can build up an expression in terms of a state input $s_i$ (also built from those three atoms) that will compute the state $s_{i+1}$, such that repeated application of that expression will be Turing-complete. In particular, it simulates one step in a 2-tag system, where the production rules are embedded as constants within the function, and the input string is $s_0$. A non-integer value indicates a halt.

This has the implications you'd expect. For example, if you let $f(s)$ be some suitable function using only those atoms, it's undecidable in general whether $f^{n}(s)$ is integer-valued for all $n$, since it's equivalent to the halting problem. More broadly, this result shows that any finite computation can be performed using only an expression built using logs, powers, and -1.

Allowing unbounded iterative application of such expressions grants Turing completeness. There exists some $f$ which would work as a Universal Turing Machine in that sense. Actually building that function using this approach would be tedious, and the result would very likely be unusably inefficient, but it would otherwise be a straightforward extrapolation.

As a proof of concept, I tried it with the 2-tag 2-symbol system $\{0 \to 001, 1\to 0\}$, and it indeed works. 2-tag 2-symbol systems are always decidable, and the current smallest tag system proven universal is 576-tag 2-symbol, but my approach should be able to scale up arbitrarily, and it is almost certain a far smaller universal machine exists.

However, I never claimed it's pretty—even the expression for this small machine is too unwieldy to show in standard form. Here's a flat representation of it instead, where log is the natural log, pow is exponentiation, and s is the previous state:

nextState[s] := log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],log[log[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],-1],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]]],-1]],log[s]]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],log[pow[pow[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]],log[pow[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],-1],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]]],-1]],log[s]]]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]]],pow[pow[log[-1],log[log[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]]],pow[log[log[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]]]]]]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]]],pow[pow[pow[log[-1],log[log[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]]],pow[log[log[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],-1]]]]]]]]]]]]]]],log[log[pow[pow[pow[pow[pow[pow[pow[pow[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[log[pow[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],-1]]],log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[pow[pow[-1,pow[log[-1],-1]],-1],pow[-1,s]]]]]]]]]]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[pow[pow[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],s]],log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],pow[-1,s]]]]]]],pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[pow[-1,pow[log[-1],-1]],pow[log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[-1,pow[log[-1],-1]]],pow[-1,pow[log[-1],-1]]]]],-1]],log[log[pow[pow[pow[-1,pow[log[-1],-1]],pow[pow[-1,pow[log[-1],-1]],-1]],pow[pow[-1,pow[log[-1],-1]],pow[-1,s]]]]]]],pow[pow[-1,pow[log[-1],-1]],s]]]]]]]]]]]]]]]]]

...or, slightly more compactly, in a prefix-ordered shorthand, ^_- being pow, log, -1 respectively:

__^^^-^_--^^^-^_--^__^^^-^_--^-^_--^-^_--__^^^^-^_--^^-^_---^^-^_---_^^^-^_--^^^-^_---^__^^^-^_--^-^_--^-^_---_^^^-^_--^^^-^_--^___^^^-^_--^-^_--^-^_---_s^^^-^_--^__^^^-^_--^-^_--^-^_---_^^_^^^-^_--^-^_--^-^_--_^_^^^-^_--^^^-^_---^__^^^-^_--^-^_--^-^_---^^^-^_--^___^^^-^_--^-^_--^-^_---_s_^^^-^_--^-^__^^^-^_--^-^_--^-^_---^^_-__^^^^^-^_--^-^_--^-^_--^-^_--^-^_--^__^^^^^-^_--^-^_--^-^_--^-^_--^-^_---_^^^-^_--^-^__^^^-^_--^-^_--^-^_---^^^_-__^^^^^-^_--^-^_--^-^_--^-^_--^-^_--^__^^^^^-^_--^-^_--^-^_--^-^_--^-^_----__^^^^^^^^^^^^^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^-^_--^_^^^^^^-^_--^^-^_---^^-^_---^^-^_---^^-^_---^^-^_---__^^^-^_--^-^_--^^^-

...or, slightly more coherently, as a tree:

CEL tree of TS(2,2)


The state string is represented as $1b_nb_{n-1}\dots b_1b_0$, that is, with a leading $1$ and with the least significant bit being the front of the string. E.g., $s=110100_2=52$ corresponds to a string of $00101$ as they are more usually represented.

My question is whether or not this is a known result, or if anyone knows of research along similar lines. I'll also accept an answer pointing out a flaw in my approach. The closest related thing I could find was Richardson's Theorem, but that seems to require the sine function.

I am also curious whether or not it would be fair to say this operates on the reals; there are intermediate complex values, but the input and output of the entire expression is always an integer, at least within its domain.


You can try it yourself, sort of, with Wolfram Alpha. It was tough getting it to fit in the character limit, but I assure you this is the same as the expression given above, simplified some and optimized for space:

s=52,c=-1,a=E^Ln[E^E^(c^s-1)]^(1/2),b=Ln[E^E^(1+s^Ln@2^c)],Ln@Ln[(E^(E^2^(Ln@Ln[b^((-Ln@b^(I2π))^(I/π))^(1/2)]-5/2))^Ln@Ln[E^(E^11*Ln[E^E^(1-c^s)]^-5)])^Ln[((E^E^s)^Ln[a^E^I^Ln@Ln[a^E^s]])^E^c]^(1/4)]

The $s$ parameter at the beginning is its current state. For tag machines, this means you also use that to give it initial input; the bitstring which $s$ encodes is roughly analogous to a Turing machine's current tape, state, and head position.

For example, for $s=52=110100_2$, we remove the leading $1$ and reverse the remaining $10100$ to map to an initial string of $00101$. Since the first bit is $0$, our rules table $\{0 \to 001, 1\to 0\}$ says to append $001$, yielding $00101\mathbf{001}$. After appending the appropriate string, the first two bits are always deleted, leaving $101001$ in this case.

We do the inverse transformation to convert back to our state form, meaning reverse it and prepend a $1$, giving $1100101_2=101=s'$. This means that if all is working as advertised, we should expect the function to spit out $101$ (in base-10).

Note that using Alpha, you may have to click 'Approximate form' and 'More digits' to see the "real" part. In Mathematica using exact values, any input value with $s \geq 4 : s\in\mathbb N$ gives an integer answer, at least within the limits of my testing.

$0 < s < 4$ corresponds to $<2$ symbols remaining in the string. This is the halting condition, and ideally should not return a valid state, although I've tested that part less since it's not technically in the domain. Any $s$ other than a positive integer is definitely outside of the domain, thus return value is undefined.


Derivation

Begin by representing a tag system with two symbols and deletion letter $v$ as

$$ x_{i+1} := \left\lfloor\frac{x_i}{2^v}\right\rfloor +(2^{\left\lfloor\log_2{x_i}\right\rfloor-v})\left[ (x_i \bmod 2)(\beta -\alpha) +\alpha-1\right], $$

where $x_i$ is the current state, and $\alpha$ and $\beta$ are the two production rules. All of these are given as integers in the form described earlier. For example, Post's still-unresolved tag system $\{0\to 00,1\to 1101\}$ can be described by plugging in $v=3, \alpha=100_2=4, \beta=11011_2=26.$

Broken down, these are the components:

  • $\left\lfloor\frac{x_i}{2^v}\right\rfloor$ is effectively a right-shift by $v$, truncating the least significant $v$ bits off the right side of the string.
  • $2^{\left\lfloor\log_2{x_i}\right\rfloor-v}$ provides the index of the most significant bit, yielding the factor we'll need to multiply by to prepend bits to the left side of the string.
  • $\left[ (x_i \bmod 2)(\beta-\alpha)+\alpha-1\right]$ provides a parity conditional. If the LSB is $0$, we get $\alpha-1$; if it's $1$, we get $\beta-1$. The $-1$ clears the extra $1$ bit from $x_i$, which we use as an end-of-string marker so we don't discard trailing zeroes.
  • $\alpha$ and $\beta$ are integers corresponding to the binary productions for $0$ and $1$. They are encoded such that if $w_0 \rightarrow b_0 b_1 \ldots b_i$, we have $\alpha = 1b_i b_{i-1} \ldots b_0$.

From that equation, it's a matter of abusing a few equalities. First, $n \bmod 2 = \frac{1-(-1)^n}{2}$, using mod as an operation, and assuming $n\in\mathbb Z$. You can extend the same principle to convert $\bmod 2^k$ for any $k$, although it gets uglier, e.g.:

$$n \bmod 4 = \frac{1-(-1)^n}{2}+1-(-1)^{\frac{n-\frac{1-(-1)^n}{2}}{2}}.$$

Second, that floors and mods are interchangeable with

$$a-b\left\lfloor\frac{a}{b}\right\rfloor=a\bmod b.$$

More problematic is the $\left\lfloor\log_2{x_i}\right\rfloor$ term. For this, as inspired by a related answer, I took advantage of the cyclic nature of $e^{2n\pi i}$ with

$$\left\lfloor\log{n}\right\rfloor=\log{(n)}- \frac{\log{\left(e^{\left(2\pi i (\log{(n)} -\frac{1}{2})\right)}\right)}}{2 \pi i} - \frac{1}{2},$$

which seems to work for all integers $n>1 : n\in\mathbb N$. I believe this works fine so long as $\log{n}$ is a positive non-integer real, which it always will be for our purposes, and is also why you need the $(-1)^n$ trick above.

Finally, you can put it all together by leveraging the fact that exponentiation subsumes the lower operations, as in

$$\large \log \log \left[\left(e^{\left(e^a\right)^{b}}\right)^{e^c}\right]=ab+c.$$

Helpful are the identities

  • $i\pi=\log (-1)$
  • $e=(-1)^{\log{(-1)}^{(-1)}}$

from which you can build up everything else you need.

Trevor
  • 6,022
  • 15
  • 35
  • 1
    [ This ] describes three functions (mapping naturals to naturals) that form a "complete basis" for universal computation; i.e., any Turing machine can be simulated by a composition of finitely many instances of these three functions. (Also see here.) – r.e.s. Dec 15 '23 at 00:01
  • @r.e.s. Someone commented earlier, I think it was you, about having trouble testing with Alpha. If it was and you're still interested, see post edit. I was also thinking about trying to implement this in Python/Sage, but I'm less familiar with those so I might or might not. – Trevor Dec 15 '23 at 21:48
  • Thanks, but the "try it yourself" link to Wolfram Alpha leads to "Standard computation time exceeded". (Yes, I had asked about programming in a freely available language.) I'm actually most interested in whether you have a general method that, for any 2-tag system, constructs a "pow,log,-1"-expression that can be used to simulate the tag system. If you have such a general method, can you briefly explain it? (Even the simple example you give is complex enough to be unclear about how it was constructed.) – r.e.s. Dec 16 '23 at 05:47
  • @r.e.s. Yeah, that's when you have to click Approximate Form and then More Digits. That works fine for me, anyway. And sure, I can add a bit explaining that tomorrow, I wasn't going to bother with the details if there was no interest. – Trevor Dec 16 '23 at 06:54
  • Ah, the error msg misled me. (By eliminating a Ln[E^ in b, I was able to run it for values of s with more than two digits, confirming it produces the correct sequence 52->101->41->18->48->...) It might be worth noting that although 2-symbol 2-tag has a decidable halting problem, Neary showed generic 2-symbol tag systems are universal. – r.e.s. Dec 16 '23 at 14:06
  • @r.e.s. Yeah, eliminating that could be problematic, since that's actually doing some of the heavy lifting as per the derivation just added. And thanks, but yup, I'd read that and indeed had already noted it. But again, I figure if this approach works here, it's not hard to extend it to $n$-tag, plugging in $n$ for $v$ in my first equation. Pretty sure the same can be said for 2-tag $n$-symbol. – Trevor Dec 16 '23 at 20:14
  • (1) What could be problematic about replacing Ln[E^E^X] with E^X? (2) As far as I can tell, you had not noted that generic 2-symbol tag systems are universal -- "generic" implying there's no restriction on the deletion number. – r.e.s. Dec 17 '23 at 05:28
  • @r.e.s. (1) See identities; it's not safe over $\mathbb C$, which my intermediate values do take. I only know because I'd tried the exact same thing, and it does break it for some inputs. (2) I said 2-tag 2-symbol systems are decidable, where unless I'm mistaken, 2-tag refers to deletion number. Either way, I'll throw the Neary link up there, thanks. – Trevor Dec 17 '23 at 13:50
  • 1
    I see now, thanks. (BTW: I notice that at Wolfram Alpha, instead of using 'Approximate form' and 'More digits', just hovering over the "Substitution" pane and clicking "Plain Text" shows the exact complex value.) Thanks so much for adding the Derivation section -- very informative! – r.e.s. Dec 17 '23 at 16:14
  • 1
    Just an observation: The three-function computational basis that I referenced, re-expressed in terms of the binary encoding $\langle b_1\dots b_k\rangle=(1b_k\dots b_1)2=n\in\mathbb{Z{\ge 1}},$ is as follows (now defined for $n\in\mathbb{Z_{\ge 2}}$):

    $$\begin{align} f_0(n) & = n + (n \bmod 2)\ 2^{\lfloor\log_2(n)\rfloor} \ f_1(n) & = n + (n \bmod 2)\ 2^{\lfloor\log_2(n)\rfloor+1} \ f_2(n) & = \left\lfloor\frac{n}{2}\right\rfloor \end{align}$$

    – r.e.s. Dec 18 '23 at 03:15
  • 1
    (cont'd) The basic operations here are the same as in the tag systems you consider, but it's no longer necessary to convert "production strings" that vary with the tag system (coded by your $\alpha,\beta$). This should make it much easier to convert everything into terms of log, pow and -1, assuming your conversion scheme is valid. – r.e.s. Dec 18 '23 at 03:16
  • @r.e.s. I hadn't realized you were the one who came up with BCT, nice one. It was pretty painless to implement. Unfortunately, composing those three functions without actually evaluating them first blows up exponentially, since there are 2 or 4 $s$'s in each. The prefix string for my entire production rule clocked in around 3mb doing it that way, but it does seem more elegant as far as a theoretical foundation. – Trevor Dec 18 '23 at 05:00

0 Answers0