Skip to main content

SimpliPy:
Efficient Simplification of Mathematical Expressions

PyPI version PyPI license Documentation Status

pytest quality checks CodeQL Advanced

Publications

  • Saegert & Köthe 2026, Breaking the Simplification Bottleneck in Amortized Neural Symbolic Regression (preprint, under review) https://arxiv.org/abs/2602.08885

Usage

pip install simplipy

The compiled Rust extension (simplipy._core) is required: the inline phase (simplify, conversions, validation) runs on it exclusively, and there is no pure-Python fallback. Prebuilt wheels are published for Linux (x86_64/aarch64), macOS (x86_64/arm64) and Windows (x64) on CPython ≥ 3.11, so pip install simplipy does not compile anything for most users. Installing from the source distribution (an unsupported platform, or --no-binary) requires a Rust toolchain (rustup, MSRV 1.83). If the extension is missing at runtime, constructing an engine raises ImportError.

import simplipy as sp

engine = sp.SimpliPyEngine.load("dev_7-3", install=True)

# Simplify prefix expressions
engine.simplify(('/', '<constant>', '*', '/', '*', 'x3', '<constant>', 'x3', 'log', 'x3'))
# > ('/', '<constant>', 'log', 'x3')

# Simplify infix expressions
engine.simplify('x3 * sin(<constant> + 1) / (x3 * x3)')
# > '<constant> / x3'

Normalization

The root-exported normalize_skeleton, normalize_expression, and normalize_variable_token helpers (also available as simplipy.normalization) canonicalize a prefix token sequence so that two expressions that are "the same" up to variable renaming / constant values compare equal. They are pure-string helpers with no engine state, so consumers such as holdout matching and symbolic-recovery scoring share identical behavior by construction.

import simplipy as sp

# Skeleton form: variables -> x{n}, numeric literals -> <constant>
sp.normalize_skeleton(['+', 'v1', '2.5'])
# > ['+', 'x1', '<constant>']

# Expression form: variables canonicalized, numeric literals kept intact
sp.normalize_expression(['+', 'V1', '2.5'])
# > ['+', 'x1', '2.5']

# Classify / canonicalize a single token -> (normalized_token, is_variable)
sp.normalize_variable_token('X3')
# > ('x3', True)
sp.normalize_variable_token('sin')
# > ('sin', False)

More examples can be found in the documentation.

Performance

As of 0.6.0 the simplify hot path defers match-time certificates to completed matches (memoized generationally, never stopping memoization), memoizes whole fixpoint passes and rule-normal subtrees, and runs on interned token ids (~20× fewer allocations per call) — all at byte-identical outputs. On a 65,536-expression training-prior benchmark, large certificate-bearing rulesets simplify ~59× faster than 0.5.0 and certificate-free rulesets ~2.3× faster; see the CHANGELOG for details. As of 0.7.0 there is a single engine line; to reproduce the historical dev_7-3 / v23.0-era behavior byte-for-byte, install simplipy<=0.6.0. The comparison below dates from the 0.3.0 Rust cutover:

Simplification time and ratio ECDFs: SymPy vs SimpliPy (Python 0.2.15) vs SimpliPy (Rust 0.3.0)

Top row: SimpliPy 0.3.0 (Rust inline engine, green). Bottom row: SimpliPy 0.2.15 (pure Python, blue). Left: Empirical Cumulative Distribution Functions (ECDFs) of simplification wall-clock time across maximum pattern lengths Lmax = 0–7, with the SymPy [Meurer et al. 2017] baseline (orange, red). The Rust inline engine is roughly 5× to 100× faster than the pure-Python engine at the same Lmax (≈ 15× at Lmax = 4), and both are orders of magnitude faster than SymPy. Right: ECDF of the simplification ratio |τ ∗|/|τ | (inset: zoom on the low-ratio region where the Lmax curves separate); the Rust and Python engines produce near-identical simplification-ratio distributions, so the Rust rewrite buys the speed-up without sacrificing simplification quality. (0.3.0 does deliberately change behaviour on a small fraction of inputs via the conversion-quirk fixes and numeric folding; see the CHANGELOG.)
Source expressions are sampled with 0 to 17 unique variables and 1 to 35 symbols [Saegert & Köthe 2026]

Development

Setup

To set up the development environment, run the following commands:

pip install -e .[dev]
pre-commit install

Tests

Test the package with pytest:

pytest tests --cov src --cov-report html

or to skip integration tests,

pytest tests --cov src --cov-report html -m "not integration"

Citation

