Documentation

CslibFrontier.Algorithms.Lean.MaxFlow.SeparableHistogramTransport

Additively Separable Grid Transport via Layered Minimum-Cost Flow #

Formalizes the $(d + 1)$-layer minimum-cost network flow reduction for discrete optimal transport between integral histograms on the $d$-dimensional grid $\{0, \dots, L - 1\}^d$ under any additively separable cost $c(a, b) = \sum_{s = 0}^{d - 1} c_s(a_s, b_s)$ .

Instead of forming the dense $L^d \times L^d$ bipartite transportation graph ($L^{2d}$ arcs), routing coordinates one axis per layer produces a $(d + 1)$-layer directed acyclic CostNetwork with $(d + 1) L^d$ vertices and $d L^{d + 1}$ positive-capacity arcs. This module establishes the forward cost-preserving projection from any integral transport plan to a feasible flow (totalCost_flowOfIntegralPlan) and the conditional lower bound showing that any minimum-cost flow has cost at most the cost of every real-valued fractional coupling (totalCost_le_realCoupling_of_isMinCost).

Main definitions #

Main results #

structure Cslib.Algorithms.Lean.MaxFlow.IsIntegralTransportPlan {d L : ℕ} (p q : (Fin d → Fin L) → ℕ) (M : (Fin d → Fin L) → (Fin d → Fin L) → ℕ) :

An integral transport plan between nonnegative integer histograms p, q on (Fin d → Fin L) is a matrix M with row sums p and column sums q.

  • row_sum (a : Fin d → Fin L) : ∑ b : Fin d → Fin L, M a b = p a

    Row-sum marginal constraint ∑ b, M a b = p a.

  • col_sum (b : Fin d → Fin L) : ∑ a : Fin d → Fin L, M a b = q b

    Column-sum marginal constraint ∑ a, M a b = q b.

def Cslib.Algorithms.Lean.MaxFlow.separablePairCost {d L : ℕ} (coordCost : Fin d → Fin L → Fin L → ℕ) (a b : Fin d → Fin L) :

Additively separable cost ∑ s : Fin d, coordCost s (a s) (b s) between grid points a, b.

def Cslib.Algorithms.Lean.MaxFlow.separablePlanCost {d L : ℕ} (coordCost : Fin d → Fin L → Fin L → ℕ) (M : (Fin d → Fin L) → (Fin d → Fin L) → ℕ) :

Total cost of an integral transport plan M under separablePairCost coordCost.

def Cslib.Algorithms.Lean.MaxFlow.layerHybridPoint {d L : ℕ} (a b : Fin d → Fin L) (t : Fin (d + 1)) :
Fin d → Fin L

Hybrid grid point after routing coordinates 0, …, t - 1 from a to b: coordinates < t.val equal b, and coordinates ≥ t.val equal a.

def Cslib.Algorithms.Lean.MaxFlow.IsLayerStep {d L : ℕ} (u v : Fin (d + 1) × (Fin d → Fin L)) :

Predicate characterizing valid single-axis transitions from layer s.castSucc to s.succ.

