l3lab/ntp-mathlib huggingface dataset:
private theorem one_sub_eps_mul_card_nonuniformWitness_le_card_star (hV : V ∈ P.parts)
    (hUV : U ≠ V) (hunif : ¬G.IsUniform ε U V) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
    (hε₁ : ε ≤ 1) :
    (1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤ ((star hP G ε hU V).biUnion id).card := by
  have hP₁ : 0 < P.parts.card := Finset.card_pos.2 ⟨_, hU⟩
  have : (↑2 ^ P.parts.card : ℝ) * m / (U.card * ε) ≤ ε / 10 := by
    rw [← div_div, div_le_iff']
    swap
    sz_positivity
    refine' le_of_mul_le_mul_left _ (pow_pos zero_lt_two P.parts.card)
    calc
      ↑2 ^ P.parts.card * ((↑2 ^ P.parts.card * m : ℝ) / U.card) =
          ((2 : ℝ) * 2) ^ P.parts.card * m / U.card := by
        rw [mul_pow, ← mul_div_assoc, mul_assoc]
      _ = ↑4 ^ P.parts.card * m / U.card := by norm_num
      _ ≤ 1 := (div_le_one_of_le (pow_mul_m_le_card_part hP hU) (cast_nonneg _))
      _ ≤ ↑2 ^ P.parts.card * ε ^ 2 / 10 := by
        refine' (one_le_sq_iff <| by positivity).1 _
        rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε,
          one_le_div (sq_pos_of_ne_zero (10 : ℝ) <| by norm_num)]
        calc
          (↑10 ^ 2) = 100 := by norm_num
          _ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε
          _ ≤ ↑4 ^ P.parts.card * ε ^ 4 :=
            (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _)
              (by positivity))
          _ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num
      _ = ↑2 ^ P.parts.card * (ε * (ε / 10)) := by rw [mul_div_assoc, sq, mul_div_assoc]
  calc
    (↑1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤
        (↑1 - ↑2 ^ P.parts.card * m / (U.card * ε)) * (G.nonuniformWitness ε U V).card :=
      mul_le_mul_of_nonneg_right (sub_le_sub_left this _) (cast_nonneg _)
    _ = (G.nonuniformWitness ε U V).card -
        ↑2 ^ P.parts.card * m / (U.card * ε) * (G.nonuniformWitness ε U V).card := by
      rw [sub_mul, one_mul]
    _ ≤ (G.nonuniformWitness ε U V).card - ↑2 ^ (P.parts.card - 1) * m := by
      refine' sub_le_sub_left _ _
      have : (2 : ℝ) ^ P.parts.card = ↑2 ^ (P.parts.card - 1) * 2 := by
        rw [← _root_.pow_succ', tsub_add_cancel_of_le (succ_le_iff.2 hP₁)]
      rw [← mul_div_right_comm, this, mul_right_comm _ (2 : ℝ), mul_assoc, le_div_iff]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      exact (G.le_card_nonuniformWitness hunif).trans
        (le_mul_of_one_le_left (cast_nonneg _) one_le_two)
      

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
hunif : ¬SimpleGraph.IsUniform G ε U V
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
hε₁ : ε ≤ 1
hP₁ : 0 < Finset.card P.parts
this✝ : 2 ^ Finset.card P.parts * ↑m / (↑(Finset.card U) * ε) ≤ ε / 10
this : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2
⊢ 0 < ↑(Finset.card U) * ε

Next tactic:
have := Finset.card_pos.mpr (P.nonempty_of_mem_parts hU)
private theorem one_sub_eps_mul_card_nonuniformWitness_le_card_star (hV : V ∈ P.parts)
    (hUV : U ≠ V) (hunif : ¬G.IsUniform ε U V) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
    (hε₁ : ε ≤ 1) :
    (1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤ ((star hP G ε hU V).biUnion id).card := by
  have hP₁ : 0 < P.parts.card := Finset.card_pos.2 ⟨_, hU⟩
  have : (↑2 ^ P.parts.card : ℝ) * m / (U.card * ε) ≤ ε / 10 := by
    rw [← div_div, div_le_iff']
    swap
    sz_positivity
    refine' le_of_mul_le_mul_left _ (pow_pos zero_lt_two P.parts.card)
    calc
      ↑2 ^ P.parts.card * ((↑2 ^ P.parts.card * m : ℝ) / U.card) =
          ((2 : ℝ) * 2) ^ P.parts.card * m / U.card := by
        rw [mul_pow, ← mul_div_assoc, mul_assoc]
      _ = ↑4 ^ P.parts.card * m / U.card := by norm_num
      _ ≤ 1 := (div_le_one_of_le (pow_mul_m_le_card_part hP hU) (cast_nonneg _))
      _ ≤ ↑2 ^ P.parts.card * ε ^ 2 / 10 := by
        refine' (one_le_sq_iff <| by positivity).1 _
        rw [div_pow, mul_pow, pow_right_comm, ← pow_mul ε,
          one_le_div (sq_pos_of_ne_zero (10 : ℝ) <| by norm_num)]
        calc
          (↑10 ^ 2) = 100 := by norm_num
          _ ≤ ↑4 ^ P.parts.card * ε ^ 5 := hPε
          _ ≤ ↑4 ^ P.parts.card * ε ^ 4 :=
            (mul_le_mul_of_nonneg_left (pow_le_pow_of_le_one (by sz_positivity) hε₁ <| le_succ _)
              (by positivity))
          _ = (↑2 ^ 2) ^ P.parts.card * ε ^ (2 * 2) := by norm_num
      _ = ↑2 ^ P.parts.card * (ε * (ε / 10)) := by rw [mul_div_assoc, sq, mul_div_assoc]
  calc
    (↑1 - ε / 10) * (G.nonuniformWitness ε U V).card ≤
        (↑1 - ↑2 ^ P.parts.card * m / (U.card * ε)) * (G.nonuniformWitness ε U V).card :=
      mul_le_mul_of_nonneg_right (sub_le_sub_left this _) (cast_nonneg _)
    _ = (G.nonuniformWitness ε U V).card -
        ↑2 ^ P.parts.card * m / (U.card * ε) * (G.nonuniformWitness ε U V).card := by
      rw [sub_mul, one_mul]
    _ ≤ (G.nonuniformWitness ε U V).card - ↑2 ^ (P.parts.card - 1) * m := by
      refine' sub_le_sub_left _ _
      have : (2 : ℝ) ^ P.parts.card = ↑2 ^ (P.parts.card - 1) * 2 := by
        rw [← _root_.pow_succ', tsub_add_cancel_of_le (succ_le_iff.2 hP₁)]
      rw [← mul_div_right_comm, this, mul_right_comm _ (2 : ℝ), mul_assoc, le_div_iff]
      refine' mul_le_mul_of_nonneg_left _ (by positivity)
      exact (G.le_card_nonuniformWitness hunif).trans
        (le_mul_of_one_le_left (cast_nonneg _) one_le_two)
      have := Finset.card_pos.mpr (P.nonempty_of_mem_parts hU)
      

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
hunif : ¬SimpleGraph.IsUniform G ε U V
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
hε₁ : ε ≤ 1
hP₁ : 0 < Finset.card P.parts
this✝¹ : 2 ^ Finset.card P.parts * ↑m / (↑(Finset.card U) * ε) ≤ ε / 10
this✝ : 2 ^ Finset.card P.parts = 2 ^ (Finset.card P.parts - 1) * 2
this : 0 < Finset.card U
⊢ 0 < ↑(Finset.card U) * ε

Next tactic:
sz_positivity
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := 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 α
hm : m ≠ 0
⊢ Finset.card (chunk hP G ε hU).parts = 4 ^ Finset.card P.parts

Next tactic:
unfold chunk
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := by
  unfold chunk
  

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 α
hm : m ≠ 0
⊢ Finset.card
      (if hUcard :
            Finset.card U =
              m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts) then
          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)
        else
          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 =
    4 ^ Finset.card P.parts

Next tactic:
split_ifs
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := by
  unfold chunk
  split_ifs
  · 

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 α
hm : m ≠ 0
h✝ : Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
⊢ Finset.card
      (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 =
    4 ^ Finset.card P.parts

Next tactic:
rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le]
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := by
  unfold chunk
  split_ifs
  · rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le]
    

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 α
hm : m ≠ 0
h✝ : Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
⊢ Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts ≤ 4 ^ Finset.card P.parts

Next tactic:
exact le_of_lt a_add_one_le_four_pow_parts_card
theorem card_chunk (hm : m ≠ 0) : (chunk hP G ε hU).parts.card = 4 ^ P.parts.card := by
  unfold chunk
  split_ifs
  · rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le]
    exact le_of_lt a_add_one_le_four_pow_parts_card
  · 

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 α
hm : m ≠ 0
h✝ : ¬Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
⊢ Finset.card
      (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 =
    4 ^ Finset.card P.parts

Next tactic:
rw [card_parts_equitabilise _ _ hm, tsub_add_cancel_of_le a_add_one_le_four_pow_parts_card]
theorem card_eq_of_mem_parts_chunk (hs : s ∈ (chunk hP G ε hU).parts) :
    s.card = m ∨ s.card = m + 1 := 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 α
hs : s ∈ (chunk hP G ε hU).parts
⊢ Finset.card s = m ∨ Finset.card s = m + 1

Next tactic:
unfold chunk at hs
theorem card_eq_of_mem_parts_chunk (hs : s ∈ (chunk hP G ε hU).parts) :
    s.card = m ∨ s.card = m + 1 := by
  unfold chunk at hs
  

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 α
hs :
  s ∈
    (if hUcard :
          Finset.card U =
            m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts) then
        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)
      else
        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
⊢ Finset.card s = m ∨ Finset.card s = m + 1

Next tactic:
split_ifs at hs
theorem card_eq_of_mem_parts_chunk (hs : s ∈ (chunk hP G ε hU).parts) :
    s.card = m ∨ s.card = m + 1 := by
  unfold chunk at hs
  split_ifs at hs <;> 

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 α
h✝ : Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
hs :
  s ∈
    (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
⊢ Finset.card s = m ∨ Finset.card s = m + 1

Next tactic:
exact card_eq_of_mem_parts_equitabilise hs
theorem card_eq_of_mem_parts_chunk (hs : s ∈ (chunk hP G ε hU).parts) :
    s.card = m ∨ s.card = m + 1 := by
  unfold chunk at hs
  split_ifs at hs <;> 

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 α
h✝ : ¬Finset.card U = m * 4 ^ Finset.card P.parts + (Fintype.card α / Finset.card P.parts - m * 4 ^ Finset.card P.parts)
hs :
  s ∈
    (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
⊢ Finset.card s = m ∨ Finset.card s = m + 1

Next tactic:
exact card_eq_of_mem_parts_equitabilise hs
theorem m_le_card_of_mem_chunk_parts (hs : s ∈ (chunk hP G ε hU).parts) : m ≤ s.card :=
  (card_eq_of_mem_parts_chunk hs).elim ge_of_eq fun i => 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 α
hs : s ∈ (chunk hP G ε hU).parts
i : Finset.card s = m + 1
⊢ m ≤ Finset.card s

Next tactic:
simp [i]
theorem card_le_m_add_one_of_mem_chunk_parts (hs : s ∈ (chunk hP G ε hU).parts) : s.card ≤ m + 1 :=
  (card_eq_of_mem_parts_chunk hs).elim (fun i => 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 α
hs : s ∈ (chunk hP G ε hU).parts
i : Finset.card s = m
⊢ Finset.card s ≤ m + 1

Next tactic:
simp [i]
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    (𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := 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 α
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card 𝒜) * ↑(Finset.card s) * (↑m / (↑m + 1)) ≤ ↑(Finset.card (sup 𝒜 id))

Next tactic:
rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    (𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := by
  rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
  

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 α
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card 𝒜) * ↑m * ↑(Finset.card s) ≤ ↑(Finset.card (sup 𝒜 id)) * (↑m + 1)

Next tactic:
refine' mul_le_mul _ _ (cast_nonneg _) (cast_nonneg _)
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    (𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := by
  rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (cast_nonneg _)
  · 

Proof state:
case refine'_1
α : 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 α
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card 𝒜) * ↑m ≤ ↑(Finset.card (sup 𝒜 id))

Next tactic:
rw [← (ofSubset _ h𝒜 rfl).sum_card_parts, ofSubset_parts, ← cast_mul, cast_le]
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    (𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := by
  rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (cast_nonneg _)
  · rw [← (ofSubset _ h𝒜 rfl).sum_card_parts, ofSubset_parts, ← cast_mul, cast_le]
    

Proof state:
case refine'_1
α : 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 α
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ Finset.card 𝒜 * m ≤ ∑ i in 𝒜, Finset.card i

Next tactic:
exact card_nsmul_le_sum _ _ _ fun x hx => m_le_card_of_mem_chunk_parts <| h𝒜 hx
private theorem le_sum_card_subset_chunk_parts (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    (𝒜.card : ℝ) * s.card * (m / (m + 1)) ≤ (𝒜.sup id).card := by
  rw [mul_div_assoc', div_le_iff coe_m_add_one_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (cast_nonneg _)
  · rw [← (ofSubset _ h𝒜 rfl).sum_card_parts, ofSubset_parts, ← cast_mul, cast_le]
    exact card_nsmul_le_sum _ _ _ fun x hx => m_le_card_of_mem_chunk_parts <| h𝒜 hx
  · 

Proof state:
case refine'_2
α : 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 α
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card s) ≤ ↑m + 1

Next tactic:
exact mod_cast card_le_m_add_one_of_mem_chunk_parts (h𝒜 hs)
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := 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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card (sup 𝒜 id)) ≤ ↑(Finset.card 𝒜) * ↑(Finset.card s) * ((↑m + 1) / ↑m)

Next tactic:
rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  

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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card (Finset.biUnion 𝒜 id)) * ↑m ≤ ↑(Finset.card 𝒜) * (↑m + 1) * ↑(Finset.card s)

Next tactic:
refine' mul_le_mul _ _ (cast_nonneg _) (by positivity)
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ 0 ≤ ↑(Finset.card 𝒜) * (↑m + 1)

Next tactic:
positivity
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (by positivity)
  · 

Proof state:
case refine'_1
α : 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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑(Finset.card (Finset.biUnion 𝒜 id)) ≤ ↑(Finset.card 𝒜) * (↑m + 1)

Next tactic:
norm_cast
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (by positivity)
  · norm_cast
    

Proof state:
case refine'_1
α : 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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ Finset.card (Finset.biUnion 𝒜 id) ≤ Finset.card 𝒜 * (m + 1)

Next tactic:
refine' card_biUnion_le_card_mul _ _ _ fun x hx => _
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (by positivity)
  · norm_cast
    refine' card_biUnion_le_card_mul _ _ _ fun x hx => _
    

Proof state:
case refine'_1
α : 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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
x : Finset α
hx : x ∈ 𝒜
⊢ Finset.card (id x) ≤ m + 1

Next tactic:
apply card_le_m_add_one_of_mem_chunk_parts (h𝒜 hx)
private theorem sum_card_subset_chunk_parts_le (m_pos : (0 : ℝ) < m)
    (h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts) (hs : s ∈ 𝒜) :
    ((𝒜.sup id).card : ℝ) ≤ 𝒜.card * s.card * ((m + 1) / m) := by
  rw [sup_eq_biUnion, mul_div_assoc', le_div_iff m_pos, mul_right_comm]
  refine' mul_le_mul _ _ (cast_nonneg _) (by positivity)
  · norm_cast
    refine' card_biUnion_le_card_mul _ _ _ fun x hx => _
    apply card_le_m_add_one_of_mem_chunk_parts (h𝒜 hx)
  · 

Proof state:
case refine'_2
α : 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 α
m_pos : 0 < ↑m
h𝒜 : 𝒜 ⊆ (chunk hP G ε hU).parts
hs : s ∈ 𝒜
⊢ ↑m ≤ ↑(Finset.card s)

Next tactic:
exact mod_cast m_le_card_of_mem_chunk_parts (h𝒜 hs)
private theorem one_sub_le_m_div_m_add_one_sq [Nonempty α]
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ↑1 - ε ^ 5 / ↑50 ≤ (m / (m + 1 : ℝ)) ^ 2 := 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 α
inst✝ : Nonempty α
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
⊢ 1 - ε ^ 5 / 50 ≤ (↑m / (↑m + 1)) ^ 2

Next tactic:
have : (m : ℝ) / (m + 1) = 1 - 1 / (m + 1) := by
    rw [one_sub_div coe_m_add_one_pos.ne', add_sub_cancel]
private theorem one_sub_le_m_div_m_add_one_sq [Nonempty α]
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ↑1 - ε ^ 5 / ↑50 ≤ (m / (m + 1 : ℝ)) ^ 2 := by
  have : (m : ℝ) / (m + 1) = 1 - 1 / (m + 1) := 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 α
inst✝ : Nonempty α
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
⊢ ↑m / (↑m + 1) = 1 - 1 / (↑m + 1)

Next tactic:
rw [one_sub_div coe_m_add_one_pos.ne', add_sub_cancel]