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("acj-4-3", install=True)   # a published ruleset artifact

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

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

Token input returns the engine's native tagged form by default (n-ary +/* bags are delimited: <add> ... </add>, <mul> ... </mul>; tagged output is accepted back as input). The form parameter selects a different projection of the same canonical answer:

expr = ('/', '<constant>', '*', '/', '*', 'x3', '<constant>', 'x3', 'log', 'x3')

engine.simplify(expr, form='infix')      # the pretty rendering (a str)
# > '<constant>/log(x3)'

engine.simplify(expr, form='explicit')   # binary prefix -- what is_valid / prefix_to_infix read
# > ('/', '<constant>', 'log', '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 (measured at 0.11.0), large certificate-bearing rulesets simplify ~59× faster than 0.5.0 and certificate-free rulesets ~2.3× faster; see the CHANGELOG for details. Since 0.7.0 there is a single compiled engine line; the published ruleset artifacts (acj-2-1, acj-3-2, acj-4-3, …) are the distinguishing factor between engines. Rule application always considers every pattern in the loaded artifact (the former max_pattern_length knob was removed in 0.10.0). (To reproduce the historical dev_7-3 / v23.0-era behavior byte-for-byte, install simplipy<=0.6.0.)

The 0.11-era SymPy comparison figure is withdrawn from the public surfaces (release audit B13: its worker-pooling disclosure misread as a SymPy handicap, and measured, pooling hurt SymPy). The 0.13.0 release ships a re-designed, pre-registered fair benchmark (three corpora, paired per-row scoring, censoring stated); its results ledger and figures accompany the release.

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.12.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.13.0.tar.gz (1.5 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.13.0-cp312-abi3-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12+Windows x86-64

simplipy-0.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

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

simplipy-0.13.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ ARM64

simplipy-0.13.0-cp312-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

simplipy-0.13.0-cp312-abi3-macosx_10_12_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for simplipy-0.13.0.tar.gz
Algorithm Hash digest
SHA256 c5c71ea16367012cc2cd8b3de0e4befc835cb610f9ec94db1972de815825c1ad
MD5 4462dda7e81251ee3d06fbe10e1c5dcc
BLAKE2b-256 854871dd883fd414cce6e18a20acc8cdb1f9e403b91ffc67dd493d377897251c

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0.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.13.0-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: simplipy-0.13.0-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for simplipy-0.13.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 105c8cd67dbdead43390ea037155be0e66e68fb517c6f1ac5b9c76053dfc77a7
MD5 181392a75444efcaf2ffa75bfbd7f605
BLAKE2b-256 5e6d3f0ece26174c9518b294f3a6c12c0436b5f30361dad0f4611c2fc3aa0c1a

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0-cp312-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.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for simplipy-0.13.0-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7d99d529f35389bb2fe4dd026c12bf7ff1a9ea1797238882bbae69004b5fe3d8
MD5 177513aa065b8903d6f6f562e20808b2
BLAKE2b-256 02b66b2cb2f4942b0e7184e2c218f0fea4250b2296c5ff90f980b9e04d6cf156

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0-cp312-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.13.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for simplipy-0.13.0-cp312-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8f05a3dcd5a9c2420507fbeee8401e7b8f556cea2ba86975bafd32404f12c4f5
MD5 ecdc4ea6e85bee3c44b9458f887a1a7a
BLAKE2b-256 f0f5efec8f438260d8c010b09838e0b1b2687c96a59804f0eeb3991eb348d94f

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0-cp312-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.13.0-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for simplipy-0.13.0-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff4cd63506bc20cee4a533bcdc206bdfddb72894769b1fd8bd1480b25fdbce5d
MD5 38d25d9c32d103a4f87438a72044c5ea
BLAKE2b-256 6e2babdc1c4c63f45cb77ccf32d253759007a30a50acd974b0ccfc56a4eab262

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0-cp312-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.13.0-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for simplipy-0.13.0-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0574bcac853f1f43063ce407d4083692c6bd2945daa7ea817e4d54b4a0352b04
MD5 d2d3f00a58d95dfd1db19b11c8ee008f
BLAKE2b-256 69a7077e507bfb813dbda647f94f25bda36a9a355fb4092b60add7dd48aca2ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for simplipy-0.13.0-cp312-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

This release

0.13.0 This release

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

0.7.1

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