One Operator to Rule Them All: The EML Operator and the NAND Gate of Continuous Mathematics

Contents
  1. Why this is non-trivial
  2. How one button builds the whole row
  3. “All functions” comes with two conditions
  4. Why I think this matters enormously for quantitative trading and deep learning
  5. Further reading

A while back I came across a paper on arXiv that stopped me dead in my tracks

The title was unassuming: All elementary functions from a single binary operator. The author is Andrzej Odrzywołek, a theoretical physicist at Jagiellonian University in Poland, and what he found is this

A single binary operator eml(x, y) = exp(x) − ln(y), together with the constant 1, can construct every function on a scientific calculator

sin, cos, tan, log, square roots, addition, subtraction, multiplication, division, powers, inverse trig, hyperbolic functions, all of them

This is essentially saying that the 36 buttons on your scientific calculator only need to be one button, eml, and the only number you have to keep is 1

Why this is non-trivial

One button replacing a whole row of them sounds like a magic trick, but the phone or computer you are reading this on has worked that way for a long time

Every operation inside a computer, taken all the way down, is a decision about 0s and 1s, like “the answer is 1 only if both are 1” or “the answer is 1 if either one is 1”. The small parts that make these decisions are called logic gates. In 1913 the American logician Henry Sheffer found that you do not need a separate part for each kind of decision, because one kind is enough. The one people mention most today is the NAND gate. It does a single thing: when both inputs are 1 it gives 0, and in every other case it gives 1. But if you wire enough of them together you can build every other decision, so in theory a whole chip can be made from this one part. An operation that can build all the others by itself came to be called a Sheffer stroke

So here is the question. The world of 0s and 1s has a universal part. What about the continuous math of sin, log and square roots, does it have one too?

People had been walking in that direction for a long time. tan is just sin divided by cos, and a square root is just the power 1/2, so those buttons could already go. Keep removing buttons like this and you end up with the pair exp and ln, that is, e to the power x and the natural logarithm that undoes it, and then you get stuck. For centuries, nobody took it one step further

Odrzywołek did not try to think his way through it. He let a computer try. First it removed the 36 buttons one at a time, and after each removal it checked whether the remaining ones could still rebuild everything. Once only a few were left, he had the computer look for a single operation that could wrap them all up, and what it found was eml

So EML is the NAND gate of continuous mathematics. A computer found it, but I think the most important thing about it is that it might return the favor and make it much easier for computers to find formulas in data, and that matters enormously for quantitative trading and deep learning

How one button builds the whole row

So what does this button look like? The answer is simple enough to be a little funny. Since everyone was stuck at exp and ln, eml just ties those two together with a minus sign. You put in two numbers x and y, and what comes out is

$$\text{eml}(x, y) = e^x - \ln(y)$$

But tying them together is only useful if you can take them apart again, because once you can get exp and ln back out of it, every other button can be rebuilt. exp is the easy one. Set y to 1, and since ln(1) = 0 the second term disappears. Then set x to 1 as well and you get e

  • exp(x) = eml(x, 1)
  • e = eml(1, 1)

ln(x) is where it starts getting counterintuitive. It looks like this

  • ln(x) = eml(1, eml(eml(1, x), 1))

Work it out from the innermost layer and it makes sense

  1. The innermost eml(1, x) is e − ln(x)
  2. Put that into eml(⋯, 1) and you get e to the power e − ln(x), which is eᵉ/x
  3. The outermost eml(1, eᵉ/x) is e − ln(eᵉ/x), which is e − (e − ln(x)). The two e’s cancel and only ln(x) is left

With exp and ln in hand, you build upward in order: first subtraction and a few constants, then addition, multiplication, division and powers, and the trigonometric functions come last. Whatever you build, it is written the same way. One eml holds two things, and each of them can be 1, or x, or another eml. Layer inside layer, and if you draw it you get a tree that keeps branching downward

I wrote a package called emltree that follows the paper. It has a Python version and a JS version, and the compiler below runs on the JS one. Type in any formula and it breaks it down into a tree like this. Even something as basic-looking as sin takes several hundred eml buttons

See the expanded formula
Every branching point in the tree is one eˣ − ln(y). At the bottom there is only the constant 1 and variables, and variables are marked in red. Try sin²+cos², it comes out to exactly 1

“All functions” comes with two conditions

At this point you might be wondering whether it really is all functions. Someone asked exactly that as soon as the paper came out, and the answer is that there are two conditions

