logoalt Hacker News

All elementary functions from a single binary operator

213 pointsby pizzatoday at 1:49 AM67 commentsview on HN

Comments

entaloneralietoday at 4:05 AM

This is amazing! I love seeing FRACTRAN-shaped things on the homepage :) This reminds me of how 1-bit stacks are encoded in binary:

A stack of zeros and ones can be encoded in a single number by keeping with bit-shifting and incrementing.

    Pushing a 0 onto the stack is equivalent to doubling the number.
    Pushing a 1 is equivalent to doubling and adding 1.
    Popping is equivalent to dividing by 2, where the remainder is the number.
I use something not too far off for my daily a programming based on a similar idea:

Rejoice is a concatenative programming language in which data is encoded as multisets that compose by multiplication. Think Fractran, without the rule-searching, or Forth without a stack.

https://wiki.xxiivv.com/site/rejoice

DoctorOetkertoday at 4:18 AM

EDIT: please change the article link to the most recent version (as of now still v2), it is currently pointing to the v1 version which misses the figures.

I'm still reading this, but if this checks out, this is one of the most significant discoveries in years.

Why use splines or polynomials or haphazardly chosen basis functions if you can just fit (gradient descent) your data or wave functions to the proper computational EML tree?

Got a multidimensional and multivariate function to model (with random samples or a full map)? Just do gradient descent and convert it to approximant EML trees.

Perform gradient descent on EML function tree "phi" so that the derivatives in the Schroedinger equation match.

But as I said, still reading, this sounds too good to be true, but I have witnessed such things before :)

show 6 replies
lioeterstoday at 4:18 AM

> A calculator with just two buttons, EML and the digit 1, can compute everything a full scientific calculator does

Reminds me of the Iota combinator, one of the smallest formal systems that can be combined to produce a universal Turing machine, meaning it can express all of computation.

testaccount28today at 5:35 AM

derivation of -x seems wrong. we can look at the execution trace on a stack machine, but it's actually not hard to see. starting from the last node before the output, we see that the tree has the form

    eml(z, eml(x, 1))
      = e^z - ln(eml(x, 1))
      = e^z - ln(e^x)
      = e^z - x
and the claim is that, after it's expanded, z will be such that this whole thing is equal to -x. but with some algebra, this is happening only if

    e^z = 0,
and there is no complex number z that satisfies this equation. indeed if we laboriously expand the given formula for z (the left branch of the tree), we see that it goes through ln(0), and compound expressions.

x^-1 has the same problem.

both formulae work ...sort of... if we allow ln(0) = Infinity and some other moxie, such as x / Infinity = 0 for all finite x.

show 2 replies
kricktoday at 4:09 AM

> using EML trees as trainable circuits ..., I demonstrate the feasibility of exact recovery of closed-form elementary functions from numerical data at shallow tree depths up to 4

That's awesome. I always wondered if there is some way to do this.

eugene3306today at 5:28 AM

This makes a good benchmark LLMs:

``` look at this paper: https://arxiv.org/pdf/2603.21852

now please produce 2x+y as a composition on EMLs ```

Opus(paid) - claimed that "2" is circular. Once I told it that ChatGPT have already done this, finished successfully.

ChatGPT(free) - did it from the first try.

Grok - produced estimation of the depth of the formula.

Gemini - success

Deepseek - Assumed some pre-existing knowledge on what EML is. Unable to fetch the pdf from the link, unable to consume pdf from "Attach file"

Kimi - produced long output, stopped and asked to upgrade

GLM - looks ok

qillertoday at 4:02 AM

For completeness, there is also Peirce’s arrow aka NOR operation which is functionally complete. Fun applications iirc VMProtect copy protection system has an internal VM based on NOR.

Quick google seach brings up https://github.com/pr701/nor_vm_core, which has a basic idea

psychoslavetoday at 6:03 AM

Very nice, though I'm not fond of the name.

What comes to my mind as an alternative which I would subjectivity finer is "axe". Think axiom or axiology.

Anyone with other suggestions? Or even remarks on this one?

notorandittoday at 5:25 AM

Not sure it really compares to NAND() and the likes.

Simply because bool algebra doesn't have that many functions and all of them are very simple to implement.

A complex bool function made out of NANDs (or the likes) is little more complex than the same made out of the other operators.

Implementing even simple real functions out of eml() seems to me to add a lot of computational complexity even with both exp() and ln() implemented in hardware in O(1). I think about stuff sum(), div() and mod().

Of course, I might be badly wrong as I am not a mathematician (not even by far).

But I don't see, at the moment, the big win on this.

simplesighmantoday at 3:48 AM

> For example, exp(x)=eml(x,1), ln(x)=eml(1,eml(eml(1,x),1)), and likewise for all other operations

I read the paper. Is there a table covering all other math operations translated to eml(x,y) form?

show 5 replies
prvctoday at 5:19 AM

This is neat, but could someone explain the significance or practical (or even theoretical) utility of it?

show 2 replies
nonfamoustoday at 3:16 AM

How would an architecture with a highly-optimized hardware implementation of EML compare with a traditional math coprocessor?

show 1 reply
tripdouttoday at 3:32 AM

Interesting, but is the required combination of EML gates less complex than using other primitives?

show 1 reply
jekudetoday at 3:29 AM

What would physical EML gates be implemented in reality?

Posts like these are the reason i check HN every day

show 1 reply
peterlktoday at 3:10 AM

Reminds me a bit of the coolest talk I ever got to see in person: https://youtu.be/FITJMJjASUs?si=Fx4hmo77A62zHqzy

It’s a derivation of the Y combinator from ruby lambdas

show 2 replies
hyperhellotoday at 3:33 AM

> eml(x,y)=exp(x)-ln(y)

Exp and ln, isn't the operation its own inverse depending on the parameter? What a neat find.

show 1 reply
nurettintoday at 5:15 AM

The problem with symbolic regression is ln(y) is undefined at 0, so you can't freely generate expressions with it. We need to guard it with something like ln(1+y*y) or ln(1+|y|) or return undefined.

supermdguytoday at 3:17 AM

Next step is to build an analog scientific calculator with only EML gates

selcukatoday at 3:11 AM

So, like brainf*ck (the esoteric programming language), but for maths?

show 2 replies
noobermintoday at 4:18 AM

I don't mean to shit on their interesting result, but exp or ln are not really that elementary themselves... it's still an interesting result, but there's a reason that all approximations are done using series of polynomials (taylor expansion).

show 2 replies
BobbyTables2today at 2:22 AM

How does one actually add with this?

show 3 replies
zephentoday at 3:37 AM

Judging by the title, I thought I would have a good laugh, like when the doctor discovered numerical integration and published a paper.

But no...

This is about continuous math, not ones and zeroes. Assuming peer review proves it out, this is outstanding.

show 1 reply