Goldberg–Tarjan Relabel-to-Front Scheduler and Combinatorial Potentials #
Pure Lean step toward #3373 formalizing the relabel-to-front topological list maximum-flow
scheduler (following [GT88], Sections 3–4; [CLRS09], Section 26.5) on the generic
push–relabel framework of CslibFrontier.Algorithms.Lean.MaxFlow.PushRelabel, with maximum-flow and
minimum-cut correctness, PushRelabel push/relabel operation-count bounds, and pure state
potentials (curPotential, rtfMeasure) consumed by
CslibFrontier.Algorithms.WordRAM.PushRelabel. This module states pure correctness and
combinatorial operation/potential bounds, not machine running times.
Model and source mapping #
- Adjacency coverage (
IsAdjacency): neighbor listsadj : V → List Vcovering every non-loop pair(u, v)with0 < N.cap u v + N.cap v u(matchingAdjValidonFin n). - Current-arc state and scan potential (
CAState,CurrentArcInv,curPotential): pairs aPushRelabel.State Nwith an unscanned neighbor suffixcur uofadj uat each vertexuwhose scanned prefix has no admissible arc (¬ (0 < resCap u w ∧ height u = height w + 1)). The pure state potentialcurPotentialstrictly decreases by1on each non-admissible cursor step, is preserved by pushes, and does not increase on valid relabels. - Discharge (
dischargeLoop,discharge): repeatedly pushes along the head ofcur uwhen admissible, drops the head ofcur uotherwise, or relabelsuand resetscur u := adj uwhencur u = [], untiluis no longer active, returning thePushRelabeloperation run, finalCAState, and whether a relabel occurred. - Relabel-to-front (
RTFState,rtfMeasure,rtfLoop,relabelToFrontWith): maintains a duplicate-free listdone ++ todoofV \ {N.s, N.t}in topological order of the admissible network (TopoOrder), with every vertex indoneinactive. Discharging the headuoftodomovesuto the front (done' = [u],todo' = done ++ rest) ifuwas relabeled and advances pastu(done' = done ++ [u],todo' = rest) otherwise, strictly decreasing the pure phase potentialrtfMeasureat every step.
Main definitions #
Cslib.Algorithms.Lean.MaxFlow.Network.RelabelToFront.IsAdjacency,exactAdj.Cslib.Algorithms.Lean.MaxFlow.Network.RelabelToFront.CAState,CAState.init,CurrentArcInv,CAInv,curPotential,DischargeOutput,dischargeFuel,dischargeLoop,discharge.Cslib.Algorithms.Lean.MaxFlow.Network.RelabelToFront.Before,TopoOrder,RTFState,RTFState.init,RTFInv,rtfMeasure,rtfFuel,rtfLoop.Cslib.Algorithms.Lean.MaxFlow.RelabelToFrontOutput,relabelToFrontWith,relabelToFront,relabelToFrontDense,relabelToFrontExact,tabulateCA,tabulateRTF,nonTermFin.
Main results #
Cslib.Algorithms.Lean.MaxFlow.Network.RelabelToFront.discharge_spec,curPotential_discharge_le: pure specification ofdischarge, proving preservation ofCAInv, validity of thePushRelabelrun, inactivity ofu, at most one nonsaturating push, admissible arc invariants forrelabeled = falseandrelabeled = true, and monotonicity ofcurPotential.Cslib.Algorithms.Lean.MaxFlow.Network.RelabelToFront.curPotential_init,curPotential_init_le_of_nodup,curPotential_init_exactAdj_le,rtfMeasure_init,rtfMeasure_init_le,rtfLoop_step: pure potential bounds (2 |V| ∑_{u ≠ s, t} |adj u|,≤ 2 |V|³for duplicate-free lists,≤ 4 n |E|forexactAdj, and(|V| - 2) * ((|V| - 2) * (2 |V| - 1) + 1) ≤ 2 |V|³forrtfMeasure) and one-step unfolding ofrtfLoop.Cslib.Algorithms.Lean.MaxFlow.relabelToFrontWith_correct,relabelToFrontWith_bounds: pure correctness and combinatorialPushRelabeloperation-count step (#3373), proving termination in a maximum flow and minimum gap cut of equal value after a validPushRelabelrun with at most2 |V|²relabels,2 |V| |E|saturating pushes,(|V| - 2) * ((|V| - 2) * (2 |V| - 1) + 1) ≤ 2 |V|³nonsaturating pushes, and4 |V|³total push/relabel operations.Cslib.Algorithms.Lean.MaxFlow.relabelToFront_correct,relabelToFrontDense_correct,relabelToFrontExact_correct: executableFin nspecializations with the same correctness and push/relabel operation-count bounds.
Limitations #
This module defines pure mathematical functions (Preflow.relabelHeight over Finset.univ,
Function.update, and list concatenation carry no machine cost here) and makes no machine
running-time claim. Dense standard-basis Word-RAM O(|V|³) compilation is in
CslibFrontier.Algorithms.WordRAM.PushRelabel; sparse CSR Word-RAM compilation, FIFO and
highest-label (O(|V|² √|E|)) schedulers, gap and global-relabelling heuristics, dynamic trees,
and verified primary-source locators remain open (#3373).
References #
Adjacency coverage #
State of the current-arc push–relabel machine: a PushRelabel.State N together with the
unscanned suffix cur u of adj u at every vertex u.
- pr : PushRelabel.State N
The underlying preflow and height function.
- cur : V → List V
Unscanned suffix of
adj uat each vertexu.
Initial current-arc state from PushRelabel.init N and full neighbor lists adj.
Current-arc invariant: every cur u is a suffix of adj u whose already-scanned prefix
contains no admissible out-neighbor.
Invariant of CAState: valid height-bounded preflow/labeling together with CurrentArcInv.
Underlying generic push–relabel invariant.
Current-arc prefix has no admissible arcs.
Fuel sufficient for dischargeLoop to drain u completely from any CAInv state.
Pure current-arc scan potential across non-terminal vertices (#3373):
∑ u ∈ (Finset.univ.erase N.s).erase N.t, ((2 * |V| - 1 - height u) * |adj u| + |cur u|).
Non-admissible cursor steps at u ∉ {N.s, N.t} strictly decrease curPotential by 1, pushes
preserve it, and valid relabels do not increase it.
Initial current-arc potential equals 2 * |V| * ∑ u ∈ (univ.erase N.s).erase N.t, |adj u|.
Duplicate-free neighbor lists bound initial curPotential by 2 * |V| ^ 3.
Dropping the head of s.cur u at a non-terminal vertex strictly decreases curPotential by
1.
Pushing flow preserves heights and current-arc suffixes, leaving curPotential unchanged.
Relabeling an active vertex u at s.cur u = [] and resetting cur u := adj u does not
increase curPotential.
Result of discharging a single vertex u: the PushRelabel operations performed, the final
current-arc state, and whether at least one relabel occurred.
- ops : List (PushRelabel.Op V)
Push and relabel operations performed during the discharge.
- ca : CAState N
Final current-arc state after the discharge.
- relabeled : Bool
Whether at least one relabel occurred during the discharge.
Discharge loop on vertex u with fuel fuel, normalizing states with norm after each step:
while u is active, push along cur u's head if admissible, drop cur u's head otherwise, or
relabel u and reset cur u := adj u at [].
Pure current-arc discharge on u with fuel dischargeFuel adj u (step toward #3373,
following [CLRS09], Section 26.5, DISCHARGE).
Pure specification of discharge (step toward #3373, following [CLRS09], Section 26.5):
discharging u from any CAInv state executes a valid run of PushRelabel operations, preserves
CAInv, renders u inactive, performs at most one nonsaturating push, does not increase
curPotential, preserves heights and admissible arcs when not relabeling, and leaves no incoming
admissible arcs at u when relabeling.
Discharging any vertex u from a CAInv state does not increase curPotential.
Evaluating discharge on an inactive vertex returns the trivial empty output.
One relabel step of discharge adj id u s when s.cur u = [] (CAInv adj s preserved).
One push step of discharge adj id u s when s.cur u = v :: vs is admissible.
One non-admissible cursor step of discharge adj id u s when s.cur u = v :: vs.
Topological ordering and relabel-to-front #
Before u v l holds when u appears strictly before v in l.
Topological order of a vertex list L with respect to the admissible network of σ
(following [CLRS09], Section 26.5): every admissible arc between vertices of L points forward
in L.
Initial state of relabel-to-front from vertex list vs and neighbor lists adj.
Invariant of RTFState (following [CLRS09], Section 26.5): CAInv, done ++ todo is a
duplicate-free enumeration of V \ {N.s, N.t} in topological order of the admissible network, and
every vertex in done is inactive.
Current-arc invariant.
Every vertex strictly before the cursor is inactive.
Relabel-to-front outer loop with fuel fuel, normalizing CAState with caNorm and RTFState
with stNorm. Returns (ops, finalState).
Pure outer phase/pass potential on RTFState (#3373, following [GT88];
[CLRS09], Section 26.5): (sumHeightMax V - ∑ v, height v) * (|V| - 2) + |todo|. Strictly
decreases on every vertex-list step of rtfLoop.
Exact value of rtfMeasure on RTFState.init:
(|V| - 2) * ((|V| - 2) * (2 * |V| - 1) + 1).
Cubic upper bound rtfMeasure V (RTFState.init N adj vs) ≤ 2 * |V| ^ 3 when N.s ≠ N.t.
One outer iteration of rtfLoop adj id id (rtfFuel V) st when st.todo = u :: rest:
preserves RTFInv, strictly decreases rtfMeasure, prepends d.ops, and reaches the same final
RTFState.
Sparse initial curPotential bound on Fin n: exactAdj N gives initial potential at most
4 * n * |N.posArcs| (#3373).
Relabel-operation count is additive along concatenated operation lists.
Output of relabelToFrontWith: the PushRelabel operation run, the final flow, and the final
gap cut.
- ops : List (Network.PushRelabel.Op V)
The push and relabel operations performed, in order.
- flow : N.Flow
The final flow.
- cut : Finset V
The gap cut of the final labeling.
The output read off a final RTFState: its preflow as a flow when every excess off N.s,
N.t vanishes (the zero flow otherwise) and its gap cut.
Pure relabel-to-front maximum-flow scheduler (step toward #3373, following
[GT88]; [CLRS09], Section 26.5), with initial vertex order vs, neighbor lists
adj, and normalizers caNorm / stNorm.
Pure correctness and nonsaturating-push bound for relabelToFrontWith (step toward #3373,
following [GT88]; [CLRS09], Section 26.5; makes no machine running-time claim):
for N.s ≠ N.t, valid neighbor lists adj, a duplicate-free list vs of V \ {N.s, N.t}, and
identity normalizers, relabelToFrontWith performs a valid run of PushRelabel operations ending
in a maximum flow and a minimum cut of equal value, with at most
(|V| - 2) * ((|V| - 2) * (2 * |V| - 1) + 1) nonsaturating pushes.
Combinatorial PushRelabel operation-count bounds for relabelToFrontWith (step toward
#3373, following [GT88]; [CLRS09], Sections 26.4–26.5; makes no machine
running-time claim): at most 2 |V|² relabels, 2 |V| |E| saturating pushes, 2 |V|³
nonsaturating pushes, and 4 |V|³ total push/relabel operations.
Tabulate a CAState on Fin n: tabulated preflow/heights together with a Vector of current
neighbor suffixes.
Tabulate an RTFState on Fin n by tabulating its underlying CAState.
Dense relabel-to-front solver on Network (Fin n) scanning defaultAdj n (List.finRange n)
at every vertex.
Exact-adjacency relabel-to-front solver on Network (Fin n) scanning exactAdj N at every
vertex.
Pure correctness and PushRelabel operation-count bounds for relabelToFront on Fin n
(step toward #3373, following [GT88]; [CLRS09], Section 26.5; makes no machine
running-time claim).
Pure correctness and PushRelabel operation-count bounds for relabelToFrontDense on Fin n
(pure specification step consumed by CslibFrontier.Algorithms.WordRAM.PushRelabel, #3373).
Pure correctness and PushRelabel operation-count bounds for relabelToFrontExact on Fin n
(step toward sparse CSR Word-RAM compilation in #3373; see curPotential_init_exactAdj_le for
the 4 * n * |N.posArcs| current-arc potential bound).