AFTD Auto-Formalizing Theoretical Domains

matroid_parallel_basis_reduction_to_connectedness

theoremverifiedoriginal

Fix a positive natural number n, with the explicit hypothesis 0<n. The original matroid M has type Matroid (Fin n) and M.E is all of Fin n, with zero-based labels. For p in Fin (n+1), let A(p) be the set of x in Fin n such that x.val < p.val and the singleton {x} is M-independent. There exists a single family N indexed by p in Fin (n+1) and j in Fin n, each N(p,j) a matroid on the sum type Fin n ⊕ Unit whose ground set is the whole sum type. For every subset Q of that sum type, Q is independent in N(p,j) exactly when M declares the intersection of A(p) with the inverse image of Q under Sum.inl independent, and Q.ncard is at most the cardinality of the complement of A(p) in Fin n plus j.val+1. The subset of all x in Fin n for which some j in Fin n has matroid_connected (N x.succ j) and fails matroid_connected (N x.castSucc j) satisfies M.IsBase. Here x.succ and x.castSucc are the indices with natural values x.val+1 and x.val in Fin (n+1), respectively.

Statement

theorem matroid_parallel_basis_reduction_to_connectedness (n : ℕ) (hn : 0 < n)
    (M : Matroid (Fin n)) (hE : M.E = Set.univ) :
    let active (p : Fin (n+1)) := {x : Fin n | x.val < p.val ∧ M.Indep {x}}
    ∃ N : Fin (n+1) → Fin n → Matroid (Fin n ⊕ Unit),
      (∀ p j, (N p j).E = Set.univ ∧
        ∀ Q : Set (Fin n ⊕ Unit), (N p j).Indep Q ↔
          M.Indep ((Sum.inl ⁻¹' Q) ∩ active p) ∧ Q.ncard ≤ (active p)ᶜ.ncard + (j.val + 1)) ∧
      M.IsBase {x : Fin n | ∃ j : Fin n,
        matroid_connected (N x.succ j) ∧ ¬ matroid_connected (N x.castSucc j)}
Related work
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 4
  • 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…
  • matroid_rank_threshold_via_connectednessGiven a loopless matroid on a finite nonempty full ground set and any positive threshold k, one can construct a matroid on the same…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…

Read back from the Lean

Given a positive natural number n (with hypothesis hn : 0 < n) and a matroid M on Fin n whose ground set M.E is all of Fin n (hE : M.E = Set.univ): Define for each p : Fin (n+1) the set active(p) ⊆ Fin n to be {x : Fin n | x.val < p.val ∧ M.Indep {x}} (the set of elements of Fin n with index strictly less than p that are non-loops in M). The theorem asserts that there exists a family of matroids N indexed by p : Fin (n+1) and j : Fin n, where each N(p, j) is a Matroid (Fin n ⊕ Unit), such that both of the following hold: 1. For all p : Fin (n+1) and j : Fin n: - The ground set of N(p, j) is Set.univ (the entire type Fin n ⊕ Unit); - For every subset Q ⊆ Fin n ⊕ Unit, Q is independent in N(p, j) if and only if: (a) the preimage of Q under Sum.inl intersected with active(p) is independent in M, and (b) the cardinality Q.ncard is at most the cardinality of the complement (active(p))ᶜ (in Fin n) plus (j.val + 1). 2. The set of all elements x : Fin n for which there exists some j : Fin n such that N(x.succ, j) is matroid-connected and N(x.castSucc, j) is not matroid-connected, is a base of M (M.IsBase).

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

A real summary sketch to test coverage. The proof constructs gadget matroids N using disjoint sums, characterizes basis elements via rank threshold jumps on prefixes, and assembles the parallel reduction.

  1. Lemma 1

    Lemma 1 explanation

    lines 10–36

      classical
      let A := M.restrict S
      let D := Matroid.freeOn Sᶜ
      let P := A.disjointSum D (show Disjoint A.E D.E from disjoint_compl_right)
      have hp : P.E = univ := by simp [P,A,D]
      have hi (I : Set α) : P.Indep I ↔ M.Indep (I ∩ S) := by
        simp [P,A,D,Matroid.disjointSum_indep_iff]
      have hs (x : α) : P.Indep {x} := by
        rw [hi]
        by_cases hx : x ∈ S
        · simpa [hx] using hloop x hx
        · simp [hx]
      obtain ⟨N,hn,ho,hc⟩ := matroid_rank_threshold_via_connectedness P hp hs (Sᶜ.ncard+k) (by omega)
      refine ⟨N,hn,fun Q => (ho Q).trans (and_congr_left fun _ => hi _),?_⟩
      rw [hc]
      constructor
      · rintro ⟨J,hJ,hsize⟩
        refine ⟨J ∩ S,inter_subset_right,(hi _).mp hJ,?_⟩
        have hrem : J \ S ⊆ Sᶜ := fun _ h => h.2
        have hh := ncard_le_ncard hrem
        have hparts := Set.ncard_inter_add_ncard_sdiff_eq_ncard J S
        omega
      · rintro ⟨I,hIS,hI,hkI⟩
        have hdis : Disjoint I Sᶜ := disjoint_left.mpr (fun _ h hin => hin (hIS h))
        refine ⟨I ∪ Sᶜ,(hi _).mpr ?_,?_⟩
        · simpa [Set.union_inter_distrib_right,Set.inter_eq_left.mpr hIS] using hI
        · rw [Set.ncard_union_eq hdis]; omega
  2. Lemma 2

    Lemma 2 explanation

    lines 43–98

      classical
      let chosen := {x : Fin n | x ∉ M.closure (Set.Iio x)}
      have hon (x : Fin n) : x ∈ M.E := he ▸ trivial
      have hsame (x : Fin n) : x ∈ chosen ↔ ∃ k : ℕ,
          (∃ I : Set (Fin n), I ⊆ Set.Iic x ∧ M.Indep I ∧ k ≤ I.ncard) ∧
          ¬ ∃ I : Set (Fin n), I ⊆ Set.Iio x ∧ M.Indep I ∧ k ≤ I.ncard := by
        obtain ⟨B,hB⟩ := M.exists_isBasis (Set.Iio x) (he ▸ subset_univ _)
        have maxCard (S : Set (Fin n)) {D I : Set (Fin n)} (hD : M.IsBasis D S)
            (hI : M.Indep I) (hIS : I ⊆ S) : I.ncard ≤ D.ncard := by
          obtain ⟨Z,hZ,hIZ⟩ := hI.subset_isBasis_of_subset hIS hD.subset_ground
          have heq := hZ.encard_eq_eRk.trans hD.encard_eq_eRk.symm
          rw [← Z.toFinite.cast_ncard_eq,← D.toFinite.cast_ncard_eq] at heq
          exact (ncard_le_ncard hIZ).trans (by exact_mod_cast heq.le)
        have hinterval : insert x (Set.Iio x) = Set.Iic x := by ext y; simp [le_iff_eq_or_lt]
        have hxB : x ∉ B := fun hh => lt_irrefl x (hB.subset hh)
        constructor
        · intro hx
          change x ∉ M.closure (Set.Iio x) at hx
          have hxc : x ∉ M.closure B := by rwa [hB.closure_eq_closure]
          have hI : M.Indep (insert x B) := hB.indep.insert_indep_iff.mpr (Or.inl ⟨hon x,hxc⟩)
          refine ⟨B.ncard+1, ⟨insert x B,hinterval ▸ insert_subset_insert hB.subset,
            hI,by simp [Set.ncard_insert_of_notMem hxB]⟩,?_⟩
          rintro ⟨I,hIS,hi,hk⟩
          have := maxCard _ hB hi hIS; omega
        · rintro ⟨k,⟨I,hIS,hI,hk⟩,hm⟩ hx
          have hxcl : x ∈ M.closure B := hB.closure_eq_closure.symm ▸ hx
          have hB' : M.IsBasis B (Set.Iic x) := by
            rw [← hinterval]
            exact hB.indep.isBasis_of_subset_of_subset_closure (hB.subset.trans (subset_insert ..))
              (insert_subset hxcl hB.subset_closure)
          exact hm ⟨B,hB.subset,hB.indep,hk.trans (maxCard _ hB' hI hIS)⟩
      rw [show {x : Fin n | ∃ k : ℕ,
          (∃ I : Set (Fin n), I ⊆ Set.Iic x ∧ M.Indep I ∧ k ≤ I.ncard) ∧
          ¬ ∃ I : Set (Fin n), I ⊆ Set.Iio x ∧ M.Indep I ∧ k ≤ I.ncard} = chosen from
        Set.ext fun x => (hsame x).symm]
      have hI : M.Indep chosen := by
        apply (Matroid.indep_iff_forall_subset_not_isCircuit (he ▸ subset_univ _)).mpr
        intro C hCB hC
        have hne : C.toFinset.Nonempty := by simpa using hC.nonempty
        let e := C.toFinset.max' hne
        have heC : e ∈ C := by simpa [e] using Finset.max'_mem C.toFinset hne
        have hs : C \ {e} ⊆ Set.Iio e := by
          intro y hy
          have le : y ≤ e := Finset.le_max' _ _ (by simpa using hy.1)
          exact lt_of_le_of_ne le hy.2
        exact hCB heC (M.closure_subset_closure hs (hC.mem_closure_sdiff_singleton_of_mem heC))
      apply hI.isBase_of_ground_subset_closure
      have hspan (x : Fin n) : x ∈ M.closure chosen := by
        induction x using WellFoundedLT.induction with
        | ind x ih =>
          by_cases hx : x ∈ chosen
          · exact M.subset_closure chosen hI.subset_ground hx
          have hxcl : x ∈ M.closure (Set.Iio x) := by simpa [chosen] using hx
          have hh := M.closure_subset_closure (show Set.Iio x ⊆ M.closure chosen from fun _ h => ih _ h) hxcl
          simpa using hh
      exact fun x _ => hspan x
  3. Main theorem

    Main theorem explanation

    lines 109–144

      classical
      intro active
      haveI : NeZero n := ⟨hn.ne'⟩
      have hr (p : Fin (n+1)) (j : Fin n) :=
        matroid_subset_rank_threshold_via_connectedness M (active p) (hE ▸ subset_univ _)
          (fun _ hx => hx.2) (j.val+1) (Nat.zero_lt_succ _)
      choose N hg ho hc using hr
      refine ⟨N,fun p j => ⟨hg p j,ho p j⟩,?_⟩
      let pref (p : Fin (n+1)) := {x : Fin n | x.val < p.val}
      have hcut (p : Fin (n+1)) (j : Fin n) :
          matroid_connected (N p j) ↔ ∃ I ⊆ pref p, M.Indep I ∧ j.val+1 ≤ I.ncard := by
        rw [hc]
        constructor
        · rintro ⟨I,hI,hi,hs⟩
          exact ⟨I,fun _ h => (hI h).1,hi,hs⟩
        · rintro ⟨I,hI,hi,hs⟩
          exact ⟨I,fun _ h => ⟨hI h,hi.subset (Set.singleton_subset_iff.mpr h)⟩,hi,hs⟩
      have hbefore (x : Fin n) : pref x.castSucc = Set.Iio x := rfl
      have hafter (x : Fin n) : pref x.succ = Set.Iic x := by
        ext y; change y.val < x.val+1 ↔ y.val ≤ x.val; omega
      convert matroid_basis_of_prefix_rank_thresholds M hE using 1
      ext x
      change (∃ j : Fin n, _ ∧ _) ↔ _
      simp only [hcut,hbefore,hafter,Set.mem_setOf_eq]
      constructor
      · rintro ⟨j,hj,hj'⟩
        exact ⟨j.val+1,hj,hj'⟩
      · rintro ⟨k,⟨I,hIS,hi,hs⟩,hm⟩
        have hk : 0 < k := by
          by_contra! hk
          exact hm ⟨∅,Set.empty_subset _,M.empty_indep,by simp_all⟩
        have card := Set.ncard_le_ncard (Set.subset_univ I)
        have hkn : k ≤ n := hs.trans (by simpa using card)
        let j : Fin n := ⟨k-1,by omega⟩
        have hj : j.val+1 = k := by dsimp [j]; omega
        exact ⟨j,⟨I,hIS,hi,hj ▸ hs⟩,hj ▸ hm⟩

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 matroid_subset_rank_threshold_via_connectedness {α : Type*} [Finite α] [Nonempty α]    (M : Matroid α) (S : Set α) (hS : S ⊆ M.E) (hloop : ∀ x ∈ S, 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) ∩ S) ∧ Q.ncard ≤ Sᶜ.ncard + k) ∧      (matroid_connected N ↔ ∃ I ⊆ S, M.Indep I ∧ k ≤ I.ncard) := by  classical  let A := M.restrict S  let D := Matroid.freeOn Sᶜ  let P := A.disjointSum D (show Disjoint A.E D.E from disjoint_compl_right)  have hp : P.E = univ := by simp [P,A,D]  have hi (I : Set α) : P.Indep I ↔ M.Indep (I ∩ S) := by    simp [P,A,D,Matroid.disjointSum_indep_iff]  have hs (x : α) : P.Indep {x} := by    rw [hi]    by_cases hx : x ∈ S    · simpa [hx] using hloop x hx    · simp [hx]  obtain ⟨N,hn,ho,hc⟩ := matroid_rank_threshold_via_connectedness P hp hs (Sᶜ.ncard+k) (by omega)  refine ⟨N,hn,fun Q => (ho Q).trans (and_congr_left fun _ => hi _),?_⟩  rw [hc]  constructor  · rintro ⟨J,hJ,hsize⟩    refine ⟨J ∩ S,inter_subset_right,(hi _).mp hJ,?_⟩    have hrem : J \ S ⊆ Sᶜ := fun _ h => h.2    have hh := ncard_le_ncard hrem    have hparts := Set.ncard_inter_add_ncard_sdiff_eq_ncard J S    omega  · rintro ⟨I,hIS,hI,hkI⟩    have hdis : Disjoint I Sᶜ := disjoint_left.mpr (fun _ h hin => hin (hIS h))    refine ⟨I ∪ Sᶜ,(hi _).mpr ?_,?_⟩    · simpa [Set.union_inter_distrib_right,Set.inter_eq_left.mpr hIS] using hI    · rw [Set.ncard_union_eq hdis]; omegaprivate theorem matroid_basis_of_prefix_rank_thresholds {n : ℕ} (M : Matroid (Fin n))    (he : M.E = Set.univ) :    M.IsBase {x | ∃ k : ℕ,      (∃ I : Set (Fin n), I ⊆ Set.Iic x ∧ M.Indep I ∧ k ≤ I.ncard) ∧      ¬ ∃ I : Set (Fin n), I ⊆ Set.Iio x ∧ M.Indep I ∧ k ≤ I.ncard} := by  classical  let chosen := {x : Fin n | x ∉ M.closure (Set.Iio x)}  have hon (x : Fin n) : x ∈ M.E := he ▸ trivial  have hsame (x : Fin n) : x ∈ chosen ↔ ∃ k : ℕ,      (∃ I : Set (Fin n), I ⊆ Set.Iic x ∧ M.Indep I ∧ k ≤ I.ncard) ∧      ¬ ∃ I : Set (Fin n), I ⊆ Set.Iio x ∧ M.Indep I ∧ k ≤ I.ncard := by    obtain ⟨B,hB⟩ := M.exists_isBasis (Set.Iio x) (he ▸ subset_univ _)    have maxCard (S : Set (Fin n)) {D I : Set (Fin n)} (hD : M.IsBasis D S)        (hI : M.Indep I) (hIS : I ⊆ S) : I.ncard ≤ D.ncard := by      obtain ⟨Z,hZ,hIZ⟩ := hI.subset_isBasis_of_subset hIS hD.subset_ground      have heq := hZ.encard_eq_eRk.trans hD.encard_eq_eRk.symm      rw [← Z.toFinite.cast_ncard_eq,← D.toFinite.cast_ncard_eq] at heq      exact (ncard_le_ncard hIZ).trans (by exact_mod_cast heq.le)    have hinterval : insert x (Set.Iio x) = Set.Iic x := by ext y; simp [le_iff_eq_or_lt]    have hxB : x ∉ B := fun hh => lt_irrefl x (hB.subset hh)    constructor    · intro hx      change x ∉ M.closure (Set.Iio x) at hx      have hxc : x ∉ M.closure B := by rwa [hB.closure_eq_closure]      have hI : M.Indep (insert x B) := hB.indep.insert_indep_iff.mpr (Or.inl ⟨hon x,hxc⟩)      refine ⟨B.ncard+1, ⟨insert x B,hinterval ▸ insert_subset_insert hB.subset,        hI,by simp [Set.ncard_insert_of_notMem hxB]⟩,?_⟩      rintro ⟨I,hIS,hi,hk⟩      have := maxCard _ hB hi hIS; omega    · rintro ⟨k,⟨I,hIS,hI,hk⟩,hm⟩ hx      have hxcl : x ∈ M.closure B := hB.closure_eq_closure.symm ▸ hx      have hB' : M.IsBasis B (Set.Iic x) := by        rw [← hinterval]        exact hB.indep.isBasis_of_subset_of_subset_closure (hB.subset.trans (subset_insert ..))          (insert_subset hxcl hB.subset_closure)      exact hm ⟨B,hB.subset,hB.indep,hk.trans (maxCard _ hB' hI hIS)⟩  rw [show {x : Fin n | ∃ k : ℕ,      (∃ I : Set (Fin n), I ⊆ Set.Iic x ∧ M.Indep I ∧ k ≤ I.ncard) ∧      ¬ ∃ I : Set (Fin n), I ⊆ Set.Iio x ∧ M.Indep I ∧ k ≤ I.ncard} = chosen from    Set.ext fun x => (hsame x).symm]  have hI : M.Indep chosen := by    apply (Matroid.indep_iff_forall_subset_not_isCircuit (he ▸ subset_univ _)).mpr    intro C hCB hC    have hne : C.toFinset.Nonempty := by simpa using hC.nonempty    let e := C.toFinset.max' hne    have heC : e ∈ C := by simpa [e] using Finset.max'_mem C.toFinset hne    have hs : C \ {e} ⊆ Set.Iio e := by      intro y hy      have le : y ≤ e := Finset.le_max' _ _ (by simpa using hy.1)      exact lt_of_le_of_ne le hy.2    exact hCB heC (M.closure_subset_closure hs (hC.mem_closure_sdiff_singleton_of_mem heC))  apply hI.isBase_of_ground_subset_closure  have hspan (x : Fin n) : x ∈ M.closure chosen := by    induction x using WellFoundedLT.induction with    | ind x ih =>      by_cases hx : x ∈ chosen      · exact M.subset_closure chosen hI.subset_ground hx      have hxcl : x ∈ M.closure (Set.Iio x) := by simpa [chosen] using hx      have hh := M.closure_subset_closure (show Set.Iio x ⊆ M.closure chosen from fun _ h => ih _ h) hxcl      simpa using hh  exact fun x _ => hspan xtheorem matroid_parallel_basis_reduction_to_connectedness (n : ℕ) (hn : 0 < n)    (M : Matroid (Fin n)) (hE : M.E = Set.univ) :    let active (p : Fin (n+1)) := {x : Fin n | x.val < p.val ∧ M.Indep {x}}    ∃ N : Fin (n+1) → Fin n → Matroid (Fin n ⊕ Unit),      (∀ p j, (N p j).E = Set.univ ∧        ∀ Q : Set (Fin n ⊕ Unit), (N p j).Indep Q ↔          M.Indep ((Sum.inl ⁻¹' Q) ∩ active p) ∧ Q.ncard ≤ (active p)ᶜ.ncard + (j.val + 1)) ∧      M.IsBase {x : Fin n | ∃ j : Fin n,        matroid_connected (N x.succ j) ∧ ¬ matroid_connected (N x.castSucc j)} := by  classical  intro active  haveI : NeZero n := ⟨hn.ne'⟩  have hr (p : Fin (n+1)) (j : Fin n) :=    matroid_subset_rank_threshold_via_connectedness M (active p) (hE ▸ subset_univ _)      (fun _ hx => hx.2) (j.val+1) (Nat.zero_lt_succ _)  choose N hg ho hc using hr  refine ⟨N,fun p j => ⟨hg p j,ho p j⟩,?_⟩  let pref (p : Fin (n+1)) := {x : Fin n | x.val < p.val}  have hcut (p : Fin (n+1)) (j : Fin n) :      matroid_connected (N p j) ↔ ∃ I ⊆ pref p, M.Indep I ∧ j.val+1 ≤ I.ncard := by    rw [hc]    constructor    · rintro ⟨I,hI,hi,hs⟩      exact ⟨I,fun _ h => (hI h).1,hi,hs⟩    · rintro ⟨I,hI,hi,hs⟩      exact ⟨I,fun _ h => ⟨hI h,hi.subset (Set.singleton_subset_iff.mpr h)⟩,hi,hs⟩  have hbefore (x : Fin n) : pref x.castSucc = Set.Iio x := rfl  have hafter (x : Fin n) : pref x.succ = Set.Iic x := by    ext y; change y.val < x.val+1 ↔ y.val ≤ x.val; omega  convert matroid_basis_of_prefix_rank_thresholds M hE using 1  ext x  change (∃ j : Fin n, _ ∧ _) ↔ _  simp only [hcut,hbefore,hafter,Set.mem_setOf_eq]  constructor  · rintro ⟨j,hj,hj'⟩    exact ⟨j.val+1,hj,hj'⟩  · rintro ⟨k,⟨I,hIS,hi,hs⟩,hm⟩    have hk : 0 < k := by      by_contra! hk      exact hm ⟨∅,Set.empty_subset _,M.empty_indep,by simp_all⟩    have card := Set.ncard_le_ncard (Set.subset_univ I)    have hkn : k ≤ n := hs.trans (by simpa using card)    let j : Fin n := ⟨k-1,by omega⟩    have hj : j.val+1 = k := by dsimp [j]; omega    exact ⟨j,⟨I,hIS,hi,hj ▸ hs⟩,hj ▸ hm⟩
See it in the graphDiscuss this resultChallenge it