l3lab/ntp-mathlib huggingface dataset:
private theorem distinct_pairs_increment :
    (P.parts.offDiag.attach.biUnion fun UV =>
      (chunk hP G ε (mem_offDiag.1 UV.2).1).parts ×ˢ
      (chunk hP G ε (mem_offDiag.1 UV.2).2.1).parts) ⊆
    (increment hP G ε).parts.offDiag := by
  rintro ⟨Ui, Vj⟩
  

Proof state:
case mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
Ui Vj : Finset α
⊢ ((Ui, Vj) ∈
      Finset.biUnion (attach (offDiag P.parts)) fun UV =>
        (chunk hP G ε (_ : (↑UV).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑UV).2 ∈ P.parts)).parts) →
    (Ui, Vj) ∈ offDiag (increment hP G ε).parts

Next tactic:
simp only [increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists, exists_and_left,
    exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_offDiag,
    forall_exists_index, bex_imp, Ne.def]
private theorem distinct_pairs_increment :
    (P.parts.offDiag.attach.biUnion fun UV =>
      (chunk hP G ε (mem_offDiag.1 UV.2).1).parts ×ˢ
      (chunk hP G ε (mem_offDiag.1 UV.2).2.1).parts) ⊆
    (increment hP G ε).parts.offDiag := by
  rintro ⟨Ui, Vj⟩
  simp only [increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists, exists_and_left,
    exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_offDiag,
    forall_exists_index, bex_imp, Ne.def]
  

Proof state:
case mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
Ui Vj : Finset α
⊢ ∀ (x x_1 : Finset α) (x_2 : x ∈ P.parts ∧ x_1 ∈ P.parts ∧ ¬x = x_1),
    Ui ∈ (chunk hP G ε (_ : (↑{ val := (x, x_1), property := (_ : (x, x_1) ∈ offDiag P.parts) }).1 ∈ P.parts)).parts →
      Vj ∈ (chunk hP G ε (_ : (↑{ val := (x, x_1), property := (_ : (x, x_1) ∈ offDiag P.parts) }).2 ∈ P.parts)).parts →
        (∃ a,
            ∃ (h : a ∈ P.parts),
              Ui ∈ (chunk hP G ε (_ : ↑{ val := a, property := (_ : a ∈ P.parts) } ∈ P.parts)).parts) ∧
          (∃ a,
              ∃ (h : a ∈ P.parts),
                Vj ∈ (chunk hP G ε (_ : ↑{ val := a, property := (_ : a ∈ P.parts) } ∈ P.parts)).parts) ∧
            ¬Ui = Vj

Next tactic:
refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
private theorem distinct_pairs_increment :
    (P.parts.offDiag.attach.biUnion fun UV =>
      (chunk hP G ε (mem_offDiag.1 UV.2).1).parts ×ˢ
      (chunk hP G ε (mem_offDiag.1 UV.2).2.1).parts) ⊆
    (increment hP G ε).parts.offDiag := by
  rintro ⟨Ui, Vj⟩
  simp only [increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists, exists_and_left,
    exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_offDiag,
    forall_exists_index, bex_imp, Ne.def]
  refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
  

Proof state:
case mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
Ui Vj U V : Finset α
hUV : U ∈ P.parts ∧ V ∈ P.parts ∧ ¬U = V
hUi : Ui ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).1 ∈ P.parts)).parts
hVj : Vj ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).2 ∈ P.parts)).parts
⊢ ¬Ui = Vj

Next tactic:
rintro rfl
private theorem distinct_pairs_increment :
    (P.parts.offDiag.attach.biUnion fun UV =>
      (chunk hP G ε (mem_offDiag.1 UV.2).1).parts ×ˢ
      (chunk hP G ε (mem_offDiag.1 UV.2).2.1).parts) ⊆
    (increment hP G ε).parts.offDiag := by
  rintro ⟨Ui, Vj⟩
  simp only [increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists, exists_and_left,
    exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_offDiag,
    forall_exists_index, bex_imp, Ne.def]
  refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
  rintro rfl
  

Proof state:
case mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
Ui U V : Finset α
hUV : U ∈ P.parts ∧ V ∈ P.parts ∧ ¬U = V
hUi : Ui ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).1 ∈ P.parts)).parts
hVj : Ui ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).2 ∈ P.parts)).parts
⊢ False

