l3lab/ntp-mathlib huggingface dataset:
theorem biUnion_congr (hs : s₁ = s₂) (ht : ∀ a ∈ s₁, t₁ a = t₂ a) : s₁.biUnion t₁ = s₂.biUnion t₂ :=
  ext fun x => by
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
hs : s₁ = s₂
ht : ∀ a ∈ s₁, t₁ a = t₂ a
x : β
⊢ x ∈ Finset.biUnion s₁ t₁ ↔ x ∈ Finset.biUnion s₂ t₂

Next tactic:
simp_rw [mem_biUnion]
theorem biUnion_congr (hs : s₁ = s₂) (ht : ∀ a ∈ s₁, t₁ a = t₂ a) : s₁.biUnion t₁ = s₂.biUnion t₂ :=
  ext fun x => by
    simp_rw [mem_biUnion]
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
hs : s₁ = s₂
ht : ∀ a ∈ s₁, t₁ a = t₂ a
x : β
⊢ (∃ a ∈ s₁, x ∈ t₁ a) ↔ ∃ a ∈ s₂, x ∈ t₂ a

Next tactic:
apply exists_congr
theorem biUnion_congr (hs : s₁ = s₂) (ht : ∀ a ∈ s₁, t₁ a = t₂ a) : s₁.biUnion t₁ = s₂.biUnion t₂ :=
  ext fun x => by
    simp_rw [mem_biUnion]
    apply exists_congr
    

Proof state:
case h
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
hs : s₁ = s₂
ht : ∀ a ∈ s₁, t₁ a = t₂ a
x : β
⊢ ∀ (a : α), a ∈ s₁ ∧ x ∈ t₁ a ↔ a ∈ s₂ ∧ x ∈ t₂ a

