---
title: "roundtrip-treecmp — Mova code model"
description: "Mova code model of tools/roundtrip/src/treecmp.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/tools/roundtrip/src/treecmp.rs.groupant/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · [Research](https://md.research.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · **Groupants**

This page as HTML: <https://groupants.elamur.ai/free/en/mova/tools/roundtrip/src/treecmp.rs.groupant/>

# roundtrip-treecmp

The groupant beside tools/roundtrip/src/treecmp.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

- **kind:** groupant
- **status:** partial source bound model
- **source:** [`tools/roundtrip/src/treecmp.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/roundtrip/src/treecmp.rs)
- **repository folder:** [`tools/roundtrip/src/treecmp.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/roundtrip/src/treecmp.rs.groupant)

> **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 derived | [Forward](#forward) |
| **Ast** | partial | `syntax.json` |
| **Composition** | partial source derived | [Composition](#composition) |
| **Cost** | partial source derived | [Invariant and cost](#invariant-and-cost) |
| **Descriptant** | partial source derived | [Descriptant](#descriptant) |
| **Invariant** | partial source derived | [Invariant and cost](#invariant-and-cost) |
| **Tests** | finite evidence | [Tests](#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.

| relation | type | label | where |
|---|---|---|---|
| Behavior complement | behavior complement | partial source derived finite checks | [Behavior complement](#behavior-complement) |
| Reverse reconstruction | reverse reconstruction | partial source derived finite checks | [Reverse reconstruction](#reverse-reconstruction) |

## Model text


### Descriptant

Compares two UD trees of one meaning without a shared word order: punctuation left out, relation subtypes folded, words aligned top-down by lemma and coarse tag, then by lemma alone; returns labelled and unlabelled attachment F1 and the differences classed by word class and kind (missing, extra, attach, label).

### Forward

compare(A, B): normalise both; align the virtual roots; for each aligned pair align the children in two passes (same word and relation, same word); align the leftover nodes by word; las <= uas <= word <= min(|A|,|B|); F1 = 2m/(|A|+|B|).

### Invariant and cost

compare(t, t) is perfect, scores are ordered and symmetric, node order and punctuation do not matter. Cost O(n·d) in nodes and out-degree, no allocation beyond the node lists.

### Composition

Called by ae2 (the pairs) and ae2round (reports).

### Behavior complement

Domain: pairs of trees. Relation: never reorders, repairs or scores order, punctuation or form; trees with different words only align by lemma and coarse tag. Counterexample: a wrong head high in the tree takes its subtree with it, so the score is lower than a UD LAS.

### Reverse reconstruction

Domain: a TreeScore. Relation: the counts do not recover the trees; the classes name where the difference was, not what the words were.

### Tests

treecmp::tests (4): identical trees and node order, wrong label / head / missing and extra words told apart (negative control: relabelled subject lowers LAS but not UAS), ordered and symmetric scores, punctuation head passes dependents up.

## History


#### 2026-11-07 · created

Written with the extended pipeline (tools/roundtrip/README.md, «The extended pipeline»). Measurements of 2026-11-07 are in that README; two identical runs of ae2-round and anti-round gave identical round.json (but for seconds) and candidate bytes.

## Provenance

- **source SHA-256:** `4fd9e8a32b4784a4…`
- **repository commit:** `c755aaec0159`
