Elamur GroupantsβŒ•
☰

treestore-cols

The groupant beside tools/treestore/src/cols.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
Costsymbolic source derivedInvariant
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

The column streams of one article (16 byte vectors in a fixed order) and their primitive codes: LEB128 varints, zigzag signed numbers, length-prefixed literals and frozen value tables (id + 1, or 0 and a literal). Epoch 2026-11-06: first version; the stream order is part of the store format.

Approximant

put(v) writes ⌈bits(v)/7βŒ‰ bytes (1 for v < 128); get reads them back. zig(v) = 2v for v β‰₯ 0, βˆ’2v βˆ’ 1 for v < 0. sym(t, v) = put(t.id(v) + 1) when v ∈ t, else put(0) Β· lit(v). Table.from_counts keeps values with count β‰₯ min, by descending count then bytes, at most max.

Invariant

get ∘ put = id on u64; unzig ∘ zig = id on i64; Rd.sym ∘ Streams.sym = id for every string (table or literal). Table ids are a bijection items ↔ 0..nβˆ’1. Cost: O(bytes) per value; table lookup O(log n) (BTreeMap).

Composition

Every codec (codec.rs) writes through Streams and reads through Rd; the store concatenates per-article streams per group (store.rs). Nothing here knows field semantics.

Behavior complement

Does not compress, does not check that a stream was fully read (callers check done), does not accept non-canonical varints as distinct values (they decode to the same number; cm::symbols rejects them by re-encoding).

Reverse reconstruction

Injective on its domain: a byte stream produced by put/lit/sym has exactly one decoding given the same reading order and tables; a truncated stream is an error, never a silent value.

Tests

cols::tests::varints_zigzag_tables: extremes of u64/i64, table hit and escape, and the negative control that reading past the end fails.

Provenance

This page in Markdown β†’ https://md.groupants.elamur.ai/free/en/mova/tools/treestore/src/cols.rs.groupant/