Documentation

CslibFrontier.Algorithms.WordRAM.Arborescence.Internal.EdmondsEntry

Entry point edmondsProg and shared finishArbProg wrapper (internal) #

Implements finishArbProg (running edmondsCoreProg on the workspace and formatting the length-prefixed parent list) and edmondsProg (loading initialized input into the workspace), with Realizes .exact and O(n³) specifications.

Parameters for finishArbProg.

  • n : ℕ

    Number of vertices.

  • r : ℕ

    Designated root vertex index.

  • ws : ℕ

    Workspace base address.

  • outAddr : ℕ

    Output list base address.

@[reducible, inline]

The tuple word encoding of the fields of encFinishArbArgs.

Runs edmondsCoreProg and writes the length-prefixed parent list (or 0 when infeasible) at a.outAddr.

theorem Cslib.Algorithms.WordRAM.Arborescence.Internal.finishArbProg_spec {w n ws M₀ : ℕ} (root : Fin n) (a₀ : Lean.Arborescence.AdjTable n) (c₀ : Lean.Arborescence.CostTable ℤ n) (s₃ : DataStructure.Memory.State) (expected : List ℕ) (hfit_top : WordRAM.Fits w (ws + wsSize n + (n + 1) + 8)) (hs₃_fr : s₃.frontier = ws + wsSize n + (n + 1)) (hwb : WordRAM.Fits w (wordBound n M₀)) (ha₃ : ∀ (u col : Fin n), s₃.mem (curAdjBase ws n + ↑u * n + ↑col) = if a₀[↑u][↑col] = true then 1 else 0) (hc₃ : ∀ (u col : Fin n), s₃.mem (curCostBase ws n + ↑u * n + ↑col) = WordRAM.Signed.encode c₀[↑u][↑col]) (hB₀ : ∀ (u col : Fin n), c₀[↑u][↑col].natAbs ≤ M₀) (hexp : match Lean.Arborescence.edmondsTableAux root n a₀ c₀ with | some pTab => expected = List.map (fun (v : Fin n) => ↑pTab[↑v]) (List.finRange n) | none => expected = []) :
have outAddr := ws + wsSize n; have fa := { n := n, r := ↑root, ws := ws, outAddr := outAddr }; have s' := (DataStructure.Memory.spec 0).clientState s₃ (finishArbProg fa); FinishArbSafe w fa s₃ ∧ (DataStructure.Memory.spec w).ValidHistory s₃ ((DataStructure.Memory.spec w).clientHistory s₃ (finishArbProg fa)) ∧ WordRAM.Realization.memoryCost (finishArbProg fa) s₃ ≤ 43 * n ^ 3 + 18 * n ^ 2 + 8 * n + 1 ∧ (DataStructure.Memory.spec 0).clientResult s₃ (finishArbProg fa) = outAddr ∧ WordRAM.outputList s'.mem outAddr = expected ∧ WordRAM.Fits w (outAddr + expected.length)

Word-RAM entry program solving rooted minimum-cost spanning in-arborescence for (n, root).

@[reducible, inline]

Safety precondition for edmondsProg.