Actual two-tape word reversal in exactly 2n+3 transitions
ProvedIntMul.TapeReverse.reverse_first_operandalgorithmsfixed-tape-routinginteger-multiplicationturing-machines
For arbitrary binary operands x,y, the fixed two-tape, five-symbol, four-state reversal machine halts with exact output reverse(x) in 2|x|+3 actual transitions. It leaves the entire input x#y unchanged, the input head at the original start marker, the output head just after reverse(x), and the complete final configuration equal to the specified frame. Empty words and arbitrary second operands are included. Scanning to the delimiter, changing direction, all reverse-copy steps and halting are charged; the table uses only finite state and scanned symbols.
Preamble
import Definitions.Def_IntMul_TapeReverse import Mathlib.Data.List.GetD import Mathlib.Data.List.TakeDrop import Mathlib.Tactic open IntMul.TapeReverse
Formal statement
theorem IntMul.TapeReverse.reverse_first_operand (x y : List Bool) :
machine.HaltsWithOutput x y (2*x.length+3) x.reverse ∧
machine.step^[2*x.length+3] (machine.initCfg x y)=frame x y 0 .halt := by sorrySource
Original fixed-tape word reversal for least-significant-first digit routing in the integer multiplication construction. Written by Codex.