l3lab/ntp-mathlib huggingface dataset:
theorem disjoint_or_nonempty_inter (s t : Finset α) : Disjoint s t ∨ (s ∩ t).Nonempty := by
  rw [← not_disjoint_iff_nonempty_inter]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ s₁ s₂ t✝ t₁ t₂ u v : Finset α
a b : α
s t : Finset α
⊢ _root_.Disjoint s t ∨ ¬_root_.Disjoint s t

Next tactic:
exact em _
instance isDirected_le : IsDirected (Finset α) (· ≤ ·) := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ IsDirected (Finset α) fun x x_1 => x ≤ x_1

Next tactic:
classical infer_instance
instance isDirected_le : IsDirected (Finset α) (· ≤ ·) := by classical 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
⊢ IsDirected (Finset α) fun x x_1 => x ≤ x_1

Next tactic:
infer_instance
@[simp]
theorem erase_singleton (a : α) : ({a} : Finset α).erase a = ∅ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a✝ b a : α
⊢ erase {a} a = ∅

Next tactic:
ext x
@[simp]
theorem erase_singleton (a : α) : ({a} : Finset α).erase a = ∅ := by
  ext x
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a✝ b a x : α
⊢ x ∈ erase {a} a ↔ x ∈ ∅

Next tactic:
simp
theorem mem_erase_of_ne_of_mem : a ≠ b → a ∈ s → a ∈ erase s b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
⊢ a ≠ b → a ∈ s → a ∈ erase s b

Next tactic:
simp only [mem_erase]
theorem mem_erase_of_ne_of_mem : a ≠ b → a ∈ s → a ∈ erase s b := by
  simp only [mem_erase]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
⊢ a ≠ b → a ∈ s → a ≠ b ∧ a ∈ s

Next tactic:
exact And.intro
/-- An element of `s` that is not an element of `erase s a` must be`a`. -/
theorem eq_of_mem_of_not_mem_erase (hs : b ∈ s) (hsa : b ∉ s.erase a) : b = a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
hs : b ∈ s
hsa : b ∉ erase s a
⊢ b = a

Next tactic:
rw [mem_erase, not_and] at hsa
/-- An element of `s` that is not an element of `erase s a` must be`a`. -/
theorem eq_of_mem_of_not_mem_erase (hs : b ∈ s) (hsa : b ∉ s.erase a) : b = a := by
  rw [mem_erase, not_and] at hsa
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
hs : b ∈ s
hsa : b ≠ a → b ∉ s
⊢ b = a

Next tactic:
exact not_imp_not.mp hsa hs
@[simp]
theorem erase_insert_eq_erase (s : Finset α) (a : α) : (insert a s).erase a = s.erase a :=
  ext fun x => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b : α
s : Finset α
a x : α
⊢ x ∈ erase (insert a s) a ↔ x ∈ erase s a

Next tactic:
simp (config := { contextual := true }) only [mem_erase, mem_insert, and_congr_right_iff,
      false_or_iff, iff_self_iff, imp_true_iff]
theorem erase_insert {a : α} {s : Finset α} (h : a ∉ s) : erase (insert a s) a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b a : α
s : Finset α
h : a ∉ s
⊢ erase (insert a s) a = s

Next tactic:
rw [erase_insert_eq_erase, erase_eq_of_not_mem h]
theorem erase_insert_of_ne {a b : α} {s : Finset α} (h : a ≠ b) :
    erase (insert a s) b = insert a (erase s b) :=
  ext fun x => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
h : a ≠ b
x : α
⊢ x ∈ erase (insert a s) b ↔ x ∈ insert a (erase s b)

Next tactic:
have : x ≠ b ∧ x = a ↔ x = a := and_iff_right_of_imp fun hx => hx.symm ▸ h
theorem erase_insert_of_ne {a b : α} {s : Finset α} (h : a ≠ b) :
    erase (insert a s) b = insert a (erase s b) :=
  ext fun x => by
    have : x ≠ b ∧ x = a ↔ x = a := and_iff_right_of_imp fun hx => hx.symm ▸ h
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
h : a ≠ b
x : α
this : x ≠ b ∧ x = a ↔ x = a
⊢ x ∈ erase (insert a s) b ↔ x ∈ insert a (erase s b)

