@@ -29,12 +29,16 @@ namespace SimpleGraph
29
29
/-- An explicit form for the constant in the triangle removal lemma.
30
30
31
31
Note that this depends on `SzemerediRegularity.bound`, which is a tower-type exponential. This means
32
- `triangleRemovalBound` is in practice absolutely tiny. -/
32
+ `triangleRemovalBound` is in practice absolutely tiny.
33
+
34
+ This definition is meant to be used for small values of `ε`, and in particular is junk for values
35
+ of `ε` greater than or equal to `1`. The junk value is chosen to be positive, so that
36
+ `0 < ε → 0 < triangleRemovalBound ε` regardless of whether `ε < 1` or not. -/
33
37
noncomputable def triangleRemovalBound (ε : ℝ) : ℝ :=
34
- min (2 * ⌈4 /ε⌉₊^3 )⁻¹ ((1 - ε/4 ) * (ε/(16 * bound (ε/8 ) ⌈4 /ε⌉₊))^3 )
38
+ min (2 * ⌈4 /ε⌉₊^3 )⁻¹ ((1 - min 1 ε/4 ) * (ε/(16 * bound (ε/8 ) ⌈4 /ε⌉₊))^3 )
35
39
36
- lemma triangleRemovalBound_pos (hε : 0 < ε) (hε₁ : ε ≤ 1 ) : 0 < triangleRemovalBound ε := by
37
- have : 0 < 1 - ε / 4 := by linarith
40
+ lemma triangleRemovalBound_pos (hε : 0 < ε) : 0 < triangleRemovalBound ε := by
41
+ have : 0 < 1 - min 1 ε/ 4 := by have := min_le_left 1 ε; linarith
38
42
unfold triangleRemovalBound
39
43
positivity
40
44
@@ -48,6 +52,10 @@ lemma triangleRemovalBound_mul_cube_lt (hε : 0 < ε) :
48
52
_ = 2 ⁻¹ := by rw [mul_inv, inv_mul_cancel_right₀]; positivity
49
53
_ < 1 := by norm_num
50
54
55
+ lemma triangleRemovalBound_le (hε₁ : ε ≤ 1 ) :
56
+ triangleRemovalBound ε ≤ (1 - ε/4 ) * (ε/(16 * bound (ε/8 ) ⌈4 /ε⌉₊)) ^ 3 := by
57
+ simp [triangleRemovalBound, hε₁]
58
+
51
59
private lemma aux {n k : ℕ} (hk : 0 < k) (hn : k ≤ n) : n < 2 * k * (n / k) := by
52
60
rw [mul_assoc, two_mul, ← add_lt_add_iff_right (n % k), add_right_comm, add_assoc,
53
61
mod_add_div n k, add_comm, add_lt_add_iff_right]
@@ -65,7 +73,7 @@ private lemma card_bound (hP₁ : P.IsEquipartition) (hP₃ : #P.parts ≤ bound
65
73
(div_le_iff₀' (by positivity)).2 <| mod_cast (aux ‹_› P.card_parts_le_card).le
66
74
_ ≤ (#s : ℝ) := mod_cast hP₁.average_le_card_part hX
67
75
68
- private lemma triangle_removal_aux (hε : 0 < ε) (hP₁ : P.IsEquipartition)
76
+ private lemma triangle_removal_aux (hε : 0 < ε) (hε₁ : ε ≤ 1 ) ( hP₁ : P.IsEquipartition)
69
77
(hP₃ : #P.parts ≤ bound (ε / 8 ) ⌈4 / ε⌉₊)
70
78
(ht : t ∈ (G.regularityReduced P (ε / 8 ) (ε / 4 )).cliqueFinset 3 ) :
71
79
triangleRemovalBound ε * card α ^ 3 ≤ #(G.cliqueFinset 3 ) := by
@@ -84,7 +92,7 @@ private lemma triangle_removal_aux (hε : 0 < ε) (hP₁ : P.IsEquipartition)
84
92
have : ε / 4 ≤ 1 := ‹ε / 4 ≤ _›.trans (by exact mod_cast G.edgeDensity_le_one _ _); linarith
85
93
calc
86
94
_ ≤ (1 - ε/4 ) * (ε/(16 * bound (ε/8 ) ⌈4 /ε⌉₊))^3 * card α ^ 3 := by
87
- gcongr; exact min_le_right _ _
95
+ gcongr; exact triangleRemovalBound_le hε₁
88
96
_ = (1 - 2 * (ε / 8 )) * (ε / 8 ) ^ 3 * (card α / (2 * bound (ε / 8 ) ⌈4 / ε⌉₊)) *
89
97
(card α / (2 * bound (ε / 8 ) ⌈4 / ε⌉₊)) * (card α / (2 * bound (ε / 8 ) ⌈4 / ε⌉₊)) := by
90
98
ring
@@ -132,7 +140,7 @@ lemma FarFromTriangleFree.le_card_cliqueFinset (hG : G.FarFromTriangleFree ε) :
132
140
rcases le_total (card α) l with hl' | hl'
133
141
· calc
134
142
_ ≤ triangleRemovalBound ε * ↑l ^ 3 := by
135
- gcongr; exact (triangleRemovalBound_pos hε hG.lt_one.le ).le
143
+ gcongr; exact (triangleRemovalBound_pos hε).le
136
144
_ ≤ (1 : ℝ) := (triangleRemovalBound_mul_cube_lt hε).le
137
145
_ ≤ _ := by simpa [one_le_iff_ne_zero] using (hG.cliqueFinset_nonempty hε).card_pos.ne'
138
146
obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := szemeredi_regularity G (by positivity : 0 < ε / 8 ) hl'
@@ -141,7 +149,7 @@ lemma FarFromTriangleFree.le_card_cliqueFinset (hG : G.FarFromTriangleFree ε) :
141
149
rw [mul_assoc] at k
142
150
replace k := lt_of_mul_lt_mul_left k zero_le_two
143
151
obtain ⟨t, ht⟩ := hG.cliqueFinset_nonempty' regularityReduced_le k
144
- exact triangle_removal_aux hε hP₁ hP₃ ht
152
+ exact triangle_removal_aux hε hG.lt_one.le hP₁ hP₃ ht
145
153
146
154
/-- **Triangle Removal Lemma** . If there are not too many triangles (on the order of `(card α)^3`)
147
155
then they can all be removed by removing a few edges (on the order of `(card α)^2`). -/
@@ -154,3 +162,23 @@ lemma triangle_removal (hG : #(G.cliqueFinset 3) < triangleRemovalBound ε * car
154
162
exact le_of_not_gt fun i ↦ h G' hG _ i hG'
155
163
156
164
end SimpleGraph
165
+
166
+ namespace Mathlib.Meta.Positivity
167
+ open Lean.Meta Qq SimpleGraph
168
+
169
+ /-- Extension for the `positivity` tactic: `SimpleGraph.triangleRemovalBound ε` is positive
170
+ if `ε` is.
171
+
172
+ This exploits the positivity of the junk value of `triangleRemovalBound ε` for `ε ≥ 1`. -/
173
+ @[positivity triangleRemovalBound _]
174
+ def evalTriangleRemovalBound : PositivityExt where eval {u α} _zα _pα e := do
175
+ match u, α, e with
176
+ | 0 , ~q(ℝ), ~q(triangleRemovalBound $ε) =>
177
+ let .positive hε ← core q(inferInstance) q(inferInstance) ε | failure
178
+ assertInstancesCommute
179
+ pure (.positive q(triangleRemovalBound_pos $hε))
180
+ | _, _, _ => throwError "failed to match on Int.ceil application"
181
+
182
+ example (ε : ℝ) (hε : 0 < ε) : 0 < triangleRemovalBound ε := by positivity
183
+
184
+ end Mathlib.Meta.Positivity
0 commit comments