AFTD Auto-Formalizing Theoretical Domains

matroid_threshold_pool_free_cube

theoremverified

Consider at most Cn pools on n points with positive C. Suppose D bounds every size whose harmonic number is at most 1+4C, T is at least tD+1, d equals 4CT, and twice t times the square of 1+dT is at most n. There exist disjoint K and U with |U|=t such that adding any subset of U to K changes none of the pool answers about whether a pool contains at most one selected point.

Statement

theorem matroid_threshold_pool_free_cube {n m C t D T d : ℕ}
    (P : Fin m → Finset (Fin n)) (hC : 0 < C) (hm : m ≤ C*n)
    (hD : ∀ j, harmonic j ≤ (1+4*C : ℚ) → j ≤ D)
    (hT : t*D + 1 ≤ T) (hd : d = 4*C*T)
    (hn : 2*(t*((1+d*T)*(1+d*T))) ≤ n) :
    ∃ K U : Finset (Fin n), Disjoint K U ∧ U.card = t ∧ ∀ Z ⊆ U, ∀ i,
      ((P i ∩ (K ∪ Z)).card ≤ 1 ↔ (P i ∩ K).card ≤ 1)
Source
Two-batch deterministic independence queries for OP-1998, building on the valid single-basis removal in Section 3 of https://arxiv.org/abs/2611.23624.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • matroid_threshold_pool_single_point_maskFor a finite list of query pools and a point x, there is a set W containing x such that no pool containing x has exactly one point outside…
  • matroid_threshold_pool_pruningFor m pools on n points and natural thresholds T,d, there is a remaining set V such that d times the number of removed points is at most…
Used by 1

The proof, explained

