Documentation

CslibFrontier.Algorithms.Reachability.DoubleCounting.Round

Updating the double-counting round #

A successful transcript answers membership in the current round. Scan successors of that round to obtain its next frontier. Each new vertex contributes once to the count, and its distance is the next round index. Figure 2 of [RA00] increments once per qualifying predecessor and flags ties. Its accumulator agrees with the set-based update here when the next-round predecessor test succeeds. On a tied round the set-based tally still counts each newly reached vertex once. Under uniqueness in the current round, a new vertex has a unique shortest walk exactly when it has a unique predecessor in that round.

The checked diamond in CslibFrontierTests.LayeredDigraph uses isSome_iff to query a vertex outside the first round, then uses the predecessor criterion to show that uniqueness fails in the second. Scan provides a streaming replay of the bounded scan, and the native LogSpace.DoubleCounting module certifies the terminal comparison of binary tallies.

Main results #

noncomputable def Cslib.DoubleCounting.frontier {α : Type u_1} [Fintype α] (r : α → α → Prop) (w : Transcript α) :

The vertices outside the current round that have a predecessor selected in its scan.

theorem Cslib.DoubleCounting.mem_frontier_iff {α : Type u_1} [Fintype α] {r : α → α → Prop} {s v : α} {k : ℕ} {w : Transcript α} (hw : Passes r s k w) :
v ∈ frontier r w ↔ v ∈ round r s (k + 1) ∧ v ∉ round r s k

A valid scan identifies exactly the vertices added by the next round.

theorem Cslib.DoubleCounting.distance_eq_succ_of_mem_frontier {α : Type u_1} [Fintype α] {r : α → α → Prop} {s v : α} {k : ℕ} {w : Transcript α} (hw : Passes r s k w) (hv : v ∈ frontier r w) :
distance r s v = k + 1

A vertex first reached in the next round has distance exactly its index.

noncomputable def Cslib.DoubleCounting.nextTally {α : Type u_1} [Fintype α] (r : α → α → Prop) (k : ℕ) (w : Transcript α) (t : Tally) :

Add one count and the new distance for each vertex in the next frontier.

theorem Cslib.DoubleCounting.nextTally_eq_expected {α : Type u_1} [Fintype α] {r : α → α → Prop} {s : α} {k : ℕ} {w : Transcript α} (hw : Passes r s k w) :
nextTally r k w (expected r s k) = expected r s (k + 1)

From the exact previous tally and a successful scan, the update computes the exact tally.

theorem Cslib.DoubleCounting.existsUnique_shortest_iff_predecessor {α : Type u_1} [Fintype α] {r : α → α → Prop} {s v : α} {k : ℕ} {w : Transcript α} (hw : Passes r s k w) (hv : v ∈ frontier r w) (hprev : ∃! t : Transcript α, Passes r s k t) :
(∃! p : List α, List.IsChainFromTo r p s v ∧ p.length = distance r s v + 1) ↔ ∃! u : α, u ∈ round r s k ∧ r u v

Assuming uniqueness in the current round, a newly reached vertex has one shortest walk exactly when it has one predecessor in the current round.

theorem Cslib.DoubleCounting.existsUnique_passes_succ_iff {α : Type u_1} [Fintype α] {r : α → α → Prop} {s : α} {k : ℕ} {w : Transcript α} (hw : Passes r s k w) (hprev : ∃! t : Transcript α, Passes r s k t) :
(∃! t : Transcript α, Passes r s (k + 1) t) ↔ ∀ v ∈ frontier r w, ∃! u : α, u ∈ round r s k ∧ r u v

A unique current transcript extends to a unique next-round transcript exactly when all newly reached vertices pass the predecessor check.