Residual-graph breadth-first search semantics for ekProg #
Internal invariants (MatLoaded, FlowStored) and correctness specifications (readResCap_spec,
bfsProg_spec) for the layered breadth-first search subroutine of
Cslib.Algorithms.WordRAM.EdmondsKarp. Imported privately by
CslibFrontier.Algorithms.WordRAM.EdmondsKarp.Spec.
Semantics: residual capacities and the breadth-first search #
def Cslib.Algorithms.WordRAM.EdmondsKarp.Internal.MatLoaded (n mb : ℕ) (W : Fin n → Fin n → ℕ) (t : DataStructure.Memory.State) :
The state holds the capacities W at mb.
def Cslib.Algorithms.WordRAM.EdmondsKarp.Internal.FlowStored {n : ℕ} {N : Lean.MaxFlow.Network (Fin n)} (sb : ℕ) (f : N.Flow) (t : DataStructure.Memory.State) :
The state holds the flow f at sb.
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.Internal.FlowStored.congr {n sb : ℕ} {N : Lean.MaxFlow.Network (Fin n)} {f : N.Flow} {t t' : DataStructure.Memory.State} (hf : FlowStored sb f t) (h : ∀ a < sb + n * n, t'.mem a = t.mem a) :
FlowStored sb f t'
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.Internal.readResCap_spec {n mb sb B : ℕ} {W : Fin n → Fin n → ℕ} {src snk : Fin n} (hB : ∀ (u v : Fin n), W u v ≤ B) {t : DataStructure.Memory.State} (hW : MatLoaded n mb W t) {f : { cap := W, s := src, t := snk }.Flow} (hf : FlowStored sb f t) (u v : Fin n) :
(DataStructure.Memory.spec 0).clientResult t
(readResCap (({ n := n, matBase := mb, scratchBase := sb, capBound := B }, ↑u), ↑v)) = f.resCap u v
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.Internal.bfsProg_spec {n mb sb B : ℕ} {W : Fin n → Fin n → ℕ} {src snk : Fin n} (hB : ∀ (u v : Fin n), W u v ≤ B) (hlay : mb + n * n ≤ sb) {s : DataStructure.Memory.State} (hW : MatLoaded n mb W s) (f : { cap := W, s := src, t := snk }.Flow) (hf : FlowStored sb f s) :
have t :=
(DataStructure.Memory.spec 0).clientState s
(bfsProg ({ n := n, matBase := mb, scratchBase := sb, capBound := B }, ↑src));
(∀ a < sb + n * n, t.mem a = s.mem a) ∧ (∀ (x : Fin n), t.mem (distAddr { n := n, matBase := mb, scratchBase := sb, capBound := B } ↑x) = f.resDist x) ∧ ∀ (x : Fin n),
0 < f.resDist x →
f.resDist x < n →
∃ (u : Fin n),
t.mem (predAddr { n := n, matBase := mb, scratchBase := sb, capBound := B } ↑x) = ↑u ∧ f.resDist u + 1 = f.resDist x ∧ 0 < f.resCap u x