AFTD Auto-Formalizing Theoretical Domains

matroid_threshold_pool_pruning

theoremverified

For 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 mT. Each point of V lies in at most d pools whose intersection with V has size at most T.

Statement

theorem matroid_threshold_pool_pruning {n m : ℕ} (P : Fin m → Finset (Fin n)) (T d : ℕ) :
    ∃ V : Finset (Fin n), d * (n - V.card) ≤ m*T ∧ ∀ x ∈ V,
      (Finset.univ.filter (fun i => x ∈ P i ∩ V ∧ (P i ∩ V).card ≤ T)).card ≤ d
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
Used by 1
  • matroid_threshold_pool_free_cubeConsider 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…

The proof, explained

The proof uses potential function (energy) minimization. We define the cost of a subset V of points by cost(V) = d * (n - |V|) + ∑ i, min(T, |P i ∩ V|) and choose V to be a global minimizer over all subsets. Comparing V to the full universe gives d * (n - |V|) ≤ cost(univ) ≤ m * T. Comparing V to V \ {x} for any x ∈ V reveals that removing x increases the penalty term by d while decreasing the mass by the number of pools containing x of size at most T; by minimality, this count cannot exceed d.

  1. There exists a subset V ⊆ {0, …, n-1} minimizing the cost function cost(V) = d * (n - |V|) + ∑ i, min(T, |P i ∩ V|).

    We define two auxiliary functions on subsets of {0, …, n-1}: the mass, which sums the pool intersections capped at T, and the total cost, which adds d times the number of removed points to the mass. Because the power set of {0, …, n-1} is finite and nonempty, the cost function achieves its minimum at some subset V.

    lines 4–7

    uses Finset.exists_min_image, Finset.univ_nonempty

      classical
      let mass (V : Finset (Fin n)) := ∑ i, min T (P i ∩ V).card
      let cost (V : Finset (Fin n)) := d * (n - V.card) + mass V
      obtain ⟨V, _, hmin⟩ := Finset.exists_min_image Finset.univ cost Finset.univ_nonempty
  2. The minimizer V satisfies d * (n - |V|) ≤ m * T.

    For the entire set of points (the universe), each pool contributes at most T to the mass, so mass(univ) ≤ m * T. Since no points are removed, cost(univ) = mass(univ) ≤ m * T. Because V minimizes cost, cost(V) ≤ cost(univ) ≤ m * T. Dropping the non-negative mass term gives d * (n - |V|) ≤ m * T, which proves the first conjunct of the theorem.

    lines 8–15

    uses Finset.sum_le_sum, min_le_left, Finset.mem_univ

      have huv : mass Finset.univ ≤ m*T := by
        calc
          _ ≤ ∑ _ : Fin m, T := Finset.sum_le_sum (fun _ _ => min_le_left _ _)
          _ = _ := by simp
      have hc := hmin Finset.univ (Finset.mem_univ _)
      have hV : d * (n - V.card) + mass V ≤ m*T := by
        simpa [cost] using hc.trans (show cost Finset.univ ≤ m*T by simpa [cost] using huv)
      refine ⟨V, by omega, fun x hx => ?_⟩
  3. For any x ∈ V and each pool i, removing x decreases min(T, |P i ∩ V|) by 1 if pool i is active at x (x ∈ P i and |P i ∩ V| ≤ T), and by 0 otherwise.

    Fix x ∈ V and consider pool i. Removing x changes the intersection from P i ∩ V to (P i ∩ V) \ {x}. If x ∉ P i ∩ V, the intersection does not change and the pool is not active. If x ∈ P i ∩ V, the cardinality decreases by 1; if |P i ∩ V| ≤ T, the pool is active and the capped size drops by 1, whereas if |P i ∩ V| > T, both capped sizes equal T and the drop is 0.

    lines 16–29

    uses Finset.card_erase_add_one, and_self, if_true, and_false, if_false, add_zero, if_neg, Finset.erase_eq_of_notMem, Nat.add_zero

      let active (i : Fin m) := x ∈ P i ∩ V ∧ (P i ∩ V).card ≤ T
      have drop (i : Fin m) :
          min T (P i ∩ V.erase x).card + (if active i then 1 else 0) = min T (P i ∩ V).card := by
        have he : P i ∩ V.erase x = (P i ∩ V).erase x := by ext z; simp; tauto
        rw [he]
        by_cases h : x ∈ P i ∩ V
        · have hc' := Finset.card_erase_add_one h
          by_cases hT : (P i ∩ V).card ≤ T
          · simp only [active, h, hT, and_self, if_true]
            omega
          · simp only [active, h, hT, and_false, if_false, add_zero]
            omega
        · have ha : ¬ active i := fun hp => h hp.1
          rw [if_neg ha, Finset.erase_eq_of_notMem h, Nat.add_zero]
  4. The total mass of V \ {x} plus the number of active pools at x equals the mass of V.

    Summing the drop identity over all m pools and rewriting the sum of indicator variables as the cardinality of the set of active pools gives mass(V \ {x}) + |{i | active(i)}| = mass(V).

    lines 30–32

    uses Finset.sum_add_distrib, Finset.sum_boole, Nat.cast_id, Finset.sum_congr

      have hmass : mass (V.erase x) + (Finset.univ.filter active).card = mass V := by
        simpa only [mass, Finset.sum_add_distrib, Finset.sum_boole active, Nat.cast_id] using
          Finset.sum_congr (s₁ := Finset.univ) (s₂ := Finset.univ) rfl (fun i _ => drop i)
  5. Each point x ∈ V belongs to at most d pools whose intersection with V has size at most T.

    By the minimality of V, cost(V) ≤ cost(V \ {x}). Removing x increases the number of removed points by 1, so the penalty d * (n - |V|) increases by d. Expanding the costs and substituting mass(V) = mass(V \ {x}) + |{i | active(i)}|, the terms d * (n - |V|) and mass(V \ {x}) cancel on both sides, leaving |{i | active(i)}| ≤ d.

    lines 33–40

    uses Finset.mem_univ, Finset.card_le_univ, Finset.card_erase_add_one, Nat.mul_add, Nat.mul_one

      have hc' := hmin (V.erase x) (Finset.mem_univ _)
      have hvn : V.card ≤ n := by simpa using Finset.card_le_univ V
      have hcV := Finset.card_erase_add_one hx
      have hdiff : n - (V.erase x).card = (n - V.card) + 1 := by omega
      change d*(n-V.card) + mass V ≤ d*(n-(V.erase x).card) + mass (V.erase x) at hc'
      rw [hdiff, Nat.mul_add, Nat.mul_one] at hc'
      change (Finset.univ.filter active).card ≤ d
      omega
