FM pointwise products by recursive calls
ProvedNLogN.fmPw_runsLet pF satisfy FMSpec pF iprog I n C: calling it multiplies any modulo (given PRM, RN, RF on top) within cost . Let be lists of equal length of canonical residues mod , with the bit length of at most . Assume V holds over , DX holds over , DL has on top, and PRM, RN, RF hold , , on top. Then fmPw pF runs from to the state where V, DX, and the products
are pushed onto P1 in reverse order (last on top), with cost at most
This is the only place where the procedure recurses: the pointwise products of the transformed sequences are computed by calls of FM at the smaller size, which yields the term in fmMain_runs.
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. FMSpec is a hypothesis about the procedure pF, discharged by induction on in the final proof.
-- 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.fmPw_runs (pF : Fin P) (n C : ℕ) (hFM : FMSpec pF iprog I n C) (s : IState NS)
(A B : List ℤ) (RV RX LL LP LN LF : List Item) (hl : A.length = B.length)
(hzK : zsz (A.length : ℤ) ≤ n) (hA : Canon (2 ^ n + 1) A) (hB : Canon (2 ^ n + 1) B)
(hV : s.G V = ints A ++ RV) (hX : s.G DX = ints B ++ RX) (hL : s.G DL = .int A.length :: LL)
(hP : s.G PRM = .int n :: LP) (hN : s.G RN = .int (2 ^ n) :: LN)
(hF : s.G RF = .int (2 ^ n + 1) :: LF) :
IRuns I iprog (fmPw pF) s
(((s.upd V RV).upd DX RX).upd P1 ((ints (pmulZ (2 ^ n + 1) A B)).reverse ++ s.G P1))
(A.length * (C + 2000 * (n + 3) + 30) + 1000 * (n + 3)) := by sorry