Radix sort and the check of neighbours #
Records are pairs of a flag (false: table entry, true: lookup) and a key of n letters over
an arbitrary alphabet B. After one stable bucket pass for each letter (srt), records with equal
keys sit in contiguous blocks preserving their original order (srt_eq). Hence every lookup
belongs to the table if and only if, after sorting, every lookup has the same key as the record
immediately preceding it (chk_table).
This generic multi-letter alphabet formulation is separate from the unsigned binary-word
imperative radix sort in CslibFrontier.Algorithms.WordRAM.RadixSort.
From VP ≠ VNP over every field [Ant26], module Nc.Sort.Radix.
Main definitions #
List.RadixSort.Rc: a record pairing a lookup/entry flag with aFin n → Bkey.List.RadixSort.pass: one stable distribution-and-collection pass along key coordinatej.List.RadixSort.srt: iteratepassover the firstjcoordinates.List.RadixSort.keys: allj-letter keys overbsin radix order.List.RadixSort.chk,List.RadixSort.headOk: neighbour equality and leading-entry predicates.
Main results #
List.RadixSort.srt_eq: exact bucket-filter expansion ofsrt.List.RadixSort.chk_srt: neighbour check afternpasses equalsheadOkon every key group.List.RadixSort.chk_table: after sorting a table followed by lookups,chkholds iff every lookup is in the table.List.RadixSort.length_srt:srtpreserves list length.
A record: a flag (false for a table entry, true for a lookup) and a key of length n.
Table entries followed by lookups: the sorted neighbour check succeeds iff every lookup is in the table.