Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Claim 3.1 — partition of S and O into blocks with B_i = capture(A_i)

Proved
LocalSearchFL.MultiSwap.exists_partition_claim_3_1

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

combinatoricsfacility-locationk-medianlocal-searchp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let SSS and OOO be two sets of facilities with ∣S∣=∣O∣|S| = |O|∣S∣=∣O∣, and let σS,σO\sigma_S, \sigma_OσS​,σO​ be client assignments; capture, good and bad are as defined for SSS and OOO. Then there are an integer r≥1r \ge 1r≥1, a partition of SSS into A1,…,ArA_1, \dots, A_rA1​,…,Ar​ and a partition of OOO into B1,…,BrB_1, \dots, B_rB1​,…,Br​ such that

  1. for 1≤i≤r−11 \le i \le r-11≤i≤r−1, ∣Ai∣=∣Bi∣|A_i| = |B_i|∣Ai​∣=∣Bi​∣ and Bi=capture(Ai)B_i = \mathrm{capture}(A_i)Bi​=capture(Ai​); and ∣Ar∣=∣Br∣|A_r| = |B_r|∣Ar​∣=∣Br​∣;
  2. for 1≤i≤r−11 \le i \le r-11≤i≤r−1, the set AiA_iAi​ has exactly one bad facility;
  3. the set ArA_rAr​ contains only good facilities.

The paper obtains the partition by the procedure of its Figure 8 and proves in Claim 3.1 that the procedure terminates with such partitions. The partition is the skeleton of the swaps used in the ppp-swap analysis.

Formalization Note The claim is stated in existence form: the procedure itself is not formalized. The blocks A1,…,Ar−1A_1,\dots,A_{r-1}A1​,…,Ar−1​ are a family indexed by Fin m (r=m+1r = m+1r=m+1) and ArA_rAr​, BrB_rBr​ are separate sets, which may be empty (as the procedure allows). "Partition" is stated as: every block is contained in SSS (resp. OOO), the blocks are pairwise disjoint and cover SSS (resp. OOO). Capture and goodness are computed against the original SSS and OOO; since disjoint sets have disjoint captures, this gives the same blocks as the procedure's shrinking OOO.

Preamble
import Mathlib
import Definitions.Def_LocalSearchFL_MultiSwap_capture
Formal statement
namespace LocalSearchFL.MultiSwap

