Complete native cube-digit lookup scan #
The actual loop reads every original cube word once and returns the existing completed leaf index, exact star/P0 counts and a valid order flag. Its invariant counts fixed P0 occurrences with Mathlib's count, so no precomputed order or index certificate is needed.
structure Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxTable.LookupParameters (L C : ℕ) (x : WordRAM.Data registers) :
Persistent actual register contents used by a raw cube lookup scan.
Original depth.
Real input cube pointer.
Constant zero.
Constant one.
Constant P0 digit.
Constant radix and star digit.
theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxTable.exec_lookupLoop {w L m t C : ℕ} (x : WordRAM.Data registers) (π : MatrixMultiplication.Schonhage.Cube L) (hπ : MatrixMultiplication.Schonhage.IsBox m t π) (hx : LookupParameters L C x) (hread : ∀ i < L, x.mem (C + i) = rawCubeDigit π i) (hlevel : x.regs Reg.level = 0) (hpow : x.regs Reg.power = 1) (hcode : x.regs Reg.completion = 0) (hstars : x.regs Reg.stars = 0) (hpop : x.regs Reg.population = 0) (hseen : x.regs Reg.fixedSeen = 0) (hinvalid : x.regs Reg.invalid = 0) (hfit : WordRAM.Fits w (C + 10 ^ L + L + 20)) :
∃ (y : WordRAM.Data registers),
WordRAM.ExecWithin w (WordRAM.Code.loop (WordRAM.Cond.lt Reg.level Reg.levels) lookupDigit) x y (18 * L + 2) ∧ y.mem = x.mem ∧ LookupParameters L C y ∧ y.regs Reg.level = L ∧ y.regs Reg.power = 10 ^ L ∧ y.regs Reg.completion = ↑(Encoding.leafIndex π.starsToP0) ∧ y.regs Reg.stars = π.starLevels.card ∧ y.regs Reg.population = π.starLevels.card + π.P0Levels.card ∧ y.regs Reg.invalid = 0 ∧ ∀ (i : Fin registers), ¬LookupLocal i → y.regs i = x.regs i
The native loop computes every final lookup scalar from the actual cube words.