and_false
The conjunction of any proposition with False is False.
and_self
The conjunction of a proposition with itself is equal to the proposition.
add_zero
Adding zero to any element on the right leaves it unchanged.
Finset.card_erase_add_one
Removing an element that belongs to a finite set reduces its cardinality by 1.
Finset.card_le_univ
The cardinality of any finset of a finite type is at most the total cardinality of the type.
Finset.erase_eq_of_notMem
Removing an element that is not in a finite set leaves the set unchanged.
Finset.exists_min_image
Any function from a nonempty finite set to a linearly ordered type attains its minimum value on that set.
Finset.mem_univ
Every element of a finite type belongs to its universal finset.
Finset.sum_add_distrib
The sum of a pointwise sum of two functions over a finite set is the sum of their individual sums.
Finset.sum_boole
The sum of the indicator function of a predicate over a finite set equals the cardinality of the subset satisfying the predicate.
Finset.sum_congr
Two sums over equal sets whose summands agree pointwise are equal.
Finset.sum_le_sum
If each term in a finite sum is bounded by the corresponding term of another sum, the sum is similarly bounded.
Finset.univ_nonempty
The universal finset of a nonempty finite type is nonempty.
if_false
An if-then-else expression whose condition is False reduces to the else-branch.
if_neg
If the condition of an if-then-else expression is false, it evaluates to the else-branch.
if_true
An if-then-else expression whose condition is True reduces to the then-branch.
min_le_left
The minimum of two elements in a linear order is at most the first element.
Nat.add_zero
Adding zero to a natural number leaves it unchanged.
Nat.cast_id
The canonical coercion from natural numbers to natural numbers is the identity.
Nat.mul_add
Multiplication of natural numbers distributes over addition from the left.
Nat.mul_one
Multiplying any natural number by 1 leaves it unchanged.

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

theorem matroid_threshold_pool_pruning {n m : ℕ} (P : Fin m → Finset (Fin n)) (T d : ℕ) :    ∃ V : Finset (Fin n), d * (n - V.card) ≤ m*T ∧ ∀ x ∈ V,      (Finset.univ.filter (fun i => x ∈ P i ∩ V ∧ (P i ∩ V).card ≤ T)).card ≤ d := by  classical  let mass (V : Finset (Fin n)) := ∑ i, min T (P i ∩ V).card  let cost (V : Finset (Fin n)) := d * (n - V.card) + mass V  obtain ⟨V, _, hmin⟩ := Finset.exists_min_image Finset.univ cost Finset.univ_nonempty  have huv : mass Finset.univ ≤ m*T := by    calc      _ ≤ ∑ _ : Fin m, T := Finset.sum_le_sum (fun _ _ => min_le_left _ _)      _ = _ := by simp  have hc := hmin Finset.univ (Finset.mem_univ _)  have hV : d * (n - V.card) + mass V ≤ m*T := by    simpa [cost] using hc.trans (show cost Finset.univ ≤ m*T by simpa [cost] using huv)  refine ⟨V, by omega, fun x hx => ?_⟩  let active (i : Fin m) := x ∈ P i ∩ V ∧ (P i ∩ V).card ≤ T  have drop (i : Fin m) :      min T (P i ∩ V.erase x).card + (if active i then 1 else 0) = min T (P i ∩ V).card := by    have he : P i ∩ V.erase x = (P i ∩ V).erase x := by ext z; simp; tauto    rw [he]    by_cases h : x ∈ P i ∩ V    · have hc' := Finset.card_erase_add_one h      by_cases hT : (P i ∩ V).card ≤ T      · simp only [active, h, hT, and_self, if_true]        omega      · simp only [active, h, hT, and_false, if_false, add_zero]        omega    · have ha : ¬ active i := fun hp => h hp.1      rw [if_neg ha, Finset.erase_eq_of_notMem h, Nat.add_zero]  have hmass : mass (V.erase x) + (Finset.univ.filter active).card = mass V := by    simpa only [mass, Finset.sum_add_distrib, Finset.sum_boole active, Nat.cast_id] using      Finset.sum_congr (s₁ := Finset.univ) (s₂ := Finset.univ) rfl (fun i _ => drop i)  have hc' := hmin (V.erase x) (Finset.mem_univ _)  have hvn : V.card ≤ n := by simpa using Finset.card_le_univ V  have hcV := Finset.card_erase_add_one hx  have hdiff : n - (V.erase x).card = (n - V.card) + 1 := by omega  change d*(n-V.card) + mass V ≤ d*(n-(V.erase x).card) + mass (V.erase x) at hc'  rw [hdiff, Nat.mul_add, Nat.mul_one] at hc'  change (Finset.univ.filter active).card ≤ d  omega
See it in the graphDiscuss this resultChallenge it