Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Initialization establishes the concrete invariant at the first queue-test visit

Proved
DirKECC1549.Main.reverse_search_queue_first_visit

by parclytaxel · Nov 14, 2026 · Mathlib 0df444a (Lean v4.33.1)

graph-algorithmsword-ram

Let G have n vertices and m edges with root r, and let original memory M contain GraphLayout G and the root at parameter cell 5B+2, where B=n+2m+3. Assume

32B+256≤2w.32B+256\le2^w.32B+256≤2w.

Suppose execution of the fixed reverseSearchAlgorithm reaches a running state at counter 70 after fuel f, and no smaller fuel gives a running state at counter 70. Then that state satisfies

ReverseSearchQueueInvariant⁡(G,r,M,sf).\operatorname{ReverseSearchQueueInvariant}(G,r,M,s_f).ReverseSearchQueueInvariant(G,r,M,sf​).

This is the one-time initialization obligation: it concerns only the first running visit to the queue test. The concrete invariant includes the fixed registers and array bases, saved original register words, the unchanged input region, parent and abstract scan data, queue/discovery-list agreement, visited flags, and processed-prefix coverage. There is no later-halt or running-time assumption.

Preamble
import Definitions.Def_DirKECC1549_Main_ReverseSearchQueueInvariant
set_option autoImplicit false
open WordRAM
Formal statement
namespace DirKECC1549.Main

theorem reverse_search_queue_first_visit
    (n m : ℕ) (G : Fin m → Fin n × Fin n) (r : Fin n)
    (w : Width) (mem : Memory w) (steps : ℕ)
    (hwidth : 32 * blk n m + 256 ≤ 2 ^ w.bits)
    (hgraph : GraphLayout G mem)
    (hroot : (mem (paramCell n m 2)).toNat = r)
    (hpc : (runFrom reverseSearchAlgorithm.code w mem steps).pc = 70)
    (hrunning : (runFrom reverseSearchAlgorithm.code w mem steps).halted = false)
    (hfirst : ∀ j < steps,
      ¬ ((runFrom reverseSearchAlgorithm.code w mem j).pc = 70 ∧
        (runFrom reverseSearchAlgorithm.code w mem j).halted = false)) :
    ReverseSearchQueueInvariant G r mem
      (runFrom reverseSearchAlgorithm.code w mem steps) := by sorry

end DirKECC1549.Main
Source
Initialization/preservation decomposition of DirKECC1549.Main.reverse_search_dequeue_invariant, https://prove2.me/theorems/ce954fc0-ecef-4653-a28a-65dc63c36dda. The concrete assertion is Definitions.Def_DirKECC1549_Main_ReverseSearchQueueInvariant; actual instructions are reverseSearchAlgorithm in Definitions.Def_DirKECC1549_Main_ReverseSearchCode. PCs 0–69 initialize the search; PC 70 tests the queue; PCs 71–110 process a dequeued vertex and incoming-edge scans.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me