Next tactic:
obtain ⟨i, hi⟩ := nonempty_of_mem_parts _ hUi
private theorem distinct_pairs_increment :
    (P.parts.offDiag.attach.biUnion fun UV =>
      (chunk hP G ε (mem_offDiag.1 UV.2).1).parts ×ˢ
      (chunk hP G ε (mem_offDiag.1 UV.2).2.1).parts) ⊆
    (increment hP G ε).parts.offDiag := by
  rintro ⟨Ui, Vj⟩
  simp only [increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists, exists_and_left,
    exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_offDiag,
    forall_exists_index, bex_imp, Ne.def]
  refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
  rintro rfl
  obtain ⟨i, hi⟩ := nonempty_of_mem_parts _ hUi
  

Proof state:
case mk.intro
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
Ui U V : Finset α
hUV : U ∈ P.parts ∧ V ∈ P.parts ∧ ¬U = V
hUi : Ui ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).1 ∈ P.parts)).parts
hVj : Ui ∈ (chunk hP G ε (_ : (↑{ val := (U, V), property := (_ : (U, V) ∈ offDiag P.parts) }).2 ∈ P.parts)).parts
i : α
hi : i ∈ Ui
⊢ False

Next tactic:
exact hUV.2.2 (P.disjoint.elim_finset hUV.1 hUV.2.1 i (Finpartition.le _ hUi hi) <|
    Finpartition.le _ hVj hi)
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ ∑ x in attach (offDiag P.parts),
      SzemerediRegularity.pairContrib G ε hP x / ↑(Finset.card (increment hP G ε).parts) ^ 2 ≤
    energy (increment hP G ε) G

Next tactic:
simp_rw [pairContrib, ← sum_div]
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ (∑ x in attach (offDiag P.parts),
        ∑ i in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
          edgeDensity G i.1 i.2 ^ 2) /
      ↑(Finset.card (increment hP G ε).parts) ^ 2 ≤
    energy (increment hP G ε) G

Next tactic:
refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ ∑ x in attach (offDiag P.parts),
      ∑ i in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
        edgeDensity G i.1 i.2 ^ 2 ≤
    ∑ uv in offDiag (increment hP G ε).parts, edgeDensity G uv.1 uv.2 ^ 2

Next tactic:
rw [← sum_biUnion]
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · 

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ ∑ x in
      Finset.biUnion (attach (offDiag P.parts)) fun x =>
        (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
      edgeDensity G x.1 x.2 ^ 2 ≤
    ∑ uv in offDiag (increment hP G ε).parts, edgeDensity G uv.1 uv.2 ^ 2

Next tactic:
exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ Set.PairwiseDisjoint ↑(attach (offDiag P.parts)) fun x =>
    (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts

Next tactic:
simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
  

Proof state:
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
⊢ Set.Pairwise ↑(attach (offDiag P.parts)) fun x y =>
    ∀ ⦃a : Finset α × Finset α⦄,
      a.1 ∈ (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ∧ a.2 ∈ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts →
        ¬(a.1 ∈ (chunk hP G ε (_ : (↑y).1 ∈ P.parts)).parts ∧ a.2 ∈ (chunk hP G ε (_ : (↑y).2 ∈ P.parts)).parts)

Next tactic:
rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
  rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
  

Proof state:
case mk.mk.mk.mk.mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
s₁ s₂ : Finset α
hs : (s₁, s₂) ∈ offDiag P.parts
a✝¹ : { val := (s₁, s₂), property := hs } ∈ ↑(attach (offDiag P.parts))
t₁ t₂ : Finset α
ht : (t₁, t₂) ∈ offDiag P.parts
a✝ : { val := (t₁, t₂), property := ht } ∈ ↑(attach (offDiag P.parts))
hst : { val := (s₁, s₂), property := hs } ≠ { val := (t₁, t₂), property := ht }
u v : Finset α
huv₁ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs }).2 ∈ P.parts)).parts
huv₂ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht }).2 ∈ P.parts)).parts
⊢ False

Next tactic:
rw [mem_offDiag] at hs ht
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
  rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
  rw [mem_offDiag] at hs ht
  

