Deterministic loading, comparison, and copy routines of `ampCore`
ProvedQuantumKtSoI.ampCore_routinesEstablishes the exact deterministic behavior and step bounds of the three classical subroutines of the repetition machine ampCore M r in Lemma 3.10 of Myrisiotis (Failure of Symmetry of Information for Quantum Computations, STOC 2027 submission, pp. 25–29): (1) Loading copies to all private input tapes and returns all heads (including qubit companions) to cell in exactly steps, entering ampRun 0 init ∅ in the -fold tensor state; (2) Comparison (ampNextCmp) compares the halted output of copy against every remaining halted partner above lo in at most steps, updating the agreement counter accurately while preserving the squared norm of every copy and leaving non-halted copies untouched; (3) Copy (ampCopy) copies the winning output onto ampOut and enters ampFin in at most steps while preserving the branch squared norm.
import Mathlib import Definitions.Def_QuantumKtSoI_Desc import Definitions.Def_QuantumKtSoI_RunSafe import Definitions.Def_QuantumKtSoI_AmpTensor open Classical namespace QuantumKtSoI
theorem ampCore_routines :
(∀ {M : Machine} {r : ℕ+}, RunSafe M → ∀ x : List Bool,
∃ ρ_load : List (ampCore M r).Record,
ρ_load.length = 2 * x.length + 3 ∧
(∀ j (hj : j < ρ_load.length), (ampCore M r).branch x (ρ_load.take j) ≠ 0 ∧
∀ C ∈ ((ampCore M r).branch x (ρ_load.take j)).support, C.record = ρ_load[j]) ∧
(ampCore M r).branch x ρ_load =
ampTensor M r (ampRun ⟨0, r.pos⟩ (fun _ => M.init) ∅) x (fun _ => M.branch x [])) ∧
(∀ {M : Machine} {r : ℕ+}, RunSafe M → ∀ (i : Fin r) (cs : Fin r → M.Q) (H : Finset (Fin r))
(x : List Bool) (s : ℕ) (u : Fin r → List Bool) (c_out : Fin r → ℤ → Sym),
(∀ k ∈ H, (u k).length ≤ s) →
(∀ k ∈ H, OutputShaped (u k) (c_out k)) →
∀ (lo : Option (Fin r)) (cnt : ℕ),
cnt + ((H.erase i).filter fun j => match lo with | none => True | some j₀ => j₀ < j).card ≤ (r : ℕ) →
∀ (ρ_A : List (ampCore M r).Record) (V : Fin r → (M.Config →₀ ℂ)),
(∀ k, V k ≠ 0) →
(∀ k, ∀ D ∈ (V k).support, D.state = cs k) →
(ampCore M r).branch x ρ_A = ampTensor M r (ampNextCmp i cs H lo cnt) x V →
i ∈ H →
(∀ k ∈ H, ∃ h_k : ℕ, h_k ≤ s ∧ ∀ D ∈ (V k).support, D.cont M.outT = c_out k ∧ D.head M.outT = h_k) →
let rest := (H.erase i).filter fun j => match lo with | none => True | some j₀ => j₀ < j
let cnt_end := cnt + (rest.filter fun j => u i = u j).card
∃ (ρ_all : List (ampCore M r).Record) (V' : Fin r → (M.Config →₀ ℂ)),
ρ_all.length ≤ rest.card * (3 * s + 3) ∧
(∀ k (hk : k < ρ_all.length), (ampCore M r).branch x (ρ_A ++ ρ_all.take k) ≠ 0 ∧
∀ C ∈ ((ampCore M r).branch x (ρ_A ++ ρ_all.take k)).support, C.record = ρ_all[k]) ∧
(ampCore M r).branch x (ρ_A ++ ρ_all) = ampTensor M r (ampDecide i cs H cnt_end) x V' ∧
(∀ k, V' k ≠ 0) ∧
(∀ k, M.sqNorm (V' k) = M.sqNorm (V k)) ∧
(∀ k, ∀ D ∈ (V' k).support, D.state = cs k) ∧
(∀ k ∉ H, V' k = V k) ∧
(∀ k ∈ H, ∃ h_k : ℕ, h_k ≤ s ∧ ∀ D ∈ (V' k).support, D.cont M.outT = c_out k ∧ D.head M.outT = h_k)) ∧
(∀ {M : Machine} {r : ℕ+}, RunSafe M → GateSafe (ampCore M r) → ∀ (i : Fin r)
(x : List Bool) (s : ℕ) (ρ_A : List (ampCore M r).Record)
(u_i : List Bool) (c_i : ℤ → Sym) (h_i : ℕ),
u_i.length ≤ s → OutputShaped u_i c_i → h_i ≤ s →
(ampCore M r).branch x ρ_A ≠ 0 →
(∀ C ∈ ((ampCore M r).branch x ρ_A).support,
C.state = ampCopy i false ∧
C.cont (ampCp M r i M.outT) = c_i ∧ C.head (ampCp M r i M.outT) = h_i ∧
C.cont (ampOut M r) = ampBlankTape ∧ C.head (ampOut M r) = 0) →
∃ ρ_cp : List (ampCore M r).Record,
ρ_cp.length ≤ 2 * s + 2 ∧
(∀ k (hk : k < ρ_cp.length), (ampCore M r).branch x (ρ_A ++ ρ_cp.take k) ≠ 0 ∧
∀ C ∈ ((ampCore M r).branch x (ρ_A ++ ρ_cp.take k)).support, C.record = ρ_cp[k]) ∧
(ampCore M r).sqNorm ((ampCore M r).branch x (ρ_A ++ ρ_cp)) =
(ampCore M r).sqNorm ((ampCore M r).branch x ρ_A) ∧
(ampCore M r).branch x (ρ_A ++ ρ_cp) ≠ 0 ∧
∀ C ∈ ((ampCore M r).branch x (ρ_A ++ ρ_cp)).support,
C.state = ampFin ∧ C.output = u_i) := by sorry
end QuantumKtSoI