Labels are walk lengths (invariant)
ProvedBertsekasDP.label_correcting_invariantThe label invariant of the label correcting method (Bertsekas, Vol. I, §2.3.1, stated in the text preceding Prop. 2.3.1). At every state reachable from the initial state — after any number of iterations, with any removal order — the labels are not arbitrary numbers but lengths of actual walks:
- for every node , either , or there is a walk from the origin to with
- either , or there is a walk from to the destination with .
Neither claim asserts optimality: the exhibited walk need not be shortest. What the invariant provides is the "" half of correctness — since is always the length of some genuine walk, it can never fall below — and it is also the engine of the termination argument, which counts the possible label values.
Formalization Note No hypothesis on arc or cycle lengths is needed here; the invariant holds for arbitrary real lengths. In the second disjunct the label is a coerced real number, so the statement also records that a non-infinite label is finite (never ). For the one-element walk , of length , is among the witnesses.
import Mathlib import Definitions.Def_BertsekasSPGraph import Definitions.Def_BertsekasLCState
namespace BertsekasDP
theorem label_correcting_invariant {V : Type} [Fintype V] [DecidableEq V]
(G : BertsekasSPGraph V) (σ : BertsekasLCState V)
(hreach : Relation.ReflTransGen (BertsekasLCStep G) (BertsekasLCInit G) σ) :
(∀ j : V, σ.label j = ⊤ ∨
∃ l, BertsekasIsWalkFrom G G.s j l ∧
σ.label j = (BertsekasWalkLength G l : EReal)) ∧
(σ.upper = ⊤ ∨
∃ l, BertsekasIsWalkFrom G G.s G.t l ∧
σ.upper = (BertsekasWalkLength G l : EReal)) := by sorry
end BertsekasDPRead-back
What the Lean code literally says, in plain math · claude-fable-5
Let be any finite type with decidable equality, any BertsekasSPGraph on (origin , destination ), and any state reachable from by the reflexive–transitive closure of (zero or more steps; the zero-step case is included). No assumption about cycle lengths is made in this theorem. The conclusion is a conjunction of two statements:
- For every vertex : either , or there exists a list with (nonempty, consecutive pairs are arcs, starting at , ending at ) such that
the right-hand side being the coercion of a real number, so the second disjunct entails that the label is a finite value (neither nor ). (For the singleton walk , of length , is among the candidate witnesses.) The disjunction is inclusive and asserts nothing about which walk is exhibited — not that it is shortest, only that some walk from to has exactly the label's value as its length.
- Either , or there exists a list with such that , again with no claim of optimality — only that the upper value is the exact length of some actual walk from to .
The theorem says nothing about the open set of and does not relate labels to the upper value or to shortest distances. The proof is left as sorry.
Confirmed by the mission captain (proposal self-audit).