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
| component | label | where |
|---|---|---|
| Approximant | partial | Approximant |
| Ast | partial | syntax.json |
| Composition | partial | Composition |
| Cost | symbolic source derived | Invariant |
| Descriptant | present | Descriptant |
| Invariant | partial | Invariant |
| Tests | executed bounded checks | 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 model | Behavior complement |
| Reverse reconstruction | reverse reconstruction | partial source derived model | Reverse 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/