eq-equiv
Equation parsing and equivalence comparison for typed symbolic equations.
eq-equiv parses a deliberately small equation surface, binds authored
symbols to stable concept identifiers, renders typed expression trees, and
compares equations through deterministic structural and SymPy-backed
normalization.
Supported Surface
Equations must contain exactly one = relation. Expressions support:
- symbols declared by
EquationSymbolBinding; - integers, decimals, and exponent notation;
- unary
+and-; - binary
+,-,*,/, and^; - one-argument functions
abs,log,ln,exp, andsqrt.
Unsupported functions, unknown symbols, inequalities, chained equalities, and
raw executable SymPy surfaces return typed EquationFailure values instead of
being evaluated.
Comparison Outcomes
EQUIVALENT: the equations are proven equivalent under the declared domain.DIFFERENT: the equations are proven different for the supported theory.INCOMPARABLE: parsing or normalization failed.UNKNOWN: both equations parsed, but the available algebraic procedure cannot make a sound equivalence or difference decision.
Domain-sensitive identities return UNKNOWN unless the caller supplies the
needed assumptions. For example, log(x * y) = z and
log(x) + log(y) = z require positive assumptions for x and y.
Related
For converting human-typed equation strings (with ^, broad function names,
constants like pi) into canonical SymPy expression strings, see the sibling
package human-to-sympy. It is
deliberately a separate library — eq-equiv deals with semantic equivalence
over a narrow grammar; human-to-sympy deals with surface translation into
SymPy. They do not depend on each other.
Example
from eq_equiv import (
BoundEquation,
EquationComparisonStatus,
EquationSymbolBinding,
Positive,
compare_equations,
)
bindings = (
EquationSymbolBinding(symbol="x", concept_id="x"),
EquationSymbolBinding(symbol="y", concept_id="y"),
EquationSymbolBinding(symbol="z", concept_id="z"),
)
left = BoundEquation("log(x * y) = z", variables=bindings)
right = BoundEquation("log(x) + log(y) = z", variables=bindings)
result = compare_equations(
left,
right,
domain_assumptions=(Positive("x"), Positive("y")),
)
assert result.status == EquationComparisonStatus.EQUIVALENT
Metadata
Release files for eq-equiv 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| eq_equiv-0.1.0.tar.gz | 14.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| eq_equiv-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.4 kB
Release files / eq_equiv-0.1.0.tar.gz
| Download URL | eq_equiv-0.1.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9a3835f556285e1435071f8966a5e4f5fc1fad3ca9d3d923a7794d20a3623fa
|
|
BLAKE2b-256 checksum How to use checksums |
99657ce04ed6224660b18811c1280e89266f8a5ea1c0ae62ce14bdefed5beaee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.8
|
Release files / eq_equiv-0.1.0-py3-none-any.whl
| Download URL | eq_equiv-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb07850fd626550ddf626a76b254b1042aa1a9f6fadec1d90556af533e5b0c2e
|
|
BLAKE2b-256 checksum How to use checksums |
6246c5c14321afed703356bd3cea49a3abdcd03a8b300c2b38dfecd857bfb101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.8
|