Every halted reverse-search run reaches restoration entry while still running
ProvedDirKECC1549.Main.reverse_search_halted_hits_restoregraph-algorithmsword-ram
For the fixed 146-instruction reverseSearchAlgorithm, consider any positive word width w, arbitrary initial memory M, and interpreter fuel f. If the execution from program counter zero is halted after f steps of fuel, then there is an interpreter fuel k, no larger than f, at which the machine is at program counter 111 and is still running:
No graph-layout, valid-root, memory-initialization, or word-modulus lower bound is assumed. This theorem concerns only the fixed program's control flow and does not assert successful termination from arbitrary input. It supplies the entry state of the restoration block from any successful halting execution.
Preamble
import Definitions.Def_DirKECC1549_Main_Machine import Definitions.Def_DirKECC1549_Main_ReverseSearchCode set_option autoImplicit false open WordRAM
Formal statement
namespace DirKECC1549.Main
theorem reverse_search_halted_hits_restore (w : Width) (mem : Memory w) (fuel : ℕ)
(hhalt : (runFrom reverseSearchAlgorithm.code w mem fuel).halted = true) :
∃ steps ≤ fuel,
(runFrom reverseSearchAlgorithm.code w mem steps).pc = 111 ∧
(runFrom reverseSearchAlgorithm.code w mem steps).halted = false := by sorry
end DirKECC1549.Main
Source
Control-flow/data-invariant decomposition of DirKECC1549.Main.reverse_search_core_exit, https://prove2.me/theorems/7652f015-be95-4325-b901-a8ae4343c1cf. Uses the explicit code in Definitions.Def_DirKECC1549_Main_ReverseSearchCode: instructions 0–110 form the search prefix, and counter 111 starts the restoring epilogue. Operational semantics are WordRAM.step and WordRAM.run in Definitions.Def_WordRAMEquivalence_Foundation1.