matroid_indep_sdiff_insert_iff_fund_circuit
For any matroid M, base B, element e ∉ B in the ground set, and subset A ⊆ B, the set insert e (B \ A) is independent if and only if the fundamental circuit M.fundCircuit e B meets A. This enables testing fundamental-graph cut connectivity in 1 query.
Statement
theorem matroid_indep_sdiff_insert_iff_fund_circuit {α : Type*} (M : Matroid α) {B : Set α} (hB : M.IsBase B) {e : α} (heE : e ∈ M.E) (heB : e ∉ B) {A : Set α} (hA : A ⊆ B) : M.Indep (insert e (B \ A)) ↔ (M.fundCircuit e B ∩ A).Nonempty
- Source
- step towards matroid_connectedness_query_linear
- Verified
- 24 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- OrderAn order of dimension d is a permutation of the attribute set {0, ..., d-1}, represented as a list without duplicates containing all…
The proof, explained
The equivalence is proved in both directions by contradiction. In the forward direction, if the fundamental circuit C(e, B) were disjoint from A, it would be contained in {e} ∪ (B \ A) (since e ∉ A), forcing the circuit to be independent—a contradiction. In the reverse direction, if {e} ∪ (B \ A) were dependent, it would contain a circuit, which must be C(e, B) because C(e, B) is the unique circuit inside {e} ∪ B; but {e} ∪ (B \ A) is disjoint from A, contradicting that C(e, B) intersects A.
The element e is not in A, and the goal reduces to proving both directions of the equivalence.
Since A ⊆ B and e ∉ B, the element e cannot belong to A. The constructor tactic then splits the iff statement into its forward (mp) and reverse (mpr) directions.
have heA : e ∉ A := fun h => heB (hA h) constructor
Assuming {e} ∪ (B \ A) is independent, we suppose for contradiction that the fundamental circuit M.fundCircuit e B is disjoint from A.
We assume {e} ∪ (B \ A) is independent and suppose for contradiction that the fundamental circuit does not meet A. A set not being nonempty means it is empty, so the intersection of M.fundCircuit e B and A is empty, which means they are disjoint.
uses
Set.not_nonempty_iff_eq_empty.mp,Set.disjoint_iff_inter_eq_empty.mpr· intro hindep by_contra hdisj have h_empty : M.fundCircuit e B ∩ A = ∅ := Set.not_nonempty_iff_eq_empty.mp hdisj have hd : Disjoint (M.fundCircuit e B) A := Set.disjoint_iff_inter_eq_empty.mpr h_empty
The fundamental circuit M.fundCircuit e B is a subset of {e} ∪ (B \ A).
The fundamental circuit is contained in {e} ∪ B. Because it is disjoint from A, it is contained in ({e} ∪ B) \ A. Since e ∉ A, subtracting A distributes over inserting e, so ({e} ∪ B) \ A = {e} ∪ (B \ A).
uses
Disjoint.le_sdiff_of_le_left,Set.insert_sdiff_of_notMemhave hsub : M.fundCircuit e B ⊆ insert e B \ A := Disjoint.le_sdiff_of_le_left hd (M.fundCircuit_subset_insert e B) rw [Set.insert_sdiff_of_notMem B heA] at hsub
The fundamental circuit would be independent, contradicting that it is a circuit.
Because M.fundCircuit e B is a subset of the independent set {e} ∪ (B \ A), it must be independent. But by definition of the fundamental circuit of an element outside a base, M.fundCircuit e B is a circuit, and circuits are never independent. This contradiction completes the forward direction.
have hcirc_indep : M.Indep (M.fundCircuit e B) := hindep.subset hsub exact (hB.fundCircuit_isCircuit heE heB).not_indep hcirc_indep
Assuming the fundamental circuit meets A, we suppose for contradiction that {e} ∪ (B \ A) is dependent.
We assume (M.fundCircuit e B ∩ A).Nonempty and suppose for contradiction that {e} ∪ (B \ A) is not independent. Since e ∈ M.E and B ⊆ M.E, {e} ∪ (B \ A) is a subset of the matroid's ground set. In a matroid, any subset of the ground set that is not independent is dependent.
uses
Set.insert_subset,Set.sdiff_subset· intro hmeet by_contra hnot have hsub_ground : insert e (B \ A) ⊆ M.E := Set.insert_subset heE (Set.sdiff_subset.trans hB.subset_ground) have hdep : M.Dep (insert e (B \ A)) := M.dep_of_not_indep hnot hsub_ground
The dependent set contains a circuit C, which must be the fundamental circuit M.fundCircuit e B.
Every dependent set contains a circuit C ⊆ {e} ∪ (B \ A). Since B \ A ⊆ B, we have C ⊆ {e} ∪ B. Because B is an independent set (being a base), M.fundCircuit e B is the unique circuit contained in {e} ∪ B, forcing C = M.fundCircuit e B.
uses
Set.insert_subset_insert,Set.sdiff_subsetobtain ⟨C, hCsub, hC⟩ := hdep.exists_isCircuit_subset have hCB : C ⊆ insert e B := hCsub.trans (Set.insert_subset_insert Set.sdiff_subset) have hC_eq : C = M.fundCircuit e B := hC.eq_fundCircuit_of_subset hB.indep hCB
The fundamental circuit M.fundCircuit e B is disjoint from A.
The set {e} ∪ (B \ A) is disjoint from A because e ∉ A and B \ A is disjoint from A. Since C ⊆ {e} ∪ (B \ A), the circuit C is also disjoint from A. Since C = M.fundCircuit e B, the fundamental circuit is disjoint from A.
uses
Set.disjoint_insert_left,Set.disjoint_sdiff_lefthave hdisj_insert : Disjoint (insert e (B \ A)) A := by rw [Set.disjoint_insert_left] exact ⟨heA, Set.disjoint_sdiff_left⟩ have hdisj_C : Disjoint C A := hdisj_insert.mono_left hCsub rw [hC_eq] at hdisj_C
The fundamental circuit meeting A contradicts their disjointness, completing the reverse direction.
By assumption, M.fundCircuit e B ∩ A is nonempty, so there exists an element x belonging to both M.fundCircuit e B and A. But this directly contradicts that M.fundCircuit e B and A are disjoint.
obtain ⟨x, hxC, hxA⟩ := hmeet exact (Set.disjoint_left.1 hdisj_C) hxC hxA
Set.disjoint_iff_inter_eq_empty.mpr- A set is disjoint from another if and only if their intersection is empty.
Set.disjoint_insert_left- An inserted set {a} ∪ s is disjoint from t if and only if a ∉ t and s is disjoint from t.
Set.disjoint_sdiff_left- The set difference t \ s is disjoint from s.
Set.insert_sdiff_of_notMem- If an element is not in t, subtracting t distributes over inserting that element: ({a} ∪ s) \ t = {a} ∪ (s \ t).
Set.insert_subset- If a ∈ t and s ⊆ t, then {a} ∪ s ⊆ t.
Set.insert_subset_insert- If s ⊆ t, then {a} ∪ s ⊆ {a} ∪ t.
Set.not_nonempty_iff_eq_empty.mp- A set is not nonempty if and only if it is empty.
Set.sdiff_subset- The set difference s \ t is a subset of s.
Disjoint.le_sdiff_of_le_left- If a is disjoint from c and a ≤ b, then a ≤ b \ c.
- In Mathlib's formalization, a matroid is defined over an ambient type α with an explicit ground set E : Set α. Subsets are not automatically subsets of the ground set, so showing insert e (B \ A) ⊆ M.E is a necessary formal check before concluding that non-independence implies dependence (M.Dep).
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- For a base B, element e not in B, and subset A ⊆ B, insert e (B \ A) is independent iff the fundamental circuit of e meets A. -/theorem matroid_indep_sdiff_insert_iff_fund_circuit {α : Type*} (M : Matroid α) {B : Set α} (hB : M.IsBase B) {e : α} (heE : e ∈ M.E) (heB : e ∉ B) {A : Set α} (hA : A ⊆ B) : M.Indep (insert e (B \ A)) ↔ (M.fundCircuit e B ∩ A).Nonempty := by have heA : e ∉ A := fun h => heB (hA h) constructor · intro hindep by_contra hdisj have h_empty : M.fundCircuit e B ∩ A = ∅ := Set.not_nonempty_iff_eq_empty.mp hdisj have hd : Disjoint (M.fundCircuit e B) A := Set.disjoint_iff_inter_eq_empty.mpr h_empty have hsub : M.fundCircuit e B ⊆ insert e B \ A := Disjoint.le_sdiff_of_le_left hd (M.fundCircuit_subset_insert e B) rw [Set.insert_sdiff_of_notMem B heA] at hsub have hcirc_indep : M.Indep (M.fundCircuit e B) := hindep.subset hsub exact (hB.fundCircuit_isCircuit heE heB).not_indep hcirc_indep · intro hmeet by_contra hnot have hsub_ground : insert e (B \ A) ⊆ M.E := Set.insert_subset heE (Set.sdiff_subset.trans hB.subset_ground) have hdep : M.Dep (insert e (B \ A)) := M.dep_of_not_indep hnot hsub_ground obtain ⟨C, hCsub, hC⟩ := hdep.exists_isCircuit_subset have hCB : C ⊆ insert e B := hCsub.trans (Set.insert_subset_insert Set.sdiff_subset) have hC_eq : C = M.fundCircuit e B := hC.eq_fundCircuit_of_subset hB.indep hCB have hdisj_insert : Disjoint (insert e (B \ A)) A := by rw [Set.disjoint_insert_left] exact ⟨heA, Set.disjoint_sdiff_left⟩ have hdisj_C : Disjoint C A := hdisj_insert.mono_left hCsub rw [hC_eq] at hdisj_C obtain ⟨x, hxC, hxA⟩ := hmeet exact (Set.disjoint_left.1 hdisj_C) hxC hxA