Proof state:
case mk.mk.mk.mk.mk
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
s₁ s₂ : Finset α
hs✝ : (s₁, s₂) ∈ offDiag P.parts
hs : (s₁, s₂).1 ∈ P.parts ∧ (s₁, s₂).2 ∈ P.parts ∧ (s₁, s₂).1 ≠ (s₁, s₂).2
a✝¹ : { val := (s₁, s₂), property := hs✝ } ∈ ↑(attach (offDiag P.parts))
t₁ t₂ : Finset α
ht✝ : (t₁, t₂) ∈ offDiag P.parts
ht : (t₁, t₂).1 ∈ P.parts ∧ (t₁, t₂).2 ∈ P.parts ∧ (t₁, t₂).1 ≠ (t₁, t₂).2
a✝ : { val := (t₁, t₂), property := ht✝ } ∈ ↑(attach (offDiag P.parts))
hst : { val := (s₁, s₂), property := hs✝ } ≠ { val := (t₁, t₂), property := ht✝ }
u v : Finset α
huv₁ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).2 ∈ P.parts)).parts
huv₂ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).2 ∈ P.parts)).parts
⊢ False

Next tactic:
obtain ⟨a, ha⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.1
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
  rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
  rw [mem_offDiag] at hs ht
  obtain ⟨a, ha⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.1
  

Proof state:
case mk.mk.mk.mk.mk.intro
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
s₁ s₂ : Finset α
hs✝ : (s₁, s₂) ∈ offDiag P.parts
hs : (s₁, s₂).1 ∈ P.parts ∧ (s₁, s₂).2 ∈ P.parts ∧ (s₁, s₂).1 ≠ (s₁, s₂).2
a✝¹ : { val := (s₁, s₂), property := hs✝ } ∈ ↑(attach (offDiag P.parts))
t₁ t₂ : Finset α
ht✝ : (t₁, t₂) ∈ offDiag P.parts
ht : (t₁, t₂).1 ∈ P.parts ∧ (t₁, t₂).2 ∈ P.parts ∧ (t₁, t₂).1 ≠ (t₁, t₂).2
a✝ : { val := (t₁, t₂), property := ht✝ } ∈ ↑(attach (offDiag P.parts))
hst : { val := (s₁, s₂), property := hs✝ } ≠ { val := (t₁, t₂), property := ht✝ }
u v : Finset α
huv₁ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).2 ∈ P.parts)).parts
huv₂ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).2 ∈ P.parts)).parts
a : α
ha : a ∈ (u, v).1
⊢ False

Next tactic:
obtain ⟨b, hb⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.2
theorem offDiag_pairs_le_increment_energy :
    ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / ((increment hP G ε).parts.card : ℚ) ^ 2 ≤
    (increment hP G ε).energy G := by
  simp_rw [pairContrib, ← sum_div]
  refine' div_le_div_of_le_of_nonneg (α := ℚ) _ (sq_nonneg _)
  rw [← sum_biUnion]
  · exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
  simp (config := { unfoldPartialApp := true }) only [Set.PairwiseDisjoint, Function.onFun,
    disjoint_left, inf_eq_inter, mem_inter, mem_product]
  rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
  rw [mem_offDiag] at hs ht
  obtain ⟨a, ha⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.1
  obtain ⟨b, hb⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.2
  

Proof state:
case mk.mk.mk.mk.mk.intro.intro
α : Type u_1
inst✝ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
s₁ s₂ : Finset α
hs✝ : (s₁, s₂) ∈ offDiag P.parts
hs : (s₁, s₂).1 ∈ P.parts ∧ (s₁, s₂).2 ∈ P.parts ∧ (s₁, s₂).1 ≠ (s₁, s₂).2
a✝¹ : { val := (s₁, s₂), property := hs✝ } ∈ ↑(attach (offDiag P.parts))
t₁ t₂ : Finset α
ht✝ : (t₁, t₂) ∈ offDiag P.parts
ht : (t₁, t₂).1 ∈ P.parts ∧ (t₁, t₂).2 ∈ P.parts ∧ (t₁, t₂).1 ≠ (t₁, t₂).2
a✝ : { val := (t₁, t₂), property := ht✝ } ∈ ↑(attach (offDiag P.parts))
hst : { val := (s₁, s₂), property := hs✝ } ≠ { val := (t₁, t₂), property := ht✝ }
u v : Finset α
huv₁ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (s₁, s₂), property := hs✝ }).2 ∈ P.parts)).parts
huv₂ :
  (u, v).1 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).1 ∈ P.parts)).parts ∧
    (u, v).2 ∈ (chunk hP G ε (_ : (↑{ val := (t₁, t₂), property := ht✝ }).2 ∈ P.parts)).parts
