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

# 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

- **kind:** groupant_fragment
- **status:** partial source bound model
- **source:** [`qagen/src/select.rs`](https://github.com/ElamurAI/mova-free/blob/main/qagen/src/select.rs)
- **source SHA-256:** `0c35caf4eda91c0a…`
- **covers:** 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. (bytes 8454–9070)
- **part of:** [qagen-select](https://md.groupants.elamur.ai/free/en/mova/qagen/src/select.rs.groupant/)
- **repository folder:** [`qagen/src/select.rs.groupant/ranking.groupant`](https://github.com/ElamurAI/mova-free/tree/main/qagen/src/select.rs.groupant/ranking.groupant)
- **repository commit:** `855da7bd4a7b`

> **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](#forward) |
| **ast** | partial | `../syntax.json` |
| **cost** | partial source model | [cost](#cost) |
| **descriptant** | partial source model | [epoch-memory](#epoch-memory) |
| **invariant** | partial source model | [invariant](#invariant) |
| **tests** | partial source model | [checks](#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](#behavior-complement) |
| `qagen-select-ranking-reverse` | reverse_reconstruction | partial source model | [reverse-reconstruction](#reverse-reconstruction) |
| `qagen-select-ranking-specialization` | round_robin_prefix | partial source model | [specialization](#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.
