Skip to contents

emlR 0.1.0

First release. Implements the EML (Exp-Minus-Log) Sheffer operator from Odrzywolek (2026, arXiv:2603.21852) — a single binary operator eml(x, y) = exp(x) − log(y) that, together with the constant 1, generates all elementary functions on the principal branch.

Features

Conventions

  • eml_eval() returns a complex value when real = FALSE, even for bare-leaf expressions like eml_eval(2). This aligns with run_bytecode() and SPEC §2.2.
  • eml_K(expr) is the total node count (leaves + interior EML nodes), matching the paper’s K (Table 4, RPN length). For log(x) = eml(1, eml(eml(1, x), 1)), eml_K returns 7. See reference/ADR-001-K-counting.md.

Simplifier coverage

  • simplify_native() reaches the SPEC §5.2 structural form for all 18 catalog entries, including sqrt, sin, and cos. Closing the previous gap required two cleanup-layer additions:
    • rule C-exp-const-plus-log (exp(_C + log(_x)) → exp(_C) * _x, sound on the principal branch via exp(a+b) = exp(a)·exp(b) and exp(log(z)) = z),
    • tolerance-aware atomic equality in the matcher (|a - b| < 1e-12) plus an asymmetric snap in .fold_constants that zeroes a sub-tolerance component only when the other component is dominantly large. Together these absorb the residual round-off from tree_i() = exp(log(-1)/2) (which yields 6.12e-17 + 1i, not exact 0+1i).

Scope and intentional non-goals

For 0.1.0, the package deliberately scopes to:

  • Two variables. Univariate and bivariate expressions are the tested surface; more variables are not precluded but not exercised.
  • EML only. The EDL variant exp(x) / log(y) and −eml(y, x) (paper Eq. 4b/4c) are deferred.
  • Master-formula SR. No tree-topology / genetic-programming search. eml_fit() operates over the paper’s master formula at fixed depth.
  • Pure R + Deriv. No Rcpp / torch / parallelisation. The bytecode loop vectorises over input bindings; no further hot-path acceleration.
  • Principal branch only. Multi-valued / alternative-branch semantics are out of scope.

Reference materials

The reference/ directory at the project root (excluded from the package build) contains the design specification (SPEC.md), phased implementation plan (IMPLEMENTATION_PLAN.md), test catalog (TESTS.md), the K-counting decision record (ADR-001-K-counting.md), and an early prototype with a custom-AST design that this implementation supersedes (reference/emlR-v1/).