roundtrip-tree
The groupant beside tools/roundtrip/src/tree.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 | model.md |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | invariant-and-cost |
| descriptant | present | descriptant |
| invariant | partial | invariant-and-cost |
| tests | 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 |
coordinate_domains | coordinate_domains | partial source derived model | coordinate_domains |
projectivity_domain | projectivity_domain | partial source derived model | projectivity_domain |
render_precedence | render_precedence | partial source derived model | render_precedence |
spacing_boundary | spacing_boundary | partial source derived model | spacing_boundary |
Parts
Model text
descriptant
roundtrip-tree
2026-10-31 prospective epoch retained externally before edits.
of_words projects lemma/tag/head/rel. kids clamps out-of-range heads to0; projective computes contiguous subtree ranges. locals sorts head/child lists by supplied permutation; emit traverses them. Dec uses learned lin/morph, case/article/two-pass render and spacing; R2 overrides head orders or full order, spelling and output-position flips.
No annotator/model loading, live corpus, full suite, teacher, GPU or persistent-learning evidence. No executable percentage surrogate: categorical codecs/effects need a useful metric before future caps 1/2/5/10%.
Exact recovery with residual is a diagnostic codec observation. It is not evidence of normal generative equivalence, semantic understanding or persistent learning. Production source is preserved; only isolated tests are appended where needed.
approximant
Forward relation
of_words projects lemma/tag/head/rel. kids clamps out-of-range heads to0; projective computes contiguous subtree ranges. locals sorts head/child lists by supplied permutation; emit traverses them. Dec uses learned lin/morph, case/article/two-pass render and spacing; R2 overrides head orders or full order, spelling and output-position flips.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Composition
Source children delimit real function scopes, sharing syntax. Real pipeline joins R4 frame reconstruction to Realizer then R3 tree script and R2 token decode; report consumes aggregated tally. Independent path/CLI branches are not fictitious codec callers.
catalog
behavior_complement
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
R2 space flips cannot make final token have trailing space because decode tests for next form. Raw spelling suppresses capitalization. kids clamping is not validation of cycles or uniqueness; malformed graphs have no totality guarantee.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
reverse_reconstruction
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
For projective valid tree and compatible permutation, emit(locals(t,o))=o; arbitrary crossing order can fail. R2 plus same decoder/hints reconstructs forms/spaces encoded with final spacing false. Normal forms discard original case, order and whitespace; ambiguous antecedents remain.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
coordinate_domains
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
Node heads and order are1-based with0 root; spelling keyed by node number, spacing keyed by zero-based output positions. Hints orders are trusted, not checked as permutations.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
projectivity_domain
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
Every reachable subtree interval must have hi+1-lo=size and root size=n. Disconnected cycles risk overflow or missing traversal; require rooted acyclic valid trees.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
render_precedence
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
Spell Raw overrides Case and hints; Case overrides hints; hints override morphology. NoCap suppresses sentence capital; a/an inspects next output form right-to-left.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
spacing_boundary
Subject: roundtrip-tree, source hash 3db953874807575403c8d2857006e1932cc72df16fa615b64c5b9e7eceae8da7; transition observation.
rule_space rejects fixed punctuation/clitic next forms or bracket/currency previous forms. Residual flips use original neighbors; final space is alwaysfalse.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
Evidence: external wave32 rt_core receipt includes native-commands.json, exact named outcomes twice debug/twice release, raw status/log files, compiled production controls with byte restoration and paired syntax. Only named synthetic helpers execute; model_path/export and live CLI paths have representation/source evidence.
Status: partial source-derived model.
tests
Native evidence
tests::orders_and_projectivitytests::tree_script_gives_the_tree_back_and_a_damaged_one_does_not
17 exact named checks total (16 library, one CLI helper), each twice debug and twice release, numeric exits zero and sorted outcomes identical. Native metadata and raw receipts are in the external wave32 rt_core run directory. No optional model tests execute. lib.rs has compile/representation evidence only.
Four compiled production controls alter class precedence, Block grouping, world boundary XOR and frame lemma patching. Each fails its named runtime assertion (exit101), restores exact source SHA256 and passes restored check (exit0). No assertion-only mutants, survivors or bug repairs. These controls do not establish complete coverage.
Two fresh syntax projections agree for each of nine sources. Production bytes are preserved as exact base prefixes. Format only appended test modules before final native receipts. CLI spec helper errors precede any reader; actual model-loading pipeline is excluded.
invariant-and-cost
Invariant and cost
R2 space flips cannot make final token have trailing space because decode tests for next form. Raw spelling suppresses capitalization. kids clamping is not validation of cycles or uniqueness; malformed graphs have no totality guarantee.
For projective valid tree and compatible permutation, emit(locals(t,o))=o; arbitrary crossing order can fail. R2 plus same decoder/hints reconstructs forms/spaces encoded with final spacing false. Normal forms discard original case, order and whitespace; ambiguous antecedents remain.
kids O(n), locals O(n+sum d_h log d_h), emit O(n) on valid acyclic local-order tree. projective O(n) on rooted valid trees. Dec adds lin/morph costs and string rendering; no learned-model inference cost or accuracy measured here.
Domain: bounded synthetic values, valid source-specific coordinates, nonoverflowing counts, available allocation; fixed environment controls. Relations are source-derived partial models with finite checks, not universal proofs.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/tools/roundtrip/src/tree.rs.groupant/