FM parameter computation pushes the rulers for the next level
ProvedNLogN.fmParams_runsLet pP be a procedure whose body is pow2Body pP. Let , with the parameters fmL, fmB, fmK, fmM, fmQ, fmN' of (as in fmMain_runs). Assume , , , , and that PRM has on top. Then fmParams pP runs from to the state obtained by pushing
onto the respective stacks (all other stacks unchanged), with cost at most
These rulers ( items) drive the shifts and splits of the subsequent segments, and the new ring on RN/RF together with on PRM sets up the recursive calls. The computation uses bit lengths and a recursive power-of-two procedure, so its cost is .
Formalization Note. States are IState NS records with item stacks G : Fin NS → List Item (head = top), input pointer ip and output out; s.upd X L replaces stack X by L; ints A is the list of integer items of A. The named stacks (ARG, PRM, RN, RF, DX, DL, …) are fixed indices in Fin 32. IRuns I iprog p s s' c means that p executes from s to exactly s' with some cost , so costs are upper bounds; the program text iprog and input I are arbitrary unless constrained.
-- Schönhage–Strassen multitape-TM development (NLogN), generated by skeleton subtraction.
import Definitions.Def_IntMul_SS_Defs2
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open NLogN
open IntMul
variable {P : ℕ} {I : List Sym} {iprog : Fin P → IStmt NS P}
theorem NLogN.fmParams_runs (pP : Fin P) (hP : iprog pP = pow2Body pP) (s : IState NS) (N : ℕ)
(LP : List Item) (hB : fmB N ≤ fmL N / 2) (hk : fmK N ≤ fmN' N) (hn1 : 1 ≤ fmN' N)
(hnN : fmN' N ≤ N) (hQ : fmQ N ≤ N) (hℓ : fmL N ≤ N) (hPRM : s.G PRM = .int N :: LP) :
IRuns I iprog (fmParams pP) s
((((((((((s.upd DL (.int (2 ^ fmK N) :: s.G DL)).upd RM (.int (2 ^ fmM N) :: s.G RM)).upd
RQ (.int (2 ^ fmQ N) :: s.G RQ)).upd DE (.int (2 ^ (2 * fmQ N)) :: s.G DE)).upd
RN (.int (2 ^ fmN' N) :: s.G RN)).upd RF (.int (2 ^ fmN' N + 1) :: s.G RF)).upd
W2 (.int (2 ^ (fmN' N - fmK N)) :: s.G W2)).upd HB (.int (2 ^ (fmN' N - 1)) :: s.G HB)).upd
PRM (.int (fmN' N) :: s.G PRM)))
(1000 * (fmL N + 1) ^ 2 + 1000 * (fmB N + 1) ^ 2 + 30000 * (fmL N + 3) +
180000 * (N + 3)) := by sorry