The call loop (round six, `cLoopR_sp`)
ProvedJ6Seg.PreT.cLoopR_spThe call loop (general register sequence): W k the registers before step k, W' k
after the call of step k (which sets 11 := f k).
The following holds (Lean statement, in the scope of module Solutions.J6SegILPre6):
theorem J6Seg.PreT.cLoopR_sp {r : Fin HS} (hr : r ∈ rg) (hr12 : r ≠ 12) (s : IState HS) (v : Fin HS → ℤ) (c : Fin HS → List ℤ) {O : Fin HS} (hO : O ∉ rg)
(hO5 : O.val < 56) (hOC : O ≠ Cu) (hc : c Cu = []) {cl : RS} (hw : Cu ∉ cl.writes)
{A N : ℕ} (hA : 2 ≤ A) (hv : VB v A) (h24 : v r = N) (hN : N ≤ 2 ^ A) (f : ℕ → ℤ)
(W W' : ℕ → Fin HS → ℤ) (hW0 : W 0 = Function.update v 12 0)
(hWs : ∀ k, W (k + 1) = Function.update (W' k) 12 (k + 1))
(hW11 : ∀ k < N, W' k 11 = f k) (hW12 : ∀ k < N, W' k 12 = k)
(hWV : ∀ k < N, VB (W' k) A) {Cc : ℕ}
(hcl : ∀ k < N, ∀ cc : Fin HS → List ℤ,
Sp cl (encK s (J6Seg.PreT.RF (W k) cc)) (encK s (J6Seg.PreT.RF (W' k) cc)) Cc) :
Sp (cLoopR O cl r) (encK s (J6Seg.PreT.RF v c)) (encK s (J6Seg.PreT.RF (W N) (Function.update c O (rv f N ++ c O))))
(J6Seg.PreT.cE (.lit 0) (BW A) + (2 * 2000 * (BW A + 2) + N * (Cc + J6Seg.PreT.cE (.reg 11) (BW A) +
J6Seg.PreT.cE (.add (.reg 12) (.lit 1)) (BW A) + 8000 * (BW A + 2) + 30) + 32))
Context. B-line IL, pre-tables (B5), part 6: the call loop
cLoop O cl = U := 0; repeat N = v 24 times { cl; push X on O; U := U + 1 } where the call cl
sets X = v 11 := f U. cLoop_sp: it pushes f 0, …, f (N-1) onto O (so O gains rv f N);
the registers end as wS v f N (only 11, 12 change).
Formalization Note. Part of the Lean formalization of the round-six κ-improvement (integer-multiplication-kappa campaign, target IntMul.Kappa.jain_round6_framework). The statement is copied verbatim from the Lean development; the platform node carries the same declaration name. Definitions it mentions live in the IntMul_Kappa_R6_Defs* bundles (on top of the published κ bundles IntMul_Kappa_K_Defs*).
-- Round-six κ development (integer-multiplication-kappa), generated by skeleton subtraction. import Definitions.Def_IntMul_Kappa_R6_Defs68 set_option autoImplicit false set_option relaxedAutoImplicit false set_option maxHeartbeats 1000000 open J6Seg J6Seg.PreT open IntMul NLogN NLogN.KIL NLogN.RS IntMul.HvdH
theorem J6Seg.PreT.cLoopR_sp {r : Fin HS} (hr : r ∈ rg) (hr12 : r ≠ 12) (s : IState HS) (v : Fin HS → ℤ) (c : Fin HS → List ℤ) {O : Fin HS} (hO : O ∉ rg)
(hO5 : O.val < 56) (hOC : O ≠ Cu) (hc : c Cu = []) {cl : RS} (hw : Cu ∉ cl.writes)
{A N : ℕ} (hA : 2 ≤ A) (hv : VB v A) (h24 : v r = N) (hN : N ≤ 2 ^ A) (f : ℕ → ℤ)
(W W' : ℕ → Fin HS → ℤ) (hW0 : W 0 = Function.update v 12 0)
(hWs : ∀ k, W (k + 1) = Function.update (W' k) 12 (k + 1))
(hW11 : ∀ k < N, W' k 11 = f k) (hW12 : ∀ k < N, W' k 12 = k)
(hWV : ∀ k < N, VB (W' k) A) {Cc : ℕ}
(hcl : ∀ k < N, ∀ cc : Fin HS → List ℤ,
Sp cl (encK s (J6Seg.PreT.RF (W k) cc)) (encK s (J6Seg.PreT.RF (W' k) cc)) Cc) :
Sp (cLoopR O cl r) (encK s (J6Seg.PreT.RF v c)) (encK s (J6Seg.PreT.RF (W N) (Function.update c O (rv f N ++ c O))))
(J6Seg.PreT.cE (.lit 0) (BW A) + (2 * 2000 * (BW A + 2) + N * (Cc + J6Seg.PreT.cE (.reg 11) (BW A) +
J6Seg.PreT.cE (.add (.reg 12) (.lit 1)) (BW A) + 8000 * (BW A + 2) + 30) + 32)) := by sorry