Instances For
    @[instance_reducible]
    theorem Cslib.Algorithms.Lean.MaxFlow.isLayerStep_iff {d L : ℕ} {u v : Fin (d + 1) × (Fin d → Fin L)} :
    IsLayerStep u v ↔ ↑u.1 < d ∧ ↑v.1 = ↑u.1 + 1 ∧ ∀ (j : Fin d), ↑j ≠ ↑u.1 → u.2 j = v.2 j

    If IsLayerStep u v, the layer index s : Fin d is uniquely determined by u.1 = s.castSucc.

    def Cslib.Algorithms.Lean.MaxFlow.separableGridCostNetwork {d L : ℕ} (k : ℕ) (p q : (Fin d → Fin L) → ℕ) (coordCost : Fin d → Fin L → Fin L → ℕ) :
    CostNetwork (Fin (d + 1) × (Fin d → Fin L)) ℤ

    The $(d + 1)$-layer CostNetwork on Fin (d + 1) × (Fin d → Fin L) for histograms p, q of total mass k and 1D coordinate costs coordCost. Valid single-axis arcs carry capacity k + 1 so every feasible flow of mass k is strictly unsaturated on every valid arc.

    @[simp]
    theorem Cslib.Algorithms.Lean.MaxFlow.separableGridCostNetwork_cost_step {d L : ℕ} (k : ℕ) (p q : (Fin d → Fin L) → ℕ) (coordCost : Fin d → Fin L → Fin L → ℕ) (s : Fin d) (x : Fin d → Fin L) (c : Fin L) :
    (separableGridCostNetwork k p q coordCost).cost (s.castSucc, x) (s.succ, Function.update x s c) = ↑(coordCost s (x s) c)
    def Cslib.Algorithms.Lean.MaxFlow.flowOfIntegralPlan {d L k : ℕ} {p q : (Fin d → Fin L) → ℕ} (coordCost : Fin d → Fin L → Fin L → ℕ) {M : (Fin d → Fin L) → (Fin d → Fin L) → ℕ} (hM : IsIntegralTransportPlan p q M) (hk : ∑ a : Fin d → Fin L, p a = k) :
    (separableGridCostNetwork k p q coordCost).Flow

    Project an integral transport plan M (with total mass k) to a feasible flow on separableGridCostNetwork k p q coordCost.

    theorem Cslib.Algorithms.Lean.MaxFlow.totalCost_flowOfIntegralPlan {d L k : ℕ} {p q : (Fin d → Fin L) → ℕ} (coordCost : Fin d → Fin L → Fin L → ℕ) {M : (Fin d → Fin L) → (Fin d → Fin L) → ℕ} (hM : IsIntegralTransportPlan p q M) (hk : ∑ a : Fin d → Fin L, p a = k) :
    (flowOfIntegralPlan coordCost hM hk).totalCost = ↑(separablePlanCost coordCost M)

    Projecting an integral transport plan M onto separableGridCostNetwork preserves total cost identically: (flowOfIntegralPlan coordCost hM hk).totalCost = separablePlanCost coordCost M.

    theorem Cslib.Algorithms.Lean.MaxFlow.flow_le_supply_on_separableGridCostNetwork {d L k : ℕ} {p q : (Fin d → Fin L) → ℕ} {coordCost : Fin d → Fin L → Fin L → ℕ} (hk : ∑ a : Fin d → Fin L, p a = k) (f : (separableGridCostNetwork k p q coordCost).Flow) (u v : Fin (d + 1) × (Fin d → Fin L)) :
    f.toFun u v ≤ k

    Cut-conservation bound: on separableGridCostNetwork k p q coordCost with ∑ a, p a = k, every feasible flow f carries at most k units on every directed pair (u, v), hence is strictly below cap u v = k + 1 on every valid layer arc.

    theorem Cslib.Algorithms.Lean.MaxFlow.totalCost_le_realCoupling_of_isMinCost {d L k : ℕ} {p q : (Fin d → Fin L) → ℕ} {coordCost : Fin d → Fin L → Fin L → ℕ} (hk : ∑ a : Fin d → Fin L, p a = k) {f : (separableGridCostNetwork k p q coordCost).Flow} (hf : f.IsMinCost) {W : (Fin d → Fin L) → (Fin d → Fin L) → ℝ} (hW_nn : ∀ (a b : Fin d → Fin L), 0 ≤ W a b) (hW_row : ∀ (a : Fin d → Fin L), ∑ b : Fin d → Fin L, W a b = ↑(p a)) (hW_col : ∀ (b : Fin d → Fin L), ∑ a : Fin d → Fin L, W a b = ↑(q b)) :
    ↑f.totalCost ≤ ∑ a : Fin d → Fin L, ∑ b : Fin d → Fin L, W a b * ↑(separablePairCost coordCost a b)

    Exact fractional optimality via complementary slackness: if f is a minimum-cost integral flow on separableGridCostNetwork k p q coordCost (∑ a, p a = k), then for ANY nonnegative real matrix W : (Fin d → Fin L) → (Fin d → Fin L) → ℝ with row sums p a and column sums q b, (f.totalCost : ℝ) ≤ ∑ a, ∑ b, W a b * separablePairCost coordCost a b.