/-- Lower bound on the edge densities between non-uniform parts of `SzemerediRegularity.star`. -/
private theorem edgeDensity_star_not_uniform [Nonempty α]
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
    (hε₁ : ε ≤ 1) {hU : U ∈ P.parts} {hV : V ∈ P.parts} (hUVne : U ≠ V) (hUV : ¬G.IsUniform ε U V) :
    ↑3 / ↑4 * ε ≤
    |(∑ ab in (star hP G ε hU V).product (star hP G ε hV U), (G.edgeDensity ab.1 ab.2 : ℝ)) /
      ((star hP G ε hU V).card * (star hP G ε hV U).card) -
        (∑ ab in (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
          (G.edgeDensity ab.1 ab.2 : ℝ)) / (16 : ℝ) ^ P.parts.card| := by
  rw [show (16 : ℝ) = ↑4 ^ 2 by norm_num, pow_right_comm, sq ((4 : ℝ) ^ _)]
  set p : ℝ :=
    (∑ ab in (star hP G ε hU V).product (star hP G ε hV U), (G.edgeDensity ab.1 ab.2 : ℝ)) /
      ((star hP G ε hU V).card * (star hP G ε hV U).card)
  set q : ℝ :=
    (∑ ab in (chunk hP G ε hU).parts.product (chunk hP G ε hV).parts,
      (G.edgeDensity ab.1 ab.2 : ℝ)) / (↑4 ^ P.parts.card * ↑4 ^ P.parts.card)
  change _ ≤ |p - q|
  set r : ℝ := ↑(G.edgeDensity ((star hP G ε hU V).biUnion id) ((star hP G ε hV U).biUnion id))
  set s : ℝ := ↑(G.edgeDensity (G.nonuniformWitness ε U V) (G.nonuniformWitness ε V U))
  set t : ℝ := ↑(G.edgeDensity U V)
  have hrs : |r - s| ≤ ε / 5 := abs_density_star_sub_density_le_eps hPε hε₁ hUVne hUV
  have hst : ε ≤ |s - t| := by
    -- After leanprover/lean4#2734, we need to do the zeta reduction before `mod_cast`.
    unfold_let s t
    exact mod_cast G.nonuniformWitness_spec hUVne hUV
  have hpr : |p - r| ≤ ε ^ 5 / 49 :=
    average_density_near_total_density hPα hPε hε₁ star_subset_chunk star_subset_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 α
inst✝ : Nonempty α
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
hε₁ : ε ≤ 1
hU : U ∈ P.parts
hV : V ∈ P.parts
hUVne : U ≠ V
hUV : ¬SimpleGraph.IsUniform G ε U V
p : ℝ :=
  (∑ ab in Finset.product (star hP G ε hU V) (star hP G ε hV U), ↑(SimpleGraph.edgeDensity G ab.1 ab.2)) /
    (↑(Finset.card (star hP G ε hU V)) * ↑(Finset.card (star hP G ε hV U)))
q : ℝ :=
  (∑ ab in Finset.product (chunk hP G ε hU).parts (chunk hP G ε hV).parts, ↑(SimpleGraph.edgeDensity G ab.1 ab.2)) /
    (4 ^ Finset.card P.parts * 4 ^ Finset.card P.parts)
r : ℝ := ↑(SimpleGraph.edgeDensity G (Finset.biUnion (star hP G ε hU V) id) (Finset.biUnion (star hP G ε hV U) id))
s : ℝ := ↑(SimpleGraph.edgeDensity G (SimpleGraph.nonuniformWitness G ε U V) (SimpleGraph.nonuniformWitness G ε V U))
t : ℝ := ↑(SimpleGraph.edgeDensity G U V)
hrs : |r - s| ≤ ε / 5
hst : ε ≤ |s - t|
hpr : |p - r| ≤ ε ^ 5 / 49
⊢ 3 / 4 * ε ≤ |p - q|

Next tactic:
have hqt : |q - t| ≤ ε ^ 5 / 49 := by
    have := average_density_near_total_density hPα hPε hε₁
      (Subset.refl (chunk hP G ε hU).parts) (Subset.refl (chunk hP G ε hV).parts)
    simp_rw [← sup_eq_biUnion, supParts, card_chunk (m_pos hPα).ne', cast_pow] at this
    norm_num at this
    exact this