world-opchoice-learner
The groupant beside world/src/opchoice.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 source model | forward |
| ast | partial | ../syntax.json |
| composition | partial source model | composition |
| cost | partial source model | cost |
| descriptant | partial source model | epoch-memory |
| invariant | partial source model | invariant |
| tests | partial source model | checks |
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 |
|---|---|---|---|
world-opchoice-learner-behavior-complement | behavior_complement | partial source model | behavior-complement |
world-opchoice-learner-reverse-reconstruction | reverse_reconstruction | partial source model | reverse-reconstruction |
world-opchoice-learner-average-boundary | constraint_relation | partial source model | average-boundary |
world-opchoice-learner-ranking-projection | information_loss | partial source model | ranking-projection |
Model text
Book loading, bagged train, incremental Learner, persistence, ranked explanations and CLI.
forward
add retains gold-reachable examples and interns first-observed names. run advances each step, chooses first max predicted and first max gold, then updates occurrences iff predicted value differs. weights catches up lazy durations and divides by max(step,1). top lexically orders tied expressions and deduplicates answers.
invariant
Interned vectors align for internally constructed Learner. run trusts valid prepared ranges. Empty learner exports empty weights. Large score/history arithmetic and invalid caller ranges are outside safe bounded model.
cost
Prepared memory O(sum C*F); each epoch scans candidate features and updates two occurrence lists on error. Export O(W). Bagging multiplies learner work; all integer sums require bounded intermediates.
composition
Candidate enumeration feeds features and first-max scoring. Learner interns the same feature occurrences, preserves candidate order and updates toward the first highest-scoring gold-valued candidate. Text extraction and lexical environment must be fixed. top uses lexical expression ties unlike choose; parent ranking cannot silently substitute one for the other.
epoch-memory
2026-10-30: i128 oracle exposed unchecked arithmetic overflow. Checked operations now omit unrepresentable candidates, including MIN/-1 division; score and training overflow remain bounded-domain assumptions. Dense learner history and first-tie tests preserve existing behavior.
checks
See ../tests.md and native opchoice::wave8_models tests. Models are source-derived partial relations, with finite evidence rather than general proof. Syntax projection excludes macro expansion, name resolution and inferred types. No executable approximant: exact gates and categorical choices have no justified percentage metric here.
behavior-complement
Gold-unreachable items cannot enter prepared via add; correct-value predictions do not update weights. Invalid manually supplied run ranges can panic, so total safety is not claimed.
reverse-reconstruction
Averaged weights admit many prepared sequences, step counts and updates. Truncation and dropped zero coordinates erase information. Complete prepared features and step trace are needed for replay.
average-boundary
Independent dense history accumulates pre-update weights for two examples with duplicate IDs over epochs 0..6. Final raw weights alone do not determine average; test checks both.
ranking-projection
top loses same-value alternatives and orders equal scores lexically, while answer chooses first enumeration maximum. Reverse ranking relation retains discarded expressions and unobserved feature explanations.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/world/src/opchoice.rs.groupant/learner.groupant/