File: Mathlib/Data/Finset/Powerset.lean

full_name: Finset.powerset
code: /-- When `s` is a finset, `s.powerset` is the finset of all subsets of `s` (seen as finsets). -/
def powerset (s : Finset α) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finset.mem_powerset
code: @[simp]
theorem mem_powerset {s t : Finset α} : s ∈ powerset t ↔ s ⊆ t 
goal: s ∈ t.powerset ↔ s ⊆ t

full_name: Finset.coe_powerset
code: @[simp, norm_cast]
theorem coe_powerset (s : Finset α) :
    (s.powerset : Set (Finset α)) = ((↑) : Finset α → Set α) ⁻¹' (s : Set α).powerset 
goal: ↑s.powerset = Finset.toSet ⁻¹' 𝒫↑s

full_name: Finset.empty_mem_powerset
code: theorem empty_mem_powerset (s : Finset α) : ∅ ∈ powerset s 
goal: ∅ ∈ s.powerset

full_name: Finset.mem_powerset_self
code: theorem mem_powerset_self (s : Finset α) : s ∈ powerset s 
goal: s ∈ s.powerset

full_name: Finset.powerset_nonempty
code: @[aesop safe apply (rule_sets := [finsetNonempty])]
theorem powerset_nonempty (s : Finset α) : s.powerset.Nonempty 
goal: s.powerset.Nonempty

full_name: Finset.powerset_mono
code: @[simp]
theorem powerset_mono {s t : Finset α} : powerset s ⊆ powerset t ↔ s ⊆ t 
goal: s.powerset ⊆ t.powerset ↔ s ⊆ t

full_name: Finset.powerset_injective
code: theorem powerset_injective : Injective (powerset : Finset α → Finset (Finset α)) 
goal: Function.Injective Finset.powerset

full_name: Finset.powerset_inj
code: @[simp]
theorem powerset_inj : powerset s = powerset t ↔ s = t 
goal: s.powerset = t.powerset ↔ s = t

full_name: Finset.powerset_empty
code: @[simp]
theorem powerset_empty : (∅ : Finset α).powerset = {∅} 
goal: ∅.powerset = {∅}

full_name: Finset.powerset_eq_singleton_empty
code: @[simp]
theorem powerset_eq_singleton_empty : s.powerset = {∅} ↔ s = ∅ 
goal: s.powerset = {∅} ↔ s = ∅

full_name: Finset.card_powerset
code: /-- **Number of Subsets of a Set** -/
@[simp]
theorem card_powerset (s : Finset α) : card (powerset s) = 2 ^ card s 
goal: s.powerset.card = 2 ^ s.card

full_name: Finset.not_mem_of_mem_powerset_of_not_mem
code: theorem not_mem_of_mem_powerset_of_not_mem {s t : Finset α} {a : α} (ht : t ∈ s.powerset)
    (h : a ∉ s) : a ∉ t 
goal: a ∉ t

full_name: Finset.powerset_insert
code: theorem powerset_insert [DecidableEq α] (s : Finset α) (a : α) :
    powerset (insert a s) = s.powerset ∪ s.powerset.image (insert a) 
goal: (insert a s).powerset = s.powerset ∪ Finset.image (insert a) s.powerset

full_name: Finset.decidableExistsOfDecidableSubsets
code: /-- For predicate `p` decidable on subsets, it is decidable whether `p` holds for any subset. -/
instance decidableExistsOfDecidableSubsets {s : Finset α} {p : ∀ t ⊆ s, Prop}
    [∀ (t) (h : t ⊆ s), Decidable (p t h)] : Decidable (∃ (t : _) (h : t ⊆ s), p t h) 
goal: Decidable (∃ t, ∃ (h : t ⊆ s), p t h)

full_name: Finset.decidableForallOfDecidableSubsets
code: /-- For predicate `p` decidable on subsets, it is decidable whether `p` holds for every subset. -/
instance decidableForallOfDecidableSubsets {s : Finset α} {p : ∀ t ⊆ s, Prop}
    [∀ (t) (h : t ⊆ s), Decidable (p t h)] : Decidable (∀ (t) (h : t ⊆ s), p t h) 
goal: Decidable (∀ (t : Finset α) (h : t ⊆ s), p t h)

full_name: Finset.decidableExistsOfDecidableSubsets'
code: /-- For predicate `p` decidable on subsets, it is decidable whether `p` holds for any subset. -/
instance decidableExistsOfDecidableSubsets' {s : Finset α} {p : Finset α → Prop}
    [∀ t, Decidable (p t)] : Decidable (∃ t ⊆ s, p t) 
