Super-root reduction and optimumBranchingProg entry (internal) #
Implements superRootProg (adding a super-root with zero-cost incoming arcs and reversing/negating
original arcs), extractBranchingProg, and optimumBranchingProg, together with
Realizes .exact, inputFits_branching_encode, and optimumBranchingProg_spec.
theorem Cslib.Algorithms.WordRAM.Arborescence.Internal.inputFits_branching_encode {w M₀ : ℕ} (I : BranchingInput) (hM : ∀ (u v : Fin I.n), (I.weight u v).natAbs ≤ M₀) (hwb : WordRAM.Fits w (wordBound (I.n + 1) M₀)) :
Word-RAM entry program solving maximum-weight branching on n vertices via the (n + 1)-node
super-root reduction to edmondsCoreProg.
def Cslib.Algorithms.WordRAM.Arborescence.Internal.OptimumBranchingProgSafe (w n : ℕ) (s₀ : DataStructure.Memory.State) :
Safety precondition for optimumBranchingProg.
theorem Cslib.Algorithms.WordRAM.Arborescence.Internal.optimumBranchingProg_spec {w M₀ : ℕ} (I : BranchingInput) (hM : ∀ (u v : Fin I.n), (I.weight u v).natAbs ≤ M₀) (hwb : WordRAM.Fits w (wordBound (I.n + 1) M₀)) :
have s₀ := DataStructure.Memory.State.init I.encode;
have n := I.n;
have outAddr := (DataStructure.Memory.spec 0).clientResult s₀ (optimumBranchingProg n);
have s' := (DataStructure.Memory.spec 0).clientState s₀ (optimumBranchingProg n);
OptimumBranchingProgSafe w n s₀ ∧ (DataStructure.Memory.spec w).ValidHistory s₀
((DataStructure.Memory.spec w).clientHistory s₀ (optimumBranchingProg n)) ∧ WordRAM.Realization.memoryCost (optimumBranchingProg n) s₀ ≤ 43 * (I.n + 1) ^ 3 + 23 * (I.n + 1) ^ 2 + 9 * (I.n + 1) + 3 ∧ WordRAM.outputList s'.mem outAddr = I.expectedParentList ∧ WordRAM.Fits w (outAddr + I.expectedParentList.length)