Theorem: Matroid.ExchangeProperty.encard_diff_le_aux
File: Mathlib/Data/Matroid/Basic.lean

Proof steps:
state_before: α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inl
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
he : B₂ \ B₁ = ∅
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard

case inr.inl
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
hinf : (B₂ \ B₁).encard = ⊤
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard

case inr.inr.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
tactic: obtain (he | hinf | ⟨e, he, hcard⟩) :=
    (B₂ \ B₁).eq_empty_or_encard_eq_top_or_encard_diff_singleton_lt
state_before: case inr.inr.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
tactic: obtain ⟨f, hf, hB'⟩ := exch B₂ B₁ hB₂ hB₁ e he
state_before: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
tactic: have : encard (insert f (B₂ \ {e}) \ B₁) < encard (B₂ \ B₁) := by
    rw [insert_diff_of_mem _ hf.1, diff_diff_comm]; exact hcard
state_before: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : (B₁ \ insert f (B₂ \ {e})).encard ≤ (insert f (B₂ \ {e}) \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
tactic: have hencard := encard_diff_le_aux exch hB₁ hB'
state_before: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : (B₁ \ insert f (B₂ \ {e})).encard ≤ (insert f (B₂ \ {e}) \ B₁).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : ((B₁ \ B₂) \ {f}).encard ≤ ((B₂ \ B₁) \ {e}).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
tactic: rw [insert_diff_of_mem _ hf.1, diff_diff_comm, ← union_singleton, ← diff_diff, diff_diff_right,
    inter_singleton_eq_empty.mpr he.2, union_empty] at hencard
state_before: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : ((B₁ \ B₂) \ {f}).encard ≤ ((B₂ \ B₁) \ {e}).encard
⊢ (B₁ \ B₂).encard ≤ (B₂ \ B₁).encard
state_after: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : ((B₁ \ B₂) \ {f}).encard ≤ ((B₂ \ B₁) \ {e}).encard
⊢ ((B₁ \ B₂) \ {f}).encard + 1 ≤ ((B₂ \ B₁) \ {e}).encard + 1
tactic: rw [← encard_diff_singleton_add_one he, ← encard_diff_singleton_add_one hf]
state_before: case inr.inr.intro.intro.intro.intro
α : Type u_1
M : Matroid α
Base : Set α → Prop
exch✝ : ExchangeProperty Base
B B' B₁ B₂ : Set α
exch : ExchangeProperty Base
hB₁ : Base B₁
hB₂ : Base B₂
e : α
he : e ∈ B₂ \ B₁
hcard : ((B₂ \ B₁) \ {e}).encard < (B₂ \ B₁).encard
f : α
hf : f ∈ B₁ \ B₂
hB' : Base (insert f (B₂ \ {e}))
this : (insert f (B₂ \ {e}) \ B₁).encard < (B₂ \ B₁).encard
hencard : ((B₁ \ B₂) \ {f}).encard ≤ ((B₂ \ B₁) \ {e}).encard
⊢ ((B₁ \ B₂) \ {f}).encard + 1 ≤ ((B₂ \ B₁) \ {e}).encard + 1
state_after: no goals
tactic: exact add_le_add_right hencard 1