The first is that “all” only counts the buttons on a scientific calculator. Robert Smith wrote a rebuttal saying that what mathematicians call elementary functions is a wider class. The solutions of a fifth-degree equation count too, and EML cannot write those. Odrzywołek’s reply was that he had meant the buttons on a scientific calculator all along

The second condition is easier to miss, but we will need it later. To compute sin and cos, the calculation has to pass through complex numbers along the way, meaning numbers that contain i, the square root of −1. The reason is that the curves of exp and ln, once you go far enough out, only ever head up or head down. However you add, subtract, multiply and divide them, you cannot build the wave of sin that swings up and down forever. The English mathematician G. H. Hardy proved this back in 1912. But as soon as exp meets complex numbers it starts going around in circles, and the up and down swing of that circling is sin and cos. When you click sin(x) in the compiler above, that tree of 351 eml buttons takes exactly this route

Why I think this matters enormously for quantitative trading and deep learning

This is what I really want to talk about. Having thirty-odd fewer buttons does not make a calculator any cheaper, so what is this good for? I think its use is somewhere else, in letting computers find formulas in data

Let’s go back four hundred years. Kepler had a large pile of planetary observations left behind by Tycho Brahe, and he wanted to know what rule the planets were following. It took him years of calculation to find the laws of planetary motion. This job of finding the formula behind a pile of data now has a name, symbolic regression, and what people want is to have a computer play Kepler

But a computer finds this job hard, because every position in a formula has many choices. Should this spot be a plus sign, a sin or a log, and how should it connect to the next one? The more choices there are, the more combinations there are to try, until there are too many to try

With EML, only one kind of button can go in each position. The computer no longer chooses what to put there. It only decides what shape the tree takes and whether each spot at the bottom holds 1 or x. The paper’s approach is to set up a full tree first and put a few adjustable numbers on every branch, like dials, then let the computer turn them little by little to fit the data, which is the same method used to train neural networks. When the turning is done, each dial is rounded to 0 or 1, which amounts to choosing 1, x or the next layer for every position, and the whole tree becomes one exact formula

So can it be done today? Not yet. For now the method only works on very small trees. With a two-level tree, starting from a random guess, the computer finds the right formula every single time. At five levels it is under 1%, and a single multiplication already takes eight levels in EML, so anything slightly complicated is still out of reach. The good news is that if the computer starts near the right answer, five-level and six-level trees come back to it every time. So the right tree is always there, and the hard part is finding it from scratch. Later, someone tried three different setups on three-level trees over more than twelve thousand runs. For the same formula, changing nothing but the setup moved the success rate from 0% to 100%. So what is stuck is the way of searching. The tree itself can write these formulas

If larger trees can be found too, quantitative trading gets one more way to mine factors. A factor is a formula computed from market data and used to predict price moves. Traditionally either a person comes up with it from experience and intuition, or you hand the job to a machine learning model that works but will not show you what it is computing. With EML you can feed price, volume and volatility into an EML tree, and what you get after tuning is a formula you can write down. You can look at it directly, see whether it makes sense, and judge whether it has caught a real pattern in the market or has only memorized the past

The same idea gets even more interesting in deep learning. A neural network is, in plain terms, layer after layer of multiplication and addition, with a fixed function applied after each layer. That function is called an activation function, and all of these are things you can press on a calculator. So the paper makes a neat observation: any conventional neural network can be written as an EML tree. But when a neural network finishes training, what you have is millions of decimals that nobody can read. If the dials of an EML tree can all be rounded to 0 and 1, what you have is a formula you can read

The paper also left a question open. Is there an activation function that can be used in a neural network and can also compute every function on the calculator exactly? What makes this hard is the complex-number condition from earlier. An activation function built only from real exp and ln can never compute sin. In September Odrzywołek published a follow-up and found half an answer, a function that works in complex numbers, $F(z) = e^z + \ln z$. Both exp and ln can be taken back out of it. But taking them out needs division, and the layers of multiplication and addition in a neural network cannot divide, so it does not fit into today’s neural networks yet. He says so himself in the abstract: this main goal is still out of reach

If such a thing exists, the entire landscape of deep learning architecture design could be rewritten

Further reading

Papers and projects mentioned in this post:

  • The original paper: Andrzej Odrzywołek, All elementary functions from a single binary operator · arXiv:2603.21852
  • The author’s follow-up: Diversity of EML-type operators · arXiv:2609.11210
  • The rebuttal: Robert Smith, Not all elementary functions can be expressed with exp-minus-log · stylewarning.com
  • My implementation: emltree · GitHub · PyPI · npm