File: Mathlib/Combinatorics/SetFamily/Compression/Down.lean

full_name: Finset.nonMemberSubfamily
code: /-- Elements of `𝒜` that do not contain `a`. -/
def nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finset.memberSubfamily
code: /-- Image of the elements of `𝒜` which contain `a` under removing `a`. Finsets that do not contain
`a` such that `insert a s ∈ 𝒜`. -/
def memberSubfamily (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: Finset.mem_nonMemberSubfamily
code: @[simp]
theorem mem_nonMemberSubfamily : s ∈ 𝒜.nonMemberSubfamily a ↔ s ∈ 𝒜 ∧ a ∉ s 
goal: s ∈ Finset.nonMemberSubfamily a 𝒜 ↔ s ∈ 𝒜 ∧ a ∉ s

full_name: Finset.mem_memberSubfamily
code: @[simp]
theorem mem_memberSubfamily : s ∈ 𝒜.memberSubfamily a ↔ insert a s ∈ 𝒜 ∧ a ∉ s 
goal: s ∈ Finset.memberSubfamily a 𝒜 ↔ insert a s ∈ 𝒜 ∧ a ∉ s

full_name: Finset.nonMemberSubfamily_inter
code: theorem nonMemberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) :
    (𝒜 ∩ ℬ).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a ∩ ℬ.nonMemberSubfamily a 
goal: Finset.nonMemberSubfamily a (𝒜 ∩ ℬ) = Finset.nonMemberSubfamily a 𝒜 ∩ Finset.nonMemberSubfamily a ℬ

full_name: Finset.memberSubfamily_inter
code: theorem memberSubfamily_inter (a : α) (𝒜 ℬ : Finset (Finset α)) :
    (𝒜 ∩ ℬ).memberSubfamily a = 𝒜.memberSubfamily a ∩ ℬ.memberSubfamily a 
goal: Finset.memberSubfamily a (𝒜 ∩ ℬ) = Finset.memberSubfamily a 𝒜 ∩ Finset.memberSubfamily a ℬ

full_name: Finset.nonMemberSubfamily_union
code: theorem nonMemberSubfamily_union (a : α) (𝒜 ℬ : Finset (Finset α)) :
    (𝒜 ∪ ℬ).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a ∪ ℬ.nonMemberSubfamily a 
goal: Finset.nonMemberSubfamily a (𝒜 ∪ ℬ) = Finset.nonMemberSubfamily a 𝒜 ∪ Finset.nonMemberSubfamily a ℬ

full_name: Finset.memberSubfamily_union
code: theorem memberSubfamily_union (a : α) (𝒜 ℬ : Finset (Finset α)) :
    (𝒜 ∪ ℬ).memberSubfamily a = 𝒜.memberSubfamily a ∪ ℬ.memberSubfamily a 
goal: Finset.memberSubfamily a (𝒜 ∪ ℬ) = Finset.memberSubfamily a 𝒜 ∪ Finset.memberSubfamily a ℬ

full_name: Finset.card_memberSubfamily_add_card_nonMemberSubfamily
code: theorem card_memberSubfamily_add_card_nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) :
    (𝒜.memberSubfamily a).card + (𝒜.nonMemberSubfamily a).card = 𝒜.card 
goal: (Finset.memberSubfamily a 𝒜).card + (Finset.nonMemberSubfamily a 𝒜).card = 𝒜.card

full_name: Finset.memberSubfamily_union_nonMemberSubfamily
code: theorem memberSubfamily_union_nonMemberSubfamily (a : α) (𝒜 : Finset (Finset α)) :
    𝒜.memberSubfamily a ∪ 𝒜.nonMemberSubfamily a = 𝒜.image fun s => s.erase a 
goal: Finset.memberSubfamily a 𝒜 ∪ Finset.nonMemberSubfamily a 𝒜 = Finset.image (fun s => s.erase a) 𝒜

full_name: Finset.memberSubfamily_memberSubfamily
code: @[simp]
theorem memberSubfamily_memberSubfamily : (𝒜.memberSubfamily a).memberSubfamily a = ∅ 
goal: Finset.memberSubfamily a (Finset.memberSubfamily a 𝒜) = ∅

