Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Inequality (8) — the facility cost of a bad facility

Proved
LocalSearchFL.UFL.bad_facility_inequality_8

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

facility-locationlocal-searchp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let fi≥0f_i \ge 0fi​≥0 be facility opening costs on a metric instance, let SSS be a nonempty set of facilities that is locally optimum for the add/drop/swap neighbourhood (4), and let OOO be any solution. Let σS\sigma_SσS​, σO\sigma_OσO​ be nearest-facility assignments for SSS and OOO, write Sj=cjσS(j)S_j = c_{j\sigma_S(j)}Sj​=cjσS​(j)​ and Oj=cjσO(j)O_j = c_{j\sigma_O(j)}Oj​=cjσO​(j)​, and let π\piπ be a permutation of the clients satisfying the three conditions of the mapping of the proof of Lemma 4.2.

If s∈Ss \in Ss∈S is bad, and P⊆OP \subseteq OP⊆O is the set of facilities of OOO that sss captures, then

∑o′∈Pfo′−fs+∑j∈NS(s)π(j)≠j(Oj+Oπ(j)+Sπ(j)−Sj)+2∑j∈NS(s)π(j)=jOj ≥ 0.\sum_{o' \in P} f_{o'} - f_s + \sum_{\substack{j \in N_S(s)\\ \pi(j) \neq j}} \bigl(O_j + O_{\pi(j)} + S_{\pi(j)} - S_j\bigr) + 2 \sum_{\substack{j \in N_S(s)\\ \pi(j) = j}} O_j \ \ge\ 0.o′∈P∑​fo′​−fs​+j∈NS​(s)π(j)=j​∑​(Oj​+Oπ(j)​+Sπ(j)​−Sj​)+2j∈NS​(s)π(j)=j​∑​Oj​ ≥ 0.

It is the counterpart for bad facilities of inequality (5): adding (5) over the good facilities, (8) over the bad ones, and fo≥0f_o \ge 0fo​≥0 over the facilities of OOO captured by no one yields Lemma 4.2.

Preamble
import Mathlib
import Definitions.Def_LocalSearchFL_UFL_captures
Formal statement
namespace LocalSearchFL.UFL

/-- Inequality (8), p. 556. Let `S` be a locally optimum solution for the neighbourhood (4), `O`
any solution, `σS`, `σO` nearest-facility assignments, `π` the mapping of the proof of
Lemma 4.2. If `s ∈ S` is bad and `P ⊆ O` is the set of facilities that `s` captures, then
`∑_{o' ∈ P} f_{o'} − f_s + ∑_{j ∈ N_S(s), π(j) ≠ j} (O_j + O_{π(j)} + S_{π(j)} − S_j)
  + 2 ∑_{j ∈ N_S(s), π(j) = j} O_j ≥ 0`. -/
theorem bad_facility_inequality_8 {Cl Fa : Type} [Fintype Cl] [DecidableEq Cl]
    [Fintype Fa] [DecidableEq Fa]
    (I : MetricInstance Cl Fa) (f : Fa → ℝ) (hf : ∀ i, 0 ≤ f i)
    (S O : Finset Fa) (hS : S.Nonempty) (hloc : IsUFLLocalOpt I f S hS)
    (σS σO : Cl → Fa) (hσS : IsNearestAssignment I S σS) (hσO : IsNearestAssignment I O σO)
    (π : Equiv.Perm Cl) (hπ : IsRefinedPi σS σO π)
    (s : Fa) (hs : s ∈ S) (hbad : ¬ IsGood σS σO O s) :
    0 ≤ ∑ o' ∈ O.filter (fun o' => captures σS σO s o'), f o' - f s +
      ∑ j ∈ (nbhd σS s).filter (fun j => π j ≠ j),
        (I.c j (σO j) + I.c (π j) (σO (π j)) + I.c (π j) (σS (π j)) - I.c j (σS j)) +
      2 * ∑ j ∈ (nbhd σS s).filter (fun j => π j = j), I.c j (σO j) := by sorry

end LocalSearchFL.UFL
Source
Arya, Garg, Khandekar, Meyerson, Munagala, Pandit, Local Search Heuristics for k-Median and Facility Location Problems, SIAM J. Comput. 33(3), 2004, p. 556, eq. (8) (from eq. (6) and eq. (7))
Read-back

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

Setting. Let C\mathcal CC (clients) and F\mathcal FF (facilities) be finite types with decidable equality. Let III be a metric instance: ddd on pairs of points of C⊔F\mathcal C\sqcup\mathcal FC⊔F, nonnegative, symmetric, triangle inequality, self-distance not assumed zero. Write cji=d(j,i)c_{ji}=d(j,i)cji​=d(j,i). Let f:F→Rf:\mathcal F\to\mathbb Rf:F→R satisfy fi≥0f_i\ge0fi​≥0 for all iii. For nonempty A⊆FA\subseteq\mathcal FA⊆F, write cost(A)=∑i∈Afi+∑j∈Cmin⁡i∈Acji\mathrm{cost}(A)=\sum_{i\in A}f_i+\sum_{j\in\mathcal C}\min_{i\in A}c_{ji}cost(A)=∑i∈A​fi​+∑j∈C​mini∈A​cji​.

