Documentation

CslibFrontier.Algorithms.Lean.KCenter.KSupplier

Metric k-supplier: 3-approximation and 3 - ε hardness gap #

In the k-supplier problem ([HS86]), the metric space separates a finite set F of candidate facilities from a finite nonempty set C of clients. One must choose at most k facilities S ⊆ F minimizing max_{c ∈ C} d(c, S). Unlike k-center (where F = C = V), the best possible polynomial-time approximation factor for metric k-supplier is 3.

Contents #

  1. Model: supplierRadius d C hC S and supplierOptimum d F C hC k in WithTop α, reusing centerDist from CslibFrontier.Algorithms.Lean.KCenter.Basic and specializing to optRadius when F = C = Finset.univ (supplierOptimum_univ).
  2. Hochbaum–Shmoys 3-approximation (hochbaumShmoysSupplier): at candidate threshold r, supplierThresholdStep computes the greedy 2r-packing T of clients C via thresholdPacking and picks for each t ∈ T a facility f ∈ F within distance r (failing if any t ∈ T has no r-close facility). If any S ⊆ F of size at most k covers C within r, then |T| ≤ k (by length_le_card_of_pairwise_lt) and every t ∈ T has an r-close facility; conversely, every client in C lies within 2r of some t ∈ T and hence within 3r of t's chosen facility. Searching over {d c f | c ∈ C, f ∈ F} gives a certified 3-approximation (hochbaumShmoysSupplier_approx).
  3. Tight 3 - ε hardness gap ([HS86], generalizing DominatingSet.lean): given a bipartite incidence relation R : U → W → Prop between universe elements U (facilities) and sets W (clients), hittingDist R on U ⊕ W puts distance 1 on incident facility–client pairs, 2 on distinct same-side pairs, and 3 on non-incident facility–client pairs. This is a metric (hittingDist_symm, hittingDist_triangle) whose optimal k-supplier radius is at most 1 iff a k-hitting set exists (exists_isHittingSet_iff_supplierOptimum_le_one), and equals 3 otherwise (supplierOptimum_eq_three_of_not_exists_hittingSet). Consequently, any ρ-approximate solution with ρ < 3 decides k-Hitting Set (exists_isHittingSet_iff_of_supplierRadius_le_mul).

Limitations #