full_name: Finset.memberSubfamily_nonMemberSubfamily
code: @[simp]
theorem memberSubfamily_nonMemberSubfamily : (𝒜.nonMemberSubfamily a).memberSubfamily a = ∅ 
goal: Finset.memberSubfamily a (Finset.nonMemberSubfamily a 𝒜) = ∅

full_name: Finset.nonMemberSubfamily_memberSubfamily
code: @[simp]
theorem nonMemberSubfamily_memberSubfamily :
    (𝒜.memberSubfamily a).nonMemberSubfamily a = 𝒜.memberSubfamily a 
goal: Finset.nonMemberSubfamily a (Finset.memberSubfamily a 𝒜) = Finset.memberSubfamily a 𝒜

full_name: Finset.nonMemberSubfamily_nonMemberSubfamily
code: @[simp]
theorem nonMemberSubfamily_nonMemberSubfamily :
    (𝒜.nonMemberSubfamily a).nonMemberSubfamily a = 𝒜.nonMemberSubfamily a 
goal: Finset.nonMemberSubfamily a (Finset.nonMemberSubfamily a 𝒜) = Finset.nonMemberSubfamily a 𝒜

full_name: Finset.memberSubfamily_image_insert
code: lemma memberSubfamily_image_insert (h𝒜 : ∀ s ∈ 𝒜, a ∉ s) :
    (𝒜.image <| insert a).memberSubfamily a = 𝒜 
goal: Finset.memberSubfamily a (Finset.image (insert a) 𝒜) = 𝒜

full_name: Finset.nonMemberSubfamily_image_insert
code: @[simp] lemma nonMemberSubfamily_image_insert : (𝒜.image <| insert a).nonMemberSubfamily a = ∅ 
goal: Finset.nonMemberSubfamily a (Finset.image (insert a) 𝒜) = ∅

full_name: Finset.memberSubfamily_image_erase
code: @[simp] lemma memberSubfamily_image_erase : (𝒜.image (erase · a)).memberSubfamily a = ∅ 
goal: Finset.memberSubfamily a (Finset.image (fun x => x.erase a) 𝒜) = ∅

full_name: Finset.image_insert_memberSubfamily
code: lemma image_insert_memberSubfamily (𝒜 : Finset (Finset α)) (a : α) :
    (𝒜.memberSubfamily a).image (insert a) = 𝒜.filter (a ∈ ·) 
goal: Finset.image (insert a) (Finset.memberSubfamily a 𝒜) = Finset.filter (fun x => a ∈ x) 𝒜

full_name: Finset.memberFamily_induction_on
code: /-- Induction principle for finset families. To prove a statement for every finset family,
it suffices to prove it for
* the empty finset family.
* the finset family which only contains the empty finset.
* `ℬ ∪ {s ∪ {a} | s ∈ 𝒞}` assuming the property for `ℬ` and `𝒞`, where `a` is an element of the
  ground type and `𝒜` and `ℬ` are families of finsets not containing `a`.
  Note that instead of giving `ℬ` and `𝒞`, the `subfamily` case gives you
  `𝒜 = ℬ ∪ {s ∪ {a} | s ∈ 𝒞}`, so that `ℬ = 𝒜.nonMemberSubfamily` and `𝒞 = 𝒜.memberSubfamily`.

This is a way of formalising induction on `n` where `𝒜` is a finset family on `n` elements.

See also `Finset.family_induction_on.`-/
@[elab_as_elim]
lemma memberFamily_induction_on {p : Finset (Finset α) → Prop}
    (𝒜 : Finset (Finset α)) (empty : p ∅) (singleton_empty : p {∅})
    (subfamily : ∀ (a : α) ⦃𝒜 : Finset (Finset α)⦄,
      p (𝒜.nonMemberSubfamily a) → p (𝒜.memberSubfamily a) → p 𝒜) : p 𝒜 
goal: p 𝒜

