p-swap local search for metric k-median has locality gap at most
ProvedLocalSearchFL.MultiSwap.multiswap_locality_gapConsider a metric instance with clients , facilities and service costs (nonnegative, symmetric, satisfying the triangle inequality), and the k-median cost of a nonempty set of open facilities.
Let and be integers, and let with be locally optimum for the -swap neighbourhood
that is, for every . Then for every nonempty set with ,
In the language of local search: the locality gap of the k-median problem with respect to -swaps is at most . As grows the bound approaches ; the paper gives a tight example (§3.5) for .
Formalization Note The bound is stated for every feasible , not only an optimum (the proof never uses optimality), and multiplied out, so that causes no division. The constant is computed in as 3 + 2 / (p : ℝ). The case is Theorem 3.2 of the paper (bound ); §3.3 introduces multiswaps for , while the abstract and §3.5 allow every .
import Mathlib import Definitions.Def_LocalSearchFL_MultiSwap_kmCost
namespace LocalSearchFL.MultiSwap
/-- §3.4, p. 553 (announced §3.3, p. 551): p-swap local search for the metric k-median problem
has locality gap at most `3 + 2/p`. If `p ≥ 1` and `S` is a set of `k` facilities that is locally
optimum for the neighbourhood (3), then `cost(S) ≤ (3 + 2/p) · cost(O)` for every nonempty set
`O` of at most `k` facilities. -/
theorem multiswap_locality_gap {Cl Fa : Type} [Fintype Cl] [DecidableEq Cl]
[Fintype Fa] [DecidableEq Fa]
(I : LocalSearchFL.Shared.MetricInstance Cl Fa) (p : ℕ) (hp : 1 ≤ p)
(k : ℕ) (S : Finset Fa) (hS : S.Nonempty) (hSk : S.card = k)
(hloc : IsPSwapLocalOpt I p S hS)
(O : Finset Fa) (hO : O.Nonempty) (hOk : O.card ≤ k) :
kmCost I S hS ≤ (3 + 2 / (p : ℝ)) * kmCost I O hO := by sorry
end LocalSearchFL.MultiSwap
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
The statement concerns two finite types:
- (the Lean type
Cl), whose elements the names suggest are clients. - (the Lean type
Fa), whose elements the names suggest are facilities.
Both types are required to be finite and to have decidable equality. The statement is also universally quantified over these arguments:
- an object of type
LocalSearchFL.Shared.MetricInstancebuilt on and ; - a natural number ;
- a natural number ;
- a finite set ;
- a finite set .
None of the three definitions it uses (MetricInstance, IsPSwapLocalOpt and kmCost) is shown in the code given here. They come from an imported definitions module. So the read-back can only name them; it cannot say what they contain:
- is a value of type
MetricInstanceon and . What data it holds (for example distances), and what conditions it imposes (for example non-negativity, symmetry or a triangle inequality), cannot be seen here. - stands for
kmCost I T. It is a real number defined for a finite set together with a proof that is nonempty. Its formula cannot be seen here. - stands for
IsPSwapLocalOpt I p S. It is a proposition that also takes the proof that is nonempty. What it requires, including what neighbourhood of it compares against, cannot be seen here.
The hypotheses are:
- ;
- is nonempty;
- ;
- holds;
- is nonempty;
- .
Under these hypotheses the statement asserts
where is converted to a real number, so is ordinary real division. The number appears only in hypotheses 3 and 6. Its only role is to require , because hypothesis 3 fixes as the size of . Nothing requires to differ from , to be disjoint from it or to be related to it in any way. Nothing gives an upper bound; in particular may exceed .
Degenerate cases:
- Division by . Hypothesis 1 rules out , so the default value of never arises. The factor lies in the interval . It equals when .
- Facilities. Hypothesis 2 forces to be nonempty and . If has one element, then and must both be that single facility. The claim then reads . Whether that holds depends on whether can be negative, which the unseen definition decides.
- Clients. may be empty. What equals in that case, for example an empty sum of , cannot be seen here.
- Local optimality. Whether hypothesis 4 can be satisfied at all, or whether it holds trivially in some cases (for example when exceeds or ), depends entirely on the unseen definition. If it can never hold, the statement is vacuous.
- Unused docstring. The docstring describes a metric -median problem and a "neighbourhood (3)". This read-back does not rely on it, because nothing in the visible code establishes those meanings.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.