Full edmondsCoreProg_spec correctness and O(n³) memory-cost theorem (internal) #
Combines the forward contraction loop and backward expansion loop invariants to establish
edmondsCoreProg_spec with O(n³) total memoryCost and width-independent admissibility.
Full solver edmondsCoreProg_spec, entry programs, and O(n³) Word-RAM theorems #
theorem Cslib.Algorithms.WordRAM.Arborescence.Internal.edmondsCoreProg_spec {w n ws M₀ : ℕ} (r : Fin n) (a₀ : Lean.Arborescence.AdjTable n) (c₀ : Lean.Arborescence.CostTable ℤ n) (s₀ : DataStructure.Memory.State) (hws : WsFits w ws n) (hf : ws + wsSize n ≤ s₀.frontier) (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₀) :
have ca := { n := n, r := ↑r, ws := ws };
have res := (DataStructure.Memory.spec 0).clientResult s₀ (forwardProg ca);
have s1 := (DataStructure.Memory.spec 0).clientState s₀ (forwardProg ca);
have s' := (DataStructure.Memory.spec 0).clientState s₀ (edmondsCoreProg ca);
have status := (DataStructure.Memory.spec 0).clientResult s₀ (edmondsCoreProg ca);
(WordRAM.Fits w 1 ∧ WordRAM.Realization.iterationSafe forwardStep ForwardStepSafe w ca n { k := 0, status := 0, depth := 0 } s₀ ∧ (res.status = 1 →
WordRAM.Realization.iterationSafe backwardStep BackwardStepSafe w { n := n, ws := ws, depth := res.depth }
res.depth 0 s1)) ∧ (DataStructure.Memory.spec w).ValidHistory s₀ ((DataStructure.Memory.spec w).clientHistory s₀ (edmondsCoreProg ca)) ∧ WordRAM.Realization.memoryCost (edmondsCoreProg ca) s₀ ≤ 43 * n ^ 3 + 18 * n ^ 2 + 6 * n ∧ s'.frontier = s₀.frontier ∧ (∀ (addr : ℕ), ¬(ws ≤ addr ∧ addr < ws + wsSize n) → s'.mem addr = s₀.mem addr) ∧ match Lean.Arborescence.edmondsTableAux r n a₀ c₀ with
| some p => status = 1 ∧ ∀ (v : Fin n), s'.mem (curParentBase ws n + ↑v) = ↑p[↑v]
| none => status = 0