math-poly-rational
The groupant beside math/src/poly.rs in the Mova repository: what the code computes, what it never does, how to go back from its outputs, its invariants, cost and checks.
Facts
Implementation material. A Mova code model describes this code at one source revision: partial models, finite checks and their stated scope. It is not a reviewed general exposition, and its labels are shown as written, never raised.
Components
| component | label | where |
|---|---|---|
| approximant | partial | approximant |
| ast | partial | ../syntax.json |
| descriptant | present | descriptant |
| invariant | partial | invariant |
| tests | executed bounded checks | tests |
Obernants
The typed relations around the forward model: the behaviour complement (what the code never does), the reverse reconstruction (every input compatible with an output) and specialised views.
| id | type | label | where |
|---|---|---|---|
behavior_complement | behavior_complement | partial source derived model | behavior_complement |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
constant_evaluation | constant_evaluation | partial source derived model | constant_evaluation |
fraction_join | fraction_join | partial source derived model | fraction_join |
power_domain | power_domain | partial source derived model | power_domain |
failure_order | failure_order | partial source derived model | failure_order |
Model text
descriptant
math-poly-rational
rf converts expressions to reduced fractions, evaluating constant subtrees through calc Env; only exact Q constants and target-independent integer powers admitted. Divisor roots are saved before cancellation. Original syntax is not reconstructible from normalized fraction/domain. Parent Poly operations supply cost and normalization assumptions.
Epoch 2026-10-31: complete source read, parent AST reused; partial finite evidence only.
approximant
Scoped forward and cost
rf converts expressions to reduced fractions, evaluating constant subtrees through calc Env; only exact Q constants and target-independent integer powers admitted. Divisor roots are saved before cancellation. Original syntax is not reconstructible from normalized fraction/domain. Parent Poly operations supply cost and normalization assumptions.
No executable percent surrogate claimed.
invariant
Scoped invariant
rf converts expressions to reduced fractions, evaluating constant subtrees through calc Env; only exact Q constants and target-independent integer powers admitted. Divisor roots are saved before cancellation. Original syntax is not reconstructible from normalized fraction/domain. Parent Poly operations supply cost and normalization assumptions.
Source range[6191,9459) bound by manifest digest. Parent domain applies, not arbitrary public states.
models
Source-scoped typed relations
behavior_complement
rf division by identically zero divisor numerator excludes success. After (x²-1)/(x-1) reduction, a result omitting the recorded denominator root1 contradicts the domain trace.
reverse_reconstruction
Reduced(x+1)/1 admits both x+1 and (x²-1)/(x-1), but dens distinguishes their admitted domains. Even num,den,dens together admit multiple syntax/evaluation histories.
constant_evaluation
If target variable absent, evaluate through calc Env before syntax dispatch; only V::Q is accepted as constant. Approximate/string/list constants error, potentially after effects in Env.
fraction_join
Add/sub combine n1d2 ± n2d1 over d1d2; multiply n1n2/d1d2; division n1d2/d1*n2 after recording nonconstant n2. reduce divides gcd and makes denominator monic.
power_domain
Exponent must be target-independent and exact integer with |k|<=200. Negative powers swap numerator/denominator and record nonconstant numerator; no explicit identically-zero check on this negative-power branch.
failure_order
For ordinary binary forms rf processes left child then right. Division tests right numerator zero after both; power evaluates/checks exponent before base conversion. Failed conversion can retain earlier Env effects.
tests
Evidence
See ../tests.md for actual checks and source mutant; this fragment adds no runtime test.
rf converts expressions to reduced fractions, evaluating constant subtrees through calc Env; only exact Q constants and target-independent integer powers admitted. Divisor roots are saved before cancellation. Original syntax is not reconstructible from normalized fraction/domain. Parent Poly operations supply cost and normalization assumptions.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/math/src/poly.rs.groupant/rational.groupant/