Next tactic:
simp only [mem_erase, mem_insert, and_or_left, this]
theorem erase_cons_of_ne {a b : α} {s : Finset α} (ha : a ∉ s) (hb : a ≠ b) :
    erase (cons a s ha) b = cons a (erase s b) fun h => ha <| erase_subset _ _ h := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
ha : a ∉ s
hb : a ≠ b
⊢ erase (cons a s ha) b = cons a (erase s b) (_ : a ∈ erase s b → False)

Next tactic:
simp only [cons_eq_insert, erase_insert_of_ne hb]
@[simp] theorem insert_erase (h : a ∈ s) : insert a (erase s a) = s :=
  ext fun x => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∈ s
x : α
⊢ x ∈ insert a (erase s a) ↔ x ∈ s

Next tactic:
simp only [mem_insert, mem_erase, or_and_left, dec_em, true_and_iff]
@[simp] theorem insert_erase (h : a ∈ s) : insert a (erase s a) = s :=
  ext fun x => by
    simp only [mem_insert, mem_erase, or_and_left, dec_em, true_and_iff]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∈ s
x : α
⊢ x = a ∨ x ∈ s ↔ x ∈ s

Next tactic:
apply or_iff_right_of_imp
@[simp] theorem insert_erase (h : a ∈ s) : insert a (erase s a) = s :=
  ext fun x => by
    simp only [mem_insert, mem_erase, or_and_left, dec_em, true_and_iff]
    apply or_iff_right_of_imp
    

Proof state:
case ha
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∈ s
x : α
⊢ x = a → x ∈ s

Next tactic:
rintro rfl
@[simp] theorem insert_erase (h : a ∈ s) : insert a (erase s a) = s :=
  ext fun x => by
    simp only [mem_insert, mem_erase, or_and_left, dec_em, true_and_iff]
    apply or_iff_right_of_imp
    rintro rfl
    

Proof state:
case ha
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
b x : α
h : x ∈ s
⊢ x ∈ s

Next tactic:
exact h
lemma erase_eq_iff_eq_insert (hs : a ∈ s) (ht : a ∉ t) : erase s a = t ↔ s = insert a t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
hs : a ∈ s
ht : a ∉ t
⊢ erase s a = t ↔ s = insert a t

Next tactic:
aesop
@[simp, norm_cast]
theorem coe_erase (a : α) (s : Finset α) : ↑(erase s a) = (s \ {a} : Set α) :=
  Set.ext fun _ => mem_erase.trans <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b a : α
s : Finset α
x✝ : α
⊢ x✝ ≠ a ∧ x✝ ∈ s ↔ x✝ ∈ ↑s \ {a}

Next tactic:
rw [and_comm, Set.mem_diff, Set.mem_singleton_iff, mem_coe]
theorem ssubset_iff_exists_subset_erase {s t : Finset α} : s ⊂ t ↔ ∃ a ∈ t, s ⊆ t.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a b : α
s t : Finset α
⊢ s ⊂ t ↔ ∃ a ∈ t, s ⊆ erase t a

Next tactic:
refine' ⟨fun h => _, fun ⟨a, ha, h⟩ => ssubset_of_subset_of_ssubset h <| erase_ssubset ha⟩
theorem ssubset_iff_exists_subset_erase {s t : Finset α} : s ⊂ t ↔ ∃ a ∈ t, s ⊆ t.erase a := by
  refine' ⟨fun h => _, fun ⟨a, ha, h⟩ => ssubset_of_subset_of_ssubset h <| erase_ssubset ha⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a b : α
s t : Finset α
h : s ⊂ t
⊢ ∃ a ∈ t, s ⊆ erase t a

Next tactic:
obtain ⟨a, ht, hs⟩ := not_subset.1 h.2
theorem ssubset_iff_exists_subset_erase {s t : Finset α} : s ⊂ t ↔ ∃ a ∈ t, s ⊆ t.erase a := by
  refine' ⟨fun h => _, fun ⟨a, ha, h⟩ => ssubset_of_subset_of_ssubset h <| erase_ssubset ha⟩
  obtain ⟨a, ht, hs⟩ := not_subset.1 h.2
  

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
h : s ⊂ t
a : α
ht : a ∈ t
hs : a ∉ s
⊢ ∃ a ∈ t, s ⊆ erase t a

Next tactic:
exact ⟨a, ht, subset_erase.2 ⟨h.1, hs⟩⟩
theorem erase_cons {s : Finset α} {a : α} (h : a ∉ s) : (s.cons a h).erase a = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b : α
s : Finset α
a : α
h : a ∉ s
⊢ erase (cons a s h) a = s

