sort_moved (KFL §11: the list model of the radix sort)
ProvedNLogN.KFL.sort_movedThe following holds (Lean statement, in the scope of module Solutions.KFLSort):
theorem NLogN.KFL.sort_moved (hγκ : ∀ m, γ (κ m) = m) (hκγ : ∀ m, κ (γ m) = m)
(hκ : ∀ m < M, κ m < M) (hγ : ∀ m < M, γ m < M) {A : ℕ} (hA : M ≤ 2 ^ A)
(recs : ℕ → List ℤ) : rsort A (ent0 κ M recs) = ent1 κ γ M recs
Context. The lemma belongs to the part KFL §11: the list model of the radix sort: Entries are pairs (key, record). rpass i is one stable LSD pass on bit i, ones first
(this is what two stacks give: the 0-bucket is moved back first, the 1-bucket on top of it);
rsort A runs the passes 0, …, A-1. rsort_eq: with keys below 2^A and distinct, the
result is the unique list sorted by strictly decreasing key.
Formalization Note. This lemma belongs to the item-language (IL) layer of the integer-multiplication-kappa campaign: tape-level programs (register programs over 64 item stacks of the NLogN multitape framework, definition bundles IntMul_HvdH_M_Defs1–IntMul_HvdH_M_Defs8) that implement the data-movement primitives of the OpenAI preprint Integer multiplication below (field moves, row split/merge, shifts, the uniform Proposition 11 interchange, Lemma 12 with fine -per-element costs, Gaussian record primitives, Proposition 14 pieces) with exact list denotations from the array-model bundles IntMul_Kappa_K_Defs* and explicit cost bounds. All names refer to the definition bundles up to IntMul_Kappa_K_Defs18.
-- OpenAI-preprint / κ-improvement development (integer-multiplication-kappa), generated by skeleton subtraction.
import Definitions.Def_IntMul_Kappa_K_Defs18
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
set_option linter.unusedSimpArgs false
set_option linter.unusedVariables false
open NLogN
open NLogN.KFL
variable (κ γ : ℕ → ℕ) (M : ℕ)
variable {κ γ M}
theorem NLogN.KFL.sort_moved (hγκ : ∀ m, γ (κ m) = m) (hκγ : ∀ m, κ (γ m) = m)
(hκ : ∀ m < M, κ m < M) (hγ : ∀ m < M, γ m < M) {A : ℕ} (hA : M ≤ 2 ^ A)
(recs : ℕ → List ℤ) : rsort A (ent0 κ M recs) = ent1 κ γ M recs := by sorry