l3lab/ntp-mathlib huggingface dataset:
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · 

Proof state:
case pos.mp
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
⊢ erase t a ⊆ s → t ⊆ s ∨ ∃ a_2 ⊆ s, insert a a_2 = t

Next tactic:
exact fun H => Or.inr ⟨_, H, insert_erase h⟩
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · 

Proof state:
case pos.mpr
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
⊢ (t ⊆ s ∨ ∃ a_1 ⊆ s, insert a a_1 = t) → erase t a ⊆ s

Next tactic:
intro H
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      

Proof state:
case pos.mpr
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
H : t ⊆ s ∨ ∃ a_1 ⊆ s, insert a a_1 = t
⊢ erase t a ⊆ s

Next tactic:
cases' H with H H
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · 

Proof state:
case pos.mpr.inl
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
H : t ⊆ s
⊢ erase t a ⊆ s

Next tactic:
exact Subset.trans (erase_subset a t) H
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · 

Proof state:
case pos.mpr.inr
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
H : ∃ a_1 ⊆ s, insert a a_1 = t
⊢ erase t a ⊆ s

Next tactic:
rcases H with ⟨u, hu⟩
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · rcases H with ⟨u, hu⟩
        

Proof state:
case pos.mpr.inr.intro
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
u : Finset α
hu : u ⊆ s ∧ insert a u = t
⊢ erase t a ⊆ s

Next tactic:
rw [← hu.2]
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · rcases H with ⟨u, hu⟩
        rw [← hu.2]
        

Proof state:
case pos.mpr.inr.intro
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∈ t
u : Finset α
hu : u ⊆ s ∧ insert a u = t
⊢ erase (insert a u) a ⊆ s

Next tactic:
exact Subset.trans (erase_insert_subset a u) hu.1
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · rcases H with ⟨u, hu⟩
        rw [← hu.2]
        exact Subset.trans (erase_insert_subset a u) hu.1
  · 

Proof state:
case neg
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∉ t
⊢ erase t a ⊆ s ↔ t ⊆ s ∨ ∃ a_1 ⊆ s, insert a a_1 = t

Next tactic:
have : ¬∃ u : Finset α, u ⊆ s ∧ insert a u = t := by simp [Ne.symm (ne_insert_of_not_mem _ _ h)]
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · rcases H with ⟨u, hu⟩
        rw [← hu.2]
        exact Subset.trans (erase_insert_subset a u) hu.1
  · have : ¬∃ u : Finset α, u ⊆ s ∧ insert a u = t := by 

Proof state:
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∉ t
⊢ ¬∃ u ⊆ s, insert a u = t

Next tactic:
simp [Ne.symm (ne_insert_of_not_mem _ _ h)]
theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) := by
  ext t
  simp only [exists_prop, mem_powerset, mem_image, mem_union, subset_insert_iff]
  by_cases h : a ∈ t
  · constructor
    · exact fun H => Or.inr ⟨_, H, insert_erase h⟩
    · intro H
      cases' H with H H
      · exact Subset.trans (erase_subset a t) H
      · rcases H with ⟨u, hu⟩
        rw [← hu.2]
        exact Subset.trans (erase_insert_subset a u) hu.1
  · have : ¬∃ u : Finset α, u ⊆ s ∧ insert a u = t := by simp [Ne.symm (ne_insert_of_not_mem _ _ h)]
    

Proof state:
case neg
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s : Finset α
a : α
t : Finset α
h : a ∉ t
this : ¬∃ u ⊆ s, insert a u = t
⊢ erase t a ⊆ s ↔ t ⊆ s ∨ ∃ a_1 ⊆ s, insert a a_1 = t

Next tactic:
simp [Finset.erase_eq_of_not_mem h, this]
@[simp]
theorem mem_ssubsets {s t : Finset α} : t ∈ s.ssubsets ↔ t ⊂ s := by
  

Proof state:
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
s t : Finset α
⊢ t ∈ ssubsets s ↔ t ⊂ s

Next tactic:
rw [ssubsets, mem_erase, mem_powerset, ssubset_iff_subset_ne, and_comm]
theorem empty_mem_ssubsets {s : Finset α} (h : s.Nonempty) : ∅ ∈ s.ssubsets := by
  

Proof state:
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
s : Finset α
h : Finset.Nonempty s
⊢ ∅ ∈ ssubsets s

Next tactic:
rw [mem_ssubsets, ssubset_iff_subset_ne]
theorem empty_mem_ssubsets {s : Finset α} (h : s.Nonempty) : ∅ ∈ s.ssubsets := by
  rw [mem_ssubsets, ssubset_iff_subset_ne]
  

