l3lab/ntp-mathlib huggingface dataset:
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
⊢ ∀ B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts,
    Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id) ≤ m

Next tactic:
intro B hB
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
B : Finset α
hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts
⊢ Finset.card (B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id) ≤ m

Next tactic:
unfold chunk
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · 

Proof state:
case pos
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
B : Finset α
hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts
h₁ : Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
⊢ Finset.card
      (B \
        Finset.biUnion
          (filter (fun x => x ⊆ B)
            (equitabilise
                (_ :
                  (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)) * m +
                      (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts) * (m + 1) =
                    Finset.card U)).parts)
          id) ≤
    m

Next tactic:
convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · 

Proof state:
case neg
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
B : Finset α
hB : B ∈ (atomise U (nonuniformWitnesses P G ε U)).parts
h₁ : ¬Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
⊢ Finset.card
      (B \
        Finset.biUnion
          (filter (fun x => x ⊆ B)
            (equitabilise
                (_ :
                  (4 ^ Finset.card P.parts - (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts + 1)) *
                        m +
                      (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts + 1) * (m + 1) =
                    Finset.card U)).parts)
          id) ≤
    m

Next tactic:
convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
⊢ ∑ _i in
      filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts,
      m ≤
    2 ^ (Finset.card P.parts - 1) * m

Next tactic:
rw [sum_const]
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
  rw [sum_const]
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
⊢ Finset.card
        (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
          (atomise U (nonuniformWitnesses P G ε U)).parts) •
      m ≤
    2 ^ (Finset.card P.parts - 1) * m

Next tactic:
refine' mul_le_mul_right' _ _
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
  rw [sum_const]
  refine' mul_le_mul_right' _ _
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
⊢ Finset.card
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts) ≤
    2 ^ (Finset.card P.parts - 1)

Next tactic:
have t := card_filter_atomise_le_two_pow (s := U) hX
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
  rw [sum_const]
  refine' mul_le_mul_right' _ _
  have t := card_filter_atomise_le_two_pow (s := U) hX
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
t :
  Finset.card
      (filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u)
        (atomise U (nonuniformWitnesses P G ε U)).parts) ≤
    2 ^ (Finset.card (nonuniformWitnesses P G ε U) - 1)
⊢ Finset.card
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts) ≤
    2 ^ (Finset.card P.parts - 1)

Next tactic:
refine' t.trans (pow_le_pow_right (by norm_num) <| tsub_le_tsub_right _ _)
private theorem card_nonuniformWitness_sdiff_biUnion_star (hV : V ∈ P.parts) (hUV : U ≠ V)
    (h₂ : ¬G.IsUniform ε U V) :
    (G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id).card ≤
    2 ^ (P.parts.card - 1) * m := by
  have hX : G.nonuniformWitness ε U V ∈ P.nonuniformWitnesses G ε U :=
    nonuniformWitness_mem_nonuniformWitnesses h₂ hV hUV
  have q : G.nonuniformWitness ε U V \ (star hP G ε hU V).biUnion id ⊆
      ((atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
        B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty).biUnion
        fun B => B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id := by
    intro x hx
    rw [← biUnion_filter_atomise hX (G.nonuniformWitness_subset h₂), star, mem_sdiff,
      mem_biUnion] at hx
    simp only [not_exists, mem_biUnion, and_imp, exists_prop, mem_filter,
      not_and, mem_sdiff, id.def, mem_sdiff] at hx ⊢
    obtain ⟨⟨B, hB₁, hB₂⟩, hx⟩ := hx
    exact ⟨B, hB₁, hB₂, fun A hA AB => hx A hA <| AB.trans hB₁.2.1⟩
  apply (card_le_of_subset q).trans (card_biUnion_le.trans _)
  trans ∑ _i in (atomise U <| P.nonuniformWitnesses G ε U).parts.filter fun B =>
    B ⊆ G.nonuniformWitness ε U V ∧ B.Nonempty, m
  · suffices ∀ B ∈ (atomise U <| P.nonuniformWitnesses G ε U).parts,
        (B \ ((chunk hP G ε hU).parts.filter (· ⊆ B)).biUnion id).card ≤ m by
      exact sum_le_sum fun B hB => this B <| filter_subset _ _ hB
    intro B hB
    unfold chunk
    split_ifs with h₁
    · convert card_parts_equitabilise_subset_le _ (card_aux₁ h₁) hB
    · convert card_parts_equitabilise_subset_le _ (card_aux₂ hP hU h₁) hB
  rw [sum_const]
  refine' mul_le_mul_right' _ _
  have t := card_filter_atomise_le_two_pow (s := U) hX
  refine' t.trans (pow_le_pow_right (by 

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
U : Finset α
hU : U ∈ P.parts
V : Finset α
𝒜 : Finset (Finset α)
s : Finset α
hV : V ∈ P.parts
hUV : U ≠ V
h₂ : ¬SimpleGraph.IsUniform G ε U V
hX : SimpleGraph.nonuniformWitness G ε U V ∈ nonuniformWitnesses P G ε U
q :
  SimpleGraph.nonuniformWitness G ε U V \ Finset.biUnion (star hP G ε hU V) id ⊆
    Finset.biUnion
      (filter (fun B => B ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty B)
        (atomise U (nonuniformWitnesses P G ε U)).parts)
      fun B => B \ Finset.biUnion (filter (fun x => x ⊆ B) (chunk hP G ε hU).parts) id
t :
  Finset.card
      (filter (fun u => u ⊆ SimpleGraph.nonuniformWitness G ε U V ∧ Finset.Nonempty u)
        (atomise U (nonuniformWitnesses P G ε U)).parts) ≤
    2 ^ (Finset.card (nonuniformWitnesses P G ε U) - 1)
⊢ 1 ≤ 2

Next tactic:
norm_num