prag-infer-scalar
The groupant beside prag/src/infer.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 source model | forward |
| ast | partial | ../syntax.json |
| composition | partial source model | composition |
| cost | partial source model | cost |
| descriptant | partial source model | epoch-memory |
| invariant | partial source model | invariant |
| tests | bounded executed evidence | ../model.md#evidence |
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 |
|---|---|---|---|
prag-infer-scalar-behavior-complement | behavior_complement | partial source model | behavior-complement |
prag-infer-scalar-reverse-reconstruction | reverse_reconstruction | partial source model | reverse-reconstruction |
prag-infer-scalar-suppression | gate_partition | partial source model | suppression |
Model text
forward
Lowercase lemmas and space-joined lowercase forms. For tokens in order, visit fixed SCALES in order. A nonmaximal matching item supplies its stronger suffix. Reject if any stronger lemma occurs anywhere, negated(W,i), or any cancellation substring occurs in joined forms. Reject non-Cc or. Reject a prior result with the same surface trigger whose content contains the strongest item. Otherwise emit strongest negation and intermediate alternatives with Quantity explanation.
behavior-complement
Universe: (W, finite scalar-result vector), valid caller index for negated. Inner absent-behavior model includes an emission from maximal hot/all, an or emission whose relation is not Cc, a warm-to-hot emission under cancellation, or two identical some surface results from the duplicate fixture. Stronger presence is sentence-wide; this is not a scope-aware semantic exclusion. The literal and tokenized fixtures independently assert those cases.
reverse-reconstruction
For fixed scalar vector, keep all W whose ordered candidate stream after filters and duplicate collapse renders that vector. Identical surface some tokens may collapse; lemma case is lost; absence cannot distinguish maximal scale words, no matching words or cancellation. Output preserves trigger spelling but not original token position or dependency graph. Exact converse is specified; no exhaustive solver or unique reconstruction is claimed.
suppression
Hold one weak candidate fixed. Let A be stronger presence, N the negated predicate, C the sentence cancellation flag, R the or relation gate and D prior duplicate state. Emit iff not(A or N or C or R or D). These flags may overlap; partition by first encountered rejecting branch in Rust, not independent semantic causes. The tokenized warm/if/not/all fixture has no stronger warm-scale item and explicitly checks N=false, isolating C. Single-Word multiword forms additionally test literal substring behavior only.
invariant
Token/scale traversal order decides first duplicate survivor. All emitted scalar results are licensed. negated requires i<n and tests negation lemma plus child/shared-head/preceding position; irony supplies indices from enumeration. The helper is not a general tree validator.
composition
Negation and cancellation feed candidate gates; duplicate detection observes already emitted results, so scalar candidates are not independent. No learned feature rows or model scores are consulted.
cost
O(n²) with fixed tables and bounded strings, from repeated presence/negation and duplicate scans; output-length and substring costs remain explicit parameters for unbounded strings. No observed timing claim.
epoch-memory
The four pre-existing infer tests plus six new tests pass on bounded fixtures. No production scalar rule changed. Non-tokenized cancellation was supplemented with separate Word tokens after review to distinguish a substring witness from realistic annotation structure. No live parser was used.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/prag/src/infer.rs.groupant/scalar.groupant/