AFTD Auto-Formalizing Theoretical Domains

matroid_circuit_mono_of_fundCircuit_mono_of_finite_sdiff

theoremverified

Let B be a base of a matroid M and P a set of elements such that every fundamental circuit M.fundCircuit e B (e in E \ B) is monochromatic for the partition (P, E \ P): contained in P or disjoint from P. Then every circuit C with finitely many elements outside B is monochromatic for that partition.

Statement

theorem matroid_circuit_mono_of_fundCircuit_mono_of_finite_sdiff {α : Type*} (M : Matroid α) {B P : Set α} (hB : M.IsBase B) (hmono : ∀ e ∈ M.E \ B, M.fundCircuit e B ⊆ P ∨ Disjoint (M.fundCircuit e B) P) (C : Set α) (hC : M.IsCircuit C) (hfin : (C \ B).Finite) : C ⊆ P ∨ Disjoint C P
Source
step towards not_matroid_connected_of_fund_circuit_separated
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

The proof proceeds by strong induction on the finite cardinality n of the trace D \ B outside the base B for any circuit D. Because a circuit cannot be contained in an independent set, D must contain some element e ∉ B, whose fundamental circuit F = M.fundCircuit e B is monochromatic by hypothesis. For any element f ∈ D outside F, strong circuit elimination between D and F yields a circuit C' containing f with strictly smaller trace C' \ B ⊊ D \ B; by induction C' is monochromatic, and because C' must intersect F outside D, its color matches that of F, forcing all of D to have the same color as F.

  1. Formulate the induction hypothesis and set up strong induction on the size of the circuit trace outside the base B.

    We strengthen the goal by proving that for every natural number n, every circuit D whose trace D \ B is finite with |D \ B| ≤ n is monochromatic for P (either D ⊆ P or D and P are disjoint). We proceed by strong induction on n.

    lines 3–6

    uses Nat.strong_induction_on

      have key : ∀ n, ∀ C, M.IsCircuit C → (C \ B).Finite → (C \ B).ncard ≤ n → C ⊆ P ∨ Disjoint C P := by
        intro n
        refine Nat.strong_induction_on n ?_
        intro n ih D hD hDfin hle
  2. The circuit D contains at least one element outside B, so D \ B is nonempty.

    If D \ B were empty, D would be entirely contained in B. Since B is a base, it is independent, which would make D independent as a subset of B; this contradicts the assumption that D is a circuit.

    lines 7–16

    uses Set.not_nonempty_iff_eq_empty

        have hne : (D \ B).Nonempty := by
          by_contra h
          rw [Set.not_nonempty_iff_eq_empty] at h
          have hDB : D ⊆ B := by
            intro x hx
            by_contra hxB
            have hmem : x ∈ D \ B := ⟨hx, hxB⟩
            rw [h] at hmem
            exact hmem
          exact hD.not_indep (hB.indep.subset hDB)
  3. Pick an element e in D \ B and form its fundamental circuit with respect to B.

    Since D \ B is nonempty, we choose an element e ∈ D \ B. Because e is in the ground set and outside the base B, the fundamental circuit F = M.fundCircuit e B is a circuit containing e, and all its other elements lie in B (so F \ {e} = F ∩ B).

    lines 17–21

    uses M.mem_fundCircuit, M.fundCircuit_sdiff_eq_inter

        obtain ⟨e, heD, heB⟩ := hne
        have heE : e ∈ M.E := hD.subset_ground heD
        have hFcirc : M.IsCircuit (M.fundCircuit e B) := hB.fundCircuit_isCircuit heE heB
        have heF : e ∈ M.fundCircuit e B := M.mem_fundCircuit e B
        have hFsdiff : M.fundCircuit e B \ {e} = M.fundCircuit e B ∩ B := M.fundCircuit_sdiff_eq_inter heB
  4. Any element f ∈ D that also belongs to the fundamental circuit F has the same P-membership as F.

    We state the claim that for every f ∈ D, if F ⊆ P then f ∈ P, and if F is disjoint from P then f ∉ P. If f already belongs to F, both implications follow immediately from the definitions of subset and disjointness.

    lines 22–25

    uses Set.disjoint_left.1

        have hclaim : ∀ f ∈ D, (M.fundCircuit e B ⊆ P → f ∈ P) ∧ (Disjoint (M.fundCircuit e B) P → f ∉ P) := by
          intro f hfD
          by_cases hfF : f ∈ M.fundCircuit e B
          · exact ⟨fun h => h hfF, fun h => Set.disjoint_left.1 h hfF⟩
  5. For f ∈ D outside F, strong circuit elimination yields a circuit C' with strictly smaller trace outside B, allowing the induction hypothesis to apply.

    Strong circuit elimination between circuits D and F on e, preserving f, produces a circuit C' ⊆ (D ∪ F) \ {e} with f ∈ C'. Since e ∉ C' and the remaining elements of F lie inside B, the elements of C' outside B are contained in (D \ B) \ {e}. Hence C' \ B is a strict subset of D \ B, so |C' \ B| < |D \ B| ≤ n. By the induction hypothesis, C' is monochromatic for P.

    lines 26–51

    uses Set.mem_singleton_iff.mpr, Set.sdiff_subset, Set.ssubset_iff_subset_ne.mpr, Set.ncard_lt_ncard, lt_of_lt_of_le, le_rfl

          · obtain ⟨C', hC'sub, hC'circ, hfC'⟩ := hD.strong_elimination hFcirc heD heF hfD hfF
            have heC' : e ∉ C' := by
              intro h
              exact (hC'sub h).2 (Set.mem_singleton_iff.mpr rfl)
            have hC'subB : C' \ B ⊆ (D \ B) \ {e} := by
              intro x hx
              obtain ⟨hxC', hxB⟩ := hx
              obtain ⟨hxU, hxe⟩ := hC'sub hxC'
              refine ⟨?_, hxe⟩
              rcases hxU with hxD | hxF
              · exact ⟨hxD, hxB⟩
              · exfalso
                have : x ∈ M.fundCircuit e B \ {e} := ⟨hxF, hxe⟩
                rw [hFsdiff] at this
                exact hxB this.2
            have hssub : C' \ B ⊆ D \ B := hC'subB.trans Set.sdiff_subset
            have hne2 : C' \ B ≠ D \ B := by
              intro heq
              have : e ∈ C' \ B := by
                rw [heq]; exact ⟨heD, heB⟩
              exact heC' this.1
            have hstrict : C' \ B ⊂ D \ B := Set.ssubset_iff_subset_ne.mpr ⟨hssub, hne2⟩
            have hfinlt : (C' \ B).ncard < (D \ B).ncard := Set.ncard_lt_ncard hstrict hDfin
            have hlt : (C' \ B).ncard < n := lt_of_lt_of_le hfinlt hle
            have hC'fin : (C' \ B).Finite := hDfin.subset hssub
            have hC'res := ih (C' \ B).ncard hlt C' hC'circ hC'fin le_rfl
  6. The circuit C' contains an element g ∈ F \ D, coupling the monochromaticity of C' to F and proving the claim for f.

    If C' were contained in D, circuit minimality would imply C' = D, contradicting C' \ B ⊊ D \ B. Thus there is an element g ∈ C' \ D, which must lie in F. Since g is shared by C' and F, the monochromaticity of C' must match that of F on g: if F ⊆ P then g ∈ P, so C' ⊆ P and f ∈ P; if F is disjoint from P then g ∉ P, so C' is disjoint from P and f ∉ P.

    lines 52–71

    uses Set.disjoint_left.1

            have hex : ∃ g ∈ C', g ∉ D := by
              by_contra h
              push Not at h
              have hCD : C' ⊆ D := fun g hg => h g hg
              have hEq : C' = D := hC'circ.eq_of_subset_isCircuit hD hCD
              rw [hEq] at hne2
              exact hne2 rfl
            obtain ⟨g, hgC', hgD⟩ := hex
            have hgF : g ∈ M.fundCircuit e B := by
              have h := hC'sub hgC'
              rcases h.1 with h' | h'
              · exact absurd h' hgD
              · exact h'
            refine ⟨fun hFP => ?_, fun hFP => ?_⟩
            · rcases hC'res with h | h
              · exact h hfC'
              · exact absurd (hFP hgF) (Set.disjoint_left.1 h hgC')
            · rcases hC'res with h | h
              · exact absurd (h hgC') (Set.disjoint_left.1 hFP hgF)
              · exact Set.disjoint_left.1 h hfC'
  7. The circuit D is monochromatic for P.

    By the assumption hmono on fundamental circuits, F is either contained in P or disjoint from P. Applying the claim to all elements f ∈ D, we obtain D ⊆ P in the first case and Disjoint D P in the second.

    lines 72–76

    uses Set.disjoint_left.2

        rcases hmono e ⟨heE, heB⟩ with hFP | hFP
        · left
          exact fun f hf => (hclaim f hf).1 hFP
        · right
          exact Set.disjoint_left.2 fun f hf => (hclaim f hf).2 hFP
  8. The theorem holds for the given circuit C.

    We specialize the inductive claim to C with n = |C \ B|, concluding that C ⊆ P or Disjoint C P.

    line 77

    uses le_rfl

      exact key (C \ B).ncard C hC hfin le_rfl
Nat.strong_induction_on
Strong induction on natural numbers: to prove a property holds for all n, it suffices to prove it for n assuming it holds for all m < n.
Set.not_nonempty_iff_eq_empty
A set is not nonempty if and only if it is the empty set.
M.mem_fundCircuit
An element e always belongs to its fundamental circuit with respect to an independent set.
M.fundCircuit_sdiff_eq_inter
For an element e not in B, the fundamental circuit of e with respect to B minus {e} equals the fundamental circuit intersected with B.
Set.disjoint_left.1
If two sets s and t are disjoint, then any element of s does not belong to t.
Set.mem_singleton_iff.mpr
If an element equals b, then it belongs to the singleton set {b}.
Set.sdiff_subset
The set difference s \ t is a subset of s.
Set.ssubset_iff_subset_ne.mpr
If s is a subset of t and s ≠ t, then s is a strict subset of t.
Set.ncard_lt_ncard
If s is a strict subset of a finite set t, then the cardinality of s is strictly less than that of t.
lt_of_lt_of_le
In a preorder, a < b and b ≤ c imply a < c.
le_rfl
The ordering relation is reflexive: a ≤ a for any element a.
Set.disjoint_left.2
If no element of s belongs to t, then s and t are disjoint.

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

/-- Fundamental circuits that are each contained in P or disjoint from P force every circuit with a finite trace outside B to be so too. -/theorem matroid_circuit_mono_of_fundCircuit_mono_of_finite_sdiff {α : Type*} (M : Matroid α) {B P : Set α} (hB : M.IsBase B) (hmono : ∀ e ∈ M.E \ B, M.fundCircuit e B ⊆ P ∨ Disjoint (M.fundCircuit e B) P) (C : Set α) (hC : M.IsCircuit C) (hfin : (C \ B).Finite) : C ⊆ P ∨ Disjoint C P := by  have key : ∀ n, ∀ C, M.IsCircuit C → (C \ B).Finite → (C \ B).ncard ≤ n → C ⊆ P ∨ Disjoint C P := by    intro n    refine Nat.strong_induction_on n ?_    intro n ih D hD hDfin hle    have hne : (D \ B).Nonempty := by      by_contra h      rw [Set.not_nonempty_iff_eq_empty] at h      have hDB : D ⊆ B := by        intro x hx        by_contra hxB        have hmem : x ∈ D \ B := ⟨hx, hxB⟩        rw [h] at hmem        exact hmem      exact hD.not_indep (hB.indep.subset hDB)    obtain ⟨e, heD, heB⟩ := hne    have heE : e ∈ M.E := hD.subset_ground heD    have hFcirc : M.IsCircuit (M.fundCircuit e B) := hB.fundCircuit_isCircuit heE heB    have heF : e ∈ M.fundCircuit e B := M.mem_fundCircuit e B    have hFsdiff : M.fundCircuit e B \ {e} = M.fundCircuit e B ∩ B := M.fundCircuit_sdiff_eq_inter heB    have hclaim : ∀ f ∈ D, (M.fundCircuit e B ⊆ P → f ∈ P) ∧ (Disjoint (M.fundCircuit e B) P → f ∉ P) := by      intro f hfD      by_cases hfF : f ∈ M.fundCircuit e B      · exact ⟨fun h => h hfF, fun h => Set.disjoint_left.1 h hfF⟩      · obtain ⟨C', hC'sub, hC'circ, hfC'⟩ := hD.strong_elimination hFcirc heD heF hfD hfF        have heC' : e ∉ C' := by          intro h          exact (hC'sub h).2 (Set.mem_singleton_iff.mpr rfl)        have hC'subB : C' \ B ⊆ (D \ B) \ {e} := by          intro x hx          obtain ⟨hxC', hxB⟩ := hx          obtain ⟨hxU, hxe⟩ := hC'sub hxC'          refine ⟨?_, hxe⟩          rcases hxU with hxD | hxF          · exact ⟨hxD, hxB⟩          · exfalso            have : x ∈ M.fundCircuit e B \ {e} := ⟨hxF, hxe⟩            rw [hFsdiff] at this            exact hxB this.2        have hssub : C' \ B ⊆ D \ B := hC'subB.trans Set.sdiff_subset        have hne2 : C' \ B ≠ D \ B := by          intro heq          have : e ∈ C' \ B := by            rw [heq]; exact ⟨heD, heB⟩          exact heC' this.1        have hstrict : C' \ B ⊂ D \ B := Set.ssubset_iff_subset_ne.mpr ⟨hssub, hne2⟩        have hfinlt : (C' \ B).ncard < (D \ B).ncard := Set.ncard_lt_ncard hstrict hDfin        have hlt : (C' \ B).ncard < n := lt_of_lt_of_le hfinlt hle        have hC'fin : (C' \ B).Finite := hDfin.subset hssub        have hC'res := ih (C' \ B).ncard hlt C' hC'circ hC'fin le_rfl        have hex : ∃ g ∈ C', g ∉ D := by          by_contra h          push Not at h          have hCD : C' ⊆ D := fun g hg => h g hg          have hEq : C' = D := hC'circ.eq_of_subset_isCircuit hD hCD          rw [hEq] at hne2          exact hne2 rfl        obtain ⟨g, hgC', hgD⟩ := hex        have hgF : g ∈ M.fundCircuit e B := by          have h := hC'sub hgC'          rcases h.1 with h' | h'          · exact absurd h' hgD          · exact h'        refine ⟨fun hFP => ?_, fun hFP => ?_⟩        · rcases hC'res with h | h          · exact h hfC'          · exact absurd (hFP hgF) (Set.disjoint_left.1 h hgC')        · rcases hC'res with h | h          · exact absurd (h hgC') (Set.disjoint_left.1 hFP hgF)          · exact Set.disjoint_left.1 h hfC'    rcases hmono e ⟨heE, heB⟩ with hFP | hFP    · left      exact fun f hf => (hclaim f hf).1 hFP    · right      exact Set.disjoint_left.2 fun f hf => (hclaim f hf).2 hFP  exact key (C \ B).ncard C hC hfin le_rfl
See it in the graphDiscuss this resultChallenge it