Core layout and fillRange primitive for dense Edmonds–Karp #
Shared memory layout (Ctx, distAddr, ekScratch, ekBound, CtxFits) and the relocatable
memory-fill primitive (fillRange, fillRange_realizes, fillRange_spec,
memoryCost_fillRange_le, validHistory_fillRange) used across
CslibFrontier.Algorithms.WordRAM.EdmondsKarp.
Main definitions #
Cslib.Algorithms.WordRAM.EdmondsKarp.Ctx,Ctx.equiv,distAddr,ekScratch,ekBound,CtxFits: solver context, layout bounds, and word-width predicate.Cslib.Algorithms.WordRAM.EdmondsKarp.fillRange: fill a memory range with a constant word.
Main results #
Cslib.Algorithms.WordRAM.EdmondsKarp.fillRange_realizes: compilation toBasis.exact.Cslib.Algorithms.WordRAM.EdmondsKarp.fillRange_spec,Cslib.Algorithms.WordRAM.EdmondsKarp.memoryCost_fillRange_le,Cslib.Algorithms.WordRAM.EdmondsKarp.validHistory_fillRange: specification, cost, and admissibility offillRange.
Layout #
Solver context: n vertices, capacity matrix at matBase, scratch area at scratchBase,
and a bound capBound on the capacities.
- n : ℕ
Number of vertices.
- matBase : ℕ
Base address of the row-major capacity matrix.
- scratchBase : ℕ
Base address of the solver's scratch area.
- capBound : ℕ
Upper bound on edge capacities.
Instances For
@[instance_reducible]
@[reducible, inline]
Words of scratch memory used by the solver: the flow matrix, distances and parents.
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.fillRange_realizes :
WordRAM.Realization.Realizes WordRAM.Basis.exact fillRange WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (d : (ℕ × ℕ) × ℕ) (x : DataStructure.Memory.State) =>
match d with
| ((base, snd), len) => WordRAM.Fits w (base + len))
fun (x : (ℕ × ℕ) × ℕ) (x_1 : DataStructure.Memory.State) => 0
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.fillRange_spec (base val len : ℕ) (s : DataStructure.Memory.State) :
fillRange ((base, val), len) writes val on [base, base + len) and nothing else.
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.memoryCost_fillRange_le (base val len : ℕ) (s : DataStructure.Memory.State) :
theorem Cslib.Algorithms.WordRAM.EdmondsKarp.validHistory_fillRange {w base val len : ℕ} {s : DataStructure.Memory.State} (hwf : DataStructure.Memory.WellFormed w s) (hend : base + len ≤ s.frontier) (hval : WordRAM.Fits w val) :
(DataStructure.Memory.spec w).ValidHistory s
((DataStructure.Memory.spec w).clientHistory s (fillRange ((base, val), len)))