goal: Decidable (∃ t ⊆ s, p t)

full_name: Finset.decidableForallOfDecidableSubsets'
code: /-- For predicate `p` decidable on subsets, it is decidable whether `p` holds for every subset. -/
instance decidableForallOfDecidableSubsets' {s : Finset α} {p : Finset α → Prop}
    [∀ t, Decidable (p t)] : Decidable (∀ t ⊆ s, p t) 
goal: Decidable (∀ t ⊆ s, p t)

full_name: Finset.ssubsets
code: /-- For `s` a finset, `s.ssubsets` is the finset comprising strict subsets of `s`. -/
def ssubsets (s : Finset α) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finset.mem_ssubsets
code: @[simp]
theorem mem_ssubsets {s t : Finset α} : t ∈ s.ssubsets ↔ t ⊂ s 
goal: t ∈ s.ssubsets ↔ t ⊂ s

full_name: Finset.empty_mem_ssubsets
code: theorem empty_mem_ssubsets {s : Finset α} (h : s.Nonempty) : ∅ ∈ s.ssubsets 
goal: ∅ ∈ s.ssubsets

full_name: Finset.decidableExistsOfDecidableSSubsets
code: /-- For predicate `p` decidable on ssubsets, it is decidable whether `p` holds for any ssubset. -/
def decidableExistsOfDecidableSSubsets {s : Finset α} {p : ∀ t ⊂ s, Prop}
    [∀ t h, Decidable (p t h)] : Decidable (∃ t h, p t h) 
goal: Decidable (∃ t, ∃ (h : t ⊂ s), p t h)

full_name: Finset.decidableForallOfDecidableSSubsets
code: /-- For predicate `p` decidable on ssubsets, it is decidable whether `p` holds for every ssubset. -/
def decidableForallOfDecidableSSubsets {s : Finset α} {p : ∀ t ⊂ s, Prop}
    [∀ t h, Decidable (p t h)] : Decidable (∀ t h, p t h) 
goal: Decidable (∀ (t : Finset α) (h : t ⊂ s), p t h)

full_name: Finset.decidableExistsOfDecidableSSubsets'
code: /-- A version of `Finset.decidableExistsOfDecidableSSubsets` with a non-dependent `p`.
Typeclass inference cannot find `hu` here, so this is not an instance. -/
def decidableExistsOfDecidableSSubsets' {s : Finset α} {p : Finset α → Prop}
    (hu : ∀ t ⊂ s, Decidable (p t)) : Decidable (∃ (t : _) (_h : t ⊂ s), p t) 
goal: Decidable (∃ t, ∃ (_ : t ⊂ s), p t)

full_name: Finset.decidableForallOfDecidableSSubsets'
code: /-- A version of `Finset.decidableForallOfDecidableSSubsets` with a non-dependent `p`.
Typeclass inference cannot find `hu` here, so this is not an instance. -/
def decidableForallOfDecidableSSubsets' {s : Finset α} {p : Finset α → Prop}
    (hu : ∀ t ⊂ s, Decidable (p t)) : Decidable (∀ t ⊂ s, p t) 
goal: Decidable (∀ t ⊂ s, p t)

full_name: Finset.powersetCard
code: /-- Given an integer `n` and a finset `s`, then `powersetCard n s` is the finset of subsets of `s`
of cardinality `n`. -/
def powersetCard (n : ℕ) (s : Finset α) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finset.mem_powersetCard
code: @[simp] lemma mem_powersetCard : s ∈ powersetCard n t ↔ s ⊆ t ∧ card s = n 
goal: s ∈ Finset.powersetCard n t ↔ s ⊆ t ∧ s.card = n

full_name: Finset.powersetCard_mono
code: @[simp]
theorem powersetCard_mono {n} {s t : Finset α} (h : s ⊆ t) : powersetCard n s ⊆ powersetCard n t 
goal: Finset.powersetCard n s ⊆ Finset.powersetCard n t

full_name: Finset.card_powersetCard
code: /-- **Formula for the Number of Combinations** -/
@[simp]
theorem card_powersetCard (n : ℕ) (s : Finset α) :
    card (powersetCard n s) = Nat.choose (card s) n 
goal: (Finset.powersetCard n s).card = s.card.choose n