Hypotheses.

  • S,OS,OS,O are finite sets of facilities, and SSS is nonempty.

  • SSS is locally optimal:

    • cost(S)≤cost(S∪{s′})\mathrm{cost}(S)\le\mathrm{cost}(S\cup\{s'\})cost(S)≤cost(S∪{s′}) for every facility s′s's′;
    • cost(S)≤cost(S∖{s})\mathrm{cost}(S)\le\mathrm{cost}(S\setminus\{s\})cost(S)≤cost(S∖{s}) for every s∈Ss\in Ss∈S with S∖{s}≠∅S\setminus\{s\}\ne\emptysetS∖{s}=∅;
    • cost(S)≤cost((S∖{s})∪{s′})\mathrm{cost}(S)\le\mathrm{cost}((S\setminus\{s\})\cup\{s'\})cost(S)≤cost((S∖{s})∪{s′}) for all s∈Ss\in Ss∈S and all facilities s′s's′.
  • σS,σO:C→F\sigma_S,\sigma_O:\mathcal C\to\mathcal FσS​,σO​:C→F are nearest-facility assignments:

    • for every jjj: σS(j)∈S\sigma_S(j)\in SσS​(j)∈S with cjσS(j)≤cjic_{j\sigma_S(j)}\le c_{ji}cjσS​(j)​≤cji​ for all i∈Si\in Si∈S;
    • for every jjj: σO(j)∈O\sigma_O(j)\in OσO​(j)∈O with cjσO(j)≤cjic_{j\sigma_O(j)}\le c_{ji}cjσO​(j)​≤cji​ for all i∈Oi\in Oi∈O.

    Write Sj=cjσS(j)S_j=c_{j\sigma_S(j)}Sj​=cjσS​(j)​ and Oj=cjσO(j)O_j=c_{j\sigma_O(j)}Oj​=cjσO​(j)​.

  • Write NS(s)={j:σS(j)=s}N_S(s)=\{j:\sigma_S(j)=s\}NS​(s)={j:σS​(j)=s}, NO(o)={j:σO(j)=o}N_O(o)=\{j:\sigma_O(j)=o\}NO​(o)={j:σO​(j)=o} and Nso=NO(o)∩NS(s)N^o_s=N_O(o)\cap N_S(s)Nso​=NO​(o)∩NS​(s). Say that sss captures ooo when ∣NO(o)∣<2∣Nso∣|N_O(o)|<2|N^o_s|∣NO​(o)∣<2∣Nso​∣.

  • π\piπ is a permutation of C\mathcal CC satisfying all three of:

    • (i) σO(π(j))=σO(j)\sigma_O(\pi(j))=\sigma_O(j)σO​(π(j))=σO​(j) for all jjj;
    • (ii) for all facilities s,os,os,o with sss not capturing ooo: j∈Nso⇒π(j)∉Nsoj\in N^o_s\Rightarrow\pi(j)\notin N^o_sj∈Nso​⇒π(j)∈/Nso​;
    • (iii) for all facilities s,os,os,o with sss capturing ooo: j,π(j)∈Nso⇒π(j)=jj,\pi(j)\in N^o_s\Rightarrow\pi(j)=jj,π(j)∈Nso​⇒π(j)=j.
  • s∈Ss\in Ss∈S is bad: it is not the case that sss captures no o∈Oo\in Oo∈O. In other words, sss captures at least one o∈Oo\in Oo∈O.

Conclusion. Let P={o′∈O:s captures o′}P=\{o'\in O: s \text{ captures } o'\}P={o′∈O:s captures o′}. Then

0≤∑o′∈Pfo′−fs+∑j∈NS(s)π(j)≠j(Oj+Oπ(j)+Sπ(j)−Sj)+2∑j∈NS(s)π(j)=jOj,0\le \sum_{o'\in P}f_{o'}-f_s+\sum_{\substack{j\in N_S(s)\\ \pi(j)\ne j}}\big(O_j+O_{\pi(j)}+S_{\pi(j)}-S_j\big)+2\sum_{\substack{j\in N_S(s)\\ \pi(j)=j}}O_j,0≤o′∈P∑​fo′​−fs​+j∈NS​(s)π(j)=j​∑​(Oj​+Oπ(j)​+Sπ(j)​−Sj​)+2j∈NS​(s)π(j)=j​∑​Oj​,

where Oπ(j)=cπ(j)σO(π(j))O_{\pi(j)}=c_{\pi(j)\sigma_O(\pi(j))}Oπ(j)​=cπ(j)σO​(π(j))​ and Sπ(j)=cπ(j)σS(π(j))S_{\pi(j)}=c_{\pi(j)\sigma_S(\pi(j))}Sπ(j)​=cπ(j)σS​(π(j))​. The first sum ranges over PPP only. The subtraction of fsf_sfs​ and the other two sums lie outside it.

Degenerate cases. Badness forces P≠∅P\ne\emptysetP=∅ and some ∣Nso∣≥1|N^o_s|\ge1∣Nso​∣≥1. So C\mathcal CC and OOO are nonempty, and NS(s)≠∅N_S(s)\ne\emptysetNS​(s)=∅.

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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me