The swaps of §3.2 and their four properties
ProvedLocalSearchFL.KMedian.exists_swaps_four_propertiesLet and be finite sets of facilities with , and let be assignments of the clients, with capture, good and bad facilities as in Definition 3.1. Then there is a choice, for every , of a facility — the swap — such that
- each is considered in exactly one swap;
- a facility which captures more than one facility in is not considered in any swap;
- each good facility is considered in at most two swaps: ;
- if the swap is considered, then captures no facility with .
These are the swaps whose inequalities (2) are added up in the proof of Theorem 3.2.
Formalization Note Property 1 is built into being a function on . The hypothesis is the case the paper treats ("we now consider swaps, one for each facility in "). The assignments are arbitrary maps; the paper's are nearest-facility assignments.
import Mathlib import Definitions.Def_LocalSearchFL_KMedian_captures
namespace LocalSearchFL.KMedian
/-- The k swaps of §3.2 (pp. 549–550): when `|S| = |O|`, one can assign to each `o ∈ O` a
facility `η o ∈ S` (the swap `⟨η o, o⟩`) such that
(1) each `o ∈ O` is in exactly one swap (built into `η` being a function on `O`);
(2) a facility of `S` capturing more than one facility of `O` is in no swap;
(3) each good facility of `S` is in at most two swaps;
(4) if `⟨s, o⟩` is a swap, then `s` captures no facility `o' ∈ O` with `o' ≠ o`. -/
theorem exists_swaps_four_properties {Cl Fa : Type} [Fintype Cl] [DecidableEq Cl]
[DecidableEq Fa]
(σS σO : Cl → Fa) (S O : Finset Fa) (hcard : S.card = O.card) :
∃ η : Fa → Fa,
(∀ o ∈ O, η o ∈ S) ∧
(∀ s ∈ S, (∃ o₁ ∈ O, ∃ o₂ ∈ O, o₁ ≠ o₂ ∧ captures σS σO s o₁ ∧ captures σS σO s o₂) →
∀ o ∈ O, η o ≠ s) ∧
(∀ s ∈ S, IsGood σS σO O s → (O.filter (fun o => η o = s)).card ≤ 2) ∧
(∀ o ∈ O, ∀ o' ∈ O, o' ≠ o → ¬ captures σS σO (η o) o') := by sorry
end LocalSearchFL.KMedian
Read-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting.
- is a finite type of clients with decidable equality.
- is a type of facilities with decidable equality.
- are arbitrary maps.
- are finite sets with .
No relation is assumed between and : the maps need not take values in or , and need not be nearest assignments. and may overlap.
Capture is defined from the maps alone, with and : " captures " means . is good when it captures no element of .
Claim. There exists a function with all four of the following properties:
- for every .
- If captures two distinct elements of , then for every .
- If is good, then
- For every and every with , does not capture .
The values of outside are unconstrained. No further condition is placed on : it need not be injective, and is not excluded.
Degenerate cases.
- If , every function satisfies the claim.
- If is empty, no capture holds and every facility is good. Conditions 2 and 4 are then automatic, and the claim reduces to a map with each element of hit at most twice.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.