@misc{saegert2026breakingsimplificationbottleneckamortized,
  title   = {Breaking the Simplification Bottleneck in Amortized Neural Symbolic Regression},
  author  = {Paul Saegert and Ullrich Köthe},
  year    = {2026},
  eprint  = {2602.08885},
  archivePrefix =  {arXiv},
  primaryClass  = {cs.LG},
  url     = {https://arxiv.org/abs/2602.08885},
}

% Optionally
@software{simplipy-2025,
    author = {Paul Saegert},
    title = {Efficient Simplification of Mathematical Expressions},
    year = 2026,
    publisher = {GitHub},
    version = {0.7.0},
    url = {https://github.com/psaegert/simplipy}
}

Download files

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

Source Distribution

simplipy-0.7.1.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

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

simplipy-0.7.1-cp311-abi3-win_amd64.whl (799.1 kB view details)

Uploaded CPython 3.11+Windows x86-64

simplipy-0.7.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (927.1 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ x86-64

simplipy-0.7.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (892.4 kB view details)

Uploaded CPython 3.11+manylinux: glibc 2.17+ ARM64

simplipy-0.7.1-cp311-abi3-macosx_11_0_arm64.whl (834.4 kB view details)

Uploaded CPython 3.11+macOS 11.0+ ARM64

simplipy-0.7.1-cp311-abi3-macosx_10_12_x86_64.whl (870.7 kB view details)

Uploaded CPython 3.11+macOS 10.12+ x86-64

File details

Details for the file simplipy-0.7.1.tar.gz.

File metadata

  • Download URL: simplipy-0.7.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for simplipy-0.7.1.tar.gz
Algorithm Hash digest
SHA256 eaf8fc7e85310e99196a89097728bc5e30e138cab83f51f46f6176450de183da
MD5 8b3868bac146976f8cee7f8aec7ecb35
BLAKE2b-256 da6fc553913ad05e1e1cd2b07a7178c0737398050efb7b85b0a7ed49c95b78d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1.tar.gz:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simplipy-0.7.1-cp311-abi3-win_amd64.whl.

File metadata

  • Download URL: simplipy-0.7.1-cp311-abi3-win_amd64.whl
  • Upload date:
  • Size: 799.1 kB
  • Tags: CPython 3.11+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for simplipy-0.7.1-cp311-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 60474d043f2e66804df5e92a1cf3f7c5af852d5f669f36c0c5fa3dae85e1c45f
MD5 01b6b45ddb48870499a30bd2f6e003db
BLAKE2b-256 a79b9f1a0cb82dfb9a03b0aa062a07ee627fa90ff124048b9e49dd390c7ec3f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1-cp311-abi3-win_amd64.whl:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simplipy-0.7.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for simplipy-0.7.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1e3f3d3fa7f488e81a3c43dbff2a38d79d7666a4b09cf15dce77450196890ed8
MD5 5d515bd6c0fbfcd58902206388295752
BLAKE2b-256 970ebb21c17d8bd4143b7a460fdda0ca8c8e0963007a2d1171d5b9498af92b05

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simplipy-0.7.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for simplipy-0.7.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad20b990c5a30e247ab7f665851c1ef3e83826af368ad129a9e677cd2db5b117
MD5 2d36a54bc4b589b6090e88320d9e2f2e
BLAKE2b-256 851e4fc61ee772cee95722b7caae07a261677255221a877a8cf9002f81a7fbe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simplipy-0.7.1-cp311-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for simplipy-0.7.1-cp311-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1bf0b66497ce7368b59fece6c3b28e185c270696e92b77ca2918ebbffc0acae1
MD5 14d5959d96be2e2a19da0bf0e2e8b3ff
BLAKE2b-256 dbd7a8b817500d632567eace3e01e9372e624bfc60905b39f89c36de5ccb1064

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1-cp311-abi3-macosx_11_0_arm64.whl:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simplipy-0.7.1-cp311-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for simplipy-0.7.1-cp311-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d42d8f1b07f98b512abd8b6db9ad8e3fc922fd0d6ca0ec4a2e4dc7e714333efa
MD5 bab40a66bc6bb6a16232c9ac38597de4
BLAKE2b-256 70612cee54bee62950b22589bf7bedcde8b7c5661e113e0d3ff1983ed71ecd40

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.7.1-cp311-abi3-macosx_10_12_x86_64.whl:

Publisher: publish.yml on psaegert/simplipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.14.6

6 files

0.14.5

6 files

0.14.4

6 files

0.14.2

6 files

0.14.1

6 files

0.14.0

6 files

0.13.1

6 files

0.13.0

6 files

0.12.0

6 files

0.11.0

6 files

0.10.1

6 files

0.10.0

6 files

0.9.1

6 files

0.9.0

6 files

0.8.0

6 files

This release

0.7.1 This release

6 files

0.7.0

6 files

0.4.2

6 files

0.4.1

6 files

0.4.0

6 files

0.3.1

6 files

0.3.0

6 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page