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

# kg-morph

The groupant beside kg/src/morph.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:** [`kg/src/morph.rs`](https://github.com/ElamurAI/mova-free/blob/main/kg/src/morph.rs)
- **source SHA-256:** `cfa483216783580f…`
- **repository folder:** [`kg/src/morph.rs.groupant`](https://github.com/ElamurAI/mova-free/tree/main/kg/src/morph.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 | [approximant](#approximant) |
| **ast** | partial | `syntax.json` |
| **composition** | partial | [composition](#composition) |
| **cost** | partial | [cost](#cost) |
| **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.

| 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) |
| `government_bits` | government_bits | partial source derived model | [government_bits](#government-bits) |
| `paradigm_selection` | paradigm_selection | partial source derived model | [paradigm_selection](#paradigm-selection) |
| `line_grammar` | line_grammar | partial source derived model | [line_grammar](#line-grammar) |
| `normalization_transport` | normalization_transport | partial source derived model | [normalization_transport](#normalization-transport) |

## Parts

- [kg-morph-two-pass](https://md.groupants.elamur.ai/free/en/mova/kg/src/morph.rs.groupant/two-pass.groupant/)

## Model text


### descriptant

#### kg-morph

Two-pass VESUM loading: vocabulary-limited analyses and full selected-paradigm synthesis.

##### Modeling epoch — 2026-10-31

Source read before tests and models; retained prospective notes accompany the parent. Current evidence uses bounded invented inputs only. This is partial modeling, not proof or corpus accuracy.

### approximant

#### Forward relation

Pass1 tracks lemma/tags/government from bz2 lines, normalizes forms and retains vocab matches. Keys lemma|POS#xp use merged first xp marker; verb/prep inherit lemma government. Pass2 rescans all forms of selected lemma keys into synthesis.

##### Executable approximant gap

Exact categorical structure, identifiers, parser decisions and effects have no useful percentage metric established here. No executable surrogate, automatic substitution or 1/2/5/10% guarantee is claimed.

### invariant

#### Invariant and domain

Unchanged file across passes: retained analyses select lemma paradigms; unrequested forms may enter synth but not forms. Vectors retain dictionary order/duplicates. norm is lossy lowercase/invisible/apostrophe projection.

##### Cost and resources

Two complete decompressions O(2B) plus hashing/strings; O(A+S) retained analysis/synthesis bytes. Empty vocab still reads twice; no byte cap.

### cost

#### Cost and resources

Two complete decompressions O(2B) plus hashing/strings; O(A+S) retained analysis/synthesis bytes. Empty vocab still reads twice; no byte cap.

### composition

#### Composition

Two-pass VESUM loading: vocabulary-limited analyses and full selected-paradigm synthesis.

Pass1 tracks lemma/tags/government from bz2 lines, normalizes forms and retains vocab matches. Keys lemma|POS#xp use merged first xp marker; verb/prep inherit lemma government. Pass2 rescans all forms of selected lemma keys into synthesis.

The parent invokes scoped transformations through the actual functions named in their source ranges. Children partition useful observations, not a complete semantic proof; boundaries can omit helpers, tests and effects.

### models

### behavior_complement

Non-vocab normalized forms cannot enter forms; unselected keys cannot enter synth. Malformed lines skip, orphan indented entries inherit initially empty lemma, comments outside government disappear.

### reverse_reconstruction

norm preimage includes case, invisible/stress, apostrophe variants. Morph admits arbitrary unselected entries, comments/ignored tags; lemma_of discards POS/xp; synth offers multiple compatible surface forms.

### government_bits

rv_inf bit0, known rv_case bit case number; only prep/verb analyses inherit lemma government.

### paradigm_selection

Form xp2 augments lemma tags unless present; first xp marker keys paradigm. Selected читає xp2 yields unrequested читав xp2 synthesis.

### line_grammar

Only ASCII leading space signals form line; literal space splits form/tags; first # splits comment; malformed lines skip.

### normalization_transport

Drop seven listed invisible marks, normalize four apostrophe variants then Unicode lowercase; no general NFC normalization.


### tests

#### Evidence

Parent source checks (a fragment inherits only the behavior they actually exercise):

- morph::tests::lines_and_government
- morph::wave29::two_pass_synthetic_dictionary

Selected kg tests: 15 named outcomes, twice debug/twice release, equal sorted outcomes. Standalone actual global/build.rs: 3 named outcomes per run, twice debug/twice optimized; build_child is normally no-op, parent fixture invokes it against isolated synthetic seeds. Eight compiled source mutations (one per source) each compiled successfully and exited101 on the focused assertion; exact source restoration followed by positive rerun.

This fragment's untested branches remain source-derived. No live graph, DB, corpus, teacher, GPU or held-out evaluation was used. Command specs and numeric exits are retained in the external wave29 graphlang receipt. Strict kg Clippy reports existing source lints; see receipt.

### prospective

#### Prospective graph-language encoding model — 2026-10-31

Read all eight sources before edits. No optimization proposed. All executable fixtures are tiny invented strings, compressed temp files, or isolated subprocess directories; no repository corpus, live store, teacher, GPU or held-out execution.

- global/build.rs: walk sorted markdown paths; close a block on any fence, discard unclosed block; parse declarations, insert verb concepts, reject canonical duplicate codes, missing/duplicate links, unknown *_cats and duplicate principle ids; emit lexical concepts/index links, first-seen verb lemma. Auxiliary absurdity cells sort real entries but tale rows preserve input order. closed_data is a separate optional branch; failed reads become empty. Build effects are output writes, expressions before global.rs, not atomic. Model independently of kg. Tests will compile actual build.rs with rustc --test, helper tests plus a child test process driving main against synthetic seed/data directories. Bound cost O(B + C log C + LC + R log R), tables and generated text retained.
- kg/src/cols.rs: six parallel public vectors; push, sort tuple permutation, all-bit filter, binary search outgoing range requires sorted src; modulo-u64 delta/zigzag, exact byteplanes, zstd files written sequentially then count. Actual raw width is 32 bytes/edge, not header's 28. Empty mask retains all, parsed empty mask rejects. u32 sort indices truncate lengths >=2^32; malformed public column lengths can panic; LEB accepts trailing/noncanonical bytes, rejects >10 continuation groups but does not validate top-group overflow. Test endpoints, error branches and synthetic file roundtrip; no crash consistency guarantee.
- kg/src/gram.rs: u32 fields with last recognized tag wins, gender implies singular only when number zero, unknown POS=13 except empty POS=0, unknown tags ignored. implicit_subject copies number/gender/person then noun+nominative+PRON+IMPLICIT. Display can panic for arbitrary public bitpatterns; dotted display is not VESUM input. Tests order and implicit projection; O(tag bytes), bounded fields.
- kg/src/id.rs: heap/name vector, per-heap lazily loaded name arrays and hash maps, reserved local zero; append only suffixes. open creates keys directory; malformed heaps checked before key loading; duplicate serialized keys collapse map to last occurrence. New keys reject tabs/newlines after existing-key lookup. Heap max +1 can overflow; append buffering can report success before ignored drop flush errors. Test tiny persistence, kind conflict, corrupt consecutive indices, key rejection; no concurrent writer/crash test. Hash lookup expected O(1), heap scan O(H), key load/save O(bytes).
- kg/src/morph.rs: normalized form map and lemma/grammar synthesis map; two complete bz2 passes, vocabulary filters analyses then selected lemma/paradigm keys select synthesis. Normalization drops seven marks and maps four apostrophes then Unicode lowercase; split_line is literal space based. Government inherited only by verb/prep, xp form marker enters lemma key. Tiny bz2 fixture checks unseen vocabulary excluded but selected lemma's unrequested forms synthesized. O(2 decompressed bytes + retained analyses/forms).
- kg/src/uk.rs: tokenize Unicode with context joiners; punctuation first (input-order failure), empty/length/digit/conjunction/unknown then dash-with-verb gate. Proper/common filtering; enumerate finite predicate analyses, greedy attachment and case preferences; deduplicate equal Facts, accept exactly one. Scope children: token/gates, verbal/nominal construction, render completeness. Render compares normalized word multisets after synthesis and restored relation words; not roles/order. Costs bounded sentence words <=8, analysis alternatives unbounded; scans O(P*n^2*a), equality overhead for candidate facts. Test precedence, simple actual parse, agreement and normalization/check damage. No linguistic accuracy claim.
- kg/src/textgen.rs: frequency lexicographic pair conditional/global, dictionary-first tie; after-preposition third-person pronoun n-form pool; attributes depth <=4; 1..12 heads; subset DP O(n^2*2^n), O(n*2^n) memory; strict transition > retains first predecessor and final max tie chooses last. Empty heads rejects before private zero DP. Frequency u32 overflow profile dependent. Test form tie, head bound and real three-word generation, no corpus order training.
- kg/src/main.rs: pattern-matched CLI dispatch; read_tatoeba strict three fields but language ignored. tatoeba pipeline needs existing store before Registry open because names.tsv created first; parse_lines drops malformed lines/ends at first line I/O error; loads names and morphology before output truncate. sub validates mask before reading store, writes columns only without registry. stats equal-count order unstable HashMap ties. Test strict compressed reader, parse_lines synthetic integration, sub invalid mask precedence. Do not invoke tatoeba_uk or held-out scoring.

Composition hypothesis: Morph::load uses Gram then uk::parse produces Fact; render_check gives only multiset completeness; main encodes each member into registry-backed parallel columns with grammar and flags; textgen consumes Fact/Morph not encoded Edges directly. No read-edges-to-Fact reconstruction adapter exists here. global's lexical concept indices have no established Registry Id translation. Complement and preimage relations must preserve these separate tags. No meaningful percentage surrogate for categorical parse, identifiers, codec or effects is established; record executable approximant as unsupported.
