Documentation

CslibFrontier.Algorithms.WordRAM.EdmondsKarp.Spec

Relocatable dense Edmonds–Karp solver, resource bounds, and specification #

Defines the relocatable solver subroutine Cslib.Algorithms.WordRAM.EdmondsKarp.ekProg together with its exact-basis realization, O(n ^ 5) memory budget (ekCost), history admissibility, frame property, return-value bound, and end-to-end minimum-cut correctness (ekProg_spec).

Main definitions #

Main results #

Semantics: the augmenting path, its bottleneck, and the augmentation #

Semantics: one round #

Semantics: the cut sum and the whole solver #

The dense Edmonds–Karp solver (ekProg), its bounds, and specification #

Dense Edmonds–Karp (d = (c, (s, t))): clear the flow, run n ^ 3 rounds (rounds after t stops being reached do nothing), and return the weight of the reached set of the final search.

@[reducible, inline]

Memory-operation budget of ekProg on n vertices, O(n ^ 5).

theorem Cslib.Algorithms.WordRAM.EdmondsKarp.ekProg_spec {n mb sb B : ℕ} {W : Fin n → Fin n → ℕ} {s t : Fin n} (hst : s ≠ t) (hB : ∀ (u v : Fin n), W u v ≤ B) (hlay : mb + n * n ≤ sb) {st : DataStructure.Memory.State} (hW : ∀ (u v : Fin n), st.mem (mb + ↑u * n + ↑v) = W u v) :
have c := { n := n, matBase := mb, scratchBase := sb, capBound := B }; have st' := (DataStructure.Memory.spec 0).clientState st (ekProg (c, ↑s, ↑t)); have C := {x : Fin n | st'.mem (distAddr c ↑x) < n}; (∀ (a : ℕ), a < sb ∨ sb + ekScratch n ≤ a → st'.mem a = st.mem a) ∧ Lean.GomoryHu.IsMinCutBetween (WeightedCut.cutWeight W) s t C ∧ (DataStructure.Memory.spec 0).clientResult st (ekProg (c, ↑s, ↑t)) = WeightedCut.cutWeight W C

Correctness of dense Edmonds–Karp. On a state holding the capacities W ≤ B at mb, ekProg leaves memory outside its scratch area unchanged, the set C of vertices whose final distance is below n is a minimum s–t cut of cutWeight W, and the returned value is cutWeight W C.