Skip to main content

Pfaffian chain order and EML routing depth for symbolic expressions.

Project description

eml-cost

Pre-release. Patent pending. Not for redistribution.

Pfaffian chain order and EML routing depth for symbolic expressions — a programmatic complexity measure on SymPy expression trees.

Status

This package is pre-release. It is being developed alongside an in-flight patent application. Do not redistribute, fork, or publish.

When the patent files, the public release will move to PyPI under the same package name.

Quick start

from eml_cost import analyze

result = analyze("exp(exp(x)) + sin(x**2)")

result.pfaffian_r           # total Pfaffian chain order
result.max_path_r           # chain order along the deepest path
result.eml_depth            # EML routing tree depth
result.structural_overhead  # tree-structural depth
result.corrections          # Corrections(c_osc, c_composite, delta_fused)
result.predicted_depth      # max_path_r + corrections + structural
result.is_pfaffian_not_eml  # True for Bessel, Airy, Lambert W, …

Drop-in measure for SymPy's simplify:

import sympy as sp
from eml_cost import measure

x = sp.Symbol("x", real=True)
sp.simplify(sp.cos(x)**2 + sp.sin(x)**2, measure=measure)
# 1

Public API

from eml_cost import (
    analyze,                # main entry point
    measure,                # SymPy simplify(…, measure=…) helper
    AnalyzeResult,          # frozen dataclass (result type)
    Corrections,            # frozen dataclass (correction terms)
    pfaffian_r,             # total chain order
    max_path_r,             # path-restricted chain order
    eml_depth,              # routing tree depth
    structural_overhead,    # Add/Mul/poly-Pow tree depth
    is_pfaffian_not_eml,    # True for Bessel/Airy/Lambert W/hyper
    PFAFFIAN_NOT_EML_R,     # registry: name -> chain order
)

What gets counted

Khovanskii r-counting throughout:

Operator Chain contribution
exp(g) 1
log(g) 1
sin(g), cos(g) (pair) 2
tan(g) 1
tanh, atan, atanh, asinh, acosh 1 each
sinh(g), cosh(g) (pair) 2
sqrt(g), Pow(g, non-integer) 1
Pow(g, integer), Add, Mul 0
Bessel J/Y/I/K, Airy Ai/Bi, Lambert W, hyper per registry

max_path_r differs from pfaffian_r only at Add and Mul nodes: pfaffian_r sums children, max_path_r takes the max. For independent- variable products like atomic orbital wavefunctions (R(r) · Y(θ) · Φ(φ)), the path-restricted count is dramatically smaller than the total — capturing the parallel-composition behavior.

EML routing depth

The eml_depth function models SuperBEST routing:

Operator Depth contribution
exp, log 1
sin, cos 3 (Euler bypass)
tan 4
tanh, atan, sinh, cosh 1 (F-family primitive)
Pow, Add, Mul 1 + max over children

F-family fusion patterns are recognized:

  • log(c + exp(g)) (LEAd / softplus shape) → depth 1 + depth(g)
  • 1/(1 + exp(-g)) (sigmoid shape) → depth 1 + depth(g)

Pfaffian-but-not-EML class

Bessel J/Y/I/K, Hankel, Airy Ai/Bi, hypergeometric, and Lambert W are Pfaffian (admit polynomial-coefficient ODE chains) but lie outside the EML-elementary class. They are flagged by is_pfaffian_not_eml(expr) and contribute their registered chain order under pfaffian_r.

Installation (local only, pre-release)

pip install -e /path/to/eml-cost-pkg

PyPI release follows patent filing.

License

PROPRIETARY-PRE-RELEASE. See LICENSE.

Citation

Citation form will be locked at public release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eml_cost-0.1.0a0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eml_cost-0.1.0a0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file eml_cost-0.1.0a0.tar.gz.

File metadata

  • Download URL: eml_cost-0.1.0a0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eml_cost-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 111cbd28445a97798e0b861e4f29afdb4487b8201f794739a5fd48fa47636163
MD5 f6a719d831cc630ded5908a7ddfe4f8b
BLAKE2b-256 317d9966b1913782e1da5f066a2448100b0c15b94a2c3e9d2b8cd489cacf8287

See more details on using hashes here.

File details

Details for the file eml_cost-0.1.0a0-py3-none-any.whl.

File metadata

  • Download URL: eml_cost-0.1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eml_cost-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d1c30c8d14874948b5f61579e72b0db870ca0d0a09fc2a7a0db838fe066e370
MD5 ee95df48e601b7c68367e6136e2fcdb9
BLAKE2b-256 79ead213f55d76f0e1a79aff3acf77fe6a4a0fb8b6c6af80b97ed214e246bad1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page