Actual cube-digit lookup step #
The native scan reads a real cube digit, checks its alphabet and order, and updates the completed-leaf code and star/P0 counts. The step theorem consumes ordinary scalar and memory readback, with all intermediate fits derived from one address/depth envelope.
def Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxTable.LookupLocal (i : Fin registers) :
Registers modified by the actual lookup digit scan.
Instances For
@[instance_reducible]
theorem Cslib.Algorithms.WordRAM.MatrixMultiplication.Schonhage.BoxTable.exec_lookupDigit {w L k C d s f c v : ℕ} (x : WordRAM.Data registers) (hk : k < L) (hd : d ≤ 10) (hs : s ≤ k) (hf : f ≤ k) (hc : c < 10 ^ k) (_hv : v ≤ 1) (horder : d = 10 → v = 0) (hC : x.regs Reg.cube = C) (hread : x.mem (C + k) = d) (hlevel : x.regs Reg.level = k) (hstars : x.regs Reg.stars = s) (hpop : x.regs Reg.population = f) (hcode : x.regs Reg.completion = c) (hseen : x.regs Reg.fixedSeen = v) (hinvalid : x.regs Reg.invalid = 0) (hpow : x.regs Reg.power = 10 ^ k) (h0 : x.regs Reg.nil = 0) (h1 : x.regs Reg.one = 1) (h9 : x.regs Reg.nine = 9) (h10 : x.regs Reg.ten = 10) (hfit : WordRAM.Fits w (C + 10 ^ L + L + 20)) :
∃ (y : WordRAM.Data registers),
WordRAM.ExecWithin w lookupDigit x y 16 ∧ y.mem = x.mem ∧ y.regs Reg.level = k + 1 ∧ y.regs Reg.power = 10 ^ (k + 1) ∧ y.regs Reg.completion = c + (if d = 10 then 9 else d) * 10 ^ k ∧ (y.regs Reg.stars = s + if d = 10 then 1 else 0) ∧ (y.regs Reg.population = f + if d = 9 ∨ d = 10 then 1 else 0) ∧ (y.regs Reg.fixedSeen = if d = 9 then 1 else v) ∧ y.regs Reg.invalid = 0 ∧ ∀ (i : Fin registers), ¬LookupLocal i → y.regs i = x.regs i
The real scan preserves a valid prefix and charges both failed branch instructions.