Efficient Simplification of Mathematical Expressions
Project description
SimpliPy:
Efficient Simplification of Mathematical Expressions
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
As of 0.3.0 the inline phase (
simplify, conversions, validation) is a compiled Rust extension (simplipy._core). Prebuilt wheels are published for Linux (x86_64/aarch64), macOS (x86_64/arm64) and Windows (x64) on CPython ≥ 3.11, sopip install simplipydoes 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 unavailable at runtime, the package transparently falls back to a slower pure-Python implementation.
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
|
Top row: SimpliPy |
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 = 2025,
publisher = {GitHub},
version = {0.3.1},
url = {https://github.com/psaegert/simplipy}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplipy-0.4.0.tar.gz.
File metadata
- Download URL: simplipy-0.4.0.tar.gz
- Upload date:
- Size: 797.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a541f4d1d66988c50f20ab4e28172461de2e2cee7eab3bf996482b90bbd4d72d
|
|
| MD5 |
a816b64f9cee1041657ffdcc8b26bf64
|
|
| BLAKE2b-256 |
df141e38de36d07df88f2c35e806e9bd28ae04f7d53ac1e8bb9cb98c3ce2447b
|
Provenance
The following attestation bundles were made for simplipy-0.4.0.tar.gz:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0.tar.gz -
Subject digest:
a541f4d1d66988c50f20ab4e28172461de2e2cee7eab3bf996482b90bbd4d72d - Sigstore transparency entry: 2041796591
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplipy-0.4.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: simplipy-0.4.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 566.6 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
020ac343c912e6faa32497a368678b3158b5dadf265c0fc7c4ab1f019ecd743d
|
|
| MD5 |
d7ba13a88a9d9faad6440d283c62e32c
|
|
| BLAKE2b-256 |
ecd724c030178e27e24cad7418ce2c8c8e39df4447c98a7934515eb197aaf954
|
Provenance
The following attestation bundles were made for simplipy-0.4.0-cp311-abi3-win_amd64.whl:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0-cp311-abi3-win_amd64.whl -
Subject digest:
020ac343c912e6faa32497a368678b3158b5dadf265c0fc7c4ab1f019ecd743d - Sigstore transparency entry: 2041798706
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplipy-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: simplipy-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 701.6 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d177c7807b89a52ea0510f58f1506a01f50d6386f343a07be6d7c8e805c902a1
|
|
| MD5 |
2a97ec19d304855192e0de2172c4e984
|
|
| BLAKE2b-256 |
17c4e6a15330bf360de446f05bef270f0c3a9f12c96261952c9b753e272f791b
|
Provenance
The following attestation bundles were made for simplipy-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d177c7807b89a52ea0510f58f1506a01f50d6386f343a07be6d7c8e805c902a1 - Sigstore transparency entry: 2041796771
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplipy-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: simplipy-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 682.1 kB
- Tags: CPython 3.11+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55c9b4790f718cbbcc7ef8c745e8e3d31e95e694a1e41124e2aa6ccf4df5de06
|
|
| MD5 |
58b238c964399a5be8cbe3070dfbb0fb
|
|
| BLAKE2b-256 |
61382c7a888fc113b544967cd677293da25d75a60f8c03b29cf047e188482980
|
Provenance
The following attestation bundles were made for simplipy-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
55c9b4790f718cbbcc7ef8c745e8e3d31e95e694a1e41124e2aa6ccf4df5de06 - Sigstore transparency entry: 2041796859
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplipy-0.4.0-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: simplipy-0.4.0-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 632.5 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2682c67dbd9c7aede129f0006b281733c74cadfab9baa2ea6284011fa25e711f
|
|
| MD5 |
a30998b7b87f2f91535d270ece70cc5b
|
|
| BLAKE2b-256 |
e6c4e1b382d2d47a264992599a6eeaeea7d791631717efa4f922fb6ad61c4c7d
|
Provenance
The following attestation bundles were made for simplipy-0.4.0-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
2682c67dbd9c7aede129f0006b281733c74cadfab9baa2ea6284011fa25e711f - Sigstore transparency entry: 2041796702
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type:
File details
Details for the file simplipy-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: simplipy-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 652.1 kB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02b0921c3e843655cb9675ea8c02ad002b95a1d0d5655be694d2498adfed89dc
|
|
| MD5 |
3ef2245826c038e297b32ff24e3a9f24
|
|
| BLAKE2b-256 |
5eac38f86c9b41c32dbe3d3bbea3852d816a31240e4b03541d945c7f98077dd4
|
Provenance
The following attestation bundles were made for simplipy-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on psaegert/simplipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simplipy-0.4.0-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
02b0921c3e843655cb9675ea8c02ad002b95a1d0d5655be694d2498adfed89dc - Sigstore transparency entry: 2041796629
- Sigstore integration time:
-
Permalink:
psaegert/simplipy@9ee7fbef51d31f7d598547135572003453d4c78f -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/psaegert
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ee7fbef51d31f7d598547135572003453d4c78f -
Trigger Event:
release
-
Statement type: