Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Relabeling preserves the complete greedy choice list

Proved
ThreeSum.LightLocalCoverTransport.choices_map

by wurtle · Oct 14, 2026 · Mathlib 0df444a (Lean v4.33.1)

3sumalgorithmsfine-grained-complexitythree-sum-1962word-ram

Let Ω\OmegaΩ be an inhabited candidate type and UUU a target type with decidable equality. Let M:N2→NM:\mathbb N^2\to\mathbb NM:N2→N, c:N→Ωc:\mathbb N\to\Omegac:N→Ω, and u:N→Uu:\mathbb N\to Uu:N→U, with a decidable covering relation. Fix R>0R>0R>0 rows and CCC columns. Assume uuu is injective below CCC and, for every row index iii and j<Cj<Cj<C, Mij=1M_{ij}=1Mij​=1 exactly when c(i)c(i)c(i) covers u(j)u(j)u(j). For every number of rounds ttt,

map⁡(c,BooleanChoices⁡(M,R,C,t))=GreedyChoices⁡([c(0),…,c(R−1)],{u(j):j<C},t).\operatorname{map}(c,\operatorname{BooleanChoices}(M,R,C,t)) =\operatorname{GreedyChoices}([c(0),\ldots,c(R-1)],\{u(j):j<C\},t).map(c,BooleanChoices(M,R,C,t))=GreedyChoices([c(0),…,c(R−1)],{u(j):j<C},t).

Both greedy procedures break ties by the given list order. Candidate labels may repeat, and matrix entries need not be bounded by one; only equality to one defines coverage. The identity preserves the whole ordered schedule.

Preamble
import Aesop
import Definitions.Def_APSPSource_RemainingDefinitions
import Definitions.Def_APSPSource_ThreeSumApsp_Lang_Logic
import Definitions.Def_APSPSource_ThreeSumApsp_Lang_Regions
import Definitions.Def_ThreeSum1962Source_Bundle01
import Definitions.Def_ThreeSum1962Source_Bundle02
import Definitions.Def_ThreeSum1962Source_Bundle04
import Lean.Elab.Tactic.Omega
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Algebra.BigOperators.Group.Finset.Basic
import Mathlib.Algebra.BigOperators.Group.Finset.Piecewise
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Group.Equiv.Basic
import Mathlib.Algebra.Group.Int.Defs
import Mathlib.Algebra.GroupWithZero.Nat
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Order.BigOperators.Group.List
import Mathlib.Algebra.Order.BigOperators.Group.Multiset
import Mathlib.Algebra.Order.Chebyshev
import Mathlib.Algebra.Order.Field.Basic
import Mathlib.Algebra.Order.Group.Abs
import Mathlib.Algebra.Order.Group.Int
import Mathlib.Algebra.Order.Group.Nat
import Mathlib.Algebra.Order.Group.Unbundled.Abs
import Mathlib.Algebra.Order.Ring.Abs
import Mathlib.Algebra.Order.Ring.Int
import Mathlib.Algebra.Order.Ring.Pow
import Mathlib.Data.Fintype.Card
import Mathlib.Data.Int.Cast.Lemmas
import Mathlib.Data.Int.Notation
import Mathlib.Data.List.GetD
import Mathlib.Data.List.MinMax
import Mathlib.Data.Nat.Cast.Order.Ring
import Mathlib.Data.Nat.Count
import Mathlib.Data.Nat.Notation
import Mathlib.Data.Nat.SuccPred
import Mathlib.Data.Real.Basic
import Mathlib.LinearAlgebra.Matrix.Defs
import Mathlib.Logic.Function.Basic
import Mathlib.Order.ConditionallyCompleteLattice.Basic
import Mathlib.Tactic.ByContra
import Mathlib.Tactic.GCongr
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.NormNum
import Mathlib.Tactic.Positivity
import Mathlib.Tactic.Ring
import Mathlib.Tactic.SplitIfs
import Theorems.Thm_ThreeSum_IndexedGreedy_argmax_range


set_option autoImplicit false
set_option relaxedAutoImplicit false
set_option Elab.async false
namespace ThreeSum.LightMinimum
end ThreeSum.LightMinimum

universe u_1 u_2
Formal statement
theorem ThreeSum.LightLocalCoverTransport.choices_map : ∀ {Ω : Type u_1} {U : Type u_2} [inst : Inhabited.{u_1 + 1} Ω] [inst_1 : DecidableEq.{u_2 + 1} U]
  (matrix : Nat → Nat → Nat) (candidate : Nat → Ω) (target : Nat → U) (covers : Ω → U → Prop)
  [inst_2 : @DecidableRel.{u_1 + 1, u_2 + 1} Ω U covers] {rows cols : Nat}
  (hrows : @LT.lt.{0} Nat instLTNat (@OfNat.ofNat.{0} Nat (nat_lit 0) (instOfNatNat (nat_lit 0))) rows)
  (hinj :
    @Set.InjOn.{0, u_2} Nat U target
      (@SetLike.coe.{0, 0} (Finset.{0} Nat) Nat (@Finset.instSetLike.{0} Nat) (Finset.range cols)))
  (hcover :
    ∀ (i j : Nat),
      @LT.lt.{0} Nat instLTNat j cols →
        Iff (ThreeSum.BooleanGreedy.covers matrix i j) (covers (candidate i) (target j)))
  (rounds : Nat),
  @Eq.{u_1 + 1} (List.{u_1} Ω)
    (@List.map.{0, u_1} Nat Ω candidate (ThreeSum.BooleanGreedy.choices matrix rows cols rounds))
    (@ThreeSum.Cover.greedyChoices.{u_1, u_2} Ω U inst (@List.map.{0, u_1} Nat Ω candidate (List.range rows)) covers
      inst_2 (@Finset.image.{0, u_2} Nat U inst_1 target (Finset.range cols)) rounds) := by
  sorry
Source
https://github.com/c0ldzy17/three-sum-lean/blob/2b639655e07421b9ac743de9090459bab473a7c0/Submission/ThreeSum/LightLocalCoverTransport.lean#L17-L77

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