Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 5.4 — routing |N_S(s)| units from each v_s to the sink at cost ≤ cost_s(S) + cost_s(O) + cost_f(O)

Proved
LocalSearchFL.CFL.flow_lemma_5_4

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

capacitated-facility-locationfacility-locationnetwork-flowsp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let CCC be a finite set of clients and FFF a set of facilities in a metric instance with distances ccc, integer capacities ui>0u_i > 0ui​>0 and facility costs fi≥0f_i \ge 0fi​≥0. Let XXX and OOO be two CFL solutions. Consider the directed graph with a node vsv_svs​ for every copy sss of XXX, a node wow_owo​ for every copy ooo of OOO and a sink, with an edge (vs,wo)(v_s, w_o)(vs​,wo​) of length csoc_{so}cso​ (the distance between the facilities of sss and ooo) and an edge (wo,sink)(w_o, \mathrm{sink})(wo​,sink) of length fo/uof_o/u_ofo​/uo​. Then one can route ∣NX(s)∣|N_X(s)|∣NX​(s)∣ units of flow from every vsv_svs​ to the sink at total cost at most the service costs of both solutions plus the facility cost of OOO: there are nonnegative integers xsox_{so}xso​ (the flow on the path vs→wo→sinkv_s \to w_o \to \mathrm{sink}vs​→wo​→sink) with ∑oxso=∣NX(s)∣\sum_o x_{so} = |N_X(s)|∑o​xso​=∣NX​(s)∣ for every sss and

∑s∑oxso(cso+fouo)≤costs(X)+costs(O)+costf(O).\sum_{s}\sum_{o} x_{so}\left(c_{so} + \frac{f_o}{u_o}\right) \le \mathrm{cost}_s(X) + \mathrm{cost}_s(O) + \mathrm{cost}_f(O).s∑​o∑​xso​(cso​+uo​fo​​)≤costs​(X)+costs​(O)+costf​(O).

The lemma needs no local optimality. It compares the two solutions through a flow whose cost is then bounded from below by a shortest-path flow in inequality (10).

Formalization Note The graph is complete bipartite plus a sink, so a flow is determined by the amounts xsox_{so}xso​ on the two-edge paths; no graph library is used. The flow is required to be integral, which is what the paper's routing (one unit per client) produces. Here ooo ranges over the copies of OOO and uou_ouo​, fof_ofo​ are those of the facility of the copy ooo.

Preamble
import Mathlib
import Definitions.Def_LocalSearchFL_CFL_IsCFLLocalOpt
Formal statement
namespace LocalSearchFL.CFL

/-- **Lemma 5.4**, p. 560: for any two CFL solutions `X` and `O`, in the flow graph with an
edge `(v_s, w_o)` of length `c_{so}` for every copy `s` of `X` and copy `o` of `O`, and an edge
`(w_o, sink)` of length `f_o / u_o`, one can simultaneously route `|N_X(s)|` units of flow
from every `v_s` to the sink at total cost at most `cost_s(X) + cost_s(O) + cost_f(O)`.
Here `x s o` is the (integer-valued) flow on the path `v_s → w_o → sink`. -/
theorem flow_lemma_5_4 {Cl Fa : Type} [Fintype Cl]
    (I : MetricInstance Cl Fa) (u : Fa → ℕ) (hu : ∀ i, 0 < u i) (f : Fa → ℝ) (hf : ∀ i, 0 ≤ f i)
    (X O : CFLSol Cl Fa u) :
    ∃ x : Fin X.n → Fin O.n → ℕ,
      (∀ s, ∑ o, x s o = (X.nbhd s).card) ∧
      ∑ s, ∑ o, (x s o : ℝ) * (I.cf (X.loc s) (O.loc o) + f (O.loc o) / (u (O.loc o) : ℝ)) ≤
        costS I X + costS I O + costF f O := by sorry

