math-deriv-simplification
The groupant beside math/src/deriv.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 |
power_guard | power_guard | partial source derived model | power_guard |
rewrite_order | rewrite_order | partial source derived model | rewrite_order |
negation_rule | negation_rule | partial source derived model | negation_rule |
call_boundary | call_boundary | partial source derived model | call_boundary |
Model text
descriptant
math-deriv-simplification
simplify folds constants and identities, bounded integer powers with zero-negative guard.0/x and0*x erase singularities; different-domain trees share outputs. No domain-preserving guarantee; recursive reconstruction includes rational arithmetic.
Epoch 2026-10-31: complete source read, parent AST reused; partial finite evidence only.
approximant
Scoped forward and cost
simplify folds constants and identities, bounded integer powers with zero-negative guard.0/x and0*x erase singularities; different-domain trees share outputs. No domain-preserving guarantee; recursive reconstruction includes rational arithmetic.
No executable percent surrogate claimed.
invariant
Scoped invariant
simplify folds constants and identities, bounded integer powers with zero-negative guard.0/x and0*x erase singularities; different-domain trees share outputs. No domain-preserving guarantee; recursive reconstruction includes rational arithmetic.
Source range[605,2373) bound by manifest digest. Parent domain applies, not arbitrary public states.
models
Source-scoped typed relations
behavior_complement
Simplification of numeric add/sub/mul must return exact Q arithmetic, and division constant-fold only if denominator nonzero. However later0/x identity does permit0/0->0; domain preservation is explicitly excluded.
reverse_reconstruction
Output0 admits Num0, x0 and0/0; their original definedness differs. Output x admits x+0, x1, x^1 and x itself, so simplified AST cannot reconstruct source or domain.
power_guard
Constant power folding requires integral exponent fitting i64 with |k|<=64 and excludes zero base with negative exponent. Subsequent power-zero identity returns1; MIN abs remains unchecked edge.
rewrite_order
Children simplify first, then numeric folding, then identities. Hence a compound child can become numeric before parent dispatch; this is recursive local rewriting, not polynomial canonicalization.
negation_rule
Neg(Num x) folds sign; Neg(Neg b) unwraps b; other negations remain. Multiplication by left -1 rewrites to Neg, while symmetric right -1 has no matching dedicated identity.
call_boundary
Calls only simplify arguments and preserve function/arity; no evaluation or domain checking is performed. Division/multiplication zero rewrites can erase unsupported or undefined calls.
tests
Evidence
See ../tests.md for actual checks and source mutant; this fragment adds no runtime test.
simplify folds constants and identities, bounded integer powers with zero-negative guard.0/x and0*x erase singularities; different-domain trees share outputs. No domain-preserving guarantee; recursive reconstruction includes rational arithmetic.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/math/src/deriv.rs.groupant/simplification.groupant/