Next tactic:
rw [cons_eq_insert, erase_insert_eq_erase, erase_eq_of_not_mem h]
theorem erase_idem {a : α} {s : Finset α} : erase (erase s a) a = erase s a := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b a : α
s : Finset α
⊢ erase (erase s a) a = erase s a

Next tactic:
simp
theorem erase_right_comm {a b : α} {s : Finset α} : erase (erase s a) b = erase (erase s b) a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
⊢ erase (erase s a) b = erase (erase s b) a

Next tactic:
ext x
theorem erase_right_comm {a b : α} {s : Finset α} : erase (erase s a) b = erase (erase s b) a := by
  ext x
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
x : α
⊢ x ∈ erase (erase s a) b ↔ x ∈ erase (erase s b) a

Next tactic:
simp only [mem_erase, ← and_assoc]
theorem erase_right_comm {a b : α} {s : Finset α} : erase (erase s a) b = erase (erase s b) a := by
  ext x
  simp only [mem_erase, ← and_assoc]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b✝ a b : α
s : Finset α
x : α
⊢ (x ≠ b ∧ x ≠ a) ∧ x ∈ s ↔ (x ≠ a ∧ x ≠ b) ∧ x ∈ s

Next tactic:
rw [@and_comm (x ≠ a)]
theorem subset_insert_iff {a : α} {s t : Finset α} : s ⊆ insert a t ↔ erase s a ⊆ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b a : α
s t : Finset α
⊢ s ⊆ insert a t ↔ erase s a ⊆ t

Next tactic:
simp only [subset_iff, or_iff_not_imp_left, mem_erase, mem_insert, and_imp]
theorem subset_insert_iff {a : α} {s t : Finset α} : s ⊆ insert a t ↔ erase s a ⊆ t := by
  simp only [subset_iff, or_iff_not_imp_left, mem_erase, mem_insert, and_imp]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b a : α
s t : Finset α
⊢ (∀ ⦃x : α⦄, x ∈ s → ¬x = a → x ∈ t) ↔ ∀ ⦃x : α⦄, x ≠ a → x ∈ s → x ∈ t

Next tactic:
exact forall_congr' fun x => forall_swap
theorem subset_insert_iff_of_not_mem (h : a ∉ s) : s ⊆ insert a t ↔ s ⊆ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∉ s
⊢ s ⊆ insert a t ↔ s ⊆ t

Next tactic:
rw [subset_insert_iff, erase_eq_of_not_mem h]
theorem erase_subset_iff_of_mem (h : a ∈ t) : s.erase a ⊆ t ↔ s ⊆ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∈ t
⊢ erase s a ⊆ t ↔ s ⊆ t

Next tactic:
rw [← subset_insert_iff, insert_eq_of_mem h]
theorem erase_inj {x y : α} (s : Finset α) (hx : x ∈ s) : s.erase x = s.erase y ↔ x = y := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b x y : α
s : Finset α
hx : x ∈ s
⊢ erase s x = erase s y ↔ x = y

Next tactic:
refine ⟨fun h => eq_of_mem_of_not_mem_erase hx ?_, congr_arg _⟩
theorem erase_inj {x y : α} (s : Finset α) (hx : x ∈ s) : s.erase x = s.erase y ↔ x = y := by
  refine ⟨fun h => eq_of_mem_of_not_mem_erase hx ?_, congr_arg _⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b x y : α
s : Finset α
hx : x ∈ s
h : erase s x = erase s y
⊢ x ∉ erase s y

Next tactic:
rw [← h]
theorem erase_inj {x y : α} (s : Finset α) (hx : x ∈ s) : s.erase x = s.erase y ↔ x = y := by
  refine ⟨fun h => eq_of_mem_of_not_mem_erase hx ?_, congr_arg _⟩
  rw [← h]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b x y : α
s : Finset α
hx : x ∈ s
h : erase s x = erase s y
⊢ x ∉ erase s x

Next tactic:
simp
theorem erase_injOn' (a : α) : { s : Finset α | a ∈ s }.InjOn fun s => erase s a :=
  fun s hs t ht (h : s.erase a = _) => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b a : α
s : Finset α
hs : s ∈ {s | a ∈ s}
t : Finset α
ht : t ∈ {s | a ∈ s}
h : erase s a = (fun s => erase s a) t
⊢ s = t

