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

# mathlib-oai-state

The groupant beside tools/mathlib/src/oai.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_fragment
- **status:** partial source bound model
- **source:** [`tools/mathlib/src/oai.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/mathlib/src/oai.rs)
- **source SHA-256:** `a31f2f7ae8b4e679…`
- **covers:** If state absent return None; otherwise scan lines, skip short/header rows, parse page strictly, add records with malformed count->0, replace last tuple with current page,total,token. (bytes 1270–1874)
- **part of:** [mathlib-oai](https://md.groupants.elamur.ai/free/en/mova/tools/mathlib/src/oai.rs.groupant/)
- **repository folder:** [`tools/mathlib/src/oai.rs.groupant/state.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/mathlib/src/oai.rs.groupant/state.groupant)
- **repository commit:** `855da7bd4a7b`

> **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` |
| **cost** | partial | [invariant-and-cost](#invariant-and-cost) |
| **descriptant** | present | [descriptant](#descriptant) |
| **invariant** | partial | [invariant-and-cost](#invariant-and-cost) |
| **tests** | 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.

| id | 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) |
| `count_default` | count_default | partial source derived model | [count_default](#count-default) |
| `terminal_token` | terminal_token | partial source derived model | [terminal_token](#terminal-token) |
| `line_order` | line_order | partial source derived model | [line_order](#line-order) |
| `header_skip_precedence` | header_skip_precedence | partial source derived model | [header_skip_precedence](#header-skip-precedence) |

## Model text


### descriptant

#### mathlib-oai-state

If state absent return None; otherwise scan lines, skip short/header rows, parse page strictly, add records with malformed count->0, replace last tuple with current page,total,token.

##### Epoch 2026-10-31

Prospective model retained before changes. Existing production bytes are preserved; additions are bounded inline tests. Nine source groupants expose ingestion and routing boundaries; typed children bind exact source bytes and reuse their parent syntax projection. Native tests run twice per profile; behavior mutants run as compiled source changes and exact bytes are restored before positive checks.

Important retained observation: network-looking helpers are not all pure (DNS inside github_host and books build); selection deliberately excludes those effects. Mixed-format manifest order is not deterministic, and error paths do not imply rollback.

No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.

### approximant

#### Forward relation

If state absent return None; otherwise scan lines, skip short/header rows, parse page strictly, add records with malformed count->0, replace last tuple with current page,total,token.

Model observations include returns, retained state and ordered partial effects; on external failures the successful-prefix relation replaces a total-function claim.

### catalog

### behavior_complement

Subject: mathlib-oai-state, source SHA-256 bad99249391507309f3ac75c270b7c802490e1b6ae7f6ffb54460d8790404846; finite transition observation.

Malformed page in a qualifying line cannot produce Ok(last); parse error aborts even if later rows would be valid. Missing file cannot produce a resume tuple.

Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.

Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.

### reverse_reconstruction

Subject: mathlib-oai-state, source SHA-256 bad99249391507309f3ac75c270b7c802490e1b6ae7f6ffb54460d8790404846; finite transition observation.

For tuple (p,t,k), compatible logs have final qualifying page p/token k and counts summing t; earlier pages need not be monotone. Short lines and header lines can be inserted freely.

Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.

Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.

### count_default

Subject: mathlib-oai-state, source SHA-256 bad99249391507309f3ac75c270b7c802490e1b6ae7f6ffb54460d8790404846; finite transition observation.

Malformed records count contributes zero while page parse is strict. This asymmetry is intentional modeled behavior; state_resume_and_stop_without_requests tests it.

Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.

Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.

### terminal_token

Subject: mathlib-oai-state, source SHA-256 bad99249391507309f3ac75c270b7c802490e1b6ae7f6ffb54460d8790404846; finite transition observation.

Third field empty is preserved as empty String and run treats it as completed; a later nonempty token would supersede earlier completion when replayed.

Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.

Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.

### line_order

Subject: mathlib-oai-state, source SHA-256 bad99249391507309f3ac75c270b7c802490e1b6ae7f6ffb54460d8790404846; finite transition observation.

Reordering qualifying lines changes returned page/token and may preserve total. This is a fold over log order, not map keyed by page number.

Domain: stated source predicates, bounded inputs and available resources; arithmetic assumptions and external effect gaps as in the invariant. Operator is the stated relation/projection; complement is a source-derived inner exclusion, reverse retains compatible antecedents. Other views are source-derived partial constraints, not inverse laws.

Evidence: tests.md identifies executed helpers and unexecuted paths. No universal guarantee follows from the finite fixtures.

### header_skip_precedence

Rows with fewer than three tab fields or first field exactly page are ignored before parsing numeric page/count. Whitespace around page is not trimmed. Adding an ignored header leaves the returned tuple invariant, whereas a qualifying malformed page causes error regardless of earlier valid state.

Subject and source identity: manifest.json. Domain: scoped forward/invariant; relation is source-derived and partial. Evidence: tests.md distinguishes actual checks from unexecuted effect paths; finite fixtures do not prove all inputs.

### tests

#### Bounded evidence

Selected actual source checks:

- mathlib::oai::tests::tokens_and_errors
- mathlib::oai::wave33::state_resume_and_stop_without_requests

These checks are file-level evidence; fragment branches not reached by these names remain source-derived.

External wave33 mathlib receipt retains native-commands.json, numeric statuses, raw debug/release logs, sorted exact outcomes, mutation logs and original/restored hashes. Seventeen named checks pass twice per profile; six production behavior mutants reject in both profiles, with restored positives. Source syntax is regenerated twice after formatting and compared byte-for-byte. Structural validation tests bindings, not Rust semantics.

No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.

### invariant-and-cost

#### Invariant and cost

##### Invariant

Returned page is last qualifying line, not maximum page. Count sums all qualifying records; token is third field without escaping.

##### Cost

O(file bytes) reads, O(longest line) working storage and cumulative u64 arithmetic.

##### Domain and gaps

No network/DNS/download, real catalog/corpus/model/teacher or database execution. Effect paths are source-derived; finite helper tests are not universal verification. No executable percentage surrogate or speed claim; future caps require metric/domain/reference and remain 1/2/5/10%.