The proof prunes the n points to a subset V where small-pool degrees are bounded by d = 4CT. A double-counting argument bounds the number of heavy points, ensuring at least t(1+dT)^2 light points remain in V. A greedy induction packs t separated points U whose 2-step neighborhoods are disjoint. For each point in U, a local mask of size at most D is extracted, and deleting all masks from V yields the free cube set K.

  1. The neighborhood packing lemma holds for s = 0 with the empty set.

    By induction on s. In the base case s = 0, the empty set ∅ is a subset of good, has cardinality 0, and vacuously satisfies pairwise disjointness.

    lines 6–8

    uses Finset.empty_subset

      classical
      induction s generalizing good with
      | zero => exact ⟨∅, Finset.empty_subset _, rfl, by simp⟩
  2. In the inductive step, picking x ∈ good and deleting its two-step neighborhood bad leaves at least s * b^2 elements in good \ bad.

    Because (s+1)b^2 ≤ |good| and b > 0, good is nonempty, providing a point x. The union of neighborhoods of points in near(x) has size at most b * |near(x)| ≤ b^2. Deleting this two-step neighborhood bad leaves |good \ bad| ≥ |good| - |bad| ≥ (s+1)b^2 - b^2 = s * b^2, so the induction hypothesis yields a packing U ⊆ good \ bad of size s with pairwise disjoint neighborhoods.

    lines 9–18

    uses Nat.mul_pos, Nat.succ_pos, Finset.card_pos.mp, Finset.card_biUnion_le_card_mul, Nat.mul_le_mul_right, Finset.card_le_card_sdiff_add_card, Nat.succ_mul

      | succ s ih =>
        have hpos : 0 < good.card := (Nat.mul_pos (Nat.succ_pos _) (Nat.mul_pos hbpos hbpos)).trans_le hg
        obtain ⟨x,hx⟩ := Finset.card_pos.mp hpos
        let bad := (near x).biUnion near
        have hbad : bad.card ≤ b*b :=
          (Finset.card_biUnion_le_card_mul (near x) near b (fun z _ => hb z)).trans
            (Nat.mul_le_mul_right b (hb x))
        have hdiff := Finset.card_le_card_sdiff_add_card (s := good) (t := bad)
        rw [Nat.succ_mul] at hg
        obtain ⟨U, hU, hc, hpair⟩ := ih (good \ bad) (by omega)
  3. Adding x to U yields a valid packing of size s + 1 in good.

    Since x ∈ bad and U ⊆ good \ bad, x is not in U. By symmetry of near, any point in near(x) ∩ near(y) for y ∈ U would place y in bad, a contradiction; thus near(x) is disjoint from near(y) for all y ∈ U. Hence {x} ∪ U has size s + 1 with pairwise disjoint neighborhoods.

    lines 19–34

    uses Finset.mem_biUnion.mpr, Finset.mem_sdiff.mp, Finset.disjoint_left.mpr, Finset.insert_subset, Finset.sdiff_subset, Finset.mem_insert.mp

        have hxx : x ∈ bad := Finset.mem_biUnion.mpr ⟨x,hrefl _,hrefl _⟩
        have hxU : x ∉ U := fun h => (Finset.mem_sdiff.mp (hU h)).2 hxx
        have hdis (y : α) (hy : y ∈ U) : Disjoint (near x) (near y) := by
          apply Finset.disjoint_left.mpr
          intro z hzx hzy
          exact (Finset.mem_sdiff.mp (hU hy)).2 (Finset.mem_biUnion.mpr ⟨z,hzx,(hsymm _ _).mp hzy⟩)
        refine ⟨insert x U, Finset.insert_subset hx (hU.trans Finset.sdiff_subset),
          by simp [hxU,hc], ?_⟩
        intro a ha b hb hab
        by_cases hax : a = x
        · subst a
          exact hdis b ((Finset.mem_insert.mp hb).resolve_left hab.symm)
        · have ha' := (Finset.mem_insert.mp ha).resolve_left hax
          by_cases hbx : b = x
          · subst b; exact (hdis _ ha').symm
          · exact hpair _ ha' _ ((Finset.mem_insert.mp hb).resolve_left hbx) hab
  4. The total fractional weight of all points is at most m.

    Writing w(x) as the sum over pools containing x of 1/|P_i|, swapping the order of summation over vertices and pools shows that each pool contributes at most 1, so the sum of all w(x) is at most m.

    lines 40–55

    uses Finset.sum_nonneg, Finset.sum_filter, Finset.sum_comm, Finset.sum_le_sum, Finset.filter_mem_eq_inter, Finset.univ_inter, Finset.sum_const, nsmul_eq_mul, mul_inv_cancel₀

      classical
      intro w
      have hw0 (x : Fin n) : 0 ≤ w x := Finset.sum_nonneg (fun _ _ => by positivity)
      have htot : ∑ x, w x ≤ (m : ℚ) := by
        simp only [w, Finset.sum_filter]
        rw [Finset.sum_comm]
        calc
          _ ≤ ∑ _ : Fin m, (1 : ℚ) := by
            apply Finset.sum_le_sum
            intro i _
            rw [← Finset.sum_filter]
            simp only [Finset.filter_mem_eq_inter, Finset.univ_inter, Finset.sum_const, nsmul_eq_mul]
            by_cases h : (P i).card = 0
            · simp [h]
            · rw [mul_inv_cancel₀ (by exact_mod_cast h)]
          _ = _ := by simp
  5. The number of heavy points in V satisfies 4C * |heavy| ≤ m.

    Each heavy point has w(x) > 4C. Summing 4C over all heavy points is bounded by the total sum of w(x), which is at most m.

    lines 56–63

    uses Finset.sum_le_sum, Finset.mem_filter.mp, Finset.sum_le_sum_of_subset_of_nonneg, Finset.subset_univ, mul_comm, nsmul_eq_mul

      let heavy := V.filter (fun x => (4*C : ℚ) < w x)
      have hh : ∑ _x ∈ heavy, (4*C : ℚ) ≤ ∑ x ∈ heavy, w x :=
        Finset.sum_le_sum (fun x hx => ((Finset.mem_filter.mp hx).2 : (4*C : ℚ) < w x).le)
      have ha := (hh.trans (Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ heavy)
        (fun x _ _ => hw0 x))).trans htot
      simpa [heavy, mul_comm] using (show (4*C : ℕ) * heavy.card ≤ m by
        exact_mod_cast (by simpa [nsmul_eq_mul, mul_comm] using ha :
          (4*C : ℚ) * (heavy.card : ℚ) ≤ (m : ℚ)))
  6. The candidate set K = V \ S is disjoint from U, where S is the union of masks W(x) for x ∈ U.

    Since each x ∈ U satisfies x ∈ W(x), U is contained in S = ⋃_{x ∈ U} W(x). Thus K = V \ S is disjoint from U. Furthermore, |S| ≤ t * D by the bound on mask sizes.

    lines 76–81

    uses Finset.mem_biUnion.mpr, Finset.card_biUnion_le_card_mul, Finset.disjoint_left.mpr, Finset.mem_sdiff.mp

      classical
      let S := U.biUnion W
      let K := V \ S
      have hUS : U ⊆ S := fun x hx => Finset.mem_biUnion.mpr ⟨x,hx,hxW x hx⟩
      have hs : S.card ≤ t*D := hU ▸ Finset.card_biUnion_le_card_mul U W D hw
      refine ⟨K, Finset.disjoint_left.mpr (fun x hx hxU => (Finset.mem_sdiff.mp hx).2 (hUS hxU)), ?_⟩
  7. If a pool meets K ∪ Z in at most one point, it meets K in at most one point.

    Because K ⊆ K ∪ Z, any point in P_i ∩ K also belongs to P_i ∩ (K ∪ Z), so |P_i ∩ K| ≤ |P_i ∩ (K ∪ Z)| ≤ 1.

    lines 82–88

    uses le_trans, Finset.card_le_card, Finset.mem_inter.mp, Finset.mem_inter.mpr, Finset.mem_union_left

      intro Z hZ i
      constructor
      · intro h; apply le_trans _ h
        apply Finset.card_le_card
        intro y hy
        obtain ⟨hp,hk⟩ := Finset.mem_inter.mp hy
        exact Finset.mem_inter.mpr ⟨hp,Finset.mem_union_left _ hk⟩
  8. When |P_i ∩ K| ≤ 1, the restricted pool p = P_i ∩ V has cardinality at most T.

    Since p \ S ⊆ P_i ∩ K, we have |p \ S| ≤ 1. Adding |S| ≤ tD gives |p| ≤ 1 + tD ≤ T. Also, any element in P_i ∩ (K ∪ Z) must belong to p.

    lines 89–105

    uses Finset.mem_sdiff.mp, Finset.mem_inter.mpr, Finset.mem_inter.mp, Finset.mem_sdiff.mpr, Finset.card_le_card, Finset.card_le_card_sdiff_add_card, Finset.mem_union.mp

      intro hK
      let p := P i ∩ V
      have hout : p \ S ⊆ P i ∩ K := by
        intro z hz
        obtain ⟨hp,hs⟩ := Finset.mem_sdiff.mp hz
        exact Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hp).1,
          Finset.mem_sdiff.mpr ⟨(Finset.mem_inter.mp hp).2,hs⟩⟩
      have hc : (p \ S).card ≤ 1 := (Finset.card_le_card hout).trans hK
      have hpT : p.card ≤ T := by
        have := Finset.card_le_card_sdiff_add_card (s := p) (t := S)
        omega
      have hzp {z} (hz : z ∈ P i ∩ (K ∪ Z)) : z ∈ p := by
        obtain ⟨h₁,h₂⟩ := Finset.mem_inter.mp hz
        refine Finset.mem_inter.mpr ⟨h₁, ?_⟩
        rcases Finset.mem_union.mp h₂ with hk | hz'
        · exact (Finset.mem_sdiff.mp hk).1
        · exact hUV (hZ hz')
  9. If p meets U at x, the pool is absorbed into W(x), so |P_i ∩ (K ∪ Z)| ≤ 1.

    Since |p| ≤ T and x ∈ p, p ⊆ near(x). Pairwise disjointness of neighborhoods prevents p from meeting any W(y) for y ≠ x, so p \ W(x) ⊆ p \ S. Hence |p \ W(x)| ≤ |p \ S| ≤ 1. By the stopping condition, |p \ W(x)| ≠ 1, so |p \ W(x)| = 0, meaning p ⊆ W(x). This implies P_i ∩ K = ∅, and no other point of U can be in p by disjointness, so P_i ∩ (K ∪ Z) ⊆ {x}.

    lines 106–135

    uses Finset.mem_inter.mp, Finset.mem_sdiff.mp, Finset.mem_sdiff.mpr, Finset.mem_biUnion.mp, Finset.disjoint_left.mp, Finset.card_le_card, Finset.sdiff_eq_empty_iff_subset.mp, Finset.card_eq_zero.mp, Finset.mem_biUnion.mpr, Finset.mem_union.mp

      by_cases hmeet : (p ∩ U).Nonempty
      · obtain ⟨x,hx⟩ := hmeet
        obtain ⟨hxp,hxU⟩ := Finset.mem_inter.mp hx
        have hpN := hpnear x i hxp hpT
        have hcut : p \ W x ⊆ p \ S := by
          intro z hz
          obtain ⟨hzp,hzW⟩ := Finset.mem_sdiff.mp hz
          refine Finset.mem_sdiff.mpr ⟨hzp, ?_⟩
          intro hzs
          obtain ⟨y,hy,hyz⟩ := Finset.mem_biUnion.mp hzs
          by_cases h : x = y
          · subst y; exact hzW hyz
          · exact Finset.disjoint_left.mp (hsep x hxU y hy h) (hpN hzp) (hwnear y hy hyz)
        have hzero : (p \ W x).card = 0 := by
          have := (Finset.card_le_card hcut).trans hc
          have := hstop x hxU i hxp
          change (p \ W x).card ≠ 1 at this
          omega
        have hsub : p ⊆ W x := Finset.sdiff_eq_empty_iff_subset.mp (Finset.card_eq_zero.mp hzero)
        have hsingle : P i ∩ (K ∪ Z) ⊆ {x} := by
          intro z hz
          have hzp' := hzp hz
          have hzS : z ∈ S := Finset.mem_biUnion.mpr ⟨x,hxU,hsub hzp'⟩
          rcases Finset.mem_union.mp (Finset.mem_inter.mp hz).2 with hk | hzu
          · exact ((Finset.mem_sdiff.mp hk).2 hzS).elim
          · by_contra hne
            have hne' : x ≠ z := fun h => hne (by simp [h])
            exact Finset.disjoint_left.mp (hsep x hxU z (hZ hzu) hne')
              (hpN hzp') (hwnear z (hZ hzu) (hxW z (hZ hzu)))
        simpa using Finset.card_le_card hsingle
  10. If p does not meet U, then P_i ∩ (K ∪ Z) = P_i ∩ K has size at most 1.

    Since p ∩ U = ∅ and Z ⊆ U, no element of Z belongs to P_i, so P_i ∩ (K ∪ Z) ⊆ P_i ∩ K, which has size at most 1.

    lines 136–142

    uses le_trans, Finset.card_le_card, Finset.mem_inter.mpr, Finset.mem_inter.mp, Finset.mem_union.mp

      · apply le_trans _ hK
        apply Finset.card_le_card
        intro z hz
        refine Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hz).1, ?_⟩
        rcases Finset.mem_union.mp (Finset.mem_inter.mp hz).2 with hk | hzu
        · exact hk
        · exact (hmeet ⟨z, Finset.mem_inter.mpr ⟨hzp hz,hZ hzu⟩⟩).elim
  11. Pruning extracts a vertex set V bounding small-pool degrees by d and discarding at most mT/d points.

    Applying matroid_threshold_pool_pruning with threshold T and degree bound d yields a subset V with d * (n - |V|) ≤ mT such that each x ∈ V belongs to at most d pools of size at most T.

    lines 151–152

    uses matroid_threshold_pool_pruning

      classical
      obtain ⟨V, hv, hprune⟩ := matroid_threshold_pool_pruning P T d
  12. The set of good points has size at least t * (1 + dT)^2.

    By pool_light_count and m ≤ Cn, heavy points satisfy 4 * |heavy| ≤ n. By the pruning bound and d = 4CT, pruned points satisfy 4 * (n - |V|) ≤ n. Hence |good| = |V| - |heavy| ≥ n - n/4 - n/4 = n/2 ≥ t(1+dT)^2 by linear arithmetic.

    lines 153–172

    uses pool_light_count, Finset.card_filter_add_card_filter_not, Nat.mul_le_mul_right, Nat.le_of_mul_le_mul_left, Nat.mul_pos

      let p := fun i => P i ∩ V
      let w := fun x : Fin n => ∑ i ∈ Finset.univ.filter (fun i => x ∈ p i), ((p i).card : ℚ)⁻¹
      let good := V.filter (fun x => w x ≤ 4*C)
      let heavy := V.filter (fun x => (4*C : ℚ) < w x)
      have hlight : 4*C*heavy.card ≤ m := pool_light_count p V C
      have hpart : V.card = good.card + heavy.card := by
        simpa [good, heavy] using (Finset.card_filter_add_card_filter_not (s := V)
          (p := fun x => w x ≤ 4*C)).symm
      have hrem : 4*(n-V.card) ≤ n := by
        have h := hv.trans (Nat.mul_le_mul_right T hm)
        rw [hd] at h
        have heq : 4*C*T*(n-V.card) = (C*T)*(4*(n-V.card)) := by ring
        have heq' : C*n*T = (C*T)*n := by ring
        rw [heq, heq'] at h
        exact Nat.le_of_mul_le_mul_left h (Nat.mul_pos hC (by omega))
      have hheavy : 4*heavy.card ≤ n := by
        have h := hlight.trans hm
        rw [show 4*C*heavy.card = C*(4*heavy.card) by ring] at h
        exact Nat.le_of_mul_le_mul_left h hC
      have hgood : t*((1+d*T)*(1+d*T)) ≤ good.card := by omega
  13. The neighborhood relation near is reflexive, symmetric, and has size at most 1 + dT.

    Defining near(x) as x together with all pools of size ≤ T containing x, reflexivity is immediate, and symmetry holds because x ∈ p_i ∧ y ∈ p_i implies y ∈ near(x) and x ∈ near(y). Each x belongs to at most d such pools, each of size ≤ T, so |near(x)| ≤ 1 + dT.

    lines 173–196

    uses Finset.mem_insert_self, Finset.mem_insert_of_mem, Finset.mem_biUnion.mpr, Finset.mem_filter.mpr, Finset.mem_univ, Finset.mem_insert.mp, Finset.mem_biUnion.mp, Finset.mem_filter.mp, Finset.card_biUnion_le_card_mul, Finset.card_insert_le, Nat.mul_le_mul_right

      let small (x : Fin n) := Finset.univ.filter (fun i => x ∈ p i ∧ (p i).card ≤ T)
      let near (x : Fin n) := insert x ((small x).biUnion p)
      have hr (x : Fin n) : x ∈ near x := Finset.mem_insert_self ..
      have hpN (x : Fin n) (i : Fin m) (hx : x ∈ p i) (ht : (p i).card ≤ T) :
          p i ⊆ near x := fun y hy => Finset.mem_insert_of_mem
            (Finset.mem_biUnion.mpr ⟨i,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hx,ht⟩,hy⟩)
      have hsN {x y : Fin n} (hx : x ∈ near y) : y ∈ near x := by
        rcases Finset.mem_insert.mp hx with rfl | h
        · exact hr _
        · obtain ⟨i,hi,hxi⟩ := Finset.mem_biUnion.mp h
          obtain ⟨hyi,hT⟩ := (Finset.mem_filter.mp hi).2
          exact hpN x i hxi hT hyi
      have hcN (x : Fin n) : (near x).card ≤ 1+d*T := by
        have hh : (small x).card ≤ d := by
          by_cases hx : x ∈ V
          · exact hprune x hx
          · have he : small x = ∅ := by ext i; simp [small,p,hx]
            simp [he]
        have hsmall := Finset.card_biUnion_le_card_mul (small x) p T
          (fun i hi => ((Finset.mem_filter.mp hi).2).2)
        have hin := Finset.card_insert_le x ((small x).biUnion p)
        change (insert x ((small x).biUnion p)).card ≤ _
        have := hsmall.trans (Nat.mul_le_mul_right T hh)
        omega
  14. There exists a subset U ⊆ good of size t with pairwise disjoint neighborhoods.

    Applying neighbor_packing with bound b = 1 + dT and target size t to the set good, which has size at least t * b^2, yields the desired separated set U.

    lines 197–198

    uses neighbor_packing

      obtain ⟨U,hUg,hUt,hsep⟩ := neighbor_packing near hr (fun x y => ⟨hsN,hsN⟩)
        (1+d*T) hcN t good hgood (by omega)
  15. For each x ∈ U, there is a mask W(x) of size at most D contained in near(x).

    By matroid_threshold_pool_single_point_mask, each x has a mask W(x) with harmonic number at most 1 + w(x) ≤ 1 + 4C, so |W(x)| ≤ D by the hypothesis on D. Each component pool of W(x) has size ≤ D ≤ T, so W(x) ⊆ near(x).

    lines 199–212

    uses matroid_threshold_pool_single_point_mask, Finset.mem_filter.mp, Finset.card_le_card, Finset.card_pos.mpr, Nat.le_mul_of_pos_left

      choose W hW using matroid_threshold_pool_single_point_mask p
      have hw (x) (hx : x ∈ U) : (W x).card ≤ D := by
        have hxw := (Finset.mem_filter.mp (hUg hx)).2
        exact hD _ ((hW x).2.1.trans (by dsimp [w] at hxw; linarith))
      have hWN (x) (hx : x ∈ U) : W x ⊆ near x := by
        intro y hy
        rcases (hW x).2.2.2 y hy with rfl | ⟨i,hxi,hyi,hsub⟩
        · exact hr _
        · have hT' : (p i).card ≤ T := by
            have := (Finset.card_le_card hsub).trans (hw x hx)
            have ht : 1 ≤ t := by have := Finset.card_pos.mpr ⟨x,hx⟩; omega
            have := Nat.le_mul_of_pos_left D ht
            omega
          exact hpN x i hxi hT' hyi
  16. Applying pool_color_cube completes the proof of the free cube threshold property.

    All conditions of pool_color_cube are satisfied: U has size t, the masks W(x) have size ≤ D, are contained in near(x), satisfy the stopping condition, and near(x) are pairwise disjoint. Applying pool_color_cube produces the required disjoint set K.

    lines 213–216

    uses pool_color_cube, Finset.filter_subset

      obtain ⟨K,hdis,hmask⟩ := pool_color_cube P V U W near
        (hUg.trans (Finset.filter_subset _ _)) hUt hT (fun x _ => (hW x).1) hw hWN
        (fun x _ => (hW x).2.2.1) hpN hsep
      exact ⟨K,U,hdis,hUt,hmask⟩
Finset.empty_subset
The empty set is a subset of any finite set.
Nat.mul_pos
The product of two strictly positive natural numbers is strictly positive.
Nat.succ_pos
The successor of any natural number is strictly positive.
Finset.card_pos.mp
A finite set with positive cardinality is nonempty.
Finset.card_biUnion_le_card_mul
The cardinality of an indexed union is bounded by the size of the index set times the maximum size of each component set.
Nat.mul_le_mul_right
Multiplying both sides of an inequality of natural numbers by a factor on the right preserves the inequality.
Finset.card_le_card_sdiff_add_card
The cardinality of a finite set s is at most |s \ t| + |t|.
Nat.succ_mul
Multiplication distributes over successor: (n + 1) * m = n * m + m.
Finset.mem_biUnion.mpr
An element belonging to some component set belongs to the indexed union.
Finset.mem_sdiff.mp
An element in s \ t belongs to s and does not belong to t.
Finset.disjoint_left.mpr
Two finite sets are disjoint if no element of the first belongs to the second.
Finset.insert_subset
Inserting an element of t into a subset of t produces a subset of t.
Finset.sdiff_subset
A set difference s \ t is a subset of s.
Finset.mem_insert.mp
An element in insert a s is either equal to a or in s.
Finset.sum_nonneg
A sum of non-negative elements over a finite set is non-negative.
Finset.sum_filter
Summing over a filtered set equals summing the conditional expression over the ambient set.
Finset.sum_comm
Swapping the order of summation in a double finite sum preserves the sum.
Finset.sum_le_sum
Pointwise inequality between functions on a finite set implies the corresponding inequality between their sums.
Finset.filter_mem_eq_inter
Filtering a set by membership in another set yields their intersection.
Finset.univ_inter
The intersection of the universal set with any set is the set itself.
Finset.sum_const
The sum of a constant value over a finite set equals the cardinality times that value.
nsmul_eq_mul
Natural number scalar multiplication equals multiplication by the coerced natural number.
mul_inv_cancel₀
A non-zero element times its inverse equals 1 in a division ring or group with zero.
Finset.mem_filter.mp
An element in a filtered set satisfies the predicate.
Finset.sum_le_sum_of_subset_of_nonneg
The sum of non-negative terms over a subset is at most the sum over the ambient set.
Finset.subset_univ
Every finite set of elements of a finite type is a subset of the universal set.
mul_comm
Multiplication is commutative: a * b = b * a.
le_trans
The ordering relation ≤ is transitive.
Finset.card_le_card
If s ⊆ t for finite sets, then |s| ≤ |t|.
Finset.mem_inter.mp
An element in s ∩ t belongs to both s and t.
Finset.mem_inter.mpr
An element belonging to both s and t belongs to s ∩ t.
Finset.mem_union_left
An element belonging to s belongs to s ∪ t.
Finset.mem_sdiff.mpr
An element belonging to s and not t belongs to s \ t.
Finset.mem_union.mp
An element in s ∪ t belongs to s or to t.
Finset.mem_biUnion.mp
An element in an indexed union belongs to at least one component set.
Finset.disjoint_left.mp
If two sets are disjoint, any element of the first does not belong to the second.
Finset.sdiff_eq_empty_iff_subset.mp
A set difference s \ t is empty if and only if s ⊆ t.
Finset.card_eq_zero.mp
A finite set with cardinality zero is empty.
matroid_threshold_pool_pruning
There exists a subset V discarding at most mT/d points such that every point in V belongs to at most d restricted pools of size at most T.
pool_light_count
The count of heavy points (points with fractional weight exceeding 4C) in V multiplied by 4C is at most m.
Finset.card_filter_add_card_filter_not
For any predicate on a finite set, the number of elements satisfying it plus the number not satisfying it equals the total size.
Nat.le_of_mul_le_mul_left
A positive natural factor on the left of an inequality can be cancelled.
Finset.mem_insert_self
An element inserted into a set belongs to the resulting set.
Finset.mem_insert_of_mem
An element of s belongs to insert b s.
Finset.mem_filter.mpr
An element in s satisfying property p belongs to the filtered set.
Finset.mem_univ
Every element of a finite type belongs to Finset.univ.
Finset.card_insert_le
Inserting an element into a finite set increases its size by at most 1.
neighbor_packing
In a symmetric relation with neighborhood sizes at most b, any set of size at least s * b^2 contains s elements with pairwise disjoint neighborhoods.
matroid_threshold_pool_single_point_mask
For any point x, there exists a mask W containing x with harmonic number at most 1 + w(x), satisfying the stopping condition, and formed by component pools containing x.
Finset.card_pos.mpr
A nonempty finite set has strictly positive cardinality.
Nat.le_mul_of_pos_left
If n is positive, then m ≤ n * m for natural numbers.
pool_color_cube
Given separated points U with bounded masks W(x) in a neighborhood system, deleting all masks yields a free cube set K disjoint from U.
Finset.filter_subset
A filtered set is a subset of the original set.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

private theorem neighbor_packing {α : Type*} [DecidableEq α] (near : α → Finset α)    (hrefl : ∀ x, x ∈ near x) (hsymm : ∀ x y, x ∈ near y ↔ y ∈ near x)    (b : ℕ) (hb : ∀ x, (near x).card ≤ b)    (s : ℕ) (good : Finset α) (hg : s*(b*b) ≤ good.card) (hbpos : 0 < b) :    ∃ U ⊆ good, U.card = s ∧ ∀ x ∈ U, ∀ y ∈ U, x ≠ y → Disjoint (near x) (near y) := by  classical  induction s generalizing good with  | zero => exact ⟨∅, Finset.empty_subset _, rfl, by simp⟩  | succ s ih =>    have hpos : 0 < good.card := (Nat.mul_pos (Nat.succ_pos _) (Nat.mul_pos hbpos hbpos)).trans_le hg    obtain ⟨x,hx⟩ := Finset.card_pos.mp hpos    let bad := (near x).biUnion near    have hbad : bad.card ≤ b*b :=      (Finset.card_biUnion_le_card_mul (near x) near b (fun z _ => hb z)).trans        (Nat.mul_le_mul_right b (hb x))    have hdiff := Finset.card_le_card_sdiff_add_card (s := good) (t := bad)    rw [Nat.succ_mul] at hg    obtain ⟨U, hU, hc, hpair⟩ := ih (good \ bad) (by omega)    have hxx : x ∈ bad := Finset.mem_biUnion.mpr ⟨x,hrefl _,hrefl _⟩    have hxU : x ∉ U := fun h => (Finset.mem_sdiff.mp (hU h)).2 hxx    have hdis (y : α) (hy : y ∈ U) : Disjoint (near x) (near y) := by      apply Finset.disjoint_left.mpr      intro z hzx hzy      exact (Finset.mem_sdiff.mp (hU hy)).2 (Finset.mem_biUnion.mpr ⟨z,hzx,(hsymm _ _).mp hzy⟩)    refine ⟨insert x U, Finset.insert_subset hx (hU.trans Finset.sdiff_subset),      by simp [hxU,hc], ?_⟩    intro a ha b hb hab    by_cases hax : a = x    · subst a      exact hdis b ((Finset.mem_insert.mp hb).resolve_left hab.symm)    · have ha' := (Finset.mem_insert.mp ha).resolve_left hax      by_cases hbx : b = x      · subst b; exact (hdis _ ha').symm      · exact hpair _ ha' _ ((Finset.mem_insert.mp hb).resolve_left hbx) habprivate theorem pool_light_count {n m : ℕ} (P : Fin m → Finset (Fin n))    (V : Finset (Fin n)) (C : ℕ) :    let w := fun x : Fin n => ∑ i ∈ Finset.univ.filter (fun i => x ∈ P i), ((P i).card : ℚ)⁻¹    (4*C) * (V.filter (fun x => (4*C : ℚ) < w x)).card ≤ m := by  classical  intro w  have hw0 (x : Fin n) : 0 ≤ w x := Finset.sum_nonneg (fun _ _ => by positivity)  have htot : ∑ x, w x ≤ (m : ℚ) := by    simp only [w, Finset.sum_filter]    rw [Finset.sum_comm]    calc      _ ≤ ∑ _ : Fin m, (1 : ℚ) := by        apply Finset.sum_le_sum        intro i _        rw [← Finset.sum_filter]        simp only [Finset.filter_mem_eq_inter, Finset.univ_inter, Finset.sum_const, nsmul_eq_mul]        by_cases h : (P i).card = 0        · simp [h]        · rw [mul_inv_cancel₀ (by exact_mod_cast h)]      _ = _ := by simp  let heavy := V.filter (fun x => (4*C : ℚ) < w x)  have hh : ∑ _x ∈ heavy, (4*C : ℚ) ≤ ∑ x ∈ heavy, w x :=    Finset.sum_le_sum (fun x hx => ((Finset.mem_filter.mp hx).2 : (4*C : ℚ) < w x).le)  have ha := (hh.trans (Finset.sum_le_sum_of_subset_of_nonneg (Finset.subset_univ heavy)    (fun x _ _ => hw0 x))).trans htot  simpa [heavy, mul_comm] using (show (4*C : ℕ) * heavy.card ≤ m by    exact_mod_cast (by simpa [nsmul_eq_mul, mul_comm] using ha :      (4*C : ℚ) * (heavy.card : ℚ) ≤ (m : ℚ)))private theorem pool_color_cube {n m t D T : ℕ} (P : Fin m → Finset (Fin n))    (V U : Finset (Fin n)) (W near : Fin n → Finset (Fin n))    (hUV : U ⊆ V) (hU : U.card = t) (hT : t*D + 1 ≤ T)    (hxW : ∀ x ∈ U, x ∈ W x) (hw : ∀ x ∈ U, (W x).card ≤ D)    (hwnear : ∀ x ∈ U, W x ⊆ near x)    (hstop : ∀ x ∈ U, ∀ i, x ∈ P i ∩ V → ((P i ∩ V) \ W x).card ≠ 1)    (hpnear : ∀ x i, x ∈ P i ∩ V → (P i ∩ V).card ≤ T → P i ∩ V ⊆ near x)    (hsep : ∀ x ∈ U, ∀ y ∈ U, x ≠ y → Disjoint (near x) (near y)) :    ∃ K : Finset (Fin n), Disjoint K U ∧ ∀ Z ⊆ U, ∀ i,      ((P i ∩ (K ∪ Z)).card ≤ 1 ↔ (P i ∩ K).card ≤ 1) := by  classical  let S := U.biUnion W  let K := V \ S  have hUS : U ⊆ S := fun x hx => Finset.mem_biUnion.mpr ⟨x,hx,hxW x hx⟩  have hs : S.card ≤ t*D := hU ▸ Finset.card_biUnion_le_card_mul U W D hw  refine ⟨K, Finset.disjoint_left.mpr (fun x hx hxU => (Finset.mem_sdiff.mp hx).2 (hUS hxU)), ?_⟩  intro Z hZ i  constructor  · intro h; apply le_trans _ h    apply Finset.card_le_card    intro y hy    obtain ⟨hp,hk⟩ := Finset.mem_inter.mp hy    exact Finset.mem_inter.mpr ⟨hp,Finset.mem_union_left _ hk⟩  intro hK  let p := P i ∩ V  have hout : p \ S ⊆ P i ∩ K := by    intro z hz    obtain ⟨hp,hs⟩ := Finset.mem_sdiff.mp hz    exact Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hp).1,      Finset.mem_sdiff.mpr ⟨(Finset.mem_inter.mp hp).2,hs⟩⟩  have hc : (p \ S).card ≤ 1 := (Finset.card_le_card hout).trans hK  have hpT : p.card ≤ T := by    have := Finset.card_le_card_sdiff_add_card (s := p) (t := S)    omega  have hzp {z} (hz : z ∈ P i ∩ (K ∪ Z)) : z ∈ p := by    obtain ⟨h₁,h₂⟩ := Finset.mem_inter.mp hz    refine Finset.mem_inter.mpr ⟨h₁, ?_⟩    rcases Finset.mem_union.mp h₂ with hk | hz'    · exact (Finset.mem_sdiff.mp hk).1    · exact hUV (hZ hz')  by_cases hmeet : (p ∩ U).Nonempty  · obtain ⟨x,hx⟩ := hmeet    obtain ⟨hxp,hxU⟩ := Finset.mem_inter.mp hx    have hpN := hpnear x i hxp hpT    have hcut : p \ W x ⊆ p \ S := by      intro z hz      obtain ⟨hzp,hzW⟩ := Finset.mem_sdiff.mp hz      refine Finset.mem_sdiff.mpr ⟨hzp, ?_⟩      intro hzs      obtain ⟨y,hy,hyz⟩ := Finset.mem_biUnion.mp hzs      by_cases h : x = y      · subst y; exact hzW hyz      · exact Finset.disjoint_left.mp (hsep x hxU y hy h) (hpN hzp) (hwnear y hy hyz)    have hzero : (p \ W x).card = 0 := by      have := (Finset.card_le_card hcut).trans hc      have := hstop x hxU i hxp      change (p \ W x).card ≠ 1 at this      omega    have hsub : p ⊆ W x := Finset.sdiff_eq_empty_iff_subset.mp (Finset.card_eq_zero.mp hzero)    have hsingle : P i ∩ (K ∪ Z) ⊆ {x} := by      intro z hz      have hzp' := hzp hz      have hzS : z ∈ S := Finset.mem_biUnion.mpr ⟨x,hxU,hsub hzp'⟩      rcases Finset.mem_union.mp (Finset.mem_inter.mp hz).2 with hk | hzu      · exact ((Finset.mem_sdiff.mp hk).2 hzS).elim      · by_contra hne        have hne' : x ≠ z := fun h => hne (by simp [h])        exact Finset.disjoint_left.mp (hsep x hxU z (hZ hzu) hne')          (hpN hzp') (hwnear z (hZ hzu) (hxW z (hZ hzu)))    simpa using Finset.card_le_card hsingle  · apply le_trans _ hK    apply Finset.card_le_card    intro z hz    refine Finset.mem_inter.mpr ⟨(Finset.mem_inter.mp hz).1, ?_⟩    rcases Finset.mem_union.mp (Finset.mem_inter.mp hz).2 with hk | hzu    · exact hk    · exact (hmeet ⟨z, Finset.mem_inter.mpr ⟨hzp hz,hZ hzu⟩⟩).elimtheorem matroid_threshold_pool_free_cube {n m C t D T d : ℕ}    (P : Fin m → Finset (Fin n)) (hC : 0 < C) (hm : m ≤ C*n)    (hD : ∀ j, harmonic j ≤ (1+4*C : ℚ) → j ≤ D)    (hT : t*D + 1 ≤ T) (hd : d = 4*C*T)    (hn : 2*(t*((1+d*T)*(1+d*T))) ≤ n) :    ∃ K U : Finset (Fin n), Disjoint K U ∧ U.card = t ∧ ∀ Z ⊆ U, ∀ i,      ((P i ∩ (K ∪ Z)).card ≤ 1 ↔ (P i ∩ K).card ≤ 1) := by  classical  obtain ⟨V, hv, hprune⟩ := matroid_threshold_pool_pruning P T d  let p := fun i => P i ∩ V  let w := fun x : Fin n => ∑ i ∈ Finset.univ.filter (fun i => x ∈ p i), ((p i).card : ℚ)⁻¹  let good := V.filter (fun x => w x ≤ 4*C)  let heavy := V.filter (fun x => (4*C : ℚ) < w x)  have hlight : 4*C*heavy.card ≤ m := pool_light_count p V C  have hpart : V.card = good.card + heavy.card := by    simpa [good, heavy] using (Finset.card_filter_add_card_filter_not (s := V)      (p := fun x => w x ≤ 4*C)).symm  have hrem : 4*(n-V.card) ≤ n := by    have h := hv.trans (Nat.mul_le_mul_right T hm)    rw [hd] at h    have heq : 4*C*T*(n-V.card) = (C*T)*(4*(n-V.card)) := by ring    have heq' : C*n*T = (C*T)*n := by ring    rw [heq, heq'] at h    exact Nat.le_of_mul_le_mul_left h (Nat.mul_pos hC (by omega))  have hheavy : 4*heavy.card ≤ n := by    have h := hlight.trans hm    rw [show 4*C*heavy.card = C*(4*heavy.card) by ring] at h    exact Nat.le_of_mul_le_mul_left h hC  have hgood : t*((1+d*T)*(1+d*T)) ≤ good.card := by omega  let small (x : Fin n) := Finset.univ.filter (fun i => x ∈ p i ∧ (p i).card ≤ T)  let near (x : Fin n) := insert x ((small x).biUnion p)  have hr (x : Fin n) : x ∈ near x := Finset.mem_insert_self ..  have hpN (x : Fin n) (i : Fin m) (hx : x ∈ p i) (ht : (p i).card ≤ T) :      p i ⊆ near x := fun y hy => Finset.mem_insert_of_mem        (Finset.mem_biUnion.mpr ⟨i,Finset.mem_filter.mpr ⟨Finset.mem_univ _,hx,ht⟩,hy⟩)  have hsN {x y : Fin n} (hx : x ∈ near y) : y ∈ near x := by    rcases Finset.mem_insert.mp hx with rfl | h    · exact hr _    · obtain ⟨i,hi,hxi⟩ := Finset.mem_biUnion.mp h      obtain ⟨hyi,hT⟩ := (Finset.mem_filter.mp hi).2      exact hpN x i hxi hT hyi  have hcN (x : Fin n) : (near x).card ≤ 1+d*T := by    have hh : (small x).card ≤ d := by      by_cases hx : x ∈ V      · exact hprune x hx      · have he : small x = ∅ := by ext i; simp [small,p,hx]        simp [he]    have hsmall := Finset.card_biUnion_le_card_mul (small x) p T      (fun i hi => ((Finset.mem_filter.mp hi).2).2)    have hin := Finset.card_insert_le x ((small x).biUnion p)    change (insert x ((small x).biUnion p)).card ≤ _    have := hsmall.trans (Nat.mul_le_mul_right T hh)    omega  obtain ⟨U,hUg,hUt,hsep⟩ := neighbor_packing near hr (fun x y => ⟨hsN,hsN⟩)    (1+d*T) hcN t good hgood (by omega)  choose W hW using matroid_threshold_pool_single_point_mask p  have hw (x) (hx : x ∈ U) : (W x).card ≤ D := by    have hxw := (Finset.mem_filter.mp (hUg hx)).2    exact hD _ ((hW x).2.1.trans (by dsimp [w] at hxw; linarith))  have hWN (x) (hx : x ∈ U) : W x ⊆ near x := by    intro y hy    rcases (hW x).2.2.2 y hy with rfl | ⟨i,hxi,hyi,hsub⟩    · exact hr _    · have hT' : (p i).card ≤ T := by        have := (Finset.card_le_card hsub).trans (hw x hx)        have ht : 1 ≤ t := by have := Finset.card_pos.mpr ⟨x,hx⟩; omega        have := Nat.le_mul_of_pos_left D ht        omega      exact hpN x i hxi hT' hyi  obtain ⟨K,hdis,hmask⟩ := pool_color_cube P V U W near    (hUg.trans (Finset.filter_subset _ _)) hUt hT (fun x _ => (hW x).1) hw hWN    (fun x _ => (hW x).2.2.1) hpN hsep  exact ⟨K,U,hdis,hUt,hmask⟩
See it in the graphDiscuss this resultChallenge it