Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Definitions bundle OAIQ037K071 of the split of OpenAI, The approximation threshold for metric k-median (result family 125)

Definition
OAIQ037K071

by dbenbenn · Oct 27, 2026 · Mathlib 0df444a (Lean v4.33.1)

openai-math

A definitions bundle of the split of OpenAI's proof of OAI.MetricKMedian.main_finite_work, carved from OpenAI's openai/math development (OpenAI, The approximation threshold for metric k-median (result family 125), OpenAI Math Release, September 24, 2026, result family 125, github.com/openai/math at commit adc7f12, Apache License 2.0) and ported to Lean 4.33.1 and Mathlib 0df444a. The declarations and their proofs are OpenAI's.

Contents. It holds 8 declarations of OpenAI's Lean: 5 definitions and 3 theorems. The definitions and types are OAI.MetricKMedian.Reduction.Program.branchList, OAI.MetricKMedian.Reduction.Program.completions, OAI.MetricKMedian.Reduction.Program.endpoints, OAI.MetricKMedian.Reduction.Program.outcomes, OAI.MetricKMedian.Reduction.Program.values.

Sources. They come from these modules of lean/OAI/Combinatorics/KMedian, in whole or in part: KMedian_Programs_BoundedEnumerationProgram, KMedian_Programs_BranchProgram, KMedian_Programs_RestrictionProgram, KMedian_Reduction_DeletionProgram, KMedian_Reduction_ReductionOutcomesProgram.

Imports. It imports the published bundle Def_MetricKMedian; the bundles OAIQ037K063, OAIQ037K064 and OAIQ037K066 of this split.

Imported by (directly, in this split): the bundle OAIQ037K076.

Definition code
import Mathlib
import Definitions.Def_MetricKMedian
import Definitions.Def_OAIQ037K063
import Definitions.Def_OAIQ037K064
import Definitions.Def_OAIQ037K066

section
-- module Solutions.OAIQ037_KM.KMedian_Programs_BoundedEnumerationProgram
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false

namespace OAI


                                                 
section
namespace MetricKMedian.Reduction.Enumeration
open Finset Binary Binary.PolyProgram Binary.Automatic Binary.Automatic.Poly
open SparseGraph.ListOperation (Row Table setView indices)
 theorem maskWord_view {n : ℕ} (T : Finset (Fin n)) (ys : List (Fin n)) :
    maskWord (setView T,ys.map Fin.val)=setView ys.toFinset := by
  simp only [maskWord,indices,setView,List.length_ofFn,RoundingList.range_finRange,← List.ofFn_eq_map,List.map_ofFn]
  apply congrArg List.ofFn
  funext i
  apply Bool.eq_iff_iff.mpr
  simp only [Function.comp_def,List.map_map,List.any_eq_true,List.mem_map,id_eq,decide_eq_true_eq,List.mem_toFinset]
  constructor
  · rintro ⟨_,⟨a,ha,rfl⟩,he⟩
    exact (Fin.ext (of_decide_eq_true he)) ▸ ha
  · intro hi
    exact ⟨true,⟨i,hi,by simp⟩,rfl⟩
 theorem choicesRaw_view {n : ℕ} (T : Finset (Fin n)) (c : ℕ) : choicesRaw c (setView T)=
    ((words c (List.ofFn (T.orderEmbOfFin rfl))).map List.toFinset).map setView := by
  unfold choicesRaw
  rw [Preparation.RationalUnitInput.Program.ranks_view]
  have hr : List.ofFn (fun a => (T.orderEmbOfFin rfl a).val)=(List.ofFn (T.orderEmbOfFin rfl)).map Fin.val := by simp only [List.map_ofFn,Function.comp_def]
  rw [hr,words_map,List.map_map,List.map_map]
  apply List.map_congr_left
  intro ys _
  exact maskWord_view T ys
end MetricKMedian.Reduction.Enumeration
end

end OAI
end

section
-- module Solutions.OAIQ037_KM.KMedian_Programs_RestrictionProgram
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false

