Elamur GroupantsโŒ•
โ˜ฐ

mlab-builtins-table-sorting

The groupant beside mlab/src/builtins/table.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

componentlabelwhere
approximantpartialapproximant
astpartial../syntax.json
costsymbolic source derivedinvariant
descriptantpresentdescriptant
invariantpartialinvariant
testspartial bounded parent evidencetests

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.

idtypelabelwhere
behavior_complementbehavior_complementpartial source derived modelbehavior_complement
reverse_reconstructionreverse_reconstructionpartial source derived modelreverse_reconstruction
index_transportindex_transportpartial source derived modelindex_transport
direction_policydirection_policypartial source derived modeldirection_policy
branch_relationbranch_relationpartial source derived modelbranch_relation
resource_costresource_costpartial source derived modelresource_cost

Model text

descriptant

mlab-builtins-table-sorting

Table sort resolves names/directions then sorted_rows; matrix sort interprets signed columns via abs as usize, copies real parts and class; second output is one-based original row positions.

Epoch 2026-10-31: isolated source-bound fragment over bytes [6880,10371); includes no claim beyond this relation. Source hash f1b0959092cfcdd3cbd171a48d252ce4c1e652b1e56ed030c160e7667d8cbb54.

approximant

sorting: forward relation

Table sort resolves names/directions then sorted_rows; matrix sort interprets signed columns via abs as usize, copies real parts and class; second output is one-based original row positions.

Domain: Well-shaped values and finite practical windows; effects delegated to it.fs. Physical filesystem not exercised.

Executable surrogate gap: no measured cheaper implementation with a useful scoped metric is supplied. Categorical/error/effect relations are exact obligations, not percent losses. Future numeric caps only1/2/5/10%.

invariant

sorting: invariant and cost

Internal zero-based order becomes idx+1 external indexing.

Single direction broadcasts; short direction vector defaults missing directions ascending.

Scope-specific cost: O(kn log n + nw) sorting/copying, O(nw) output; zero-based permutation stored O(n).

models

behavior_complement

Stable equal keys exclude row reversal. Fractional matrix column indices truncate rather than reject; complex imaginary components are not copied.

reverse_reconstruction

Output with permutation admits original row order via inverse permutation only when full data is retained; real-only matrix output cannot recover imaginary values.

index_transport

Internal zero-based order becomes idx+1 external indexing.

direction_policy

Single direction broadcasts; short direction vector defaults missing directions ascending.

branch_relation

Table sort resolves names/directions then sorted_rows; matrix sort interprets signed columns via abs as usize, copies real parts and class; second output is one-based original row positions.

resource_cost

O(kn log n + nw) sorting/copying, O(nw) output; zero-based permutation stored O(n).

tests

Evidence boundary

See ../tests.md for the actual selected source test and mutant. These tests sample the file, not every fragment branch. Stable equal keys exclude row reversal. Fractional matrix column indices truncate rather than reject; complex imaginary components are not copied. Other branches here are source-derived and unexecuted unless the parent test explicitly calls them.

This page in Markdown โ†’ https://md.groupants.elamur.ai/free/en/mova/mlab/src/builtins/table.rs.groupant/sorting.groupant/