qagen-select-ranking
The groupant beside qagen/src/select.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 |
| 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 |
|---|---|---|---|
qagen-select-ranking-complement | behavior_complement | partial source model | behavior-complement |
qagen-select-ranking-reverse | reverse_reconstruction | partial source model | reverse-reconstruction |
qagen-select-ranking-specialization | round_robin_prefix | partial source model | specialization |
Model text
forward
Group supplied pool indices by document; sort within each by (seeded key hash,index), label rank r; globally sort (r,document hash,index), take k. Sorting resolves randomized HashMap traversal.
behavior-complement
Exclude later per-document rank before an earlier available rank. No random iteration-order tie decides the result. Duplicate pool indices are outside the production pool construction invariant.
reverse-reconstruction
Output prefixes permit all compatible pools whose first k sorted rank triples are those indices. Unselected suffixes and hash collisions prevent unique reconstruction; fixed supplied all/pool/seed reconstruct the output exactly.
invariant
Source-bound operational relation over supplied finite inputs; deterministic observations under fixed order and seed. No corpus/distribution assumption. Integer quota arithmetic assumes 32/64-bit usize.
cost
P pool indices: O(P log P) sorting plus key hashing, O(P) temporary storage.
specialization
Type round_robin_prefix: scoped observation above, exact intended relation, no approximation-error budget asserted.
checks
selection_order_filter_skip_balance_and_rounds. See ../evidence.md for actual profiles and negative controls.
epoch-memory
2026-10-30: model written from the existing mechanism before numerical repair. Source hash "0c35caf4eda91c0a5d36bce728f3846b360b483a66fa4ca3c884964839cd2554". Finite witnesses constrain this relation, not a general proof.
This page in Markdown โ https://md.groupants.elamur.ai/free/en/mova/qagen/src/select.rs.groupant/ranking.groupant/