mova-whale-originality
The groupant beside tools/whale/src/originality.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 | Forward approximant |
| ast | partial | syntax.json |
| composition | partial | Composition |
| cost | partial | Cost |
| descriptant | present | Descriptant |
| invariant | partial | 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 |
reverse_reconstruction | reverse_reconstruction | partial source derived model | reverse_reconstruction |
Model text
Descriptant
Configurable bounded local lexical originality gate against primary documents and a configured corpus. Source: tools/whale/src/originality.rs. Public, domain-agnostic: concrete prompts, schemas, gate parameters and deployments come from pinned configuration.
Forward approximant
Tokenize (Unicode alphanumeric/combining-mark runs, lowercase); select narrative strings except configured exempt keys; index exact-run, shingle and short-gram windows of each document (primary full text plus configured .md/.txt corpus files, optionally through a hash-verified SQLite text cache); mark exact runs, shingle coverage union and near-copy windows; decision blocked_overlap if any exact run, near window >= near_percent, or shingle union >= aggregate bounds; pending_incomplete if any coverage reason; else clear_in_checked_corpus.
Invariant
publication_allowed iff decision=clear_in_checked_corpus; any incompleteness (missing roots, bound exhaustion, symlink, unreadable file, incomplete primary) yields at least pending_incomplete; thresholds lie in documented bounds and the three gram sizes are distinct; the cache returns text only if its hash equals the source hash.
Cost
O(D * (T_doc + T_out * sizes)) BTreeMap operations for D documents with T tokens; windows add O(T_out * |windows| * width); bounded by max_entries/max_bytes/max_document_bytes/max_output_bytes.
Composition
Called by whale::publish on the raw reply before projection with the specification thresholds merged with deployment corpus keys (spec::originality_config).
behavior_complement
Domain: narrative fields and configured documents. Excluded from 'clear': any exact run, near-copy window or aggregate overlap; any incomplete corpus. Not detected: semantic paraphrase, translation, copying from outside the configured corpus. Counterexample: substitutions breaking every exact run still block via near windows (lexical_near_copy_without_exact_run_blocks). Evidence status: source-derived model with finite checks, not a proof.
reverse_reconstruction
A receipt records matched spans (capped at 100), document hashes and thresholds; compatible narratives are all texts with the same token coverage pattern; the original text is not reconstructible from counts. A clear decision admits every narrative with no configured overlap in the checked corpus only. No unique inverse is claimed.
tests.md
8 originality tests: exact/case, near copy, configured thresholds incl. invalid sizes, aggregate union with negative control, exempt fields, incomplete scope, four concurrent cold cache writers, cache tamper.
Command: cargo test --manifest-path tools/whale/Cargo.toml --offline --locked (74 tests, fake teachers/executables; two identical runs on 2026-11-03). These are finite fixtures; no live run, model call or deployment was exercised.
This page in Markdown ā https://md.groupants.elamur.ai/free/en/mova/tools/whale/src/originality.rs.groupant/