AFTD Auto-Formalizing Theoretical Domains

matroid_rank_threshold_via_connectedness

theoremverified

Given a loopless matroid on a finite nonempty full ground set and any positive threshold k, one can construct a matroid on the same elements and one new point. Its connectedness says that the original rank is at least k. A query on Q asks the original oracle about the old elements of Q and checks that the total size including the new point is at most k.

Statement

theorem matroid_rank_threshold_via_connectedness {α : Type*} [Finite α] [Nonempty α]
    (M : Matroid α) (hE : M.E = Set.univ) (hloop : ∀ x : α, M.Indep {x}) (k : ℕ) (hk : 0 < k) :
    ∃ N : Matroid (α ⊕ Unit), N.E = Set.univ ∧
      (∀ Q : Set (α ⊕ Unit), N.Indep Q ↔ M.Indep (Sum.inl ⁻¹' Q) ∧ Q.ncard ≤ k) ∧
      (matroid_connected N ↔ ∃ I : Set α, M.Indep I ∧ k ≤ I.ncard)
Source
Open problem OP-1998 and Theorem 4.1 of https://arxiv.org/abs/2611.23624. Parallel basis-finding lower and upper bounds: https://arxiv.org/abs/2507.08194 and https://arxiv.org/abs/2606.24845. Experiment 44378 tests the forward reduction.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • matroid_connectedA matroid M on a type α is connected if for all elements e and f of its ground set M.E, either e = f or there is a circuit C of M that…
Used by 1

The proof, explained

To decide whether the rank of a loopless matroid M is at least k, we adjoin a single freely independent point z to form P = M ⊕ freeOn(Unit) and truncate P to cardinality threshold k, yielding a matroid N. If M has an independent set I of size at least k, then I ∪ {z} is an independent set of size at least k + 1 in P, which ensures any two elements of N lie on a common (k+1)-element circuit, making N connected. Conversely, if N is connected, any circuit connecting z to an element of M has its original elements independent in M; if all independent sets were smaller than k, this circuit would have size at most k and hence be independent in N, a contradiction.

  1. For any matroid P and integer threshold k, there exists a matroid N on the same ground set whose independent sets are precisely the independent sets of P of cardinality at most k.

    We define the k-truncation of P using IndepMatroid.ofFinite. The empty set is independent of size 0 ≤ k; the hereditary property follows from subset independence in P and monotonicity of cardinality via ncard_le_ncard; and given independent sets I and J with |I| < |J| ≤ k, the augmentation property of P yields an element e ∈ J \ I with I ∪ {e} independent in P, while its size is bounded by |I| + 1 ≤ |J| ≤ k via ncard_insert_le and Nat.succ_le_of_lt. Packaging this gives the required matroid N.

    lines 5–15

    uses IndepMatroid.ofFinite, ncard_le_ncard, ncard_insert_le, Nat.succ_le_of_lt, Iff.rfl

      let A := IndepMatroid.ofFinite P.E.toFinite (fun I => P.Indep I ∧ I.ncard ≤ k)
        (by simp) (fun {_ _} hJ hIJ => ⟨hJ.1.subset hIJ, (ncard_le_ncard hIJ).trans hJ.2⟩)
        (by
          intro I J hI hJ hlt
          have he : I.encard < J.encard := by
            rw [← I.toFinite.cast_ncard_eq, ← J.toFinite.cast_ncard_eq]
            exact_mod_cast hlt
          obtain ⟨e,⟨heJ,heI⟩,hind⟩ := hI.1.exists_insert_of_encard_lt hJ.1 he
          exact ⟨e,heJ,heI,hind,(ncard_insert_le e I).trans ((Nat.succ_le_of_lt hlt).trans hJ.2)⟩)
        (fun {_} hI => hI.1.subset_ground)
      exact ⟨A.matroid,rfl,fun _ => Iff.rfl⟩
  2. To show connectedness of the truncated matroid N, it suffices to find a common circuit for distinct elements x, y, and every singleton is independent.

    Let x, y ∈ N.E. If x = y, the connectivity condition holds immediately via Or.inl. When x ≠ y, we must exhibit a circuit containing both. Since P is loopless and k > 0, each singleton {z} is independent in P and has cardinality 1 ≤ k by Nat.succ_le_of_lt, so all singletons remain independent in N.

    lines 22–28

    uses Or.inl, Nat.succ_le_of_lt

      classical
      intro x hx y hy
      by_cases hxy : x = y
      · exact Or.inl hxy
      right
      have hs (z : α) (hz : z ∈ N.E) : N.Indep {z} :=
        (hi _).mpr ⟨hloop z (hn ▸ hz),by simpa using Nat.succ_le_of_lt hk⟩
  3. If {x, y} is independent in N, then x and y are contained in a circuit of size k + 1.

    Extend {x, y} to a base B of P, and extend the given large independent set J (with |J| ≥ k + 1) to a base D of P. Since any two bases have the same cardinality, |B| = |D| ≥ |J| ≥ k + 1. By exists_subsuperset_card_eq, there is an intermediate set C with {x, y} ⊆ C ⊆ B of cardinality exactly k + 1. Because |C| = k + 1 > k, C is dependent in N. Furthermore, any strict subset I ⊊ C has |I| ≤ k by Set.ncard_lt_ncard and is independent in P as a subset of the base B, so I is independent in N. Hence C is a circuit of N containing both x and y.

    lines 29–44

    uses Nat.succ_le_of_lt, ncard_le_ncard, exists_subsuperset_card_eq, le_trans, Nat.le_succ, Set.ncard_lt_ncard

      by_cases hpair : N.Indep {x,y}
      · obtain ⟨B,hB,hsub⟩ := ((hi _).mp hpair).1.exists_isBase_superset
        obtain ⟨D,hD,hJD⟩ := hJ.exists_isBase_superset
        have hbig : k+1 ≤ B.ncard := by
          rw [hB.ncard_eq_ncard_of_isBase hD]
          exact (Nat.succ_le_of_lt hj).trans (ncard_le_ncard hJD)
        obtain ⟨C,hxys,hCB,hcard⟩ := exists_subsuperset_card_eq hsub
          (le_trans ((hi _).mp hpair).2 (Nat.le_succ k)) hbig
        have hCP := hB.indep.subset hCB
        have hC : N.IsCircuit C := by
          apply Matroid.isCircuit_iff_forall_ssubset.mpr
          refine ⟨N.dep_of_not_indep (fun h => ?_) (hn ▸ hCP.subset_ground),?_⟩
          · have := ((hi _).mp h).2; omega
          · intro I hI
            exact (hi _).mpr ⟨hCP.subset hI.subset,by have := Set.ncard_lt_ncard hI; omega⟩
        exact ⟨C,hC,hxys (by simp),hxys (by simp)⟩
  4. If {x, y} is dependent in N, then {x, y} is itself a circuit containing x and y.

    Since {x, y} is dependent in N, it contains a circuit C ⊆ {x, y}. If x ∉ C, then C ⊆ {y}, which would make C independent because singletons are independent, contradicting that C is a circuit; thus x ∈ C. By the same reasoning, y ∈ C. Therefore C = {x, y} is a circuit containing both points, which completes the proof that N is connected.

    lines 45–55

    uses insert_subset

      · have hd := N.dep_of_not_indep hpair (insert_subset hx (singleton_subset_iff.mpr hy))
        obtain ⟨C,hCsub,hC⟩ := hd.exists_isCircuit_subset
        refine ⟨C,hC,?_,?_⟩
        · by_contra hxx
          apply hC.not_indep ((hs y hy).subset ?_)
          intro z hz
          exact (hCsub hz).resolve_left (by rintro rfl; exact hxx hz)
        · by_contra hyy
          apply hC.not_indep ((hs x hx).subset ?_)
          intro z hz
          exact (hCsub hz).resolve_right (by rintro rfl; exact hyy hz)
  5. We form P by adding a freely independent point z to M and obtain N as its k-truncation, satisfying the oracle condition.

    We extend M to P by adjoining a fresh element z = Sum.inr () via Matroid.freeOn. The ground set of P is universal, a set Q is independent in P iff its α-elements are independent in M, and every singleton in P is independent. Applying rank_cut_make to P and k gives a matroid N on α ⊕ Unit whose independent sets are precisely those whose preimage under Sum.inl is independent in M and whose total size is at most k.

    lines 62–74

    uses Matroid.freeOn, rank_cut_make, and_congr_left

      classical
      let P := M.sum (Matroid.freeOn (univ : Set Unit))
      let z : α ⊕ Unit := Sum.inr ()
      have hp : P.E = univ := by
        ext e; cases e <;> simp [P,hE]
      have hor (I : Set (α ⊕ Unit)) : P.Indep I ↔ M.Indep (Sum.inl ⁻¹' I) := by simp [P]
      have hsing (e : α ⊕ Unit) (_ : e ∈ P.E) : P.Indep {e} := by
        rw [hor]
        cases e with
        | inl x => simpa [Set.preimage] using hloop x
        | inr x => simp [Set.preimage]
      obtain ⟨N,hN,hi⟩ := rank_cut_make P k
      refine ⟨N,hN.trans hp, fun Q => (hi Q).trans (and_congr_left fun _ => hor Q),?_⟩
  6. If N is connected, then M contains an independent set of size at least k.

    Suppose for contradiction that all independent sets in M have size strictly less than k. Pick an arbitrary point x ∈ α using Classical.arbitrary. Since N is connected and z ≠ x, there is a circuit C of N containing both z and x. Removing z leaves an independent set C \ {z} in N, so its α-preimage is independent in M. By assumption, this preimage has cardinality at most k - 1. Decomposing C into {z} and its α-elements shows |C| ≤ 1 + (k - 1) = k using ncard_le_ncard, ncard_insert_le, and ncard_image_of_injective with Sum.inl_injective. But then C satisfies both conditions to be independent in N, contradicting that C is a circuit.

    lines 75–93

    uses Classical.arbitrary, Or.inr, Or.inl, ncard_le_ncard, ncard_insert_le, ncard_image_of_injective, Sum.inl_injective

      constructor
      · intro hc
        by_contra! hsmall
        let x : α := Classical.arbitrary α
        have he (e : α ⊕ Unit) : e ∈ N.E := (hN.trans hp) ▸ trivial
        rcases hc z (he z) (.inl x) (he _) with h | ⟨C,hC,hz,_⟩
        · simp [z] at h
        have hCI := hC.sdiff_singleton_indep hz
        have hpre : Sum.inl ⁻¹' (C \ {z}) = (Sum.inl ⁻¹' C : Set α) := by ext; simp [z]
        have hMC : M.Indep (Sum.inl ⁻¹' C) := hpre ▸ (hor _).mp ((hi _).mp hCI).1
        apply hC.not_indep ((hi _).mpr ⟨(hor _).mpr hMC,?_⟩)
        have ha : C ⊆ insert z (Sum.inl '' (Sum.inl ⁻¹' C : Set α)) := by
          rintro (e | ⟨⟩) heC
          · exact Or.inr ⟨e,heC,rfl⟩
          · exact Or.inl rfl
        have hh := (ncard_le_ncard ha).trans (ncard_insert_le z _)
        rw [ncard_image_of_injective _ Sum.inl_injective] at hh
        have := hsmall _ hMC
        omega
  7. If M contains an independent set of size at least k, then N is connected.

    Given an independent set I in M with |I| ≥ k, consider J = {z} ∪ Sum.inl '' I in α ⊕ Unit. Its α-preimage is I, so J is independent in P. Since z is disjoint from the image of I, Set.ncard_insert_of_notMem and Set.ncard_image_of_injective show that |J| = |I| + 1 ≥ k + 1 > k. Applying rank_cut_connected to P and the large independent set J proves that N is connected.

    lines 94–99

    uses rank_cut_connected, Set.ncard_insert_of_notMem, Set.ncard_image_of_injective, Sum.inl_injective

      · rintro ⟨I,hI,hcard⟩
        let J : Set (α ⊕ Unit) := insert z (Sum.inl '' I)
        have hpre : Sum.inl ⁻¹' J = I := by ext; simp [J,z]
        have hz : z ∉ (Sum.inl '' I : Set (α ⊕ Unit)) := by simp [z]
        apply rank_cut_connected hk hN hi hsing ((hor J).mpr (hpre ▸ hI))
        simpa [J,Set.ncard_insert_of_notMem hz,Set.ncard_image_of_injective _ Sum.inl_injective] using hcard
IndepMatroid.ofFinite
Constructs a matroid from independence axioms on a finite ground set (empty set, hereditary subsets, augmentation, and ground set containment).
Iff.rfl
The identity equivalence: every proposition implies itself.
Or.inl
Constructs a disjunction P ∨ Q from a proof of the left disjunct P.
Or.inr
Constructs a disjunction P ∨ Q from a proof of the right disjunct Q.
Nat.succ_le_of_lt
For natural numbers, n < m implies n + 1 ≤ m.
Nat.le_succ
For any natural number n, n ≤ n + 1.
le_trans
Transitivity of inequality: a ≤ b and b ≤ c imply a ≤ c.
ncard_le_ncard
If s ⊆ t and t is finite, then |s| ≤ |t|.
ncard_insert_le
For any element a and set s, |insert a s| ≤ |s| + 1.
exists_subsuperset_card_eq
If s ⊆ t are finite sets with |s| ≤ n ≤ |t|, there exists a intermediate set u with s ⊆ u ⊆ t and |u| = n.
Set.ncard_lt_ncard
A proper subset of a finite set has strictly smaller cardinality.
insert_subset
If a ∈ t and s ⊆ t, then insert a s ⊆ t.
Matroid.freeOn
The free matroid on a set E, where every subset of E is independent.
rank_cut_make
Auxiliary lemma establishing the existence of the k-truncation matroid, whose independent sets are the original independent sets of size at most k.
and_congr_left
If c implies (a ↔ b), then (a ∧ c) ↔ (b ∧ c).
Classical.arbitrary
Selects an arbitrary element from any nonempty type.
ncard_image_of_injective
The cardinality of the image of a set under an injective function equals the cardinality of the domain set.
Set.ncard_image_of_injective
The cardinality of the image of a set under an injective function equals the cardinality of the domain set.
Sum.inl_injective
The canonical injection Sum.inl into a disjoint sum is injective.
Set.ncard_insert_of_notMem
If an element is not in a finite set, inserting it increases the cardinality by 1.
rank_cut_connected
Auxiliary lemma showing that the k-truncation of a loopless matroid is connected whenever the matroid has an independent set of size strictly greater than k.

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

open Setprivate theorem rank_cut_make {α : Type*} [Finite α] (P : Matroid α) (k : ℕ) :    ∃ N : Matroid α, N.E = P.E ∧ ∀ I : Set α, N.Indep I ↔ P.Indep I ∧ I.ncard ≤ k := by  let A := IndepMatroid.ofFinite P.E.toFinite (fun I => P.Indep I ∧ I.ncard ≤ k)    (by simp) (fun {_ _} hJ hIJ => ⟨hJ.1.subset hIJ, (ncard_le_ncard hIJ).trans hJ.2⟩)    (by      intro I J hI hJ hlt      have he : I.encard < J.encard := by        rw [← I.toFinite.cast_ncard_eq, ← J.toFinite.cast_ncard_eq]        exact_mod_cast hlt      obtain ⟨e,⟨heJ,heI⟩,hind⟩ := hI.1.exists_insert_of_encard_lt hJ.1 he      exact ⟨e,heJ,heI,hind,(ncard_insert_le e I).trans ((Nat.succ_le_of_lt hlt).trans hJ.2)⟩)    (fun {_} hI => hI.1.subset_ground)  exact ⟨A.matroid,rfl,fun _ => Iff.rfl⟩private theorem rank_cut_connected {α : Type*} [Finite α] {P N : Matroid α} {k : ℕ}    (hk : 0 < k) (hn : N.E = P.E)    (hi : ∀ I : Set α, N.Indep I ↔ P.Indep I ∧ I.ncard ≤ k)    (hloop : ∀ x ∈ P.E, P.Indep {x}) {J : Set α} (hJ : P.Indep J) (hj : k < J.ncard) :    matroid_connected N := by  classical  intro x hx y hy  by_cases hxy : x = y  · exact Or.inl hxy  right  have hs (z : α) (hz : z ∈ N.E) : N.Indep {z} :=    (hi _).mpr ⟨hloop z (hn ▸ hz),by simpa using Nat.succ_le_of_lt hk⟩  by_cases hpair : N.Indep {x,y}  · obtain ⟨B,hB,hsub⟩ := ((hi _).mp hpair).1.exists_isBase_superset    obtain ⟨D,hD,hJD⟩ := hJ.exists_isBase_superset    have hbig : k+1 ≤ B.ncard := by      rw [hB.ncard_eq_ncard_of_isBase hD]      exact (Nat.succ_le_of_lt hj).trans (ncard_le_ncard hJD)    obtain ⟨C,hxys,hCB,hcard⟩ := exists_subsuperset_card_eq hsub      (le_trans ((hi _).mp hpair).2 (Nat.le_succ k)) hbig    have hCP := hB.indep.subset hCB    have hC : N.IsCircuit C := by      apply Matroid.isCircuit_iff_forall_ssubset.mpr      refine ⟨N.dep_of_not_indep (fun h => ?_) (hn ▸ hCP.subset_ground),?_⟩      · have := ((hi _).mp h).2; omega      · intro I hI        exact (hi _).mpr ⟨hCP.subset hI.subset,by have := Set.ncard_lt_ncard hI; omega⟩    exact ⟨C,hC,hxys (by simp),hxys (by simp)⟩  · have hd := N.dep_of_not_indep hpair (insert_subset hx (singleton_subset_iff.mpr hy))    obtain ⟨C,hCsub,hC⟩ := hd.exists_isCircuit_subset    refine ⟨C,hC,?_,?_⟩    · by_contra hxx      apply hC.not_indep ((hs y hy).subset ?_)      intro z hz      exact (hCsub hz).resolve_left (by rintro rfl; exact hxx hz)    · by_contra hyy      apply hC.not_indep ((hs x hx).subset ?_)      intro z hz      exact (hCsub hz).resolve_right (by rintro rfl; exact hyy hz)theorem matroid_rank_threshold_via_connectedness {α : Type*} [Finite α] [Nonempty α]    (M : Matroid α) (hE : M.E = Set.univ) (hloop : ∀ x : α, M.Indep {x}) (k : ℕ) (hk : 0 < k) :    ∃ N : Matroid (α ⊕ Unit), N.E = Set.univ ∧      (∀ Q : Set (α ⊕ Unit), N.Indep Q ↔ M.Indep (Sum.inl ⁻¹' Q) ∧ Q.ncard ≤ k) ∧      (matroid_connected N ↔ ∃ I : Set α, M.Indep I ∧ k ≤ I.ncard) := by  classical  let P := M.sum (Matroid.freeOn (univ : Set Unit))  let z : α ⊕ Unit := Sum.inr ()  have hp : P.E = univ := by    ext e; cases e <;> simp [P,hE]  have hor (I : Set (α ⊕ Unit)) : P.Indep I ↔ M.Indep (Sum.inl ⁻¹' I) := by simp [P]  have hsing (e : α ⊕ Unit) (_ : e ∈ P.E) : P.Indep {e} := by    rw [hor]    cases e with    | inl x => simpa [Set.preimage] using hloop x    | inr x => simp [Set.preimage]  obtain ⟨N,hN,hi⟩ := rank_cut_make P k  refine ⟨N,hN.trans hp, fun Q => (hi Q).trans (and_congr_left fun _ => hor Q),?_⟩  constructor  · intro hc    by_contra! hsmall    let x : α := Classical.arbitrary α    have he (e : α ⊕ Unit) : e ∈ N.E := (hN.trans hp) ▸ trivial    rcases hc z (he z) (.inl x) (he _) with h | ⟨C,hC,hz,_⟩    · simp [z] at h    have hCI := hC.sdiff_singleton_indep hz    have hpre : Sum.inl ⁻¹' (C \ {z}) = (Sum.inl ⁻¹' C : Set α) := by ext; simp [z]    have hMC : M.Indep (Sum.inl ⁻¹' C) := hpre ▸ (hor _).mp ((hi _).mp hCI).1    apply hC.not_indep ((hi _).mpr ⟨(hor _).mpr hMC,?_⟩)    have ha : C ⊆ insert z (Sum.inl '' (Sum.inl ⁻¹' C : Set α)) := by      rintro (e | ⟨⟩) heC      · exact Or.inr ⟨e,heC,rfl⟩      · exact Or.inl rfl    have hh := (ncard_le_ncard ha).trans (ncard_insert_le z _)    rw [ncard_image_of_injective _ Sum.inl_injective] at hh    have := hsmall _ hMC    omega  · rintro ⟨I,hI,hcard⟩    let J : Set (α ⊕ Unit) := insert z (Sum.inl '' I)    have hpre : Sum.inl ⁻¹' J = I := by ext; simp [J,z]    have hz : z ∉ (Sum.inl '' I : Set (α ⊕ Unit)) := by simp [z]    apply rank_cut_connected hk hN hi hsing ((hor J).mpr (hpre ▸ hI))    simpa [J,Set.ncard_insert_of_notMem hz,Set.ncard_image_of_injective _ Sum.inl_injective] using hcard
See it in the graphDiscuss this resultChallenge it