Complete actual streaming coefficient ingestion, carry arithmetic and digit append
ProvedIntMul.StreamCarryStep.stream_carry_stepLet pre, x, tail, a, y, z and l be arbitrary binary words. Assume |x|=|y|=n=val(l)+1, put B=val(z)+1 and assume B≤n+1. From its explicit prepared incoming caller frame, the fixed fifteen-tape machine reads the next coefficient x at the interior root-input cursor, physically builds the x#y request using the previous carry y, performs the actual padded carry update, and appends the emitted low digit to the saved output prefix a. It halts at its exact complete terminal configuration after some number t of actual transitions with
The appended low digit is little-endian and has value (val(x)+val(y)) mod 2^B. Bank 11 contains the exact canonical n-bit next carry word for floor((val(x)+val(y))/2^B). The read-only root input pre++x++tail#l is preserved, with its cursor advanced by n; the output cursor advances by B. All fifteen tape contents and heads, the retained previous carry and restored width templates are specified. Every opening, delimiter write, copy, rewind, arithmetic transition and four caller returns is counted. The bound is independent of the earlier input and output prefix lengths. Descriptor, previous-carry and cursor preparation remain explicit caller obligations.
import Definitions.Def_IntMul_StreamCarryStep import Mathlib.Tactic import Theorems.Thm_IntMul_FramedBlockRead_read_block import Theorems.Thm_IntMul_PaddedCarryStep_padded_carry_step import Theorems.Thm_IntMul_FiniteCaller_simulate_run open IntMul IntMul.StreamCarryStep
theorem IntMul.StreamCarryStep.stream_carry_step (pre x tail a y z l : List Bool)
(h : x.length=y.length) (hn : x.length=val l+1)
(hB : CarryStep.blockSize z ≤ x.length+1) :
∃ t : ℕ, t ≤ 19*x.length+12*CarryStep.blockSize z+12*z.length+4*l.length+50 ∧
machine.step^[t] (initialFrame pre x tail a y z l)=finalFrame pre x tail a y z l ∧
(machine.step^[t] (initialFrame pre x tail a y z l)).state=machine.qHalt ∧
val (CarryStep.digitWord x y z).reverse=(val x+val y)%(2^CarryStep.blockSize z) ∧
val (PaddedCarryStep.nextCarryWord x y z)=(val x+val y)/(2^CarryStep.blockSize z) := by sorry