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

This page as HTML: <https://groupants.elamur.ai/free/en/mova/coref/src/main.rs.groupant/>

# coref-main

The groupant beside coref/src/main.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:** [`coref/src/main.rs`](https://github.com/ElamurAI/mova-free/blob/main/coref/src/main.rs)
- **source SHA-256:** `e2ff8656a295c323…`
- **repository folder:** [`coref/src/main.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/coref/src/main.rs.groupant)
- **repository commit:** `48f2e6f74146`

> **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 | [approximant](#approximant) |
| **ast** | partial | `syntax.json` |
| **composition** | partial | [composition](#composition) |
| **descriptant** | present | [descriptant](#descriptant) |
| **invariant** | partial | [invariant](#invariant) |
| **tests** | executed bounded checks | [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.

| id | type | label | where |
|---|---|---|---|
| `behavior_complement` | behavior_complement | partial source derived model | [behavior_complement](#behavior-complement) |
| `reverse_reconstruction` | reverse_reconstruction | partial source derived model | [reverse_reconstruction](#reverse-reconstruction) |
| `argument_grammar` | argument_grammar | partial source derived model | [argument_grammar](#argument-grammar) |
| `dispatch_effects` | dispatch_effects | partial source derived model | [dispatch_effects](#dispatch-effects) |
| `load_transport` | load_transport | partial source derived model | [load_transport](#load-transport) |
| `diagnostic_zero` | diagnostic_zero | partial source derived model | [diagnostic_zero](#diagnostic-zero) |

## Parts

- [coref-main-input](https://md.groupants.elamur.ai/free/en/mova/coref/src/main.rs.groupant/input.groupant/)
- [coref-main-dispatch](https://md.groupants.elamur.ai/free/en/mova/coref/src/main.rs.groupant/dispatch.groupant/)
- [coref-main-diagnostics](https://md.groupants.elamur.ai/free/en/mova/coref/src/main.rs.groupant/diagnostics.groupant/)

## Model text


### descriptant

#### coref-main

CLI flag/arity dispatch, file loading with optional aligned trees, resolver output and diagnostic printing.

State: Process argv/environment, input paths and files, stdout/stderr, optional evaluation directory.

Epoch 2026-10-31: prospective analysis preceded test additions. Production behavior is unchanged. A registry entry records partial source-bound modeling, not verification.

Arg parser/process dispatch and output formatting not fully executed; synthetic load test only. No broad CLI or I/O-failure control.

### approximant

#### Forward model

args takes first argument as command; --trees/out/label consume next token with missing-value error; --exact boolean; all other tokens positional. Repeated values last-win. resolve requires1, score2, eval1+out, mentions1; explain accepts>=1 and uses second as optional id, ignoring further positionals. load reads gold then optional tree, retrees and builds documents. Eval creates directory before input load, then run outputs and report write.

Domain: acyclic, in-range document views from checked parsing unless explicitly discussing permissive adapters; stable environment during each call; finite addressable allocations. Public vectors can be malformed and panic.

No runtime substitute or numerical error budget is established.

### invariant

#### Invariant and cost

Resolve gold stripping is implicit in detector behavior, not removal before load. Score loads both files without --trees and checks document count only; heads use each file's tree. Mention diagnostics use zip and zero denominators can print NaN. CLI results depend on filesystem and may leave partial effects.

Argument bytes linear; load holds raw cloned input plus tree/document views. Resolve/eval costs delegated; mention_stats matching plus map counts and sorted top-k summaries. Whole input/output strings are buffered, no resource cap.

Integer counters/lengths use Rust native arithmetic with no separate overflow certificate. Allocation exhaustion, panics and I/O failures are not experimentally characterized.

### composition

#### Source-fragment composition

Fragments project exact byte ranges of this source; shared types/imports outside ranges remain prerequisites. Models compose through actual caller/callee state, not an error-budget sum.

- input: bytes [1728,2913); Private argv parser and real filesystem load adapter.
- dispatch: bytes [2913,6673); Command arity and effect ordering.
- diagnostics: bytes [6673,12644); Explanation rendering and mention diagnostics with zero/count behavior.

Parent relation: args takes first argument as command; --trees/out/label consume next token with missing-value error; --exact boolean; all other tokens positional. Repeated values last-win. resolve requires1, score2, eval1+out, mentions1; explain accepts>=1 and uses second as optional id, ignoring further positionals. load reads gold then optional tree, retrees and builds documents. Eval creates directory before input load, then run outputs and report write.

Integration: checked document tree -> mention spans/features -> ordered resolver partition -> eval visibility -> CorefUD rows or existing score module. Source-specific exceptions and projection losses remain in models.md.

### models

## Typed models

### behavior_complement

Invalid dispatch arity cannot execute chosen processing arm and returns usage after argument parsing. Missing flag value errors before usage. Eval input failure does not exclude a newly created output directory. Unknown option tokens are accepted as positionals, not rejected as unknown flags.

### reverse_reconstruction

For stdout y, compatible argv/files may vary in ignored flags, extra explain positionals and discarded data. load output admits any aligned tree source with matching replacement columns; output does not uniquely identify file bytes or path. Error messages constrain failing stage rather than full prior state.

### argument_grammar

Flags are recognized after command, values consume even flag-looking tokens; duplicate path/label last wins. No -- terminator.

### dispatch_effects

resolve prints raw updated text; explain may print multiple documents; score computes two policies; eval creates dir, writes diagnostics/output then report; mentions prints counts.

### load_transport

load(path,Some(t))=documents(retree(read(path),read(t))); gold read failure precedes tree read/alignment, documents validates resulting trees.

### diagnostic_zero

mention_stats head recall=100 hit/ng and precision=100 hit/np without zero guard; exact conditional denominator max(hit,1). Ties in top tables sort count descending then lexical key.

No executable percentage surrogate: categorical state/effect semantics currently lack a useful cheaper observation metric. Supported future caps are 1%, 2%, 5%, 10%; no profile is claimed here.

### tests

#### Evidence — 2026-10-31

Safe synthetic command: env -u COREF_X -u COREF_MD -u PRAG_OFF cargo test -p coref tests:: -- --skip score::. Two debug and two release executions are retained externally with numeric exit status and sorted named outcomes. Selected checks:

- wave27_tests::synthetic_load_preserves_gold_and_rejects_mismatched_trees

See source-test-map.json and controls.json in the wave27 coref run receipts. The library declaration file has compilation evidence only. No corpus, teacher, GPU or speed measurement.

Partial scope: Arg parser/process dispatch and output formatting not fully executed; synthetic load test only. No broad CLI or I/O-failure control.

##### Measured receipts

Final source state: 13 named tests (12 library, 1 binary) passed twice debug and twice release, 52 total executed test instances; all four command exits0 and sorted named outcomes identical. Five added tests are four library boundary tests plus one main load test. The pre-existing score tests and groupant_transfers were filtered out.

Compiled actual-source control: wave27_tests::synthetic_load_preserves_gold_and_rejects_mismatched_trees. Compile exit0, assertion-run exit101, exact bytes restored, positive rerun exit0. Retained logs: control-main-compile.log, control-main-red.log, control-main-restored.log.

Nine source AST projections were generated twice identically. Shared ancestor declarations are deferred to root integration; local owned leaves have no structural diagnostics. No timings or general accuracy claim.

Strict scoped Clippy: exit101 on four pre-existing production lints (corefud unnecessary_sort_by, doc if_same_then_else and clone_on_copy, mention collapsible_if). Those source files are byte-identical to the base. No unrelated lint refactor was made.
