Exact writable dyadic tape replay with a geometric cleanup bound
ProvedPvsNP.HennieStearnsBuffer.writable_run_exact_with_geometric_chargeConsider a two-sided writable tape over an alphabet with a distinguished blank symbol. An instruction writes a symbol at the head and then moves left, stays in place, or moves right. Both sides are initially blank. A deterministic buffer represents the tape by a center symbol and a finite sequence of layers, indexed from . In layer , each side holds zero, one, or two blocks of size , and the two sides together hold exactly two such blocks. The represented view treats all unallocated cells as blank.
A move selects the first layer that contains a symbol on the side being entered and redistributes the intervening layers. If the current layers do not contain such a symbol, the buffer first allocates a balanced blank layer. Each cleanup records its order and whether the selected layer is unbalanced afterward. A stay performs no cleanup.
For an instruction list of length , ordinary execution and buffered execution have the same final tape view. The layer capacities are preserved. The cleanup schedule starts with no unbalanced layers and has at most events. If the recorded cleanup orders are , then
Here is the binary length, with . The bound quantifies the geometric charge of a writable buffer even when the head repeatedly changes direction. It isolates the storage and scheduling part of multitape simulation.
import Definitions.Def_HennieStearnsWritableBuffer set_option autoImplicit false open PvsNP.HennieStearnsBuffer
theorem PvsNP.HennieStearnsBuffer.writable_run_exact_with_geometric_charge {A : Type} (blank : A) (instructions : List (A × Turn)) :
let initial := blankBuffer blank
let result := runBuffer blank initial instructions
FitsFrom 0 result.1.layers ∧
glimpse blank result.1 = runSnapshot (glimpse blank initial) instructions ∧
physicalSchedule (fun _ => false) result.2 ∧
result.2.length ≤ instructions.length ∧
bill (result.2.map Prod.fst) ≤ instructions.length*instructions.length.size := by sorry