The 3-approximation is a pure Lean function over facility and client lists; no machine-level Word-RAM running time is certified (tracked in #9248). The 3 - ε hardness section formalizes the combinatorial gap reduction on bipartite incidence relations, not the encoded NP-hardness statement (P = NP from a polynomial-time < 3-approximation).

Main definitions #

Main results #

References #

The k-supplier objective #

def Cslib.Algorithms.Lean.KCenter.supplierRadius {V : Type u_1} {α : Type u_2} [LinearOrder α] (d : V → V → α) (C : Finset V) (hC : C.Nonempty) (S : Finset V) :

The k-supplier radius max_{c ∈ C} d(c, S) of a set S of facilities serving a nonempty finite set C of clients. It is ⊤ when S is empty.

def Cslib.Algorithms.Lean.KCenter.supplierOptimum {V : Type u_1} {α : Type u_2} [LinearOrder α] (d : V → V → α) (F C : Finset V) (hC : C.Nonempty) (k : ℕ) :

The optimal k-supplier radius min_{S ⊆ F, |S| ≤ k} supplierRadius d C hC S. It is ⊤ when k = 0 or F = ∅.

theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_le_iff {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S : Finset V} {hC : C.Nonempty} {r : WithTop α} :
supplierRadius d C hC S ≤ r ↔ ∀ c ∈ C, centerDist d S c ≤ r
theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_le_coe_iff {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S : Finset V} {hC : C.Nonempty} {r : α} :
supplierRadius d C hC S ≤ ↑r ↔ ∀ c ∈ C, ∃ f ∈ S, d c f ≤ r

The supplier radius of S is at most r iff every client in C is within r of some facility in S.

theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_lt_iff {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S : Finset V} {hC : C.Nonempty} {r : WithTop α} :
supplierRadius d C hC S < r ↔ ∀ c ∈ C, centerDist d S c < r
theorem Cslib.Algorithms.Lean.KCenter.centerDist_le_supplierRadius {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S : Finset V} {hC : C.Nonempty} {c : V} (hc : c ∈ C) :
theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_anti {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S T : Finset V} {hC : C.Nonempty} (h : S ⊆ T) :

Opening additional facilities never increases the supplier radius.

@[simp]
theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_empty {V : Type u_1} {α : Type u_2} [LinearOrder α] (d : V → V → α) (C : Finset V) (hC : C.Nonempty) :
theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_lt_top {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {C S : Finset V} {hC : C.Nonempty} (hS : S.Nonempty) :

Any nonempty set of facilities achieves a finite supplier radius.

theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_le_supplierRadius {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {F C S : Finset V} {hC : C.Nonempty} {k : ℕ} (hSF : S ⊆ F) (hSk : S.card ≤ k) :
supplierOptimum d F C hC k ≤ supplierRadius d C hC S
theorem Cslib.Algorithms.Lean.KCenter.exists_supplierRadius_eq_supplierOptimum {V : Type u_1} {α : Type u_2} [LinearOrder α] (d : V → V → α) (F C : Finset V) (hC : C.Nonempty) (k : ℕ) :
∃ S ⊆ F, S.card ≤ k ∧ supplierRadius d C hC S = supplierOptimum d F C hC k

Some subset of at most k facilities attains supplierOptimum.

theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_le_iff {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {F C : Finset V} {hC : C.Nonempty} {k : ℕ} {r : WithTop α} :
supplierOptimum d F C hC k ≤ r ↔ ∃ S ⊆ F, S.card ≤ k ∧ supplierRadius d C hC S ≤ r
theorem Cslib.Algorithms.Lean.KCenter.le_supplierOptimum_iff {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {F C : Finset V} {hC : C.Nonempty} {k : ℕ} {r : WithTop α} :
r ≤ supplierOptimum d F C hC k ↔ ∀ S ⊆ F, S.card ≤ k → r ≤ supplierRadius d C hC S
@[simp]
theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_zero {V : Type u_1} {α : Type u_2} [LinearOrder α] (d : V → V → α) (F C : Finset V) (hC : C.Nonempty) :
supplierOptimum d F C hC 0 = ⊤
theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_lt_top {V : Type u_1} {α : Type u_2} [LinearOrder α] {d : V → V → α} {F C : Finset V} {hC : C.Nonempty} {k : ℕ} (hF : F.Nonempty) (hk : 0 < k) :
supplierOptimum d F C hC k < ⊤

With at least one available facility and k ≥ 1, the optimal supplier radius is finite.

theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_univ {V : Type u_1} {α : Type u_2} [LinearOrder α] [Fintype V] [Nonempty V] (d : V → V → α) (k : ℕ) :

When F = C = Finset.univ, supplierOptimum coincides with the k-center optRadius.

Hochbaum–Shmoys 3-approximation for k-supplier #

def Cslib.Algorithms.Lean.KCenter.supplierThresholdStep {V : Type u_1} {α : Type u_2} [LinearOrder α] [Semiring α] (d : V → V → α) (F C : List V) (r : α) :

Threshold r step of Hochbaum–Shmoys for k-supplier ([HS86]): compute a greedy 2r-packing T of the clients C, and pick for each t ∈ T the first facility f ∈ F with d t f ≤ r. Returns none if some t ∈ T has no r-close facility in F.

def Cslib.Algorithms.Lean.KCenter.hochbaumShmoysSupplier {V : Type u_1} {α : Type u_2} [LinearOrder α] [Semiring α] [DecidableEq V] (d : V → V → α) (F C : List V) (k : ℕ) :

Hochbaum–Shmoys parametric threshold 3-approximation for metric k-supplier ([HS86]): searches all client–facility distances d c f (c ∈ C, f ∈ F) for the smallest threshold r at which supplierThresholdStep d F C r succeeds with at most k facilities, returning that facility set (or ∅ if none is feasible).

theorem Cslib.Algorithms.Lean.KCenter.hochbaumShmoysSupplier_subset {V : Type u_1} {α : Type u_2} [LinearOrder α] [Semiring α] [DecidableEq V] (d : V → V → α) (F C : List V) (k : ℕ) :

Feasibility (subset): every facility chosen by hochbaumShmoysSupplier belongs to F.

theorem Cslib.Algorithms.Lean.KCenter.card_hochbaumShmoysSupplier_le {V : Type u_1} {α : Type u_2} [LinearOrder α] [Semiring α] [DecidableEq V] (d : V → V → α) (F C : List V) (k : ℕ) :

Feasibility (cardinality): hochbaumShmoysSupplier opens at most k facilities.

theorem Cslib.Algorithms.Lean.KCenter.hochbaumShmoysSupplier_approx {V : Type u_1} {α : Type u_2} [LinearOrder α] [Semiring α] [IsOrderedCancelAddMonoid α] [DecidableEq V] {d : V → V → α} (hsymm : ∀ (x y : V), d x y = d y x) (htri : ∀ (x y z : V), d x z ≤ d x y + d y z) {F C : List V} (hC : C.toFinset.Nonempty) {k : ℕ} {r : α} (hr : supplierOptimum d F.toFinset C.toFinset hC k ≤ ↑r) :

Hochbaum–Shmoys threshold algorithm is a 3-approximation for metric k-supplier ([HS86]): on any symmetric distance satisfying the triangle inequality over a linearly ordered cancelative semiring (ℕ, ℚ, ℝ, …), the returned facility set has supplier radius at most 3 * r for every bound r on the optimal k-supplier radius.

Tight 3 - ε hardness gap via Hitting Set #

def Cslib.Algorithms.Lean.KCenter.IsHittingSet {U : Type u_3} {W : Type u_4} (R : U → W → Prop) (H : Set U) :

A set H of elements in U is a hitting set for an incidence relation R : U → W → Prop when every set w : W is incident to some u ∈ H.

Instances For
    @[instance_reducible]
    def Cslib.Algorithms.Lean.KCenter.hittingDist {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] (R : U → W → Prop) [DecidableEq U] [DecidableEq W] [DecidableRel R] :
    U ⊕ W → U ⊕ W → α

    The {1, 2, 3} hitting-set distance ([HS86]) on U ⊕ W associated to a bipartite incidence relation R : U → W → Prop: 0 on identical points, 1 on incident facility–client pairs, 2 on distinct same-side pairs, and 3 on non-incident facility–client pairs.

    The set of facility vertices .inl u in U ⊕ W.

    The set of client vertices .inr w in U ⊕ W.

    theorem Cslib.Algorithms.Lean.KCenter.hittingDist_symm {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] {R : U → W → Prop} [DecidableEq U] [DecidableEq W] [DecidableRel R] (x y : U ⊕ W) :
    theorem Cslib.Algorithms.Lean.KCenter.hittingDist_triangle {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] (x y z : U ⊕ W) :
    theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_hittingDist_le_one_iff {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] [Fintype U] [Fintype W] [Nonempty W] {S : Finset (U ⊕ W)} (hSF : S ⊆ hittingFacilities U W) :

    A subset S of facilities achieves radius at most 1 in hittingDist R exactly when its elements form a hitting set for R.

    theorem Cslib.Algorithms.Lean.KCenter.supplierRadius_hittingDist_lt_three_iff {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] [Fintype U] [Fintype W] [Nonempty W] {S : Finset (U ⊕ W)} (hSF : S ⊆ hittingFacilities U W) :

    Because client–facility distances in hittingDist R take only values 1 and 3, radius strictly below 3 is also equivalent to being a hitting set.

    Hitting sets are k-supplier solutions of radius 1 ([HS86]): a k-hitting set for R exists iff the optimal k-supplier radius of hittingDist R is at most 1.

    theorem Cslib.Algorithms.Lean.KCenter.supplierOptimum_eq_three_of_not_exists_hittingSet {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] [Fintype U] [Fintype W] [Nonempty W] [Nonempty U] {k : ℕ} (hk : 0 < k) (h : ¬∃ (H : Finset U), H.card ≤ k ∧ IsHittingSet R ↑H) :

    NO-instance radius is 3 ([HS86]): when U is nonempty, k ≥ 1, and no k-hitting set for R exists, the optimal k-supplier radius of hittingDist R is 3.

    theorem Cslib.Algorithms.Lean.KCenter.isHittingSet_of_supplierRadius_le_mul {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] [Fintype U] [Fintype W] [Nonempty W] {k : ℕ} {ρ : α} {S : Finset (U ⊕ W)} (hρ : ρ < 3) (hSF : S ⊆ hittingFacilities U W) (happrox : ∀ (r : α), supplierOptimum (hittingDist R) (hittingFacilities U W) (hittingClients U W) ⋯ k ≤ ↑r → supplierRadius (hittingDist R) (hittingClients U W) ⋯ S ≤ ↑(ρ * r)) (hhit : ∃ (H : Finset U), H.card ≤ k ∧ IsHittingSet R ↑H) :

    The 3 - ε hardness gap for metric k-supplier ([HS86]): if a k-hitting set exists, then any ρ-approximate facility set S ⊆ hittingFacilities U W with ρ < 3 is a hitting set.

    theorem Cslib.Algorithms.Lean.KCenter.exists_isHittingSet_iff_of_supplierRadius_le_mul {α : Type u_2} {U : Type u_3} {W : Type u_4} [Semiring α] [LinearOrder α] [IsStrictOrderedRing α] [DecidableEq U] [DecidableEq W] {R : U → W → Prop} [DecidableRel R] [Fintype U] [Fintype W] [Nonempty W] {k : ℕ} {ρ : α} {S : Finset (U ⊕ W)} (hρ : ρ < 3) (hSF : S ⊆ hittingFacilities U W) (hSk : S.card ≤ k) (happrox : ∀ (r : α), supplierOptimum (hittingDist R) (hittingFacilities U W) (hittingClients U W) ⋯ k ≤ ↑r → supplierRadius (hittingDist R) (hittingClients U W) ⋯ S ≤ ↑(ρ * r)) :
    (∃ (H : Finset U), H.card ≤ k ∧ IsHittingSet R ↑H) ↔ IsHittingSet R {u : U | Sum.inl u ∈ S}

    A ρ-approximation with ρ < 3 decides k-Hitting Set ([HS86]): if S ⊆ hittingFacilities U W has at most k facilities and is ρ-approximate with ρ < 3, then a k-hitting set exists iff S itself is a hitting set.