treeagree-rules
The groupant beside tools/treeagree/src/rules.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 |
priority_shadow | priority_shadow | partial source derived model | priority_shadow |
subtype_transport | subtype_transport | partial source derived model | subtype_transport |
lexical_evidence | lexical_evidence | partial source derived model | lexical_evidence |
coordination_guard | coordination_guard | partial source derived model | coordination_guard |
Parts
Model text
descriptant
Descriptant
propose scans one-based positions, skips frozen tokens, selects first matching if/else rule R1..R7, then attaches POS fix or emits R8 when both witness base relations match draft. First matched branch can return None and suppress later rules. spaCy pobj head lifts one level. POS fix requires matching witness UPOS/XPOS and Lex evidence; moving head retains draft relation subtype when bases agree.
Epoch 2026-10-31
Prospective source reading identified conditional input alignment, information loss and failure order before tests. Existing production code is retained; added tests use actual helpers. Finite results update this source-bound model, not all parser/corpus semantics.
No executable percentage surrogate has a justified observation metric for these categorical/effectful APIs. Future profiles require metric, domain and real-reference evidence at caps 1/2/5/10%; no higher cap. Syntax is partial lexical Rust projection without macro expansion or semantic resolution.
approximant
Forward approximant
propose scans one-based positions, skips frozen tokens, selects first matching if/else rule R1..R7, then attaches POS fix or emits R8 when both witness base relations match draft. First matched branch can return None and suppress later rules. spaCy pobj head lifts one level. POS fix requires matching witness UPOS/XPOS and Lex evidence; moving head retains draft relation subtype when bases agree.
Composition
Child fragments model one narrow helper each; their correctness alone does not establish orchestration.
The containing source wires this scoped relation to its callers. Treeagree proposal→gate→commit and treebanks parse→match→collect→render are actual joins; parsecmp is an independent diagnostic path. The external group model distinguishes these tags.
catalog
Typed models for treeagree-rules
Subject: source SHA-256 1f33a4afa995261fb36eb9c29a0ab8fd1b624501e49713acaad28ece769f8120; manifest supplies exact source/byte scope. Domain: admitted states in forward model, nonoverflow arithmetic and successful allocations. Observation: one terminating invocation, except explicitly described file trace. Source-derived partial relations; named finite tests constrain selected cases only. Each entry holds arguments and environment fixed except its stated intervention.
behavior_complement
Frozen X/Flat/FlatForeign/Fixed/Goeswith/Reparandum tokens never receive proposals. A Strong head move needs both UD witnesses and optional third head agreement; None third witness prevents it.
Operator: inner exclusion on admitted domain. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
reverse_reconstruction
An Edit identifies a compatible priority branch and evidence constraints, not exact witnesses: unrelated tokens, subtype spellings and optional lex observations can vary. Missing edits may be frozen, no evidence, or an earlier matched branch returning None.
Operator: compatible antecedent relation, retaining ambiguity. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
priority_shadow
CcNext branch entered but no qualifying next conjunct prevents all later R5/R7 even if their predicates would otherwise hold.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
subtype_transport
pick preserves old subtype iff relation bases equal; head zero becomes Root and nonzero Root disagreement rejects Strong.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
lexical_evidence
pos_fix requires learned tag pair and preserves supplied lemma only on by-tag fallback; lowercase form shares by-form fiber.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
coordination_guard
A conjunct with cc dependent cannot become non-conj through Strong/RelAgree; this is a structural evidence guard, not semantic proof.
Operator: specialized observation relation under the stated fixed inputs. Evidence: source branch derivation plus tests.md; unexercised branches remain hypotheses. Oracle: evaluate the scoped actual helper on admissible fixtures and compare this observation. No universal proof.
tests
Bounded evidence — 2026-10-31
Source tools/treeagree/src/rules.rs at SHA-256 1f33a4afa995261fb36eb9c29a0ab8fd1b624501e49713acaad28ece769f8120. Selected actual-source tests in treeagree:
tests::rules_fire_on_evidence_and_only_thentests::gates_reject_bad_treestests::swap_needs_both_editstests::retag_rides_with_the_relation
These names passed twice in debug and twice in release; the complete treebank/comparison slice has 25 target-qualified names and identical sorted outcomes in all four runs. Ten compiled behavior mutations (one per owned source) failed named runtime assertions; exact original/restored SHA-256 equality and positive reruns were checked. Zero assertion-only mutants, zero surviving exploratory mutants, zero production fixes. Fresh raw logs, numeric exits, commands and mutation hashes are external in the wave33 trees receipt set.
Scope and gaps
pick fragment is source-derived; native rule tests exercise proposals but do not exhaust relation subtype pairs. No corpus, network, downloads, annotation model, live teacher, full release build or site execution. The treebanks join is entirely in memory and parsecmp uses a tiny uniquely named temporary directory. Treeagree Registry::load uses the embedded UD registry. Tests are finite CPU observations, not universal semantic proof, title-match quality estimates or corpus accuracy.
invariant-and-cost
Invariant and cost
n tokens: next_conj traverses descendants by repeated full scans and set membership, O(n²) on acyclic trees; called per token gives conservative O(n³). Lex lookups add ordered-map/string costs. Domain requires all witness lengths n, valid heads and acyclic conjunction structure.
Frozen X/Flat/FlatForeign/Fixed/Goeswith/Reparandum tokens never receive proposals. A Strong head move needs both UD witnesses and optional third head agreement; None third witness prevents it.
The complement and specialized catalog constrain preserved coordinates and effect boundaries. Empty/malformed domains are only guaranteed where explicitly admitted. No whole-program cost bound follows from a helper bound.
This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/treeagree/src/rules.rs.groupant/