OxiEML
All elementary functions from a single binary operator.
A Pure Rust crate that implements the EML operator eml(x, y) = exp(x) - ln(y)
and builds uniform binary trees expressing all elementary functions using only
this operator and the constant 1.
Based on arXiv:2603.21852 — "All elementary functions from a single binary operator" by Andrzej Odrzywolek (Jagiellonian University, Institute of Theoretical Physics).
Key Capabilities
-
Uniform Tree Representation — Every elementary function (exp, ln, sin, cos, +, -, *, /, ^, sqrt, abs, ...) is expressed via the grammar
S -> 1 | eml(S, S). -
Symbolic Regression — Discover closed-form mathematical formulas from input/output data using gradient-based search over EML tree topologies.
-
Lowering & Code Generation — Convert discovered EML trees to standard operation trees for efficient evaluation, pretty-printing, and Rust code emission.
-
CLI Tool — Parse, evaluate, and generate EML expressions from the command line.
-
SMT Integration — Constraint solving via EML tree interval narrowing (feature-gated for oxiz integration).
CLI Tool
The oxieml CLI can evaluate EML expressions, generate EML from function names,
and verify claims about mathematical constants.
# Evaluate an EML expression
#=> MATCH: e (Euler's number) = 2.718281828459045
# Generate EML from a function/constant name
#=> E(1,E(E(1,E(E(1,E(E(1,E(1,E(1,1))),1)),E(E(1,1),1))),1))
#=> MATCH: Im ~ pi (diff = 0.00e0)
#=> E(1,1)
#=> Result: 0.4794255386042034
# Evaluate with variables
#=> Result: 7.38905609893065 (= exp(2))
# Read from file
# List all available functions and constants
# Show help / version
If the input is not a valid EML expression, the CLI auto-detects function names:
Quick Start (Library)
use ;
// Build exp(x) = eml(x, 1)
let x = var;
let exp_x = exp;
// Evaluate at x = 1.0 -> e
let ctx = new;
let result = exp_x.eval_real.unwrap;
assert!;
// Euler's number: eml(1, 1) = exp(1) - ln(1) = e
let e = euler;
println!; // "eml(1, 1)"
// Negation, addition, multiplication — all from eml and 1
let y = var;
let sum = add;
let product = mul;
// Lower to standard operations for efficient evaluation
let lowered = exp_x.lower;
println!; // "exp(x0)"
let fast_result = lowered.eval;
// Generate Rust source code
let code = compile_to_rust;
println!;
Parser
Parse EML expressions from strings and convert back:
use ;
// Parse E(x, y) notation
let tree = parse.unwrap;
assert_eq!;
// Also accepts eml(x, y) notation
let tree = parse.unwrap;
// Convert back to compact string
let compact = to_compact_string;
assert_eq!; // roundtrip
Symbolic Regression
use ;
// Generate data from an unknown function
let inputs: = .map.collect;
let targets: = inputs.iter.map.collect;
let config = SymRegConfig ;
let engine = new;
let formulas = engine.discover.unwrap;
println!;
println!;
SMT / Constraint Solving
With the smt feature, oxieml integrates OxiZ 0.2
as a backend for deciding EML constraints. The solver uses interval propagation
(EML-aware forward/backward rules for exp/ln) followed by linear relaxation
(secant + tangent bounds) for OxiZ's LRA theory.
use ;
// Constraint: exp(x) > 0 — trivially true for all x
let x = var;
let one = one;
let exp_x = eml;
let c = GtZero;
let solver = new;
match solver.check_sat.unwrap
The EmlSmtSolver can prove UNSAT for cases the legacy EmlNraSolver
(interval bisection) cannot — e.g., ln(x) > 0 with x ∈ [-2, -1] (ln
undefined for non-positive reals). It falls back to bisection on OxiZ-tightened
bounds to extract concrete SAT witnesses, since extracting real-valued models
from OxiZ 0.2 is not yet ergonomic.
Enable with:
[]
= { = "0.1", = ["smt"] }
The IntervalDomain type is always available (no feature) for lightweight
propagation use-cases.
Canonical Constructions (Complete Phylogenetic Tree)
All functions from the paper's phylogenetic tree (Figure 1) are implemented:
Table 1: Basic Operations
| Function | EML Construction | Depth |
|---|---|---|
exp(x) |
eml(x, 1) |
1 |
e |
eml(1, 1) |
1 |
ln(x) |
eml(1, eml(eml(1, x), 1)) |
3 |
-x |
via (e-x) - e composition |
6 |
0 |
ln(1) |
3 |
Table 2: Arithmetic
| Function | EML Construction | Depth |
|---|---|---|
x + y |
sub(x, neg(y)) |
~12 |
x - y |
eml(ln(x), eml(y, 1)) |
~7 |
x * y |
exp(ln(x) + ln(y)) |
~14 |
x / y |
exp(ln(x) - ln(y)) |
~14 |
x ^ y |
exp(y * ln(x)) |
~18 |
1/x |
exp(-ln(x)) |
~10 |
x^2 |
pow(x, 2) |
deep |
Table 3: Trigonometric
| Function | EML Construction | Depth |
|---|---|---|
pi (iπ) |
ln(-1) in complex domain |
9 |
sin(x) |
(exp(ix) - exp(-ix)) / 2i |
~52 |
cos(x) |
(exp(ix) + exp(-ix)) / 2 |
~52 |
tan(x) |
sin(x) / cos(x) |
deep |
Table 4: Inverse Trigonometric
| Function | EML Construction |
|---|---|
arcsin(x) |
-i * ln(ix + sqrt(1 - x^2)) |
arccos(x) |
-i * ln(x + i * sqrt(1 - x^2)) |
arctan(x) |
(-i/2) * ln((1 + ix) / (1 - ix)) |
Table 5: Hyperbolic
| Function | EML Construction |
|---|---|
sinh(x) |
(exp(x) - exp(-x)) / 2 |
cosh(x) |
(exp(x) + exp(-x)) / 2 |
tanh(x) |
sinh(x) / cosh(x) |
Table 6: Inverse Hyperbolic
| Function | EML Construction |
|---|---|
arcsinh(x) |
ln(x + sqrt(x^2 + 1)) |
arccosh(x) |
ln(x + sqrt(x^2 - 1)) |
arctanh(x) |
(1/2) * ln((1 + x) / (1 - x)) |
Table 7: Other Functions & Constants
| Function | EML Construction |
|---|---|
sqrt(x) |
x^0.5 |
abs(x) |
sqrt(x^2) |
nat(n) |
1 + 1 + ... + 1 |
-1 |
neg(1) |
-2 |
neg(nat(2)) |
i |
exp(iπ/2) |
Architecture
Discovery Phase Execution Phase
───────────────── ──────────────────
EML tree space lower() Standard ops
S -> 1 | eml(S,S) -------> Add/Sub/Mul/Exp/Ln...
| |
| Adam optimizer | to_pretty()
| (symreg) | compile_to_rust()
| | eval()
DiscoveredFormula Fast evaluation
parse() to_compact_string()
"E(1,1)" -----> EmlTree ---------> "E(1,1)"
|
| -g pi / -g sin
|
CLI evaluation & constant matching
Module Overview
| Module | Purpose |
|---|---|
tree |
EmlNode/EmlTree — Arc-shared uniform binary trees |
eval |
Stack-machine evaluation (real, complex, batch) |
grad |
Automatic differentiation for parameter optimization |
canonical |
Complete phylogenetic tree: 30+ elementary functions |
parser |
Parse E(x,y) / eml(x,y) notation, roundtrip |
simplify |
EML tree algebraic simplification + CSE |
lower |
EML -> standard operation trees + pretty-print |
compile |
EML -> Rust source code generation |
symreg |
Symbolic regression engine (topology enum + Adam) |
smt |
[feature: smt] Constraint solving (interval propagation + OxiZ LRA via linear relaxation) |
simd_eval |
[feature: simd] SIMD batch evaluation via oxiblas-core |
error |
Error types |
Features
[]
= []
= ["dep:oxiz", "dep:num-rational"] # OxiZ 0.2 backend + interval propagation
= ["dep:oxiblas-core"] # SIMD batch evaluation (F64x2/F64x4 via oxiblas-core 0.2)
= ["dep:rayon"] # Rayon-based parallel discovery & batch eval
Combine simd,parallel for SIMD-per-worker batch evaluation.
Performance
Measured on Apple M1 (8-core, NEON 128-bit), M1 MacBook Air, 2026-04:
Speedup from parallel feature (RAYON_NUM_THREADS=1 → 8):
| Workload | 1 thread | 8 threads | Speedup |
|---|---|---|---|
eval_batch 10K points (exp tree walk) |
436 µs | 235 µs | 1.85× |
lowered_eval_batch 100K points (SIMD) |
2.71 ms | 682 µs | 3.97× |
symreg_discover (topology optimization) |
73.7 ms | 17.3 ms | 4.26× |
Speedup from simd feature (10K-point batch, LoweredOp IR):
| Variant | time | Speedup |
|---|---|---|
| Scalar stack machine | 159.8 µs | 1.0× |
| SIMD (F64x2 NEON via oxiblas-core) | 57.0 µs | 2.80× |
Parallelism helps most for coarse-grained work (symreg topology optimization). SIMD gives ~2.8× on batch evaluation regardless of batch size. Combining both scales near-linearly on large batches (100K+ points).
Design Decisions
Arc<EmlNode>— O(1) subtree sharing during symbolic regression- Stack-machine evaluator — Post-order traversal avoids recursion overflow on deep trees (sin alone needs 543 nodes)
- Complex64 internally — Trig functions and π require
ln(-1) = iπ; complex eval is an internal detail, API is real-valued - Discovery vs execution separation — EML trees for search, lowered ops for speed
- Parser roundtrip —
parse(to_compact_string(tree)) == tree - Pure Rust, zero FFI — Deps:
num-complex,rand; optional:rayon(parallel),oxiblas-core(simd),oxiz+num-rational(smt)
Test Coverage
173 tests covering:
- All canonical constructions (Tables 1-7)
- Evaluation: real, complex, batch, error cases
- Parser: roundtrip, E/eml notation, error handling
- Symbolic regression: exp, constant, linear discovery
- Lowering + simplification: pattern matching, constant folding
- SIMD/parallel equivalence (scalar vs SIMD vs rayon results match to 1e-12)
- Integration: EML <-> lower <-> compile consistency
- SMT/constraint solving: interval propagation, OxiZ backend SAT/UNSAT, witness verification
References
- Paper: Andrzej Odrzywolek, "All elementary functions from a single binary operator", arXiv:2603.21852 (v2: 2026-04-04), Jagiellonian University, Institute of Theoretical Physics
COOLJAPAN Ecosystem
OxiEML is part of the COOLJAPAN Pure Rust Ecosystem — one of the largest pure-Rust sovereignty stacks in existence, comprising 660 crates, ~26M SLoC, and 350,000+ passing tests across 50+ production-grade libraries. All projects enforce fail0 + Clippy0 with zero C/Fortran dependencies by default.
Core Projects
| Domain | Project | Description |
|---|---|---|
| Scientific Computing | SciRS2 | Complete NumPy/SciPy/scikit-learn replacement (3M SLoC) |
| Scientific Computing | NumRS2 | High-performance numerical computing in Rust |
| Scientific Computing | QuantRS2 | Full quantum computing framework |
| Deep Learning | ToRSh | PyTorch-compatible framework with native sharding |
| LLM | OxiBonsai | Pure Rust 1-Bit LLM inference engine for PrismML Bonsai models |
| GPU (CUDA) | OxiCUDA | NVIDIA CUDA Toolkit with type-safe, memory-safe Rust code |
| Media & CV | OxiMedia | FFmpeg + OpenCV replacement (106 crates) |
| Geospatial | OxiGDAL | Pure Rust GDAL replacement (cloud-native, full CRS & formats) |
| Semantic Web | OxiRS | SPARQL 1.2, GraphQL, Digital Twin (Apache Jena replacement) |
| Physics | OxiPhysics | Unified physics engine — Bullet/OpenFOAM/LAMMPS/CalculiX replacement |
| Formal Verification | OxiLean | Memory-safe interactive theorem prover (Lean 4 inspired) |
| Formal Verification | OxiZ | High-performance SMT solver (Z3 replacement) |
| Legal Technology | Legalis-RS | Legal statute parser, analyzer & simulator |
| Digital Humans | OxiHuman | Privacy-first parametric human body generator (WASM/WebGPU) |
| Signal Processing | Kizzasi | Rust-native AGSP for continuous audio, sensor, robotics & video streams |
| Tensor Logic | TensorLogic | Logical rules → tensor equations (einsum graphs) with DSL + IR |
| Math | OxiEML | All elementary functions from a single binary operator (this crate) |
Full project list & latest releases → cooljapan.tech · GitHub
Sponsorship
OxiEML is developed and maintained by COOLJAPAN OU (Team Kitasan).
The COOLJAPAN Ecosystem represents one of the largest Pure Rust scientific computing efforts in existence — spanning 50+ projects, 650+ crates, and millions of lines of Rust code across scientific computing, machine learning, quantum computing, geospatial analysis, legal technology, multimedia processing, and more. Every line is written and maintained by a small dedicated team committed to a C/Fortran-free future for scientific software.
If you find OxiEML or any COOLJAPAN project useful, please consider sponsoring to support continued development.
https://github.com/sponsors/cool-japan
Your sponsorship helps us:
- Maintain and expand the COOLJAPAN ecosystem (50+ projects, 650+ crates)
- Keep the entire stack 100% Pure Rust — no C/Fortran/system library dependencies
- Develop production-grade alternatives to OpenCV, FFmpeg, SciPy, NumPy, scikit-learn, PyTorch, TensorFlow, GDAL, and more
- Provide long-term support, security updates, and documentation
- Fund research into novel Rust-native algorithms and optimizations
License
Apache-2.0
2026 COOLJAPAN OU (Team KitaSan)