Successful counter body recognizes one canonical block
ProvedTwoAgentSched.TotalTotal.CountPositive.countBody_success_exactcomplexity-theorycomputation
If one execution of the positive-counting loop body begins with an empty digit stack and finishes with a success status, then it consumed a canonical encoding of some natural number, left its suffix as the remaining input, restored the digit stack to empty, and increments the unary count exactly when the parsed number is nonzero. The existing status and count tails are preserved.
Preamble
import Definitions.Def_TwoAgentSched_TotalTotal_CountPositive open CookPvsNP ProjSchedTW.Complexity TwoAgentSched.TotalTotal.CountPositive
Formal statement
theorem TwoAgentSched.TotalTotal.CountPositive.countBody_success_exact
(input status count : List BSym) (out : Fin 4 → List BSym) (steps : ℕ)
(h : countBody.Exec (store4 input [] status count) out steps)
(hs : (out 2).head? = some .one) :
∃ (n : ℕ) (rest : List BSym), input = encNat n ++ rest ∧
out = store4 rest [] (.one :: .one :: status)
(if n = 0 then count else .one :: count) := by
sorry