Next tactic:
rw [← insert_erase hs, ← insert_erase ht, h]
@[simp]
theorem inter_sdiff_self (s₁ s₂ : Finset α) : s₁ ∩ (s₂ \ s₁) = ∅ :=
  eq_empty_of_forall_not_mem <| by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
s₁ s₂ : Finset α
⊢ ∀ (x : α), x ∉ s₁ ∩ (s₂ \ s₁)

Next tactic:
simp only [mem_inter, mem_sdiff]
@[simp]
theorem inter_sdiff_self (s₁ s₂ : Finset α) : s₁ ∩ (s₂ \ s₁) = ∅ :=
  eq_empty_of_forall_not_mem <| by
    simp only [mem_inter, mem_sdiff]; 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
s₁ s₂ : Finset α
⊢ ∀ (x : α), ¬(x ∈ s₁ ∧ x ∈ s₂ ∧ x ∉ s₁)

Next tactic:
rintro x ⟨h, _, hn⟩
@[simp]
theorem inter_sdiff_self (s₁ s₂ : Finset α) : s₁ ∩ (s₂ \ s₁) = ∅ :=
  eq_empty_of_forall_not_mem <| by
    simp only [mem_inter, mem_sdiff]; rintro x ⟨h, _, hn⟩; 

Proof state:
case intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
s₁ s₂ : Finset α
x : α
h : x ∈ s₁
left✝ : x ∈ s₂
hn : x ∉ s₁
⊢ False

