---
title: "treestore-model — Mova code model"
description: "Mova code model of tools/treestore/src/model.rs: components with their labels, obernants and the model text."
url: "https://groupants.elamur.ai/free/en/mova/tools/treestore/src/model.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/tools/treestore/src/model.rs.groupant/>

# treestore-model

The groupant beside tools/treestore/src/model.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:** [`tools/treestore/src/model.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/treestore/src/model.rs)
- **repository folder:** [`tools/treestore/src/model.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/treestore/src/model.rs.groupant)

> **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) |
| **Cost** | symbolic source derived | [Invariant](#invariant) |
| **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.

| relation | 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) |

## Model text


### Descriptant

The store model: frozen value tables (headers, sections, tag tuples, relations, lemma edit scripts, frame pieces,
pragmatics tuples), shapes, split exceptions, the fragment meta-dictionary, one trained zstd dictionary and one primed
context model per stream. Named by the first 16 hex of its file's SHA-256. Epoch 2026-11-06: the tier-1 model
(250 sample articles of 10 shards) is 2.97 MB, trained in 28 s, peak 825 MB.

### Approximant

train: pass 1 counts table values and the chunks the split rule gets wrong; pass 2 counts shapes (≥ 3) and learns
fragments; pass 3 encodes the sample and trains a zstd dictionary (≤ dict bytes, ≤ 1/10 of the samples) and primes a
context model per stream. Serialisation is a fixed field order of varints and byte strings.

### Invariant

from_bytes ∘ to_bytes = id; train is deterministic (BTreeMap counts, ties by bytes). A store file names the model id, so
a different model is refused. Cost O(sample bytes) plus fragment learning and dictionary training.

### Composition

Read by codec (tables, shapes, fragments, splits) and store (dictionaries, context models).

### Behavior complement

Does not adapt after training (values outside the tables go to literals), does not version tables inside a store (one
model per store directory), and does not guarantee good ratios for text unlike the sample.

### Reverse reconstruction

Tables cannot be recovered from a store's data without the model file; the model file is the dictionary of the
format.

### Tests

In `tests/roundtrip.rs`: model bytes round-trip and training twice gives the same bytes, in three modes.

## Provenance

- **source SHA-256:** `9b0df5cf161aa0b7…`
- **repository commit:** `f55191f0d47f`
