Theorem: Finpartition.card_filter_atomise_le_two_pow
File: Mathlib/Order/Partition/Finpartition.lean

tactic: suffices h :
  ((atomise s F).parts.filter fun u ↦ u ⊆ t ∧ u.Nonempty) ⊆
    (F.erase t).powerset.image fun P ↦ s.filter fun i ↦ ∀ x ∈ F, x ∈ insert t P ↔ i ∈ x
state_before: α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
⊢ card (filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts) ≤ 2 ^ (card F - 1)

tactic: rw [subset_iff]
state_before: case h
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
⊢ filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts ⊆
    image (fun P => filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t P ↔ i ∈ x)) s) (powerset (erase F t))

tactic: simp_rw [mem_image, mem_powerset, mem_filter, and_imp, Finset.Nonempty, exists_imp, mem_atomise,
  and_imp, Finset.Nonempty, exists_imp]
state_before: case h
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
⊢ ∀ ⦃x : Finset α⦄,
    x ∈ filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts →
      x ∈ image (fun P => filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t P ↔ i ∈ x)) s) (powerset (erase F t))

tactic: rintro P' i hi P PQ rfl hy₂ j _hj
state_before: case h
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
⊢ ∀ ⦃x : Finset α⦄ (x_1 : α),
    x_1 ∈ x →
      ∀ (x_2 : Finset (Finset α)),
        x_2 ⊆ F →
          filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ x_2 ↔ i ∈ u)) s = x →
            x ⊆ t →
              ∀ (x_4 : α),
                x_4 ∈ x →
                  ∃ a, a ⊆ erase F t ∧ filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t a ↔ i ∈ x)) s = x

tactic: refine' ⟨P.erase t, erase_subset_erase _ PQ, _⟩
state_before: case h
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P✝ : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
i : α
P : Finset (Finset α)
PQ : P ⊆ F
hi : i ∈ filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s
hy₂ : filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s ⊆ t
j : α
_hj : j ∈ filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s
⊢ ∃ a,
    a ⊆ erase F t ∧
      filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t a ↔ i ∈ x)) s =
        filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s

tactic: simp only [insert_erase (((mem_filter.1 hi).2 _ ht).2 <| hy₂ hi)]
state_before: case h
α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P✝ : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
i : α
P : Finset (Finset α)
PQ : P ⊆ F
hi : i ∈ filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s
hy₂ : filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s ⊆ t
j : α
_hj : j ∈ filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s
⊢ filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t (erase P t) ↔ i ∈ x)) s =
    filter (fun i => ∀ (u : Finset α), u ∈ F → (u ∈ P ↔ i ∈ u)) s

tactic: refine' (card_le_of_subset h).trans (card_image_le.trans _)
state_before: α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
h :
  filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts ⊆
    image (fun P => filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t P ↔ i ∈ x)) s) (powerset (erase F t))
⊢ card (filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts) ≤ 2 ^ (card F - 1)

tactic: rw [card_powerset, card_erase_of_mem ht]
state_before: α : Type u_1
inst✝ : DecidableEq α
s t : Finset α
P : Finpartition s
F : Finset (Finset α)
ht : t ∈ F
h :
  filter (fun u => u ⊆ t ∧ Finset.Nonempty u) (atomise s F).parts ⊆
    image (fun P => filter (fun i => ∀ (x : Finset α), x ∈ F → (x ∈ insert t P ↔ i ∈ x)) s) (powerset (erase F t))
⊢ card (powerset (erase F t)) ≤ 2 ^ (card F - 1)