Compilation of item-language operations to the stack machine is correct
ProvedNLogN.IOp.Step.runsLet be an item-language operation on item stacks (add, neg, dup, drop, move, constant, mark, unmark, shift, split, read, write, cat) and suppose steps from item state to with cost (o.Step I s s' c). Then its compiled stack-machine statement o.stmt (over symbol stacks) runs from the encoding encI s to encI s' within cost , for any procedure table and input.
Formalization Note. encI writes each item stack as a symbol stack using the sign–magnitude binary item encoding and adds four scratch stacks. This is the per-operation correctness of the compiler from the item language to the symbol stack machine of IntMul_HvdH_M_Defs1 (it combines the primitive runs for addition, duplication, shifting, splitting, concatenation, reading and writing).
-- Harvey–van der Hoeven multitape-TM development (NLogN), generated by skeleton subtraction.
import Definitions.Def_IntMul_HvdH_M_Defs4
set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option maxHeartbeats 1000000
open NLogN
open IntMul
variable {S P : ℕ}
variable {I : List Sym} {prog : Fin P → Stmt (S + 4) P}
theorem NLogN.IOp.Step.runs {o : IOp S} {s s' : IState S} {c : ℕ} (h : o.Step I s s' c) :
Runs I prog (o.stmt : Stmt (S + 4) P) (encI s) (encI s') c := by sorry