/-- Claim 3.1 (p. 552), in existence form. If `|S| = |O|`, then `S` can be partitioned into
`A_1, …, A_r` and `O` into `B_1, …, B_r` (here `r = m + 1`, `A_i = A (i-1)` and `B_i = B (i-1)`
for `i ≤ m`, and `A_r = Ar`, `B_r = Br`) such that
1. for `1 ≤ i ≤ r − 1`, `|A_i| = |B_i|` and `B_i = capture(A_i)`; and `|A_r| = |B_r|`;
2. for `1 ≤ i ≤ r − 1`, `A_i` has exactly one bad facility;
3. `A_r` contains only good facilities.
Capture, good and bad are taken with respect to the original `S` and `O` (the assignments `σS`,
`σO` and the set `O`). The last blocks `Ar`, `Br` may be empty. -/
theorem exists_partition_claim_3_1 {Cl Fa : Type} [Fintype Cl] [DecidableEq Cl] [DecidableEq Fa]
    (σS σO : Cl → Fa) (S O : Finset Fa) (hcard : S.card = O.card) :
    ∃ (m : ℕ) (A B : Fin m → Finset Fa) (Ar Br : Finset Fa),
      -- `A_1, …, A_{r-1}, A_r` partition `S`
      (∀ i, A i ⊆ S) ∧ Ar ⊆ S ∧ (∀ s ∈ S, (∃ i, s ∈ A i) ∨ s ∈ Ar) ∧
      (∀ i i', i ≠ i' → Disjoint (A i) (A i')) ∧ (∀ i, Disjoint (A i) Ar) ∧
      -- `B_1, …, B_{r-1}, B_r` partition `O`
      (∀ i, B i ⊆ O) ∧ Br ⊆ O ∧ (∀ o ∈ O, (∃ i, o ∈ B i) ∨ o ∈ Br) ∧
      (∀ i i', i ≠ i' → Disjoint (B i) (B i')) ∧ (∀ i, Disjoint (B i) Br) ∧
      -- property 1
      (∀ i, (A i).card = (B i).card ∧ B i = capture σS σO O (A i)) ∧ Ar.card = Br.card ∧
      -- property 2
      (∀ i, ∃ b ∈ A i, ¬ IsGood σS σO O b ∧ ∀ s ∈ A i, s ≠ b → IsGood σS σO O s) ∧
      -- property 3
      (∀ s ∈ Ar, IsGood σS σO O s) := by sorry

end LocalSearchFL.MultiSwap
Source
Arya, Garg, Khandekar, Meyerson, Munagala, Pandit, Local Search Heuristics for k-Median and Facility Location Problems, SIAM J. Comput. 33(3), 2004, pp. 551–552, §3.4, Claim 3.1 and Figure 8
Read-back

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

Data.

  • CCC is a finite type of clients and FFF is a type of facilities, both with decidable equality.
  • σS,σO:C→F\sigma_S, \sigma_O : C \to FσS​,σO​:C→F are arbitrary functions.
  • SSS and OOO are finite subsets of FFF.

Hypothesis. ∣S∣=∣O∣|S| = |O|∣S∣=∣O∣. Nothing else is assumed:

  • SSS and OOO may overlap;
  • σS\sigma_SσS​ need not map into SSS, and σO\sigma_OσO​ need not map into OOO.

Definitions used.

  • capture⁡(T)={ o∈O:∣NO(o)∣<2 ∣NS(T)∩NO(o)∣ }\operatorname{capture}(T) = \{\, o \in O : |N_O(o)| < 2\,|N_S(T) \cap N_O(o)| \,\}capture(T)={o∈O:∣NO​(o)∣<2∣NS​(T)∩NO​(o)∣}, where NS(T)={j:σS(j)∈T}N_S(T) = \{j : \sigma_S(j) \in T\}NS​(T)={j:σS​(j)∈T} and NO(o)={j:σO(j)=o}N_O(o) = \{j : \sigma_O(j) = o\}NO​(o)={j:σO​(j)=o}.
  • A facility sss is good when capture⁡({s})=∅\operatorname{capture}(\{s\}) = \varnothingcapture({s})=∅, and bad otherwise.

Claim. There exist:

  • a natural number mmm (possibly 000);
  • finite sets A0,…,Am−1A_0, \dots, A_{m-1}A0​,…,Am−1​ and B0,…,Bm−1B_0, \dots, B_{m-1}B0​,…,Bm−1​ of facilities;
  • finite sets ArA_rAr​ and BrB_rBr​ of facilities;

such that the following hold.

  • AAA-blocks cover SSS disjointly.
    • Every AiA_iAi​ and ArA_rAr​ is a subset of SSS.
    • Every s∈Ss \in Ss∈S lies in some AiA_iAi​ or in ArA_rAr​.
    • Ai∩Ai′=∅A_i \cap A_{i'} = \varnothingAi​∩Ai′​=∅ whenever i≠i′i \ne i'i=i′.
    • Ai∩Ar=∅A_i \cap A_r = \varnothingAi​∩Ar​=∅ for every iii.
  • BBB-blocks cover OOO disjointly.
    • Every BiB_iBi​ and BrB_rBr​ is a subset of OOO.
    • Every o∈Oo \in Oo∈O lies in some BiB_iBi​ or in BrB_rBr​.
    • Bi∩Bi′=∅B_i \cap B_{i'} = \varnothingBi​∩Bi′​=∅ whenever i≠i′i \ne i'i=i′.
    • Bi∩Br=∅B_i \cap B_r = \varnothingBi​∩Br​=∅ for every iii.
  • Sizes and capture.
    • For every i<mi < mi<m: ∣Ai∣=∣Bi∣|A_i| = |B_i|∣Ai​∣=∣Bi​∣ and Bi=capture⁡(Ai)B_i = \operatorname{capture}(A_i)Bi​=capture(Ai​).
    • ∣Ar∣=∣Br∣|A_r| = |B_r|∣Ar​∣=∣Br​∣.
  • One bad facility per block. For every i<mi < mi<m there is a b∈Aib \in A_ib∈Ai​ that is bad, and every other element of AiA_iAi​ is good. So each AiA_iAi​ is nonempty and contains exactly one bad facility, and therefore ∣Bi∣≥1|B_i| \ge 1∣Bi​∣≥1.
  • Last block is good. Every element of ArA_rAr​ is good.

Nonemptiness of the individual blocks is not otherwise required: ArA_rAr​ and BrB_rBr​ may be empty.

Degenerate cases.

  • If S=O=∅S = O = \varnothingS=O=∅, the claim is satisfied with m=0m = 0m=0 and Ar=Br=∅A_r = B_r = \varnothingAr​=Br​=∅.
  • If m=0m = 0m=0, the claim reduces to Ar=SA_r = SAr​=S, Br=OB_r = OBr​=O, and every element of SSS being good.
  • If O=∅O = \varnothingO=∅, then ∣S∣=0|S| = 0∣S∣=0 as well.
  • If CCC is empty, every facility is good. Since each AiA_iAi​ must contain a bad facility, this forces m=0m = 0m=0.
  • No subtraction, division or other default-valued operations occur.
Human review
  • Endorsed by Shuze Chen · Sep 28, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 28, 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