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

# mova-whale-gates

The groupant beside tools/whale/src/gates.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/whale/src/gates.rs`](https://github.com/ElamurAI/mova-free/blob/main/tools/whale/src/gates.rs)
- **source SHA-256:** `c966f162615b26af…`
- **repository folder:** [`tools/whale/src/gates.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/tools/whale/src/gates.rs.groupant)
- **repository commit:** `48f2e6f74146`

> **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 | [Forward approximant](#forward-approximant) |
| **ast** | partial | `syntax.json` |
| **composition** | partial | [Composition](#composition) |
| **cost** | partial | [Cost](#cost) |
| **descriptant** | present | [Descriptant](#descriptant) |
| **invariant** | partial | [Invariant](#invariant) |
| **tests** | finite evidence | `tests.md` |

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

## Model text


### Descriptant

Anti-padding gates of a Whale's own description: word bounds, near-duplicate sentences, verbatim run against the whole paper, n-gram overlap with any terminal answer (unless the paper has it), traceability of every content word to its basis or the frame vocabulary, and the share of structural sentences. Source: `tools/whale/src/gates.rs`.

### Forward approximant

Guard::new(paper, answers, params): token positions of the paper, paper n-grams, answer n-grams (n = answer_ngram). verbatim(s): longest run of s's tokens consecutive in the paper (position DP). answer_overlap(s): n-grams in answers and not in the paper. check(draft, reading, knowledge, guard, min, max): duplicates (exact or Jaccard >= near_duplicate on >= 4 content words), verbatim (structure sentences without «…» quotations), overlap, traceability (source/reading: source sentence texts + cited knowledge; explain: knowledge basis; structure: stated basis; plus FRAME), structure share; pass iff all.

### Invariant

A gate that cannot fail is not a gate: each has a red control in tests; deterministic; defaults verbatim_max 12, answer_ngram 6, near_duplicate 0.8, structure_share_max 0.2 (validated ranges 4..40, 3..20, 0.5..1, 0..1).

### Cost

Guard build O(paper tokens + answer tokens); verbatim O(sentence tokens x occurrences); duplicates O(items^2); milliseconds per draft (2026-11-04).

### Composition

Parent: whale-workers; used by compose.rs (admits) while writing and by learn.rs (check) after writing.

### behavior_complement

Not done: semantic paraphrase detection, factual correctness, originality against other papers or the web, judging that a structural sentence is informative. A paper-wide repeated phrase longer than the cap counts against the description even where the paper repeats itself. Evidence status: source-derived model with finite checks, not a proof.

### reverse_reconstruction

gates.json names every failing item (index, run length, first overlapping n-gram, untraceable text, duplicate pairs) so the failing sentence and the gate are recovered; the passing set is not reconstructible from the report alone.

### Epoch 2026-11-04 (grammar gate)

New gate `grammar`: every source/reading sentence passes `clause::grammatical`; red control on the ma-2018 fragments. Traceability compares normalized forms (a term may be written as «MRFs» for an item keyed «MRF»).

### tests.md


gates::tests::a_clean_draft_passes_and_every_gate_has_a_red_control and guard_counts_runs_anywhere_in_the_paper (2026-11-04). Every gate has its red control in the same test. Finite fixtures, not a proof.

2026-11-04: tests of the batched/pod/stall/review/grammar/filter/selection changes listed in the crate README «Checks»; negative controls (grammar gate always passing, pod claim ignored, stall off, extraction check off) each turned their tests red, restored.
