Elamur Groupants⌕
☰

mova-elephant-part

The groupant beside tools/elephant/src/part.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
ApproximantpartialForward approximant
Astpartialsyntax.json
CompositionpartialComposition
CostpartialCost
DescriptantpresentDescriptant
InvariantpartialInvariant
Testsfinite evidenceTests

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

Reader and writer of word-graph parts and runs in both formats (WGPART01 without OOV frequencies, WGPART02 with them), independent of the wordgraph version's own reader. Source: tools/elephant/src/part.rs.

Forward approximant

open: magic -> format; next_oov: entries strictly sorted (checked), frequency u32::MAX in format 1; next_rec: strictly increasing keys (checked), the OOV table skipped if unread. Writer::start(format, n_oov, n) -> push_oov (strictly sorted) -> push(key, count>0, strictly increasing) -> finish: both counts met, fsync, rename from .tmp.

Invariant

A written run is sorted, unique, with positive counts and exactly the announced number of records; a reader never sees a half-written run (temporary file and rename); read_all(write(x)) = x.

Cost

Streaming: O(bytes) time, O(OOV table) memory.

Composition

Parent: elephant. Used by merge (runs), key (scans for list changes) and store (format and hashes).

Behavior complement

Never interprets a key beyond its packing; never writes in place. Evidence status: source-derived model with finite checks, not a proof.

Reverse reconstruction

A run decodes to its records exactly (round-trip test); the parts a run was merged from are not recoverable from it (the store's manifest keeps them).

Tests

Checks

part::tests: both formats round-trip; unsorted records, a short run and a zero count refused. These are finite fixtures and measurements; not a proof.

History

2026-11-06 · document

Epoch 2026-11-06

First model, written with the source (the Elephant made incremental and an animal on Mova).

Provenance

This page in Markdown → https://md.groupants.elamur.ai/free/en/mova/tools/elephant/src/part.rs.groupant/