full_name: Finset.family_induction_on
code: /-- Induction principle for finset families. To prove a statement for every finset family,
it suffices to prove it for
* the empty finset family.
* the finset family which only contains the empty finset.
* `{s ∪ {a} | s ∈ 𝒜}` assuming the property for `𝒜` a family of finsets not containing `a`.
* `ℬ ∪ 𝒞` assuming the property for `ℬ` and `𝒞`, where `a` is an element of the ground type and
  `ℬ`is a family of finsets not containing `a` and `𝒞` a family of finsets containing `a`.
  Note that instead of giving `ℬ` and `𝒞`, the `subfamily` case gives you `𝒜 = ℬ ∪ 𝒞`, so that
  `ℬ = 𝒜.filter (a ∉ ·)` and `𝒞 = 𝒜.filter (a ∈ ·)`.

This is a way of formalising induction on `n` where `𝒜` is a finset family on `n` elements.

See also `Finset.memberFamily_induction_on.`-/
@[elab_as_elim]
protected lemma family_induction_on {p : Finset (Finset α) → Prop}
    (𝒜 : Finset (Finset α)) (empty : p ∅) (singleton_empty : p {∅})
    (image_insert : ∀ (a : α) ⦃𝒜 : Finset (Finset α)⦄,
      (∀ s ∈ 𝒜, a ∉ s) → p 𝒜 → p (𝒜.image <| insert a))
    (subfamily : ∀ (a : α) ⦃𝒜 : Finset (Finset α)⦄,
      p (𝒜.filter (a ∉ ·)) → p (𝒜.filter (a ∈ ·)) → p 𝒜) : p 𝒜 
goal: p 𝒜

full_name: Down.compression
code: /-- `a`-down-compressing `𝒜` means removing `a` from the elements of `𝒜` that contain it, when the
resulting Finset is not already in `𝒜`. -/
def compression (a : α) (𝒜 : Finset (Finset α)) : Finset (Finset α) 
goal: Finset (Finset α)

full_name: FinsetFamily._aux_Mathlib_Combinatorics_SetFamily_Compression_Down___unexpand_Down_compression_1
code: @[inherit_doc]
scoped[FinsetFamily] notation "𝓓 " => Down.compression
goal: Lean.PrettyPrinter.Unexpander

full_name: FinsetFamily._aux_Mathlib_Combinatorics_SetFamily_Compression_Down___macroRules_FinsetFamily_term𝓓_1
code: @[inherit_doc]
scoped[FinsetFamily] notation "𝓓 " => Down.compression
goal: Lean.Macro

full_name: Down.mem_compression
code: /-- `a` is in the down-compressed family iff it's in the original and its compression is in the
original, or it's not in the original but it's the compression of something in the original. -/
theorem mem_compression : s ∈ 𝓓 a 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ s ∉ 𝒜 ∧ insert a s ∈ 𝒜 
goal: s ∈ Down.compression a 𝒜 ↔ s ∈ 𝒜 ∧ s.erase a ∈ 𝒜 ∨ s ∉ 𝒜 ∧ insert a s ∈ 𝒜

full_name: Down.erase_mem_compression
code: theorem erase_mem_compression (hs : s ∈ 𝒜) : s.erase a ∈ 𝓓 a 𝒜 
goal: s.erase a ∈ Down.compression a 𝒜

full_name: Down.erase_mem_compression_of_mem_compression
code: theorem erase_mem_compression_of_mem_compression : s ∈ 𝓓 a 𝒜 → s.erase a ∈ 𝓓 a 𝒜 
goal: s ∈ Down.compression a 𝒜 → s.erase a ∈ Down.compression a 𝒜

full_name: Down.mem_compression_of_insert_mem_compression
code: theorem mem_compression_of_insert_mem_compression (h : insert a s ∈ 𝓓 a 𝒜) : s ∈ 𝓓 a 𝒜 
goal: s ∈ Down.compression a 𝒜

full_name: Down.compression_idem
code: /-- Down-compressing a family is idempotent. -/
@[simp]
theorem compression_idem (a : α) (𝒜 : Finset (Finset α)) : 𝓓 a (𝓓 a 𝒜) = 𝓓 a 𝒜 
goal: Down.compression a (Down.compression a 𝒜) = Down.compression a 𝒜

full_name: Down.card_compression
code: /-- Down-compressing a family doesn't change its size. -/
@[simp]
theorem card_compression (a : α) (𝒜 : Finset (Finset α)) : (𝓓 a 𝒜).card = 𝒜.card 
goal: (Down.compression a 𝒜).card = 𝒜.card