|
| 1 | +/- |
| 2 | +Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Yaël Dillies, Bhavik Mehta |
| 5 | +-/ |
| 6 | +import combinatorics.simple_graph.regularity.chunk |
| 7 | +import combinatorics.simple_graph.regularity.energy |
| 8 | + |
| 9 | +/-! |
| 10 | +# Increment partition for Szemerédi Regularity Lemma |
| 11 | +
|
| 12 | +In the proof of Szemerédi Regularity Lemma, we need to partition each part of a starting partition |
| 13 | +to increase the energy. This file defines the partition obtained by gluing the parts partitions |
| 14 | +together (the *increment partition*) and shows that the energy globally increases. |
| 15 | +
|
| 16 | +This entire file is internal to the proof of Szemerédi Regularity Lemma. |
| 17 | +
|
| 18 | +## Main declarations |
| 19 | +
|
| 20 | +* `szemeredi_regularity.increment`: The increment partition. |
| 21 | +* `szemeredi_regularity.card_increment`: The increment partition is much bigger than the original, |
| 22 | + but by a controlled amount. |
| 23 | +* `szemeredi_regularity.energy_increment`: The increment partition has energy greater than the |
| 24 | + original by a known (small) fixed amount. |
| 25 | +
|
| 26 | +## TODO |
| 27 | +
|
| 28 | +Once ported to mathlib4, this file will be a great golfing ground for Heather's new tactic |
| 29 | +`rel_congr`. |
| 30 | +
|
| 31 | +## References |
| 32 | +
|
| 33 | +[Yaël Dillies, Bhavik Mehta, *Formalising Szemerédi’s Regularity Lemma in Lean*][srl_itp] |
| 34 | +-/ |
| 35 | + |
| 36 | +open finset fintype simple_graph szemeredi_regularity |
| 37 | +open_locale big_operators classical |
| 38 | + |
| 39 | +local attribute [positivity] tactic.positivity_szemeredi_regularity |
| 40 | + |
| 41 | +variables {α : Type*} [fintype α] {P : finpartition (univ : finset α)} (hP : P.is_equipartition) |
| 42 | + (G : simple_graph α) (ε : ℝ) |
| 43 | + |
| 44 | +local notation `m` := (card α/step_bound P.parts.card : ℕ) |
| 45 | + |
| 46 | +namespace szemeredi_regularity |
| 47 | + |
| 48 | +/-- The **increment partition** in Szemerédi's Regularity Lemma. |
| 49 | +
|
| 50 | +If an equipartition is *not* uniform, then the increment partition is a (much bigger) equipartition |
| 51 | +with a slightly higher energy. This is helpful since the energy is bounded by a constant (see |
| 52 | +`szemeredi_regularity.energy_le_one`), so this process eventually terminates and yields a |
| 53 | +not-too-big uniform equipartition. -/ |
| 54 | +noncomputable def increment : finpartition (univ : finset α) := P.bind $ λ U, chunk hP G ε |
| 55 | + |
| 56 | +open finpartition finpartition.is_equipartition |
| 57 | + |
| 58 | +variables {hP G ε} |
| 59 | + |
| 60 | +/-- The increment partition has a prescribed (very big) size in terms of the original partition. -/ |
| 61 | +lemma card_increment (hPα : P.parts.card * 16^P.parts.card ≤ card α) (hPG : ¬P.is_uniform G ε) : |
| 62 | + (increment hP G ε).parts.card = step_bound P.parts.card := |
| 63 | +begin |
| 64 | + have hPα' : step_bound P.parts.card ≤ card α := |
| 65 | + (mul_le_mul_left' (pow_le_pow_of_le_left' (by norm_num) _) _).trans hPα, |
| 66 | + have hPpos : 0 < step_bound P.parts.card := step_bound_pos (nonempty_of_not_uniform hPG).card_pos, |
| 67 | + rw [increment, card_bind], |
| 68 | + simp_rw [chunk, apply_dite finpartition.parts, apply_dite card, sum_dite], |
| 69 | + rw [sum_const_nat, sum_const_nat, card_attach, card_attach], rotate, |
| 70 | + any_goals { exact λ x hx, card_parts_equitabilise _ _ (nat.div_pos hPα' hPpos).ne' }, |
| 71 | + rw [nat.sub_add_cancel a_add_one_le_four_pow_parts_card, nat.sub_add_cancel ((nat.le_succ _).trans |
| 72 | + a_add_one_le_four_pow_parts_card), ←add_mul], |
| 73 | + congr, |
| 74 | + rw [filter_card_add_filter_neg_card_eq_card, card_attach], |
| 75 | +end |
| 76 | + |
| 77 | +lemma increment_is_equipartition (hP : P.is_equipartition) (G : simple_graph α) (ε : ℝ) : |
| 78 | + (increment hP G ε).is_equipartition := |
| 79 | +begin |
| 80 | + simp_rw [is_equipartition, set.equitable_on_iff_exists_eq_eq_add_one], |
| 81 | + refine ⟨m, λ A hA, _⟩, |
| 82 | + rw [mem_coe, increment, mem_bind] at hA, |
| 83 | + obtain ⟨U, hU, hA⟩ := hA, |
| 84 | + exact card_eq_of_mem_parts_chunk hA, |
| 85 | +end |
| 86 | + |
| 87 | +private lemma distinct_pairs_increment : |
| 88 | + P.parts.off_diag.attach.bUnion |
| 89 | + (λ UV, (chunk hP G ε (mem_off_diag.1 UV.2).1).parts ×ˢ |
| 90 | + (chunk hP G ε (mem_off_diag.1 UV.2).2.1).parts) |
| 91 | + ⊆ (increment hP G ε).parts.off_diag := |
| 92 | +begin |
| 93 | + rintro ⟨Ui, Vj⟩, |
| 94 | + simp only [increment, mem_off_diag, bind_parts, mem_bUnion, prod.exists, exists_and_distrib_left, |
| 95 | + exists_prop, mem_product, mem_attach, true_and, subtype.exists, and_imp, mem_off_diag, |
| 96 | + forall_exists_index, bex_imp_distrib, ne.def], |
| 97 | + refine λ U V hUV hUi hVj, ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩, |
| 98 | + rintro rfl, |
| 99 | + obtain ⟨i, hi⟩ := nonempty_of_mem_parts _ hUi, |
| 100 | + exact hUV.2.2 (P.disjoint.elim_finset hUV.1 hUV.2.1 i (finpartition.le _ hUi hi) $ |
| 101 | + finpartition.le _ hVj hi), |
| 102 | +end |
| 103 | + |
| 104 | +/-- The contribution to `finpartition.energy` of a pair of distinct parts of a finpartition. -/ |
| 105 | +private noncomputable def pair_contrib (G : simple_graph α) (ε : ℝ) (hP : P.is_equipartition) |
| 106 | + (x : {x // x ∈ P.parts.off_diag}) : ℚ := |
| 107 | +∑ i in (chunk hP G ε (mem_off_diag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_off_diag.1 x.2).2.1).parts, |
| 108 | + G.edge_density i.fst i.snd ^ 2 |
| 109 | + |
| 110 | +lemma off_diag_pairs_le_increment_energy : |
| 111 | + ∑ x in P.parts.off_diag.attach, pair_contrib G ε hP x / (increment hP G ε).parts.card ^ 2 ≤ |
| 112 | + (increment hP G ε).energy G := |
| 113 | +begin |
| 114 | + simp_rw [pair_contrib, ←sum_div], |
| 115 | + refine div_le_div_of_le_of_nonneg _ (sq_nonneg _), |
| 116 | + rw ←sum_bUnion, |
| 117 | + { exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment (λ i _ _, sq_nonneg _) }, |
| 118 | + simp only [set.pairwise_disjoint, function.on_fun, disjoint_left, inf_eq_inter, mem_inter, |
| 119 | + mem_product], |
| 120 | + rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂, |
| 121 | + rw mem_off_diag at hs ht, |
| 122 | + obtain ⟨a, ha⟩ := finpartition.nonempty_of_mem_parts _ huv₁.1, |
| 123 | + obtain ⟨b, hb⟩ := finpartition.nonempty_of_mem_parts _ huv₁.2, |
| 124 | + exact hst (subtype.ext_val $ prod.ext |
| 125 | + (P.disjoint.elim_finset hs.1 ht.1 a |
| 126 | + (finpartition.le _ huv₁.1 ha) $ finpartition.le _ huv₂.1 ha) $ |
| 127 | + P.disjoint.elim_finset hs.2.1 ht.2.1 b |
| 128 | + (finpartition.le _ huv₁.2 hb) $ finpartition.le _ huv₂.2 hb), |
| 129 | +end |
| 130 | + |
| 131 | +lemma pair_contrib_lower_bound [nonempty α] (x : {i // i ∈ P.parts.off_diag}) (hε₁ : ε ≤ 1) |
| 132 | + (hPα : P.parts.card * 16^P.parts.card ≤ card α) (hPε : 100 ≤ 4^P.parts.card * ε^5) : |
| 133 | + ↑(G.edge_density x.1.1 x.1.2)^2 - ε^5/25 + (if G.is_uniform ε x.1.1 x.1.2 then 0 else ε^4/3) ≤ |
| 134 | + pair_contrib G ε hP x / (16^P.parts.card) := |
| 135 | +begin |
| 136 | + rw pair_contrib, |
| 137 | + push_cast, |
| 138 | + split_ifs, |
| 139 | + { rw add_zero, |
| 140 | + exact edge_density_chunk_uniform hPα hPε _ _ }, |
| 141 | + { exact edge_density_chunk_not_uniform hPα hPε hε₁ (mem_off_diag.1 x.2).2.2 h } |
| 142 | +end |
| 143 | + |
| 144 | +lemma uniform_add_nonuniform_eq_off_diag_pairs [nonempty α] (hε₁ : ε ≤ 1) (hP₇ : 7 ≤ P.parts.card) |
| 145 | + (hPα : P.parts.card * 16^P.parts.card ≤ card α) (hPε : 100 ≤ 4^P.parts.card * ε^5) |
| 146 | + (hPG : ¬P.is_uniform G ε) : |
| 147 | + (∑ x in P.parts.off_diag, G.edge_density x.1 x.2 ^ 2 + P.parts.card^2 * (ε ^ 5 / 4) : ℝ) |
| 148 | + / P.parts.card ^ 2 |
| 149 | + ≤ ∑ x in P.parts.off_diag.attach, pair_contrib G ε hP x / (increment hP G ε).parts.card ^ 2 := |
| 150 | +begin |
| 151 | + conv_rhs |
| 152 | + { rw [←sum_div, card_increment hPα hPG, step_bound, ←nat.cast_pow, mul_pow, pow_right_comm, |
| 153 | + nat.cast_mul, mul_comm, ←div_div, (show 4^2 = 16, by norm_num), sum_div] }, |
| 154 | + rw [←nat.cast_pow, nat.cast_pow 16], |
| 155 | + refine div_le_div_of_le_of_nonneg _ (nat.cast_nonneg _), |
| 156 | + norm_num, |
| 157 | + transitivity ∑ x in P.parts.off_diag.attach, |
| 158 | + (G.edge_density x.1.1 x.1.2^2 - ε^5/25 + if G.is_uniform ε x.1.1 x.1.2 then 0 else ε^4/3 : ℝ), |
| 159 | + swap, |
| 160 | + { exact sum_le_sum (λ i hi, pair_contrib_lower_bound i hε₁ hPα hPε) }, |
| 161 | + have : ∑ x in P.parts.off_diag.attach, |
| 162 | + (G.edge_density x.1.1 x.1.2^2 - ε^5/25 + if G.is_uniform ε x.1.1 x.1.2 then 0 else ε^4/3 : ℝ) = |
| 163 | + ∑ x in P.parts.off_diag, |
| 164 | + (G.edge_density x.1 x.2^2 - ε^5/25 + if G.is_uniform ε x.1 x.2 then 0 else ε^4/3), |
| 165 | + { convert sum_attach, refl }, |
| 166 | + rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero, |
| 167 | + zero_add, sum_const, nsmul_eq_mul, ←finpartition.non_uniforms], |
| 168 | + rw [finpartition.is_uniform, not_le] at hPG, |
| 169 | + refine le_trans _ (add_le_add_left (mul_le_mul_of_nonneg_right hPG.le $ by positivity) _), |
| 170 | + conv_rhs { congr, congr, skip, rw [off_diag_card], congr, congr, |
| 171 | + conv { congr, skip, rw ←mul_one P.parts.card }, rw ←nat.mul_sub_left_distrib }, |
| 172 | + simp_rw [mul_assoc, sub_add_eq_add_sub, add_sub_assoc, ←mul_sub_left_distrib, mul_div_assoc' ε, |
| 173 | + ←pow_succ, div_eq_mul_one_div (ε^5), ←mul_sub_left_distrib, mul_left_comm _ (ε^5), sq, |
| 174 | + nat.cast_mul, mul_assoc, ←mul_assoc (ε ^ 5)], |
| 175 | + refine add_le_add_left (mul_le_mul_of_nonneg_left _ $ by positivity) _, |
| 176 | + rw [nat.cast_sub (P.parts_nonempty $ univ_nonempty.ne_empty).card_pos, mul_sub_right_distrib, |
| 177 | + nat.cast_one, one_mul, le_sub_comm, ←mul_sub_left_distrib, |
| 178 | + ←div_le_iff (show (0:ℝ) < 1/3 - 1/25 - 1/4, by norm_num)], |
| 179 | + exact le_trans (show _ ≤ (7:ℝ), by norm_num) (by exact_mod_cast hP₇), |
| 180 | +end |
| 181 | + |
| 182 | +/-- The increment partition has energy greater than the original one by a known fixed amount. -/ |
| 183 | +lemma energy_increment [nonempty α] (hP : P.is_equipartition) (hP₇ : 7 ≤ P.parts.card) |
| 184 | + (hε : 100 < 4^P.parts.card * ε^5) (hPα : P.parts.card * 16^P.parts.card ≤ card α) |
| 185 | + (hPG : ¬P.is_uniform G ε) (hε₁ : ε ≤ 1) : |
| 186 | + ↑(P.energy G) + ε^5 / 4 ≤ (increment hP G ε).energy G := |
| 187 | +begin |
| 188 | + rw coe_energy, |
| 189 | + have h := uniform_add_nonuniform_eq_off_diag_pairs hε₁ hP₇ hPα hε.le hPG, |
| 190 | + rw [add_div, mul_div_cancel_left] at h, |
| 191 | + exact h.trans (by exact_mod_cast off_diag_pairs_le_increment_energy), |
| 192 | + positivity, |
| 193 | +end |
| 194 | + |
| 195 | +end szemeredi_regularity |
0 commit comments