Proof state:
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
s : Finset α
h : Finset.Nonempty s
⊢ ∅ ⊆ s ∧ ∅ ≠ s

Next tactic:
exact ⟨empty_subset s, h.ne_empty.symm⟩
/-- **Formula for the Number of Combinations** -/
theorem mem_powersetCard {n} {s t : Finset α} : s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n := by
  

Proof state:
α : Type u_1
s✝ t✝ : Finset α
n : ℕ
s t : Finset α
⊢ s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n

Next tactic:
cases s
/-- **Formula for the Number of Combinations** -/
theorem mem_powersetCard {n} {s t : Finset α} : s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n := by
  cases s; 

Proof state:
case mk
α : Type u_1
s t✝ : Finset α
n : ℕ
t : Finset α
val✝ : Multiset α
nodup✝ : Nodup val✝
⊢ { val := val✝, nodup := nodup✝ } ∈ powersetCard n t ↔
    { val := val✝, nodup := nodup✝ } ⊆ t ∧ card { val := val✝, nodup := nodup✝ } = n

Next tactic:
simp [powersetCard, val_le_iff.symm]
@[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
  

Proof state:
α : Type u_1
s✝ t s : Finset α
⊢ powersetCard 0 s = {∅}

Next tactic:
ext
@[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
  ext; 

Proof state:
case a
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ ∈ powersetCard 0 s ↔ a✝ ∈ {∅}

Next tactic:
rw [mem_powersetCard, mem_singleton, card_eq_zero]
@[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
  ext; rw [mem_powersetCard, mem_singleton, card_eq_zero]
  

Proof state:
case a
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ ⊆ s ∧ a✝ = ∅ ↔ a✝ = ∅

Next tactic:
refine'
    ⟨fun h => h.2, fun h => by
      rw [h]
      exact ⟨empty_subset s, rfl⟩⟩
@[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
  ext; rw [mem_powersetCard, mem_singleton, card_eq_zero]
  refine'
    ⟨fun h => h.2, fun h => by
      

Proof state:
α : Type u_1
s✝ t s a✝ : Finset α
h : a✝ = ∅
⊢ a✝ ⊆ s ∧ a✝ = ∅

Next tactic:
rw [h]
@[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} := by
  ext; rw [mem_powersetCard, mem_singleton, card_eq_zero]
  refine'
    ⟨fun h => h.2, fun h => by
      rw [h]
      

Proof state:
α : Type u_1
s✝ t s a✝ : Finset α
h : a✝ = ∅
⊢ ∅ ⊆ s ∧ ∅ = ∅

Next tactic:
exact ⟨empty_subset s, rfl⟩
@[simp]
theorem map_val_val_powersetCard (s : Finset α) (i : ℕ) :
    (s.powersetCard i).val.map Finset.val = s.1.powersetCard i := by
  

Proof state:
α : Type u_1
s✝ t s : Finset α
i : ℕ
⊢ Multiset.map val (powersetCard i s).val = Multiset.powersetCard i s.val

Next tactic:
simp [Finset.powersetCard, map_pmap, pmap_eq_map, map_id']
theorem powersetCard_one (s : Finset α) :
    s.powersetCard 1 = s.map ⟨_, Finset.singleton_injective⟩ :=
  eq_of_veq <| Multiset.map_injective val_injective <| by 

Proof state:
α : Type u_1
s✝ t s : Finset α
⊢ Multiset.map val (powersetCard 1 s).val =
    Multiset.map val (map { toFun := singleton, inj' := (_ : Injective singleton) } s).val

Next tactic:
simp [Multiset.powersetCard_one]
@[simp]
theorem powersetCard_empty (n : ℕ) {s : Finset α} (h : s.card < n) : powersetCard n s = ∅ :=
  Finset.card_eq_zero.mp (by 

Proof state:
α : Type u_1
s✝ t : Finset α
n : ℕ
s : Finset α
h : card s < n
⊢ card (powersetCard n s) = 0

Next tactic:
rw [card_powersetCard, Nat.choose_eq_zero_of_lt h]
theorem powersetCard_eq_filter {n} {s : Finset α} :
    powersetCard n s = (powerset s).filter fun x => x.card = n := by
  

Proof state:
α : Type u_1
s✝ t : Finset α
n : ℕ
s : Finset α
⊢ powersetCard n s = filter (fun x => card x = n) (powerset s)

Next tactic:
ext
theorem powersetCard_eq_filter {n} {s : Finset α} :
    powersetCard n s = (powerset s).filter fun x => x.card = n := by
  ext
  

Proof state:
case a
α : Type u_1
s✝ t : Finset α
n : ℕ
s a✝ : Finset α
⊢ a✝ ∈ powersetCard n s ↔ a✝ ∈ filter (fun x => card x = n) (powerset s)

Next tactic:
simp [mem_powersetCard]
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  

Proof state:
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
⊢ powersetCard (Nat.succ n) (insert x s) = powersetCard (Nat.succ n) s ∪ image (insert x) (powersetCard n s)

Next tactic:
rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  

Proof state:
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
⊢ powersetCard (Nat.succ n) s ∪ filter (fun x => card x = Nat.succ n) (image (insert x) (powerset s)) =
    powersetCard (Nat.succ n) s ∪ image (insert x) (powersetCard n s)

Next tactic:
congr
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  

Proof state:
case e_a
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
⊢ filter (fun x => card x = Nat.succ n) (image (insert x) (powerset s)) = image (insert x) (powersetCard n s)

Next tactic:
rw [powersetCard_eq_filter, image_filter]
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  

Proof state:
case e_a
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
⊢ image (insert x) (filter (fun a => card (insert x a) = Nat.succ n) (powerset s)) =
    image (insert x) (filter (fun x => card x = n) (powerset s))

Next tactic:
congr 1
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  congr 1
  

Proof state:
case e_a.e_s
α : Type u_1
s✝ t : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
⊢ filter (fun a => card (insert x a) = Nat.succ n) (powerset s) = filter (fun x => card x = n) (powerset s)

Next tactic:
ext t
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  congr 1
  ext t
  

Proof state:
case e_a.e_s.a
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
t : Finset α
⊢ t ∈ filter (fun a => card (insert x a) = Nat.succ n) (powerset s) ↔ t ∈ filter (fun x => card x = n) (powerset s)

Next tactic:
simp only [mem_powerset, mem_filter, Function.comp_apply, and_congr_right_iff]
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  congr 1
  ext t
  simp only [mem_powerset, mem_filter, Function.comp_apply, and_congr_right_iff]
  

Proof state:
case e_a.e_s.a
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
t : Finset α
⊢ t ⊆ s → (card (insert x t) = Nat.succ n ↔ card t = n)

Next tactic:
intro ht
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  congr 1
  ext t
  simp only [mem_powerset, mem_filter, Function.comp_apply, and_congr_right_iff]
  intro ht
  

Proof state:
case e_a.e_s.a
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
t : Finset α
ht : t ⊆ s
⊢ card (insert x t) = Nat.succ n ↔ card t = n

Next tactic:
have : x ∉ t := fun H => h (ht H)
theorem powersetCard_succ_insert [DecidableEq α] {x : α} {s : Finset α} (h : x ∉ s) (n : ℕ) :
    powersetCard n.succ (insert x s) =
    powersetCard n.succ s ∪ (powersetCard n s).image (insert x) := by
  rw [powersetCard_eq_filter, powerset_insert, filter_union, ← powersetCard_eq_filter]
  congr
  rw [powersetCard_eq_filter, image_filter]
  congr 1
  ext t
  simp only [mem_powerset, mem_filter, Function.comp_apply, and_congr_right_iff]
  intro ht
  have : x ∉ t := fun H => h (ht H)
  

Proof state:
case e_a.e_s.a
α : Type u_1
s✝ t✝ : Finset α
inst✝ : DecidableEq α
x : α
s : Finset α
h : x ∉ s
n : ℕ
t : Finset α
ht : t ⊆ s
this : x ∉ t
⊢ card (insert x t) = Nat.succ n ↔ card t = n

Next tactic:
simp [card_insert_of_not_mem this, Nat.succ_inj']
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  

Proof state:
α : Type u_1
s✝ t : Finset α
n : ℕ
s : Finset α
h : n ≤ card s
⊢ Finset.Nonempty (powersetCard n s)

Next tactic:
classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · simp
      · rw [card_insert_of_not_mem hx, Nat.succ_le_succ_iff] at h
        rw [powersetCard_succ_insert hx]
        refine' Nonempty.mono _ ((IH h).image (insert x))
        exact subset_union_right _ _
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    

Proof state:
α : Type u_1
s✝ t : Finset α
n : ℕ
s : Finset α
h : n ≤ card s
⊢ Finset.Nonempty (powersetCard n s)

Next tactic:
induction' s using Finset.induction_on with x s hx IH generalizing n
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · 

Proof state:
case empty
α : Type u_1
s t : Finset α
n : ℕ
h : n ≤ card ∅
⊢ Finset.Nonempty (powersetCard n ∅)

Next tactic:
rw [card_empty, le_zero_iff] at h
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      

Proof state:
case empty
α : Type u_1
s t : Finset α
n : ℕ
h : n = 0
⊢ Finset.Nonempty (powersetCard n ∅)

Next tactic:
rw [h, powersetCard_zero]
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      

Proof state:
case empty
α : Type u_1
s t : Finset α
n : ℕ
h : n = 0
⊢ Finset.Nonempty {∅}

Next tactic:
exact Finset.singleton_nonempty _
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · 

Proof state:
case insert
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
n : ℕ
h : n ≤ card (insert x s)
⊢ Finset.Nonempty (powersetCard n (insert x s))

Next tactic:
cases n
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · 

Proof state:
case insert.zero
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
h : Nat.zero ≤ card (insert x s)
⊢ Finset.Nonempty (powersetCard Nat.zero (insert x s))

Next tactic:
simp
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · simp
      · 

Proof state:
case insert.succ
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
n✝ : ℕ
h : Nat.succ n✝ ≤ card (insert x s)
⊢ Finset.Nonempty (powersetCard (Nat.succ n✝) (insert x s))

Next tactic:
rw [card_insert_of_not_mem hx, Nat.succ_le_succ_iff] at h
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · simp
      · rw [card_insert_of_not_mem hx, Nat.succ_le_succ_iff] at h
        

Proof state:
case insert.succ
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
n✝ : ℕ
h : n✝ ≤ card s
⊢ Finset.Nonempty (powersetCard (Nat.succ n✝) (insert x s))

Next tactic:
rw [powersetCard_succ_insert hx]
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · simp
      · rw [card_insert_of_not_mem hx, Nat.succ_le_succ_iff] at h
        rw [powersetCard_succ_insert hx]
        

Proof state:
case insert.succ
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
n✝ : ℕ
h : n✝ ≤ card s
⊢ Finset.Nonempty (powersetCard (Nat.succ n✝) s ∪ image (insert x) (powersetCard n✝ s))

Next tactic:
refine' Nonempty.mono _ ((IH h).image (insert x))
theorem powersetCard_nonempty {n : ℕ} {s : Finset α} (h : n ≤ s.card) :
    (powersetCard n s).Nonempty := by
  classical
    induction' s using Finset.induction_on with x s hx IH generalizing n
    · rw [card_empty, le_zero_iff] at h
      rw [h, powersetCard_zero]
      exact Finset.singleton_nonempty _
    · cases n
      · simp
      · rw [card_insert_of_not_mem hx, Nat.succ_le_succ_iff] at h
        rw [powersetCard_succ_insert hx]
        refine' Nonempty.mono _ ((IH h).image (insert x))
        

Proof state:
case insert.succ
α : Type u_1
s✝ t : Finset α
x : α
s : Finset α
hx : x ∉ s
IH : ∀ {n : ℕ}, n ≤ card s → Finset.Nonempty (powersetCard n s)
n✝ : ℕ
h : n✝ ≤ card s
⊢ image (insert x) (powersetCard n✝ s) ⊆ powersetCard (Nat.succ n✝) s ∪ image (insert x) (powersetCard n✝ s)

Next tactic:
exact subset_union_right _ _
@[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} := by
  

Proof state:
α : Type u_1
s✝ t s : Finset α
⊢ powersetCard (card s) s = {s}

Next tactic:
ext
@[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} := by
  ext
  

Proof state:
case a
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ ∈ powersetCard (card s) s ↔ a✝ ∈ {s}

Next tactic:
rw [mem_powersetCard, mem_singleton]
@[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} := by
  ext
  rw [mem_powersetCard, mem_singleton]
  

Proof state:
case a
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ ⊆ s ∧ card a✝ = card s ↔ a✝ = s

Next tactic:
constructor
@[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} := by
  ext
  rw [mem_powersetCard, mem_singleton]
  constructor
  · 

Proof state:
case a.mp
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ ⊆ s ∧ card a✝ = card s → a✝ = s

Next tactic:
exact fun ⟨hs, hc⟩ => eq_of_subset_of_card_le hs hc.ge
@[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} := by
  ext
  rw [mem_powersetCard, mem_singleton]
  constructor
  · exact fun ⟨hs, hc⟩ => eq_of_subset_of_card_le hs hc.ge
  · 

Proof state:
case a.mpr
α : Type u_1
s✝ t s a✝ : Finset α
⊢ a✝ = s → a✝ ⊆ s ∧ card a✝ = card s

Next tactic:
rintro rfl