end LocalSearchFL.CFL
Source
Arya, Garg, Khandekar, Meyerson, Munagala, Pandit, Local Search Heuristics for k-Median and Facility Location Problems, SIAM J. Comput. 33(3), 2004, p. 560, Lemma 5.4 (graph G defined on p. 559)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. Let CCC be a type of clients. It must be finite. Let FFF be a type of facilities, which is an arbitrary type and need not be finite. The statement takes the following data:

  • III, a metric instance on CCC and FFF. This is a structure from the imported definitions file, and its contents are not shown in the code. The statement uses one field of it, cIc_IcI​. It is applied to two facility locations, so cI(a,b)c_I(a,b)cI​(a,b) is a real number for facilities a,ba, ba,b.

  • A capacity function u:F→Nu : F \to \mathbb{N}u:F→N, with the hypothesis ui>0u_i > 0ui​>0 for every facility iii.

  • An opening-cost function f:F→Rf : F \to \mathbb{R}f:F→R, with the hypothesis fi≥0f_i \ge 0fi​≥0 for every facility iii.

  • Two capacitated facility location solutions XXX and OOO for CCC, FFF and uuu. These are also defined in the imported file, which is not visible. The statement uses three pieces of each solution. For XXX they are:

    • a natural number nXn_XnX​, the number of copies in the solution;
    • for each copy s∈{0,…,nX−1}s \in \{0,\dots,n_X-1\}s∈{0,…,nX​−1}, a facility locX(s)∈F\mathrm{loc}_X(s) \in FlocX​(s)∈F;
    • for each copy sss, a finite set NX(s)N_X(s)NX​(s), the "neighbourhood" of sss, which enters only through its size ∣NX(s)∣|N_X(s)|∣NX​(s)∣.

    OOO has the same pieces: nOn_OnO​, locO(o)\mathrm{loc}_O(o)locO​(o) and so on.

  • Three cost quantities from the imported file: costS(I,X)\mathrm{cost}_S(I,X)costS​(I,X), costS(I,O)\mathrm{cost}_S(I,O)costS​(I,O) and costF(f,O)\mathrm{cost}_F(f,O)costF​(f,O). They are real numbers. Their definitions are not shown here, and the statement relies on whatever those definitions say. The same goes for any constraints built into the solution type, such as whether copies respect the capacities uuu.

Assertion. There is a function xxx that assigns a natural number xs,ox_{s,o}xs,o​ to each copy sss of XXX and each copy ooo of OOO, with both of these properties:

  1. Row sums. For every copy sss of XXX,
∑o=0nO−1xs,o=∣NX(s)∣.\sum_{o=0}^{n_O-1} x_{s,o} = |N_X(s)|.o=0∑nO​−1​xs,o​=∣NX​(s)∣.
  1. Cost bound.
∑s=0nX−1∑o=0nO−1xs,o(cI(locX(s), locO(o))+f(locO(o))u(locO(o)))  ≤  costS(I,X)+costS(I,O)+costF(f,O).\sum_{s=0}^{n_X-1}\sum_{o=0}^{n_O-1} x_{s,o}\left( c_I\big(\mathrm{loc}_X(s),\,\mathrm{loc}_O(o)\big) + \frac{f\big(\mathrm{loc}_O(o)\big)}{u\big(\mathrm{loc}_O(o)\big)}\right) \;\le\; \mathrm{cost}_S(I,X) + \mathrm{cost}_S(I,O) + \mathrm{cost}_F(f,O).s=0∑nX​−1​o=0∑nO​−1​xs,o​(cI​(locX​(s),locO​(o))+u(locO​(o))f(locO​(o))​)≤costS​(I,X)+costS​(I,O)+costF​(f,O).

The division in the cost bound is real division.

No other constraint is placed on xxx. In particular:

  • The column sums ∑sxs,o\sum_s x_{s,o}∑s​xs,o​ are not bounded, so nothing limits the total amount assigned to a copy ooo of OOO (for example, by a capacity).
  • Nothing mentions a graph, edges or a sink. The accompanying comment describes the result as a flow-routing statement, but the code states only the two conditions above on the numbers xs,ox_{s,o}xs,o​.

Edge cases. These follow from the text as written:

  • No division by zero. Because ui>0u_i > 0ui​>0 for every facility, every denominator u(locO(o))u(\mathrm{loc}_O(o))u(locO​(o)) is positive.
  • nX=0n_X = 0nX​=0 (no copies in XXX). The row-sum condition holds vacuously, and the double sum is empty, so its value is 000. The statement then says only that 0≤costS(I,X)+costS(I,O)+costF(f,O)0 \le \mathrm{cost}_S(I,X) + \mathrm{cost}_S(I,O) + \mathrm{cost}_F(f,O)0≤costS​(I,X)+costS​(I,O)+costF​(f,O).
  • nO=0n_O = 0nO​=0 but nX>0n_X > 0nX​>0. Each row sum is empty and equals 000. So the statement can hold only if ∣NX(s)∣=0|N_X(s)| = 0∣NX​(s)∣=0 for every copy sss. If some NX(s)N_X(s)NX​(s) is nonempty, the statement is false unless the hidden definitions rule this combination out.
  • FFF empty. No copy can have a location, so nX=nO=0n_X = n_O = 0nX​=nO​=0 is forced (assuming locations are total functions, as they appear to be) and the nX=0n_X = 0nX​=0 case above applies.
  • CCC empty. The code places no constraint that makes this case special. Whether the neighbourhoods NX(s)N_X(s)NX​(s) must then be empty depends on the hidden definitions.
  • Unused hypotheses. Nonnegativity of fff, positivity of uuu and finiteness of CCC are assumed. Whether the bound actually needs them depends on the hidden definitions of the cost terms.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me