Next tactic:
exact hn h
instance : GeneralizedBooleanAlgebra (Finset α) :=
  { sup_inf_sdiff := fun x y => by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
x y : Finset α
⊢ x ⊓ y ⊔ x \ y = x

Next tactic:
simp only [ext_iff, mem_union, mem_sdiff, inf_eq_inter, sup_eq_union, mem_inter,
        ← and_or_left, em, and_true, implies_true]
instance : GeneralizedBooleanAlgebra (Finset α) :=
  { sup_inf_sdiff := fun x y => by
      simp only [ext_iff, mem_union, mem_sdiff, inf_eq_inter, sup_eq_union, mem_inter,
        ← and_or_left, em, and_true, implies_true]
    inf_inf_sdiff := fun x y => by
      

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
x y : Finset α
⊢ x ⊓ y ⊓ x \ y = ⊥

Next tactic:
simp only [ext_iff, inter_sdiff_self, inter_empty, inter_assoc, false_iff_iff, inf_eq_inter,
        not_mem_empty, bot_eq_empty, not_false_iff, implies_true]
theorem not_mem_sdiff_of_mem_right (h : a ∈ t) : a ∉ s \ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∈ t
⊢ a ∉ s \ t

Next tactic:
simp only [mem_sdiff, h, not_true, not_false_iff, and_false_iff]
theorem not_mem_sdiff_of_not_mem_left (h : a ∉ s) : a ∉ s \ t := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
h : a ∉ s
⊢ a ∉ s \ t

Next tactic:
simp [h]
theorem inter_sdiff (s t u : Finset α) : s ∩ (t \ u) = (s ∩ t) \ u := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u✝ v : Finset α
a b : α
s t u : Finset α
⊢ s ∩ (t \ u) = (s ∩ t) \ u

Next tactic:
ext x
theorem inter_sdiff (s t u : Finset α) : s ∩ (t \ u) = (s ∩ t) \ u := by
  ext x
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u✝ v : Finset α
a b : α
s t u : Finset α
x : α
⊢ x ∈ s ∩ (t \ u) ↔ x ∈ (s ∩ t) \ u

Next tactic:
simp [and_assoc]
theorem union_sdiff_symm : s ∪ t \ s = t ∪ s \ t := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
⊢ s ∪ t \ s = t ∪ s \ t

Next tactic:
simp [union_comm]
theorem insert_sdiff_of_not_mem (s : Finset α) {t : Finset α} {x : α} (h : x ∉ t) :
    insert x s \ t = insert x (s \ t) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a b : α
s t : Finset α
x : α
h : x ∉ t
⊢ insert x s \ t = insert x (s \ t)

Next tactic:
rw [← coe_inj, coe_insert, coe_sdiff, coe_sdiff, coe_insert]
theorem insert_sdiff_of_not_mem (s : Finset α) {t : Finset α} {x : α} (h : x ∉ t) :
    insert x s \ t = insert x (s \ t) := by
  rw [← coe_inj, coe_insert, coe_sdiff, coe_sdiff, coe_insert]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a b : α
s t : Finset α
x : α
h : x ∉ t
⊢ insert x ↑s \ ↑t = insert x (↑s \ ↑t)

Next tactic:
exact Set.insert_diff_of_not_mem _ h
theorem insert_sdiff_of_mem (s : Finset α) {x : α} (h : x ∈ t) : insert x s \ t = s \ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b : α
s : Finset α
x : α
h : x ∈ t
⊢ insert x s \ t = s \ t

Next tactic:
rw [← coe_inj, coe_sdiff, coe_sdiff, coe_insert]
theorem insert_sdiff_of_mem (s : Finset α) {x : α} (h : x ∈ t) : insert x s \ t = s \ t := by
  rw [← coe_inj, coe_sdiff, coe_sdiff, coe_insert]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b : α
s : Finset α
x : α
h : x ∈ t
⊢ insert x ↑s \ ↑t = ↑s \ ↑t

Next tactic:
exact Set.insert_diff_of_mem _ h
@[simp] lemma insert_sdiff_cancel (ha : a ∉ s) : insert a s \ s = {a} := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ s
⊢ insert a s \ s = {a}

Next tactic:
rw [insert_sdiff_of_not_mem _ ha, Finset.sdiff_self, insert_emptyc_eq]
theorem sdiff_insert_of_not_mem {x : α} (h : x ∉ s) (t : Finset α) : s \ insert x t = s \ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t✝ u v : Finset α
a b x : α
h : x ∉ s
t : Finset α
⊢ s \ insert x t = s \ t

Next tactic:
refine' Subset.antisymm (sdiff_subset_sdiff (Subset.refl _) (subset_insert _ _)) fun y hy => _
theorem sdiff_insert_of_not_mem {x : α} (h : x ∉ s) (t : Finset α) : s \ insert x t = s \ t := by
  refine' Subset.antisymm (sdiff_subset_sdiff (Subset.refl _) (subset_insert _ _)) fun y hy => _
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t✝ u v : Finset α
a b x : α
h : x ∉ s
t : Finset α
y : α
hy : y ∈ s \ t
⊢ y ∈ s \ insert x t

Next tactic:
simp only [mem_sdiff, mem_insert, not_or] at hy ⊢
theorem sdiff_insert_of_not_mem {x : α} (h : x ∉ s) (t : Finset α) : s \ insert x t = s \ t := by
  refine' Subset.antisymm (sdiff_subset_sdiff (Subset.refl _) (subset_insert _ _)) fun y hy => _
  simp only [mem_sdiff, mem_insert, not_or] at hy ⊢
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t✝ u v : Finset α
a b x : α
h : x ∉ s
t : Finset α
y : α
hy : y ∈ s ∧ y ∉ t
⊢ y ∈ s ∧ ¬y = x ∧ y ∉ t

Next tactic:
exact ⟨hy.1, fun hxy => h <| hxy ▸ hy.1, hy.2⟩
theorem sdiff_singleton_eq_erase (a : α) (s : Finset α) : s \ singleton a = erase s a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝ b a : α
s : Finset α
⊢ s \ {a} = erase s a

Next tactic:
ext
theorem sdiff_singleton_eq_erase (a : α) (s : Finset α) : s \ singleton a = erase s a := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a✝¹ b a : α
s : Finset α
a✝ : α
⊢ a✝ ∈ s \ {a} ↔ a✝ ∈ erase s a

Next tactic:
rw [mem_erase, mem_sdiff, mem_singleton, and_comm]
theorem disjoint_erase_comm : Disjoint (s.erase a) t ↔ Disjoint s (t.erase a) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
⊢ _root_.Disjoint (erase s a) t ↔ _root_.Disjoint s (erase t a)

Next tactic:
simp_rw [erase_eq, disjoint_sdiff_comm]
theorem disjoint_of_erase_left (ha : a ∉ t) (hst : Disjoint (s.erase a) t) : Disjoint s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ t
hst : _root_.Disjoint (erase s a) t
⊢ _root_.Disjoint s t

Next tactic:
rw [← erase_insert ha, ← disjoint_erase_comm, disjoint_insert_right]
theorem disjoint_of_erase_left (ha : a ∉ t) (hst : Disjoint (s.erase a) t) : Disjoint s t := by
  rw [← erase_insert ha, ← disjoint_erase_comm, disjoint_insert_right]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ t
hst : _root_.Disjoint (erase s a) t
⊢ a ∉ erase s a ∧ _root_.Disjoint (erase s a) t

Next tactic:
exact ⟨not_mem_erase _ _, hst⟩
theorem disjoint_of_erase_right (ha : a ∉ s) (hst : Disjoint s (t.erase a)) : Disjoint s t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ s
hst : _root_.Disjoint s (erase t a)
⊢ _root_.Disjoint s t

Next tactic:
rw [← erase_insert ha, disjoint_erase_comm, disjoint_insert_left]
theorem disjoint_of_erase_right (ha : a ∉ s) (hst : Disjoint s (t.erase a)) : Disjoint s t := by
  rw [← erase_insert ha, disjoint_erase_comm, disjoint_insert_left]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ s
hst : _root_.Disjoint s (erase t a)
⊢ a ∉ erase t a ∧ _root_.Disjoint s (erase t a)

Next tactic:
exact ⟨not_mem_erase _ _, hst⟩
theorem inter_erase (a : α) (s t : Finset α) : s ∩ t.erase a = (s ∩ t).erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b a : α
s t : Finset α
⊢ s ∩ erase t a = erase (s ∩ t) a

Next tactic:
simp only [erase_eq, inter_sdiff]
@[simp]
theorem erase_inter (a : α) (s t : Finset α) : s.erase a ∩ t = (s ∩ t).erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b a : α
s t : Finset α
⊢ erase s a ∩ t = erase (s ∩ t) a

Next tactic:
simpa only [inter_comm t] using inter_erase a t s
theorem erase_sdiff_comm (s t : Finset α) (a : α) : s.erase a \ t = (s \ t).erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ erase s a \ t = erase (s \ t) a

Next tactic:
simp_rw [erase_eq, sdiff_right_comm]
theorem insert_union_comm (s t : Finset α) (a : α) : insert a s ∪ t = s ∪ insert a t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ insert a s ∪ t = s ∪ insert a t

Next tactic:
rw [insert_union, union_insert]
theorem erase_inter_comm (s t : Finset α) (a : α) : s.erase a ∩ t = s ∩ t.erase a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ erase s a ∩ t = s ∩ erase t a

Next tactic:
rw [erase_inter, inter_erase]
theorem erase_union_distrib (s t : Finset α) (a : α) : (s ∪ t).erase a = s.erase a ∪ t.erase a :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ erase (s ∪ t) a = erase s a ∪ erase t a

Next tactic:
simp_rw [erase_eq, union_sdiff_distrib]
theorem insert_inter_distrib (s t : Finset α) (a : α) :
    insert a (s ∩ t) = insert a s ∩ insert a t := by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ insert a (s ∩ t) = insert a s ∩ insert a t

Next tactic:
simp_rw [insert_eq, union_distrib_left]
theorem erase_sdiff_distrib (s t : Finset α) (a : α) : (s \ t).erase a = s.erase a \ t.erase a :=
  by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t✝ u v : Finset α
a✝ b : α
s t : Finset α
a : α
⊢ erase (s \ t) a = erase s a \ erase t a

Next tactic:
simp_rw [erase_eq, sdiff_sdiff, sup_sdiff_eq_sup le_rfl, sup_comm]
theorem erase_union_of_mem (ha : a ∈ t) (s : Finset α) : s.erase a ∪ t = s ∪ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s✝ t u v : Finset α
a b : α
ha : a ∈ t
s : Finset α
⊢ erase s a ∪ t = s ∪ t

Next tactic:
rw [← insert_erase (mem_union_right s ha), erase_union_distrib, ← union_insert, insert_erase ha]
theorem union_erase_of_mem (ha : a ∈ s) (t : Finset α) : s ∪ t.erase a = s ∪ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t✝ u v : Finset α
a b : α
ha : a ∈ s
t : Finset α
⊢ s ∪ erase t a = s ∪ t

Next tactic:
rw [← insert_erase (mem_union_left t ha), erase_union_distrib, ← insert_union, insert_erase ha]
@[simp]
theorem sdiff_singleton_eq_self (ha : a ∉ s) : s \ {a} = s :=
  sdiff_eq_self_iff_disjoint.2 <| by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq α
s t u v : Finset α
a b : α
ha : a ∉ s
⊢ _root_.Disjoint {a} s

Next tactic:
simp [ha]