Next tactic:
simp (config := { contextual := true }) only [hs, and_congr_right_iff, ht, implies_true]
theorem biUnion_subset {s' : Finset β} : s.biUnion t ⊆ s' ↔ ∀ x ∈ s, t x ⊆ s' := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s' : Finset β
⊢ Finset.biUnion s t ⊆ s' ↔ ∀ x ∈ s, t x ⊆ s'

Next tactic:
simp only [subset_iff, mem_biUnion]
theorem biUnion_subset {s' : Finset β} : s.biUnion t ⊆ s' ↔ ∀ x ∈ s, t x ⊆ s' := by
  simp only [subset_iff, mem_biUnion]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s' : Finset β
⊢ (∀ ⦃x : β⦄, (∃ a ∈ s, x ∈ t a) → x ∈ s') ↔ ∀ x ∈ s, ∀ ⦃x_1 : β⦄, x_1 ∈ t x → x_1 ∈ s'

Next tactic:
exact ⟨fun H a ha b hb => H ⟨a, ha, hb⟩, fun H b ⟨a, ha, hb⟩ => H a ha hb⟩
@[simp]
theorem singleton_biUnion {a : α} : Finset.biUnion {a} t = t a := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
a : α
⊢ Finset.biUnion {a} t = t a

Next tactic:
classical rw [← insert_emptyc_eq, biUnion_insert, biUnion_empty, union_empty]
@[simp]
theorem singleton_biUnion {a : α} : Finset.biUnion {a} t = t a := by
  classical 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
a : α
⊢ Finset.biUnion {a} t = t a

Next tactic:
rw [← insert_emptyc_eq, biUnion_insert, biUnion_empty, union_empty]
theorem biUnion_inter (s : Finset α) (f : α → Finset β) (t : Finset β) :
    s.biUnion f ∩ t = s.biUnion fun x => f x ∩ t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
⊢ Finset.biUnion s f ∩ t = Finset.biUnion s fun x => f x ∩ t

Next tactic:
ext x
theorem biUnion_inter (s : Finset α) (f : α → Finset β) (t : Finset β) :
    s.biUnion f ∩ t = s.biUnion fun x => f x ∩ t := by
  ext x
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
x : β
⊢ x ∈ Finset.biUnion s f ∩ t ↔ x ∈ Finset.biUnion s fun x => f x ∩ t

Next tactic:
simp only [mem_biUnion, mem_inter]
theorem biUnion_inter (s : Finset α) (f : α → Finset β) (t : Finset β) :
    s.biUnion f ∩ t = s.biUnion fun x => f x ∩ t := by
  ext x
  simp only [mem_biUnion, mem_inter]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
x : β
⊢ (∃ a ∈ s, x ∈ f a) ∧ x ∈ t ↔ ∃ a ∈ s, x ∈ f a ∧ x ∈ t

Next tactic:
tauto
theorem inter_biUnion (t : Finset β) (s : Finset α) (f : α → Finset β) :
    t ∩ s.biUnion f = s.biUnion fun x => t ∩ f x := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
t : Finset β
s : Finset α
f : α → Finset β
⊢ t ∩ Finset.biUnion s f = Finset.biUnion s fun x => t ∩ f x

Next tactic:
rw [inter_comm, biUnion_inter]
theorem inter_biUnion (t : Finset β) (s : Finset α) (f : α → Finset β) :
    t ∩ s.biUnion f = s.biUnion fun x => t ∩ f x := by
  rw [inter_comm, biUnion_inter]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
t : Finset β
s : Finset α
f : α → Finset β
⊢ (Finset.biUnion s fun x => f x ∩ t) = Finset.biUnion s fun x => t ∩ f x

Next tactic:
simp [inter_comm]
theorem biUnion_biUnion [DecidableEq γ] (s : Finset α) (f : α → Finset β) (g : β → Finset γ) :
    (s.biUnion f).biUnion g = s.biUnion fun a => (f a).biUnion g := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
inst✝ : DecidableEq γ
s : Finset α
f : α → Finset β
g : β → Finset γ
⊢ Finset.biUnion (Finset.biUnion s f) g = Finset.biUnion s fun a => Finset.biUnion (f a) g

Next tactic:
ext
theorem biUnion_biUnion [DecidableEq γ] (s : Finset α) (f : α → Finset β) (g : β → Finset γ) :
    (s.biUnion f).biUnion g = s.biUnion fun a => (f a).biUnion g := by
  ext
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
inst✝ : DecidableEq γ
s : Finset α
f : α → Finset β
g : β → Finset γ
a✝ : γ
⊢ a✝ ∈ Finset.biUnion (Finset.biUnion s f) g ↔ a✝ ∈ Finset.biUnion s fun a => Finset.biUnion (f a) g

Next tactic:
simp only [Finset.mem_biUnion, exists_prop]
theorem biUnion_biUnion [DecidableEq γ] (s : Finset α) (f : α → Finset β) (g : β → Finset γ) :
    (s.biUnion f).biUnion g = s.biUnion fun a => (f a).biUnion g := by
  ext
  simp only [Finset.mem_biUnion, exists_prop]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
inst✝ : DecidableEq γ
s : Finset α
f : α → Finset β
g : β → Finset γ
a✝ : γ
⊢ (∃ a, (∃ a_1 ∈ s, a ∈ f a_1) ∧ a✝ ∈ g a) ↔ ∃ a ∈ s, ∃ a_1 ∈ f a, a✝ ∈ g a_1

Next tactic:
simp_rw [← exists_and_right, ← exists_and_left, and_assoc]
theorem biUnion_biUnion [DecidableEq γ] (s : Finset α) (f : α → Finset β) (g : β → Finset γ) :
    (s.biUnion f).biUnion g = s.biUnion fun a => (f a).biUnion g := by
  ext
  simp only [Finset.mem_biUnion, exists_prop]
  simp_rw [← exists_and_right, ← exists_and_left, and_assoc]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
inst✝ : DecidableEq γ
s : Finset α
f : α → Finset β
g : β → Finset γ
a✝ : γ
⊢ (∃ a, ∃ x ∈ s, a ∈ f x ∧ a✝ ∈ g a) ↔ ∃ a x, a ∈ s ∧ x ∈ f a ∧ a✝ ∈ g x

Next tactic:
rw [exists_comm]
theorem bind_toFinset [DecidableEq α] (s : Multiset α) (t : α → Multiset β) :
    (s.bind t).toFinset = s.toFinset.biUnion fun a => (t a).toFinset :=
  ext fun x => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
inst✝ : DecidableEq α
s : Multiset α
t : α → Multiset β
x : β
⊢ x ∈ toFinset (Multiset.bind s t) ↔ x ∈ Finset.biUnion (toFinset s) fun a => toFinset (t a)

Next tactic:
simp only [Multiset.mem_toFinset, mem_biUnion, Multiset.mem_bind, exists_prop]
theorem biUnion_mono (h : ∀ a ∈ s, t₁ a ⊆ t₂ a) : s.biUnion t₁ ⊆ s.biUnion t₂ := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
h : ∀ a ∈ s, t₁ a ⊆ t₂ a
⊢ Finset.biUnion s t₁ ⊆ Finset.biUnion s t₂

Next tactic:
have : ∀ b a, a ∈ s → b ∈ t₁ a → ∃ a : α, a ∈ s ∧ b ∈ t₂ a := fun b a ha hb =>
    ⟨a, ha, Finset.mem_of_subset (h a ha) hb⟩
theorem biUnion_mono (h : ∀ a ∈ s, t₁ a ⊆ t₂ a) : s.biUnion t₁ ⊆ s.biUnion t₂ := by
  have : ∀ b a, a ∈ s → b ∈ t₁ a → ∃ a : α, a ∈ s ∧ b ∈ t₂ a := fun b a ha hb =>
    ⟨a, ha, Finset.mem_of_subset (h a ha) hb⟩
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
h : ∀ a ∈ s, t₁ a ⊆ t₂ a
this : ∀ (b : β), ∀ a ∈ s, b ∈ t₁ a → ∃ a ∈ s, b ∈ t₂ a
⊢ Finset.biUnion s t₁ ⊆ Finset.biUnion s t₂

Next tactic:
simpa only [subset_iff, mem_biUnion, exists_imp, and_imp, exists_prop]
theorem biUnion_subset_biUnion_of_subset_left (t : α → Finset β) (h : s₁ ⊆ s₂) :
    s₁.biUnion t ⊆ s₂.biUnion t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t✝ t₁ t₂ t : α → Finset β
h : s₁ ⊆ s₂
⊢ Finset.biUnion s₁ t ⊆ Finset.biUnion s₂ t

Next tactic:
intro x
theorem biUnion_subset_biUnion_of_subset_left (t : α → Finset β) (h : s₁ ⊆ s₂) :
    s₁.biUnion t ⊆ s₂.biUnion t := by
  intro x
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t✝ t₁ t₂ t : α → Finset β
h : s₁ ⊆ s₂
x : β
⊢ x ∈ Finset.biUnion s₁ t → x ∈ Finset.biUnion s₂ t

Next tactic:
simp only [and_imp, mem_biUnion, exists_prop]
theorem biUnion_subset_biUnion_of_subset_left (t : α → Finset β) (h : s₁ ⊆ s₂) :
    s₁.biUnion t ⊆ s₂.biUnion t := by
  intro x
  simp only [and_imp, mem_biUnion, exists_prop]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t✝ t₁ t₂ t : α → Finset β
h : s₁ ⊆ s₂
x : β
⊢ (∃ a ∈ s₁, x ∈ t a) → ∃ a ∈ s₂, x ∈ t a

Next tactic:
exact Exists.imp fun a ha => ⟨h ha.1, ha.2⟩
@[simp]
theorem biUnion_singleton_eq_self [DecidableEq α] : s.biUnion (singleton : α → Finset α) = s :=
  ext fun x => by 

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
inst✝ : DecidableEq α
x : α
⊢ x ∈ Finset.biUnion s singleton ↔ x ∈ s

Next tactic:
simp only [mem_biUnion, mem_singleton, exists_prop, exists_eq_right']
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
⊢ filter p (Finset.biUnion s f) = Finset.biUnion s fun a => filter p (f a)

Next tactic:
ext b
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ b ∈ filter p (Finset.biUnion s f) ↔ b ∈ Finset.biUnion s fun a => filter p (f a)

Next tactic:
simp only [mem_biUnion, exists_prop, mem_filter]
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  simp only [mem_biUnion, exists_prop, mem_filter]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a ∈ s, b ∈ f a) ∧ p b ↔ ∃ a ∈ s, b ∈ f a ∧ p b

Next tactic:
constructor
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  simp only [mem_biUnion, exists_prop, mem_filter]
  constructor
  · 

Proof state:
case a.mp
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a ∈ s, b ∈ f a) ∧ p b → ∃ a ∈ s, b ∈ f a ∧ p b

Next tactic:
rintro ⟨⟨a, ha, hba⟩, hb⟩
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  simp only [mem_biUnion, exists_prop, mem_filter]
  constructor
  · rintro ⟨⟨a, ha, hba⟩, hb⟩
    

Proof state:
case a.mp.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
hb : p b
a : α
ha : a ∈ s
hba : b ∈ f a
⊢ ∃ a ∈ s, b ∈ f a ∧ p b

Next tactic:
exact ⟨a, ha, hba, hb⟩
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  simp only [mem_biUnion, exists_prop, mem_filter]
  constructor
  · rintro ⟨⟨a, ha, hba⟩, hb⟩
    exact ⟨a, ha, hba, hb⟩
  · 

Proof state:
case a.mpr
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
⊢ (∃ a ∈ s, b ∈ f a ∧ p b) → (∃ a ∈ s, b ∈ f a) ∧ p b

Next tactic:
rintro ⟨a, ha, hba, hb⟩
theorem filter_biUnion (s : Finset α) (f : α → Finset β) (p : β → Prop) [DecidablePred p] :
    (s.biUnion f).filter p = s.biUnion fun a => (f a).filter p := by
  ext b
  simp only [mem_biUnion, exists_prop, mem_filter]
  constructor
  · rintro ⟨⟨a, ha, hba⟩, hb⟩
    exact ⟨a, ha, hba, hb⟩
  · rintro ⟨a, ha, hba, hb⟩
    

Proof state:
case a.mpr.intro.intro.intro
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
p : β → Prop
inst✝ : DecidablePred p
b : β
a : α
ha : a ∈ s
hba : b ∈ f a
hb : p b
⊢ (∃ a ∈ s, b ∈ f a) ∧ p b

Next tactic:
exact ⟨⟨a, ha, hba⟩, hb⟩
theorem biUnion_filter_eq_of_maps_to [DecidableEq α] {s : Finset α} {t : Finset β} {f : α → β}
    (h : ∀ x ∈ s, f x ∈ t) : (t.biUnion fun a => s.filter fun c => f c = a) = s := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝¹ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
inst✝ : DecidableEq α
s : Finset α
t : Finset β
f : α → β
h : ∀ x ∈ s, f x ∈ t
⊢ (Finset.biUnion t fun a => filter (fun c => f c = a) s) = s

Next tactic:
simpa only [disjiUnion_eq_biUnion] using disjiUnion_filter_eq_of_maps_to h
theorem erase_biUnion (f : α → Finset β) (s : Finset α) (b : β) :
    (s.biUnion f).erase b = s.biUnion fun x => (f x).erase b := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ f : α → Finset β
s : Finset α
b : β
⊢ erase (Finset.biUnion s f) b = Finset.biUnion s fun x => erase (f x) b

Next tactic:
ext a
theorem erase_biUnion (f : α → Finset β) (s : Finset α) (b : β) :
    (s.biUnion f).erase b = s.biUnion fun x => (f x).erase b := by
  ext a
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ f : α → Finset β
s : Finset α
b a : β
⊢ a ∈ erase (Finset.biUnion s f) b ↔ a ∈ Finset.biUnion s fun x => erase (f x) b

Next tactic:
simp only [mem_biUnion, not_exists, not_and, mem_erase, ne_eq]
theorem erase_biUnion (f : α → Finset β) (s : Finset α) (b : β) :
    (s.biUnion f).erase b = s.biUnion fun x => (f x).erase b := by
  ext a
  simp only [mem_biUnion, not_exists, not_and, mem_erase, ne_eq]
  

Proof state:
case a
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t t₁ t₂ f : α → Finset β
s : Finset α
b a : β
⊢ (¬a = b ∧ ∃ a_1 ∈ s, a ∈ f a_1) ↔ ∃ a_1 ∈ s, ¬a = b ∧ a ∈ f a_1

Next tactic:
tauto
@[simp]
theorem biUnion_nonempty : (s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
⊢ Finset.Nonempty (Finset.biUnion s t) ↔ ∃ x ∈ s, Finset.Nonempty (t x)

Next tactic:
simp only [Finset.Nonempty, mem_biUnion]
@[simp]
theorem biUnion_nonempty : (s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty := by
  simp only [Finset.Nonempty, mem_biUnion]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
⊢ (∃ x, ∃ a ∈ s, x ∈ t a) ↔ ∃ x ∈ s, ∃ x_1, x_1 ∈ t x

Next tactic:
rw [exists_swap]
@[simp]
theorem biUnion_nonempty : (s.biUnion t).Nonempty ↔ ∃ x ∈ s, (t x).Nonempty := by
  simp only [Finset.Nonempty, mem_biUnion]
  rw [exists_swap]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s s₁ s₂ : Finset α
t t₁ t₂ : α → Finset β
⊢ (∃ y x, y ∈ s ∧ x ∈ t y) ↔ ∃ x ∈ s, ∃ x_1, x_1 ∈ t x

Next tactic:
simp [exists_and_left]
theorem disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
⊢ _root_.Disjoint (Finset.biUnion s f) t ↔ ∀ i ∈ s, _root_.Disjoint (f i) t

Next tactic:
classical
    refine' s.induction _ _
    · simp only [forall_mem_empty_iff, biUnion_empty, disjoint_empty_left]
    · intro i s his ih
      simp only [disjoint_union_left, biUnion_insert, his, forall_mem_insert, ih]
theorem disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t := by
  classical
    

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
⊢ _root_.Disjoint (Finset.biUnion s f) t ↔ ∀ i ∈ s, _root_.Disjoint (f i) t

Next tactic:
refine' s.induction _ _
theorem disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t := by
  classical
    refine' s.induction _ _
    · 

Proof state:
case refine'_1
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
⊢ _root_.Disjoint (Finset.biUnion ∅ f) t ↔ ∀ i ∈ ∅, _root_.Disjoint (f i) t

Next tactic:
simp only [forall_mem_empty_iff, biUnion_empty, disjoint_empty_left]
theorem disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t := by
  classical
    refine' s.induction _ _
    · simp only [forall_mem_empty_iff, biUnion_empty, disjoint_empty_left]
    · 

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset α
f : α → Finset β
t : Finset β
⊢ ∀ ⦃a : α⦄ {s : Finset α},
    a ∉ s →
      (_root_.Disjoint (Finset.biUnion s f) t ↔ ∀ i ∈ s, _root_.Disjoint (f i) t) →
        (_root_.Disjoint (Finset.biUnion (insert a s) f) t ↔ ∀ i ∈ insert a s, _root_.Disjoint (f i) t)

Next tactic:
intro i s his ih
theorem disjoint_biUnion_left (s : Finset α) (f : α → Finset β) (t : Finset β) :
    Disjoint (s.biUnion f) t ↔ ∀ i ∈ s, Disjoint (f i) t := by
  classical
    refine' s.induction _ _
    · simp only [forall_mem_empty_iff, biUnion_empty, disjoint_empty_left]
    · intro i s his ih
      

Proof state:
case refine'_2
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝¹ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s✝ : Finset α
f : α → Finset β
t : Finset β
i : α
s : Finset α
his : i ∉ s
ih : _root_.Disjoint (Finset.biUnion s f) t ↔ ∀ i ∈ s, _root_.Disjoint (f i) t
⊢ _root_.Disjoint (Finset.biUnion (insert i s) f) t ↔ ∀ i_1 ∈ insert i s, _root_.Disjoint (f i_1) t

Next tactic:
simp only [disjoint_union_left, biUnion_insert, his, forall_mem_insert, ih]
theorem disjoint_biUnion_right (s : Finset β) (t : Finset α) (f : α → Finset β) :
    Disjoint s (t.biUnion f) ↔ ∀ i ∈ t, Disjoint s (f i) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
inst✝ : DecidableEq β
s✝ s₁ s₂ : Finset α
t✝ t₁ t₂ : α → Finset β
s : Finset β
t : Finset α
f : α → Finset β
⊢ _root_.Disjoint s (Finset.biUnion t f) ↔ ∀ i ∈ t, _root_.Disjoint s (f i)

Next tactic:
simpa only [_root_.disjoint_comm] using disjoint_biUnion_left t f s
theorem pairwise_cons' {a : α} (ha : a ∉ s) (r : β → β → Prop) (f : α → β) :
    Pairwise (r on fun a : s.cons a ha => f a) ↔
    Pairwise (r on fun a : s => f a) ∧ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a) := by
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Finset α
a : α
ha : a ∉ s
r : β → β → Prop
f : α → β
⊢ _root_.Pairwise (r on fun a_1 => f ↑a_1) ↔
    _root_.Pairwise (r on fun a => f ↑a) ∧ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a)

Next tactic:
simp only [pairwise_subtype_iff_pairwise_finset', Finset.coe_cons, Set.pairwise_insert,
    Finset.mem_coe, and_congr_right_iff]
theorem pairwise_cons' {a : α} (ha : a ∉ s) (r : β → β → Prop) (f : α → β) :
    Pairwise (r on fun a : s.cons a ha => f a) ↔
    Pairwise (r on fun a : s => f a) ∧ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a) := by
  simp only [pairwise_subtype_iff_pairwise_finset', Finset.coe_cons, Set.pairwise_insert,
    Finset.mem_coe, and_congr_right_iff]
  

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Finset α
a : α
ha : a ∉ s
r : β → β → Prop
f : α → β
⊢ Set.Pairwise (↑s) (r on f) → ((∀ b ∈ s, a ≠ b → (r on f) a b ∧ (r on f) b a) ↔ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a))

