Elamur GroupantsโŒ•
โ˜ฐ

algorithm-wavelet-matrix-tests

The groupant beside algorithms/src/wavelet_matrix/tests.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
approximantpartialforward
astpartialsyntax.json
costpartialcost
descriptantpartialdescriptant
invariantpartialinvariant
testspartialtests

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
algorithm-wavelet-matrix-tests-behavior-complementbehavior_complementpartial source modelbehavior-complement
algorithm-wavelet-matrix-tests-reverse-reconstructionreverse_reconstructionpartial source modelreverse-reconstruction
algorithm-wavelet-matrix-tests-independent-oracledirect_reference_relationpartial source modelindependent-oracle
algorithm-wavelet-matrix-tests-boundariesinterval_boundary_coveragepartial source modelboundaries
algorithm-wavelet-matrix-tests-discriminationmutation_sensitivitypartial source modeldiscrimination

Model text

model

Wavelet matrix finite checks

2026-10-30. Original fixtures with no external problem statements.

domain

Compiled implementation; all ternary arrays of lengths 0..5 (364 arrays), their valid index intervals and selected thresholds. Additional fixed cases include MAX, 2^63, duplicates, snapshot mutation and invalid usize bounds.

forward

Independently copy and sort each selected slice, compare every kth position including the first missing position, and count predicates with iterator filter. range_count uses direct lower<=v<upper rather than count subtraction. Inspect prefix increment invariants. Each test returns pass or a Rust assertion failure; the intentional k<=z production mutant is separately compiled.

invariant

Oracle values derive from caller-owned Vec slices, never from matrix rows. Expected interval counts remain independent of bit traversal and stable partition details. Exhaustive enumeration covers 1+3+9+27+81+243 arrays.

cost

Bounded 364 snapshots plus fixed cases; per snapshot O(n^2) ranges and O(n log(n+1)) sort per range, selected constant threshold pairs and n kth checks. Production row construction O(64n) per snapshot. This is finite correctness evidence, not a benchmark or allocation stress test.

behavior-complement

Type behavior_complement. In the universe of candidate implementation behaviors and finite verdicts, exclude a passing verdict when any enumerated observation differs from the sorted-slice/predicate oracle. Failures outside enumerated cases are not excluded by a pass.

reverse-reconstruction

Type reverse_reconstruction. A passing verdict admits every implementation agreeing on the sampled observations, including incorrect implementations elsewhere. A kth failure at [0,1], k=1 narrows candidates to those returning the observed wrong value or branching incorrectly, but cannot uniquely identify a source defect. Full logged assertion provides a concrete fiber.

independent-oracle

Type direct_reference_relation. Sorting the actual selected slice and filtering original elements uses neither zero-prefix rank nor bit routing. Unsigned extrema distinguish numeric order from signed reinterpretation.

boundaries

Type interval_boundary_coverage. Empty intervals count zero; reversed and out-of-bounds intervals are absent. k at length and usize::MAX is absent. Value-bound reversal differs from equal-bound zero count.

discrimination

Type mutation_sensitivity. Replace k<z by k<=z in production. The named kth_zero_branch_control at [0,1], k=1 must fail an assertion, not compilation. Restored source bytes must equal the original before positive rerun.

tests

Four tests pass twice in each profile; see evidence.md for hashes and logs.

descriptant

Small exhaustive alphabets exercise duplicates and interior interval routing; fixed high-bit witnesses cover behavior absent from ternary values. This composition does not cover every large length or allocation failure. Partial syntax is not a semantic proof. No useful numerical surrogate of a finite test verdict is proposed; executable approximant remains an explicit gap.

evidence

Evidence, 2026-10-30

4 tests pass twice debug and twice release. Normalized named outcomes match within each profile. Compiled control kth_zero_branch_control: k<z changed to k<=z fails by named assertion (exit 101), then source is restored byte-for-byte and all focused tests pass. Syntax projections run twice and compare byte-for-byte.

External logs: $MOVA_DATA/runs/octopus-wave18-structures-2026-10-30/. Finite tests provide no universal proof or timing guarantee.

Source algorithms/src/wavelet_matrix/tests.rs: sha256 9711b619c5149f73a82d5ea6d622721ebb38e90c36775c19e7dc0d4a1055f23a

This page in Markdown โ†’ https://md.groupants.elamur.ai/free/en/mova/algorithms/src/wavelet_matrix/tests.rs.groupant/