Elamur Groupants⌕
☰

latex-tomath-precedence

The groupant beside latex/src/tomath.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

componentlabelwhere
approximantpartialapproximant
astpartial../syntax.json
compositionpartialcomposition
descriptantpresentdescriptant
invariantpartialinvariant
testsexecuted bounded checkstests

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.

idtypelabelwhere
behavior_complementbehavior_complementpartial source derived modelbehavior_complement
reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
associationassociationpartial source derived modelassociation
flatteningflatteningpartial source derived modelflattening
functionsfunctionspartial source derived modelfunctions
script_invariantscript_invariantpartial source derived modelscript_invariant

Model text

descriptant

latex-tomath-precedence

seq rejects empty/leftovers. sum/term flatten only while open flags permit; sub/div reset. unary handles negative literals, group matches closer/power, func_arg stops next function/operator.

Epoch 2026-10-31: complete sources read before tests/model edits. Partial source-bound modeling; no production optimization or speed claim. Nested fragments share the parent lexical syntax. Caller/callee contracts outside owned files remain delegated.

approximant

Forward relation

seq rejects empty/leftovers. sum/term flatten only while open flags permit; sub/div reset. unary handles negative literals, group matches closer/power, func_arg stops next function/operator.

Domain and executable surrogate gap

Bounded UTF-8 inputs and synthetic local files; supported parser-produced trees and representable arithmetic. Arbitrary public constructors are not certified total. Exact categorical semantics lack a useful percentage surrogate; no executable approximant attachment. Future numerical profiles require an explicit metric, zero case, source/evidence binding and supported 1/2/5/10% cap. Failure/effect differences cannot count as numerical error.

invariant

Invariant

For the scoped transition bytes [4135,14572): seq rejects empty/leftovers. sum/term flatten only while open flags permit; sub/div reset. unary handles negative literals, group matches closer/power, func_arg stops next function/operator. Adjacent Num atoms reject only in term juxtaposition; the separate func_arg factor loop can admit adjacent numeric factors. Missing operand/bracket reject, function inverse exponent -1 unsupported; manual missing sup may panic.

Cost

Row traversal with repeated nested-group scans, potentially quadratic plus O(depth) recursive stack.

Allocation failure, stack exhaustion and unchecked counter overflow have no additional certificate. No timing claim or global error bound.

composition

Composition

seq rejects empty/leftovers. sum/term flatten only while open flags permit; sub/div reset. unary handles negative literals, group matches closer/power, func_arg stops next function/operator.

For the scoped transition bytes [4135,14572): seq rejects empty/leftovers. sum/term flatten only while open flags permit; sub/div reset. unary handles negative literals, group matches closer/power, func_arg stops next function/operator. Adjacent Num atoms reject only in term juxtaposition; the separate func_arg factor loop can admit adjacent numeric factors. Missing operand/bracket reject, function inverse exponent -1 unsupported; manual missing sup may panic.

Parser, printer, AST equality, Macros, Rat and evaluator dependencies retain their own contracts. Structural roundtrip is not arithmetic definedness or numeric truth. Exact lexical binding does not prove caller/callee semantics.

models

behavior_complement

Adjacent Num atoms reject only in term juxtaposition; the separate func_arg factor loop can admit adjacent numeric factors. Missing operand/bracket reject, function inverse exponent -1 unsupported; manual missing sup may panic.

reverse_reconstruction

Same ordered Expr admits unary-plus/grouped/explicit-product rows; presentation and delimiters unrecoverable.

association

a-b-c=Sub(Sub(a,b),c).

flattening

open flags preserve separately grouped Add/Mul.

functions

Next function ends argument; ordinary factors join.

script_invariant

Some branches unwrap sup, relying on parser constructor invariant.

tests

Selected evidence

cargo test -p latex --features math --test bridge

Two debug/two release executions retained matching sorted named outcomes. External wave28 latexbridge receipts retain numeric exits, compiled assertion controls, restoration, feature checks and source-test map. This scope is not exhaustive branch coverage; parent tests may only exercise some child transitions. Frozen VMM DATA/classification/hash subprocess, live corpus, teacher/API, training/GPU excluded. Reexport/feature compilation is separate from runtime semantics.

This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/latex/src/tomath.rs.groupant/precedence.groupant/