full_name: Finset.powersetCard_zero
code: @[simp]
theorem powersetCard_zero (s : Finset α) : s.powersetCard 0 = {∅} 
goal: Finset.powersetCard 0 s = {∅}

full_name: Finset.powersetCard_empty_subsingleton
code: lemma powersetCard_empty_subsingleton (n : ℕ) :
    (powersetCard n (∅ : Finset α) : Set $ Finset α).Subsingleton 
goal: (↑(Finset.powersetCard n ∅)).Subsingleton

full_name: Finset.map_val_val_powersetCard
code: @[simp]
theorem map_val_val_powersetCard (s : Finset α) (i : ℕ) :
    (s.powersetCard i).val.map Finset.val = s.1.powersetCard i 
goal: Multiset.map Finset.val (Finset.powersetCard i s).val = Multiset.powersetCard i s.val

full_name: Finset.powersetCard_one
code: theorem powersetCard_one (s : Finset α) :
    s.powersetCard 1 = s.map ⟨_, Finset.singleton_injective⟩ 
goal: Finset.powersetCard 1 s = Finset.map { toFun := singleton, inj' := ⋯ } s

full_name: Finset.powersetCard_eq_empty
code: @[simp]
lemma powersetCard_eq_empty : powersetCard n s = ∅ ↔ s.card < n 
goal: Finset.powersetCard n s = ∅ ↔ s.card < n

full_name: Finset.powersetCard_card_add
code: @[simp] lemma powersetCard_card_add (s : Finset α) (hn : 0 < n) :
    s.powersetCard (s.card + n) = ∅ 
goal: Finset.powersetCard (s.card + n) s = ∅

full_name: Finset.powersetCard_eq_filter
code: theorem powersetCard_eq_filter {n} {s : Finset α} :
    powersetCard n s = (powerset s).filter fun x => x.card = n 
goal: Finset.powersetCard n s = Finset.filter (fun x => x.card = n) s.powerset

full_name: Finset.powersetCard_succ_insert
code: 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) 
goal: Finset.powersetCard n.succ (insert x s) =
  Finset.powersetCard n.succ s ∪ Finset.image (insert x) (Finset.powersetCard n s)

full_name: Finset.powersetCard_nonempty
code: @[simp, aesop safe apply (rule_sets := [finsetNonempty])]
lemma powersetCard_nonempty : (powersetCard n s).Nonempty ↔ n ≤ s.card 
goal: (Finset.powersetCard n s).Nonempty ↔ n ≤ s.card

full_name: Finset.powersetCard_self
code: @[simp]
theorem powersetCard_self (s : Finset α) : powersetCard s.card s = {s} 
goal: Finset.powersetCard s.card s = {s}

full_name: Finset.pairwise_disjoint_powersetCard
code: theorem pairwise_disjoint_powersetCard (s : Finset α) :
    Pairwise fun i j => Disjoint (s.powersetCard i) (s.powersetCard j) 
goal: Pairwise fun i j => Disjoint (Finset.powersetCard i s) (Finset.powersetCard j s)

full_name: Finset.powerset_card_disjiUnion
code: theorem powerset_card_disjiUnion (s : Finset α) :
    Finset.powerset s =
      (range (s.card + 1)).disjiUnion (fun i => powersetCard i s)
        (s.pairwise_disjoint_powersetCard.set_pairwise _) 
goal: s.powerset = (Finset.range (s.card + 1)).disjiUnion (fun i => Finset.powersetCard i s) ⋯

full_name: Finset.powerset_card_biUnion
code: theorem powerset_card_biUnion [DecidableEq (Finset α)] (s : Finset α) :
    Finset.powerset s = (range (s.card + 1)).biUnion fun i => powersetCard i s 
goal: s.powerset = (Finset.range (s.card + 1)).biUnion fun i => Finset.powersetCard i s

full_name: Finset.powersetCard_sup
code: theorem powersetCard_sup [DecidableEq α] (u : Finset α) (n : ℕ) (hn : n < u.card) :
    (powersetCard n.succ u).sup id = u 
goal: (Finset.powersetCard n.succ u).sup id = u

full_name: Finset.powersetCard_map
code: theorem powersetCard_map {β : Type*} (f : α ↪ β) (n : ℕ) (s : Finset α) :
    powersetCard n (s.map f) = (powersetCard n s).map (mapEmbedding f).toEmbedding 
goal: Finset.powersetCard n (Finset.map f s) = Finset.map (Finset.mapEmbedding f).toEmbedding (Finset.powersetCard n s)