Outer potential initialization and per-phase array initialization #
Internal subroutines initOuterCode and initPhaseCode for the Word-RAM Hungarian solver.
Initialize y, nz, colMate, and rowMate before the first phase.
theorem Cslib.Algorithms.WordRAM.Hungarian.exec_initOuterCode {w n bC M W : ℕ} {C : Fin n × Fin n → ℕ} (hCW : ∀ (u v : Fin n), C (u, v) ≤ W) (x : WordRAM.Data 28) (hb : BaseRegs n bC M x) (hC : CostMem bC C x.mem) (hfit : WordRAM.Fits w (bC + n * n + 8 * n + 2 * W + 2)) :
∃ (y : WordRAM.Data 28),
WordRAM.ExecWithin w initOuterCode x y (10 * n * n + 27 * n + 12) ∧ (∀ (i : Fin 28), ↑i < 21 → y.regs i = x.regs i) ∧ OuterMem bC (Vector.ofFn (Lean.MaxFlow.hgRowMin fun (p : Fin n × Fin n) => ↑(C p))) (Vector.replicate n 0)
(Vector.replicate n none) y.mem ∧ ∀ (a : ℕ), ¬(bC + n * n ≤ a ∧ a < bC + n * n + 8 * n + 1 ∧ a ≠ bC + n * n + 7 * n) → y.mem a = x.mem a
Initialize all phase arrays (used, tree, bestRow, minv, and augmented = 0).
theorem Cslib.Algorithms.WordRAM.Hungarian.exec_initPhaseCode {w n bC M W : ℕ} {C : Fin n × Fin n → ℕ} {y₀ z₀ : Vector ℤ n} {mate₀ : Vector (Option (Fin n)) n} (hCW : ∀ (u v : Fin n), C (u, v) ≤ W) (hOB : Lean.MaxFlow.HgOuterBound (fun (p : Fin n × Fin n) => ↑(C p)) W y₀ z₀ mate₀) (r : Fin n) (x : WordRAM.Data 28) (hb : BaseRegs n bC M x) (hC : CostMem bC C x.mem) (hOM : OuterMem bC y₀ z₀ mate₀ x.mem) (hr_reg : x.regs Reg.rr = ↑r) (hfit : WordRAM.Fits w (bC + n * n + 8 * n + 2 * W + 2)) :
∃ (y : WordRAM.Data 28),
WordRAM.ExecWithin w initPhaseCode x y (30 * n + 15) ∧ (∀ (i : Fin 28), ↑i < 17 → y.regs i = x.regs i) ∧ y.regs Reg.augmented = 0 ∧ StepMem bC (Lean.MaxFlow.hgInit (fun (p : Fin n × Fin n) => ↑(C p)) y₀ z₀ mate₀ r) (fun (x : Fin n) => r)
y.mem ∧ ∀ (a : ℕ), ¬(bC + n * n + 3 * n ≤ a ∧ a < bC + n * n + 7 * n) → y.mem a = x.mem a