a : α
ha : a ∈ (u, v).1
b : α
hb : b ∈ (u, v).2
⊢ False

Next tactic:
exact hst (Subtype.ext_val <| Prod.ext
    (P.disjoint.elim_finset hs.1 ht.1 a (Finpartition.le _ huv₁.1 ha) <|
      Finpartition.le _ huv₂.1 ha) <|
        P.disjoint.elim_finset hs.2.1 ht.2.1 b (Finpartition.le _ huv₁.2 hb) <|
          Finpartition.le _ huv₂.2 hb)
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  

Proof state:
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
⊢ (↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 + if SimpleGraph.IsUniform G ε (↑x).1 (↑x).2 then 0 else ε ^ 4 / 3) ≤
    ↑(SzemerediRegularity.pairContrib G ε hP x) / 16 ^ Finset.card P.parts

Next tactic:
rw [pairContrib]
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  rw [pairContrib]
  

Proof state:
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
⊢ (↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 + if SimpleGraph.IsUniform G ε (↑x).1 (↑x).2 then 0 else ε ^ 4 / 3) ≤
    ↑(∑ i in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
          edgeDensity G i.1 i.2 ^ 2) /
      16 ^ Finset.card P.parts

Next tactic:
push_cast
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  rw [pairContrib]
  push_cast
  

Proof state:
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
⊢ (↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 + if SimpleGraph.IsUniform G ε (↑x).1 (↑x).2 then 0 else ε ^ 4 / 3) ≤
    (∑ x in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
        ↑(edgeDensity G x.1 x.2) ^ 2) /
      16 ^ Finset.card P.parts

Next tactic:
split_ifs with h
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  rw [pairContrib]
  push_cast
  split_ifs with h
  · 

Proof state:
case pos
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
h : SimpleGraph.IsUniform G ε (↑x).1 (↑x).2
⊢ ↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 + 0 ≤
    (∑ x in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
        ↑(edgeDensity G x.1 x.2) ^ 2) /
      16 ^ Finset.card P.parts

Next tactic:
rw [add_zero]
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  rw [pairContrib]
  push_cast
  split_ifs with h
  · rw [add_zero]
    

Proof state:
case pos
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
h : SimpleGraph.IsUniform G ε (↑x).1 (↑x).2
⊢ ↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 ≤
    (∑ x in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
        ↑(edgeDensity G x.1 x.2) ^ 2) /
      16 ^ Finset.card P.parts

Next tactic:
exact edgeDensity_chunk_uniform hPα hPε _ _
theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
    (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
    ((G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
      if G.IsUniform ε x.1.1 x.1.2 then (0 : ℝ) else ε ^ 4 / 3) ≤
    pairContrib G ε hP x / ↑16 ^ P.parts.card := by
  rw [pairContrib]
  push_cast
  split_ifs with h
  · rw [add_zero]
    exact edgeDensity_chunk_uniform hPα hPε _ _
  · 

Proof state:
case neg
α : Type u_1
inst✝¹ : Fintype α
P : Finpartition univ
hP : IsEquipartition P
G : SimpleGraph α
ε : ℝ
inst✝ : Nonempty α
x : { i // i ∈ offDiag P.parts }
hε₁ : ε ≤ 1
hPα : Finset.card P.parts * 16 ^ Finset.card P.parts ≤ Fintype.card α
hPε : 100 ≤ 4 ^ Finset.card P.parts * ε ^ 5
h : ¬SimpleGraph.IsUniform G ε (↑x).1 (↑x).2
⊢ ↑(edgeDensity G (↑x).1 (↑x).2) ^ 2 - ε ^ 5 / 25 + ε ^ 4 / 3 ≤
    (∑ x in (chunk hP G ε (_ : (↑x).1 ∈ P.parts)).parts ×ˢ (chunk hP G ε (_ : (↑x).2 ∈ P.parts)).parts,
        ↑(edgeDensity G x.1 x.2) ^ 2) /
      16 ^ Finset.card P.parts

Next tactic:
exact edgeDensity_chunk_not_uniform hPα hPε hε₁ (mem_offDiag.1 x.2).2.2 h