namespace OAI


                                          
section
namespace MetricKMedian.Reduction.Enumeration
open Finset Binary Binary.PolyProgram Binary.Automatic Binary.Automatic.Poly
open SparseGraph.ListOperation (Row Table setView indices)
open InstanceProgram (Raw view)
open MetricKMedian.MaskProgram
 theorem choicesRaw_choices {n : ℕ} (T : Finset (Fin n)) (c : ℕ) : choicesRaw c (setView T)=(choices T c).map setView :=
  choicesRaw_view T c

end MetricKMedian.Reduction.Enumeration
end

end OAI
end

section
-- module Solutions.OAIQ037_KM.KMedian_Reduction_DeletionProgram
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false

namespace OAI


                                       
section
namespace MetricKMedian.Reduction.Program
open Finset Binary Binary.PolyProgram Binary.Automatic Binary.Automatic.Poly
open SparseGraph.ListOperation (Row Table setView indices)
open InstanceProgram (Raw view)
open MetricKMedian.MaskProgram
open Preparation.RationalNearest.MaskProgram (erase )
open Completion.Rational.BestProgram (card card_view)
open Enumeration

def values (I : Instance) (T : Finset (Fin I.n)) (c : ℕ) : List ℚ :=
  (choices T c).flatMap (fun D => (List.ofFn (T.orderEmbOfFin rfl)).map (fun i =>
    rationalCost I ((T\D).erase i)-rationalCost I (T\D)))

def endpoints (I : Instance) (T : Finset (Fin I.n)) (c : ℕ) : List (Finset (Fin I.n)) :=
  (0::values I T c).map (fun B => rationalHistory I B T c)
end MetricKMedian.Reduction.Program
end

end OAI
end

section
-- module Solutions.OAIQ037_KM.KMedian_Reduction_ReductionOutcomesProgram
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false

namespace OAI


                                                
section
namespace MetricKMedian.Reduction.Program
open Finset Binary Binary.PolyProgram Binary.Automatic Binary.Automatic.Poly
open SparseGraph.ListOperation (Row Table setView indices)
open InstanceProgram (Raw view)
open Enumeration

def completions (I : Instance) (F U : Finset (Fin I.n)) (δ : ℚ) (b : ℕ) : List (Finset (Fin I.n)) :=
  (choices U b).flatMap (fun H => (choices F b).map (fun B => completionSet I F B (U\H) (rationalRadii I U) δ))

def outcomes (I : Instance) (F T : Finset (Fin I.n)) (δ : ℚ) (c b : ℕ) : List (Finset (Fin I.n)) :=
  T::(endpoints I T c).flatMap (fun U => U::completions I F U δ b)
end MetricKMedian.Reduction.Program
end

end OAI
end

section
-- module Solutions.OAIQ037_KM.KMedian_Programs_BranchProgram
set_option linter.all false
set_option linter.unusedVariables false
set_option linter.unusedTactic false
set_option linter.unreachableTactic false

namespace OAI


                                     
section
namespace MetricKMedian.Reduction.Program
open Finset Preparation Binary Binary.PolyProgram Binary.Automatic Binary.Automatic.Poly
open SparseGraph.ListOperation (Row Table setView)
open InstanceProgram (Raw view)
open Completion.Rational.BestProgram (card card_view)
open Enumeration
variable (r : ℕ) (hr : 0 < r) {η τ : ℝ} (p : RationalAllParameters η τ) (c a b : ℕ) (δ : ℚ)
def branchList (I : Instance) : List Branch := (branches I I.facilities a).map (fun F => ⟨I,F⟩)
end MetricKMedian.Reduction.Program
end

end OAI
end
Source
OpenAI, The approximation threshold for metric k-median (result family 125), OpenAI Math Release, September 24, 2026, https://github.com/openai/math (result family 125; paper: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/preprints/The-Approximation-Threshold-for-Metric-k-Median-September-24-2026/main.pdf; Apache License 2.0); definitions carved from lean/OAI/Combinatorics/KMedian at commit adc7f12

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