From stack-machine executions to the platform Turing-machine multiplication predicate
ProvedNLogN.multipliesAt_of_execLet prog be a stack-machine program with stacks and procedures (procedure is the main program), let and . Suppose that for all bit strings of length there are a final state and a cost such that
- procedure , started from the initial state (all stacks empty, input position , empty output) on the input word (
inputCodes x y), executes to with exact cost ; - the output of is ;
- .
Then the compiled multitape Turing machine machineOf prog hP satisfies the platform predicate
i.e. on every input with it halts within steps with output tape .
This is the bridge from the program-level semantics to the machine model of Def_IntMul_MultitapeModel: each flat instruction is simulated by at most two Turing machine steps, plus one step to halt.
Formalization Note. machineOf compiles the structured program to flat code with jumps and calls, then to a MultitapeTM with tapes: the input tape, the output tape, a control tape holding return addresses, and one tape per stack. Exec is the big-step semantics with exact cost; bin and val are the platform's definitions.
-- 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 IntMul.Mach
variable {S P : ℕ}
theorem NLogN.multipliesAt_of_exec (prog : Fin P → Stmt S P) (hP : 0 < P) (n : ℕ) (T : ℝ)
(h : ∀ x y : List Bool, x.length = n → y.length = n → ∃ σ' c,
Exec (inputCodes x y) prog (prog ⟨0, hP⟩) (St.init S) σ' c ∧
σ'.out = bin (2 * n) (val x * val y) ∧ (2 * c + 1 : ℝ) ≤ T) :
MultipliesAt (machineOf prog hP) n T := by sorry