Next tactic:
exact fun _ =>
    ⟨fun h b hb =>
      h b hb <| by
        rintro rfl
        contradiction,
      fun h b hb _ => h b hb⟩
theorem pairwise_cons' {a : α} (ha : a ∉ s) (r : β → β → Prop) (f : α → β) :
    Pairwise (r on fun a : s.cons a ha => f a) ↔
    Pairwise (r on fun a : s => f a) ∧ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a) := by
  simp only [pairwise_subtype_iff_pairwise_finset', Finset.coe_cons, Set.pairwise_insert,
    Finset.mem_coe, and_congr_right_iff]
  exact fun _ =>
    ⟨fun h b hb =>
      h b hb <| by
        

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Finset α
a : α
ha : a ∉ s
r : β → β → Prop
f : α → β
x✝ : Set.Pairwise (↑s) (r on f)
h : ∀ b ∈ s, a ≠ b → (r on f) a b ∧ (r on f) b a
b : α
hb : b ∈ s
⊢ a ≠ b

Next tactic:
rintro rfl
theorem pairwise_cons' {a : α} (ha : a ∉ s) (r : β → β → Prop) (f : α → β) :
    Pairwise (r on fun a : s.cons a ha => f a) ↔
    Pairwise (r on fun a : s => f a) ∧ ∀ b ∈ s, r (f a) (f b) ∧ r (f b) (f a) := by
  simp only [pairwise_subtype_iff_pairwise_finset', Finset.coe_cons, Set.pairwise_insert,
    Finset.mem_coe, and_congr_right_iff]
  exact fun _ =>
    ⟨fun h b hb =>
      h b hb <| by
        rintro rfl
        

