Boolean-stack simulation of a finite-alphabet TM2 machine on the campaign encodings
ProvedQuantumMaxCutEnergy.tm2_to_boolean_stacksLet be an encoded input type with encoding , and let admit a polynomial-time certificate on the campaign's canonical output encoding in Mathlib's multi-tape model Turing.TM2ComputableInPolyTime, whose stack alphabets are arbitrary finite types. Then is computed, in polynomial time, by a program of the library's Boolean-stack language PolyProgram that keeps the same input and output encodings.
In words: a finite-alphabet multi-tape machine with a polynomial step bound can be simulated, step for step with polynomial overhead, by a machine all of whose stacks are Boolean. Each symbol of a finite stack alphabet is written as a fixed block of bits, using an injection into for a suitable ; a simulated step then pops one constant-size block from each of the finitely many stacks that the instruction touches and pushes the blocks prescribed by the simulated transition. Constant overhead per simulated step preserves polynomial time, and the input and output tapes carry lists of bits in the campaign encodings already, so no re-encoding is needed here.
This isolates the machine-model simulation from the output-frame conversion, which is the separate lemma QuantumMaxCutEnergy.ratio_frame_recode.
import Definitions.Def_QuantumMaxCutEnergyEstimationModel import Definitions.Def_QuantumMaxCutFiniteNumericRuntime import Mathlib open scoped BigOperators
theorem QuantumMaxCutEnergy.tm2_to_boolean_stacks
{α : Type} (ea : α → List Bool) (f : α → ℚ≥0)
(h : Nonempty (Turing.TM2ComputableInPolyTime ea QuantumMaxCutEnergy.encodeValue f)) :
Nonempty (OAI.MetricKMedian.Binary.PolyProgram ea QuantumMaxCutEnergy.encodeValue f) := by sorry