Theorem: Matroid.Base.compl_inter_basis_of_inter_basis
File: Mathlib/Data/Matroid/Dual.lean

tactic: refine Indep.basis_of_forall_insert ?_ inter_subset_right (fun e he ↦ ?_)
state_before: α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
⊢ M✶.Basis (M.E \ B ∩ (M.E \ X)) (M.E \ X)
state_after: case refine_1
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
⊢ M✶.Indep (M.E \ B ∩ (M.E \ X))

case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : e ∈ (M.E \ X) \ (M.E \ B ∩ (M.E \ X))
⊢ M✶.Dep (insert e (M.E \ B ∩ (M.E \ X)))

tactic: simp only [diff_inter_self_eq_diff, mem_diff, not_and, not_not, imp_iff_right he.1.1] at he
state_before: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : e ∈ (M.E \ X) \ (M.E \ B ∩ (M.E \ X))
⊢ M✶.Dep (insert e (M.E \ B ∩ (M.E \ X)))
state_after: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
⊢ M✶.Dep (insert e (M.E \ B ∩ (M.E \ X)))

tactic: simp_rw [dual_dep_iff_forall, insert_subset_iff, and_iff_right he.1.1,
  and_iff_left (inter_subset_left.trans diff_subset)]
state_before: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
⊢ M✶.Dep (insert e (M.E \ B ∩ (M.E \ X)))
state_after: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
⊢ ∀ (B_1 : Set α), M.Base B_1 → (insert e (M.E \ B ∩ (M.E \ X)) ∩ B_1).Nonempty

tactic: refine fun B' hB' ↦ by_contra (fun hem ↦ ?_)
state_before: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
⊢ ∀ (B_1 : Set α), M.Base B_1 → (insert e (M.E \ B ∩ (M.E \ X)) ∩ B_1).Nonempty
state_after: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : ¬(insert e (M.E \ B ∩ (M.E \ X)) ∩ B').Nonempty
⊢ False

tactic: rw [nonempty_iff_ne_empty, not_ne_iff, ← union_singleton, diff_inter_diff,
 union_inter_distrib_right, union_empty_iff, singleton_inter_eq_empty, diff_eq,
 inter_right_comm, inter_eq_self_of_subset_right hB'.subset_ground, ← diff_eq,
 diff_eq_empty] at hem
state_before: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : ¬(insert e (M.E \ B ∩ (M.E \ X)) ∩ B').Nonempty
⊢ False
state_after: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
⊢ False

tactic: obtain ⟨f, hfb, hBf⟩ := hB.exchange hB' ⟨he.2, hem.2⟩
state_before: case refine_2
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
⊢ False
state_after: case refine_2.intro.intro
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
⊢ False

tactic: have hi : M.Indep (insert f (B ∩ X)) := by
  refine hBf.indep.subset (insert_subset_insert ?_)
  simp_rw [subset_diff, and_iff_right inter_subset_left, disjoint_singleton_right,
    mem_inter_iff, iff_false_intro he.1.2, and_false, not_false_iff]
state_before: case refine_2.intro.intro
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
⊢ False
state_after: case refine_2.intro.intro
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
hi : M.Indep (insert f (B ∩ X))
⊢ False

tactic: exact hfb.2 (hBX.mem_of_insert_indep (Or.elim (hem.1 hfb.1) (False.elim ∘ hfb.2) id) hi).1
state_before: case refine_2.intro.intro
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
hi : M.Indep (insert f (B ∩ X))
⊢ False
state_after: no goals

tactic: rw [dual_indep_iff_exists]
state_before: case refine_1
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
⊢ M✶.Indep (M.E \ B ∩ (M.E \ X))
state_after: case refine_1
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
⊢ ∃ B_1, M.Base B_1 ∧ Disjoint (M.E \ B ∩ (M.E \ X)) B_1

tactic: exact ⟨B, hB, disjoint_of_subset_left inter_subset_left disjoint_sdiff_left⟩
state_before: case refine_1
α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
⊢ ∃ B_1, M.Base B_1 ∧ Disjoint (M.E \ B ∩ (M.E \ X)) B_1
state_after: no goals

tactic: refine hBf.indep.subset (insert_subset_insert ?_)
state_before: α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
⊢ M.Indep (insert f (B ∩ X))
state_after: α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
⊢ B ∩ X ⊆ B \ {e}

tactic: simp_rw [subset_diff, and_iff_right inter_subset_left, disjoint_singleton_right,
  mem_inter_iff, iff_false_intro he.1.2, and_false, not_false_iff]
state_before: α : Type u_1
M : Matroid α
I B X : Set α
hB : M.Base B
hBX : M.Basis (B ∩ X) X
e : α
he : (e ∈ M.E ∧ e ∉ X) ∧ e ∈ B
B' : Set α
hB' : M.Base B'
hem : B' ⊆ B ∪ X ∧ e ∉ B'
f : α
hfb : f ∈ B' \ B
hBf : M.Base (insert f (B \ {e}))
⊢ B ∩ X ⊆ B \ {e}
state_after: no goals