Proof state:
α : Type u_1
β : Type u_2
γ : Type u_3
s : Finset α
a : α
ha : a ∉ s
r : β → β → Prop
f : α → β
x✝ : Set.Pairwise (↑s) (r on f)
h : ∀ b ∈ s, a ≠ b → (r on f) a b ∧ (r on f) b a
hb : a ∈ s
⊢ False

Next tactic:
contradiction
/--
Inhabited types are equivalent to `Option β` for some `β` by identifying `default α` with `none`.
-/
def sigmaEquivOptionOfInhabited (α : Type u) [Inhabited α] [DecidableEq α] :
    Σβ : Type u, α ≃ Option β :=
  ⟨{ x : α // x ≠ default },
    { toFun := fun x : α => if h : x = default then none else some ⟨x, h⟩
      invFun := Option.elim' default (↑)
      left_inv := fun x => by
        

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u
inst✝¹ : Inhabited α
inst✝ : DecidableEq α
x : α
⊢ Option.elim' default Subtype.val ((fun x => if h : x = default then none else some { val := x, property := h }) x) = x

Next tactic:
dsimp only
/--
Inhabited types are equivalent to `Option β` for some `β` by identifying `default α` with `none`.
-/
def sigmaEquivOptionOfInhabited (α : Type u) [Inhabited α] [DecidableEq α] :
    Σβ : Type u, α ≃ Option β :=
  ⟨{ x : α // x ≠ default },
    { toFun := fun x : α => if h : x = default then none else some ⟨x, h⟩
      invFun := Option.elim' default (↑)
      left_inv := fun x => by
        dsimp only
        

Proof state:
α✝ : Type u_1
β : Type u_2
γ : Type u_3
α : Type u
inst✝¹ : Inhabited α
inst✝ : DecidableEq α
x : α
⊢ Option.elim' default Subtype.val (if h : x = default then none else some { val := x, property := h }) = x

Next tactic:
split_ifs