Elamur Groupants⌕
☰

wordgraph-rel

The groupant beside wordgraph/src/rel.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

componentlabelwhere
ApproximantpartialApproximant
Astpartialsyntax.json
CompositionpartialComposition
CostpartialCost
DescriptantpresentDescriptant
InvariantpartialInvariant
Testsexecuted bounded checksTests

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.

relationtypelabelwhere
Behavior complementbehavior complementpartial source derived modelBehavior complement
Reverse reconstructionreverse reconstructionpartial source derived modelReverse reconstruction

Model text

Descriptant

Relation codes of the word graph: an 8-bit base relation (15 kinds) and a 24-bit preposition slot holding the en lemma number of an obl/nmod case word (0 = none, 0xFFFFFF = outside the dictionary). Names print as obl:in. Epoch 2026-11-06: first version; the dictionary has about 110 k lemmas, well under 2^24.

Approximant

code(b, p) = b << 24 | (p & 0xFFFFFF); base_of(c) = Base::from_u8(c >> 24); prep_of(c) = c & 0xFFFFFF. parse accepts a bare base name (prep 0), or obl|nmod:<word> with the word looked up in en::dict, or :?. name(code(b, p)) prints b, b:? or b:<lemma text>.

Invariant

Codes sort by base first, so all codes of one base are contiguous. parse(name(c)) = c for every code whose preposition is 0, PREP_OTHER or a dictionary lemma whose text is unique. base_of(code(b, p)) = b for all b, p.

Cost

O(1) per code operation; parse/name do one dictionary hash probe and one allocation.

Composition

Used by extract (to emit codes), compile (bounds by base), graph (relation table, edges_base), eval and the CLI. No state.

Tests

rel::tests::names_round_trip: every base round-trips; obl:in parses and prints; obj:in and unknown names are refused (negative cases).

Behavior complement

Does not represent multiword prepositions («because of»: only the first case word), subtypes other than pass, agent, poss, or prepositions on relations other than obl/nmod. Never panics; unknown bytes print rel#hex.

Reverse reconstruction

code is injective on (base, prep mod 2^24). From a code, base and preposition number are recovered exactly; the preposition's surface form, case and any second case word are not. PREP_OTHER admits every out-of-dictionary word.

Provenance

This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/wordgraph/src/rel.rs.groupant/