combinatorics.simple_graph.regularity.increment ⟷
Mathlib.Combinatorics.SimpleGraph.Regularity.Increment
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -109,7 +109,7 @@ private theorem distinct_pairs_increment :
rintro ⟨Ui, Vj⟩
simp only [increment, mem_off_diag, bind_parts, mem_bUnion, Prod.exists, exists_and_left,
exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp, mem_off_diag,
- forall_exists_index, bex_imp, Ne.def]
+ forall_exists_index, exists₂_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
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -212,7 +212,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
rw [← mul_one P.parts.card]
rw [← Nat.mul_sub_left_distrib]
simp_rw [mul_assoc, sub_add_eq_add_sub, add_sub_assoc, ← mul_sub_left_distrib, mul_div_assoc' ε, ←
- pow_succ, div_eq_mul_one_div (ε ^ 5), ← mul_sub_left_distrib, mul_left_comm _ (ε ^ 5), sq,
+ pow_succ', div_eq_mul_one_div (ε ^ 5), ← mul_sub_left_distrib, mul_left_comm _ (ε ^ 5), sq,
Nat.cast_mul, mul_assoc, ← mul_assoc (ε ^ 5)]
refine' add_le_add_left (mul_le_mul_of_nonneg_left _ <| by positivity) _
rw [Nat.cast_sub (P.parts_nonempty <| univ_nonempty.ne_empty).card_pos, mul_sub_right_distrib,
@@ -230,7 +230,7 @@ theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P
by
rw [coe_energy]
have h := uniform_add_nonuniform_eq_off_diag_pairs hε₁ hP₇ hPα hε.le hPG
- rw [add_div, mul_div_cancel_left] at h
+ rw [add_div, mul_div_cancel_left₀] at h
exact h.trans (by exact_mod_cast off_diag_pairs_le_increment_energy)
positivity
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -93,7 +93,7 @@ theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α)
by
simp_rw [is_equipartition, Set.equitableOn_iff_exists_eq_eq_add_one]
refine' ⟨m, fun A hA => _⟩
- rw [mem_coe, increment, mem_bind] at hA
+ rw [mem_coe, increment, mem_bind] at hA
obtain ⟨U, hU, hA⟩ := hA
exact card_eq_of_mem_parts_chunk hA
#align szemeredi_regularity.increment_is_equipartition SzemerediRegularity.increment_isEquipartition
@@ -130,13 +130,13 @@ theorem offDiag_pairs_le_increment_energy :
(increment hP G ε).energy G :=
by
simp_rw [pair_contrib, ← sum_div]
- refine' div_le_div_of_le_of_nonneg _ (sq_nonneg _)
+ refine' div_le_div_of_nonneg_right _ (sq_nonneg _)
rw [← sum_bUnion]
· exact sum_le_sum_of_subset_of_nonneg distinct_pairs_increment fun i _ _ => sq_nonneg _
simp 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_off_diag] at hs ht
+ rw [mem_off_diag] at hs ht
obtain ⟨a, ha⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.1
obtain ⟨b, hb⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.2
exact
@@ -177,7 +177,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
rw [← sum_div, card_increment hPα hPG, step_bound, ← Nat.cast_pow, mul_pow, pow_right_comm,
Nat.cast_mul, mul_comm, ← div_div, show 4 ^ 2 = 16 by norm_num, sum_div]
rw [← Nat.cast_pow, Nat.cast_pow 16]
- refine' div_le_div_of_le_of_nonneg _ (Nat.cast_nonneg _)
+ refine' div_le_div_of_nonneg_right _ (Nat.cast_nonneg _)
norm_num
trans
∑ x in P.parts.off_diag.attach,
@@ -197,7 +197,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
by convert sum_attach; rfl
rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms]
- rw [Finpartition.IsUniform, not_le] at hPG
+ rw [Finpartition.IsUniform, not_le] at hPG
refine' le_trans _ (add_le_add_left (mul_le_mul_of_nonneg_right hPG.le <| by positivity) _)
conv_rhs =>
congr
@@ -230,7 +230,7 @@ theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P
by
rw [coe_energy]
have h := uniform_add_nonuniform_eq_off_diag_pairs hε₁ hP₇ hPα hε.le hPG
- rw [add_div, mul_div_cancel_left] at h
+ rw [add_div, mul_div_cancel_left] at h
exact h.trans (by exact_mod_cast off_diag_pairs_le_increment_energy)
positivity
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -125,7 +125,6 @@ private noncomputable def pair_contrib (G : SimpleGraph α) (ε : ℝ) (hP : P.I
∑ i in (chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts,
G.edgeDensity i.fst i.snd ^ 2
-#print SzemerediRegularity.offDiag_pairs_le_increment_energy /-
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 :=
@@ -148,12 +147,12 @@ theorem offDiag_pairs_le_increment_energy :
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)
-#align szemeredi_regularity.off_diag_pairs_le_increment_energy SzemerediRegularity.offDiag_pairs_le_increment_energy
--/
+#align szemeredi_regularity.off_diag_pairs_le_increment_energy szemeredi_regularity.offDiag_pairs_le_increment_energy
-#print SzemerediRegularity.pairContrib_lower_bound /-
-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) :
+#print SzemerediRegularity.le_sum_distinctPairs_edgeDensity_sq /-
+theorem le_sum_distinctPairs_edgeDensity_sq [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 :=
@@ -164,10 +163,9 @@ theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag
· rw [add_zero]
exact edge_density_chunk_uniform hPα hPε _ _
· exact edge_density_chunk_not_uniform hPα hPε hε₁ (mem_off_diag.1 x.2).2.2 h
-#align szemeredi_regularity.pair_contrib_lower_bound SzemerediRegularity.pairContrib_lower_bound
+#align szemeredi_regularity.pair_contrib_lower_bound SzemerediRegularity.le_sum_distinctPairs_edgeDensity_sq
-/
-#print SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs /-
theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1) (hP₇ : 7 ≤ P.parts.card)
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : 100 ≤ 4 ^ P.parts.card * ε ^ 5)
(hPG : ¬P.IsUniform G ε) :
@@ -221,8 +219,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
Nat.cast_one, one_mul, le_sub_comm, ← mul_sub_left_distrib, ←
div_le_iff (show (0 : ℝ) < 1 / 3 - 1 / 25 - 1 / 4 by norm_num)]
exact le_trans (show _ ≤ (7 : ℝ) by norm_num) (by exact_mod_cast hP₇)
-#align szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs
--/
+#align szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs szemeredi_regularity.uniform_add_nonuniform_eq_offDiag_pairs
#print SzemerediRegularity.energy_increment /-
/-- The increment partition has energy greater than the original one by a known fixed amount. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -74,7 +74,7 @@ theorem card_increment (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hP
(increment hP G ε).parts.card = stepBound P.parts.card :=
by
have hPα' : step_bound P.parts.card ≤ card α :=
- (mul_le_mul_left' (pow_le_pow_of_le_left' (by norm_num) _) _).trans hPα
+ (mul_le_mul_left' (pow_le_pow_left' (by norm_num) _) _).trans hPα
have hPpos : 0 < step_bound P.parts.card := step_bound_pos (nonempty_of_not_uniform hPG).card_pos
rw [increment, card_bind]
simp_rw [chunk, apply_dite Finpartition.parts, apply_dite card, sum_dite]
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Bhavik Mehta
-/
-import Mathbin.Combinatorics.SimpleGraph.Regularity.Chunk
-import Mathbin.Combinatorics.SimpleGraph.Regularity.Energy
+import Combinatorics.SimpleGraph.Regularity.Chunk
+import Combinatorics.SimpleGraph.Regularity.Energy
#align_import combinatorics.simple_graph.regularity.increment from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Bhavik Mehta
-
-! This file was ported from Lean 3 source module combinatorics.simple_graph.regularity.increment
-! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Combinatorics.SimpleGraph.Regularity.Chunk
import Mathbin.Combinatorics.SimpleGraph.Regularity.Energy
+#align_import combinatorics.simple_graph.regularity.increment from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
+
/-!
# Increment partition for Szemerédi Regularity Lemma
mathlib commit https://github.com/leanprover-community/mathlib/commit/9240e8be927a0955b9a82c6c85ef499ee3a626b8
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Bhavik Mehta
! This file was ported from Lean 3 source module combinatorics.simple_graph.regularity.increment
-! leanprover-community/mathlib commit bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d
+! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -14,6 +14,9 @@ import Mathbin.Combinatorics.SimpleGraph.Regularity.Energy
/-!
# Increment partition for Szemerédi Regularity Lemma
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
In the proof of Szemerédi Regularity Lemma, we need to partition each part of a starting partition
to increase the energy. This file defines the partition obtained by gluing the parts partitions
together (the *increment partition*) and shows that the energy globally increases.
mathlib commit https://github.com/leanprover-community/mathlib/commit/fdc286cc6967a012f41b87f76dcd2797b53152af
@@ -39,7 +39,7 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
-/
-open Finset Fintype SimpleGraph SzemerediRegularity
+open Finset Fintype SimpleGraph szemeredi_regularity
open scoped BigOperators Classical
@@ -50,8 +50,9 @@ variable {α : Type _} [Fintype α] {P : Finpartition (univ : Finset α)} (hP :
local notation "m" => (card α / stepBound P.parts.card : ℕ)
-namespace SzemerediRegularity
+namespace szemeredi_regularity
+#print SzemerediRegularity.increment /-
/-- The **increment partition** in Szemerédi's Regularity Lemma.
If an equipartition is *not* uniform, then the increment partition is a (much bigger) equipartition
@@ -61,11 +62,13 @@ not-too-big uniform equipartition. -/
noncomputable def increment : Finpartition (univ : Finset α) :=
P.bind fun U => chunk hP G ε
#align szemeredi_regularity.increment SzemerediRegularity.increment
+-/
open Finpartition Finpartition.IsEquipartition
variable {hP G ε}
+#print SzemerediRegularity.card_increment /-
/-- The increment partition has a prescribed (very big) size in terms of the original partition. -/
theorem card_increment (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPG : ¬P.IsUniform G ε) :
(increment hP G ε).parts.card = stepBound P.parts.card :=
@@ -82,7 +85,9 @@ theorem card_increment (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hP
congr
rw [filter_card_add_filter_neg_card_eq_card, card_attach]
#align szemeredi_regularity.card_increment SzemerediRegularity.card_increment
+-/
+#print SzemerediRegularity.increment_isEquipartition /-
theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α) (ε : ℝ) :
(increment hP G ε).IsEquipartition :=
by
@@ -92,6 +97,7 @@ theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α)
obtain ⟨U, hU, hA⟩ := hA
exact card_eq_of_mem_parts_chunk hA
#align szemeredi_regularity.increment_is_equipartition SzemerediRegularity.increment_isEquipartition
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
private theorem distinct_pairs_increment :
@@ -119,6 +125,7 @@ private noncomputable def pair_contrib (G : SimpleGraph α) (ε : ℝ) (hP : P.I
∑ i in (chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts,
G.edgeDensity i.fst i.snd ^ 2
+#print SzemerediRegularity.offDiag_pairs_le_increment_energy /-
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 :=
@@ -142,7 +149,9 @@ theorem offDiag_pairs_le_increment_energy :
P.disjoint.elim_finset hs.2.1 ht.2.1 b (Finpartition.le _ huv₁.2 hb) <|
Finpartition.le _ huv₂.2 hb)
#align szemeredi_regularity.off_diag_pairs_le_increment_energy SzemerediRegularity.offDiag_pairs_le_increment_energy
+-/
+#print SzemerediRegularity.pairContrib_lower_bound /-
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 +
@@ -156,7 +165,9 @@ theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag
exact edge_density_chunk_uniform hPα hPε _ _
· exact edge_density_chunk_not_uniform hPα hPε hε₁ (mem_off_diag.1 x.2).2.2 h
#align szemeredi_regularity.pair_contrib_lower_bound SzemerediRegularity.pairContrib_lower_bound
+-/
+#print SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs /-
theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1) (hP₇ : 7 ≤ P.parts.card)
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : 100 ≤ 4 ^ P.parts.card * ε ^ 5)
(hPG : ¬P.IsUniform G ε) :
@@ -211,7 +222,9 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
div_le_iff (show (0 : ℝ) < 1 / 3 - 1 / 25 - 1 / 4 by norm_num)]
exact le_trans (show _ ≤ (7 : ℝ) by norm_num) (by exact_mod_cast hP₇)
#align szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs
+-/
+#print SzemerediRegularity.energy_increment /-
/-- The increment partition has energy greater than the original one by a known fixed amount. -/
theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
(hε : 100 < 4 ^ P.parts.card * ε ^ 5) (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
@@ -224,6 +237,7 @@ theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P
exact h.trans (by exact_mod_cast off_diag_pairs_le_increment_energy)
positivity
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
+-/
-end SzemerediRegularity
+end szemeredi_regularity
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -48,7 +48,6 @@ attribute [local positivity] tactic.positivity_szemeredi_regularity
variable {α : Type _} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
(G : SimpleGraph α) (ε : ℝ)
--- mathport name: exprm
local notation "m" => (card α / stepBound P.parts.card : ℕ)
namespace SzemerediRegularity
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -121,7 +121,7 @@ private noncomputable def pair_contrib (G : SimpleGraph α) (ε : ℝ) (hP : P.I
G.edgeDensity i.fst i.snd ^ 2
theorem offDiag_pairs_le_increment_energy :
- (∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / (increment hP G ε).parts.card ^ 2) ≤
+ ∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / (increment hP G ε).parts.card ^ 2 ≤
(increment hP G ε).energy G :=
by
simp_rw [pair_contrib, ← sum_div]
@@ -161,7 +161,7 @@ theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag
theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1) (hP₇ : 7 ≤ P.parts.card)
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : 100 ≤ 4 ^ P.parts.card * ε ^ 5)
(hPG : ¬P.IsUniform G ε) :
- ((∑ x in P.parts.offDiag, G.edgeDensity x.1 x.2 ^ 2) + P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) /
+ (∑ x in P.parts.offDiag, G.edgeDensity x.1 x.2 ^ 2 + P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) /
P.parts.card ^ 2 ≤
∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / (increment hP G ε).parts.card ^ 2 :=
by
@@ -179,12 +179,13 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
swap
· exact sum_le_sum fun i hi => pair_contrib_lower_bound i hε₁ hPα hPε
have :
- (∑ x in P.parts.off_diag.attach,
+ ∑ x in P.parts.off_diag.attach,
(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 :
- ℝ)) =
+ ℝ) =
∑ x in P.parts.off_diag,
- G.edge_density x.1 x.2 ^ 2 - ε ^ 5 / 25 + if G.is_uniform ε x.1 x.2 then 0 else ε ^ 4 / 3 :=
+ (G.edge_density x.1 x.2 ^ 2 - ε ^ 5 / 25 +
+ if G.is_uniform ε x.1 x.2 then 0 else ε ^ 4 / 3) :=
by convert sum_attach; rfl
rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms]
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -89,7 +89,7 @@ theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α)
by
simp_rw [is_equipartition, Set.equitableOn_iff_exists_eq_eq_add_one]
refine' ⟨m, fun A hA => _⟩
- rw [mem_coe, increment, mem_bind] at hA
+ rw [mem_coe, increment, mem_bind] at hA
obtain ⟨U, hU, hA⟩ := hA
exact card_eq_of_mem_parts_chunk hA
#align szemeredi_regularity.increment_is_equipartition SzemerediRegularity.increment_isEquipartition
@@ -131,7 +131,7 @@ theorem offDiag_pairs_le_increment_energy :
simp 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_off_diag] at hs ht
+ rw [mem_off_diag] at hs ht
obtain ⟨a, ha⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.1
obtain ⟨b, hb⟩ := Finpartition.nonempty_of_mem_parts _ huv₁.2
exact
@@ -188,7 +188,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
by convert sum_attach; rfl
rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms]
- rw [Finpartition.IsUniform, not_le] at hPG
+ rw [Finpartition.IsUniform, not_le] at hPG
refine' le_trans _ (add_le_add_left (mul_le_mul_of_nonneg_right hPG.le <| by positivity) _)
conv_rhs =>
congr
@@ -220,7 +220,7 @@ theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P
by
rw [coe_energy]
have h := uniform_add_nonuniform_eq_off_diag_pairs hε₁ hP₇ hPα hε.le hPG
- rw [add_div, mul_div_cancel_left] at h
+ rw [add_div, mul_div_cancel_left] at h
exact h.trans (by exact_mod_cast off_diag_pairs_le_increment_energy)
positivity
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -41,7 +41,7 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
open Finset Fintype SimpleGraph SzemerediRegularity
-open BigOperators Classical
+open scoped BigOperators Classical
attribute [local positivity] tactic.positivity_szemeredi_regularity
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -185,9 +185,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
ℝ)) =
∑ x in P.parts.off_diag,
G.edge_density x.1 x.2 ^ 2 - ε ^ 5 / 25 + if G.is_uniform ε x.1 x.2 then 0 else ε ^ 4 / 3 :=
- by
- convert sum_attach
- rfl
+ by convert sum_attach; rfl
rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms]
rw [Finpartition.IsUniform, not_le] at hPG
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -112,7 +112,6 @@ private theorem distinct_pairs_increment :
hUV.2.2
(P.disjoint.elim_finset hUV.1 hUV.2.1 i (Finpartition.le _ hUi hi) <|
Finpartition.le _ hVj hi)
-#align szemeredi_regularity.distinct_pairs_increment szemeredi_regularity.distinct_pairs_increment
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/-- The contribution to `finpartition.energy` of a pair of distinct parts of a finpartition. -/
@@ -120,7 +119,6 @@ private noncomputable def pair_contrib (G : SimpleGraph α) (ε : ℝ) (hP : P.I
(x : { x // x ∈ P.parts.offDiag }) : ℚ :=
∑ i in (chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts,
G.edgeDensity i.fst i.snd ^ 2
-#align szemeredi_regularity.pair_contrib szemeredi_regularity.pair_contrib
theorem offDiag_pairs_le_increment_energy :
(∑ x in P.parts.offDiag.attach, pairContrib G ε hP x / (increment hP G ε).parts.card ^ 2) ≤
mathlib commit https://github.com/leanprover-community/mathlib/commit/33c67ae661dd8988516ff7f247b0be3018cdd952
bex and ball from lemma names (#11615)
Follow-up to #10816.
Remaining places containing such lemmas are
Option.bex_ne_none and Option.ball_ne_none: defined in Lean coreNat.decidableBallLT and Nat.decidableBallLE: defined in Lean corebef_def is still used in a number of places and could be renamedBAll.imp_{left,right}, BEx.imp_{left,right}, BEx.intro and BEx.elimI only audited the first ~150 lemmas mentioning "ball"; too many lemmas named after Metric.ball/openBall/closedBall.
Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -96,7 +96,7 @@ private theorem distinctPairs_increment :
rintro ⟨Ui, Vj⟩
simp only [distinctPairs, 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]
+ mem_offDiag, forall_exists_index, exists₂_imp, Ne]
refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
rintro rfl
obtain ⟨i, hi⟩ := nonempty_of_mem_parts _ hUi
@@ -96,7 +96,7 @@ private theorem distinctPairs_increment :
rintro ⟨Ui, Vj⟩
simp only [distinctPairs, 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]
+ mem_offDiag, forall_exists_index, bex_imp, Ne]
refine' fun U V hUV hUi hVj => ⟨⟨_, hUV.1, hUi⟩, ⟨_, hUV.2.1, hVj⟩, _⟩
rintro rfl
obtain ⟨i, hi⟩ := nonempty_of_mem_parts _ hUi
mul-div cancellation lemmas (#11530)
Lemma names around cancellation of multiplication and division are a mess.
This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).
| Statement | New name | Old name | |
@@ -143,7 +143,7 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
calc
_ = (∑ x in P.parts.offDiag, (G.edgeDensity x.1 x.2 : ℝ) ^ 2 +
P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) / P.parts.card ^ 2 := by
- rw [coe_energy, add_div, mul_div_cancel_left]; positivity
+ rw [coe_energy, add_div, mul_div_cancel_left₀]; positivity
_ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs G ε hP x,
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 := ?_
_ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs G ε hP x,
I removed some of the tactics that were not used and are hopefully uncontroversial arising from the linter at #11308.
As the commit messages should convey, the removed tactics are, essentially,
push_cast
norm_cast
congr
norm_num
dsimp
funext
intro
infer_instance
@@ -126,7 +126,6 @@ lemma le_sum_distinctPairs_edgeDensity_sq (x : {i // i ∈ P.parts.offDiag}) (h
((if G.IsUniform ε x.1.1 x.1.2 then 0 else ε ^ 4 / 3) - ε ^ 5 / 25) ≤
(∑ i in distinctPairs G ε hP x, G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card := by
rw [distinctPairs, ← add_sub_assoc, add_sub_right_comm]
- push_cast
split_ifs with h
· rw [add_zero]
exact edgeDensity_chunk_uniform hPα hPε _ _
/ lemmas (#10634)
The new names and argument orders match the corresponding * lemmas, which I already took care of in a previous PR.
From LeanAPAP
@@ -146,8 +146,7 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) / P.parts.card ^ 2 := by
rw [coe_energy, add_div, mul_div_cancel_left]; positivity
_ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs G ε hP x,
- G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 :=
- div_le_div_of_le (by positivity) ?_
+ G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 := ?_
_ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs G ε hP x,
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / (increment hP G ε).parts.card ^ 2 := by
rw [card_increment hPα hPG, coe_stepBound, mul_pow, pow_right_comm,
@@ -157,6 +156,7 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
gcongr
rw [← sum_biUnion pairwiseDisjoint_distinctPairs]
exact sum_le_sum_of_subset_of_nonneg distinctPairs_increment fun i _ _ ↦ sq_nonneg _
+ gcongr
rw [Finpartition.IsUniform, not_le, mul_tsub, mul_one, ← offDiag_card] at hPG
calc
_ ≤ ∑ x in P.parts.offDiag, (edgeDensity G x.1 x.2 : ℝ) ^ 2 +
@@ -180,8 +180,7 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
nlinarith
· norm_num
_ = (P.parts.offDiag.card * ε * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) := by ring
- _ ≤ ((nonUniforms P G ε).card * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) := by
- gcongr
+ _ ≤ ((nonUniforms P G ε).card * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) := by gcongr
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
end SzemerediRegularity
$ with <| (#9319)
See Zulip thread for the discussion.
@@ -112,7 +112,7 @@ private lemma pairwiseDisjoint_distinctPairs :
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
- exact hst $ Subtype.ext_val <| Prod.ext
+ 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) <|
@@ -147,7 +147,7 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
rw [coe_energy, add_div, mul_div_cancel_left]; positivity
_ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs G ε hP x,
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 :=
- div_le_div_of_le_of_nonneg ?_ $ by positivity
+ div_le_div_of_le (by positivity) ?_
_ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs G ε hP x,
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / (increment hP G ε).parts.card ^ 2 := by
rw [card_increment hPα hPG, coe_stepBound, mul_pow, pow_right_comm,
by using calc, gcongr and positivity. This should be much more maintainable now.
Nicely enough, this reduces the total number of lines.
@@ -86,112 +86,102 @@ theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α)
exact card_eq_of_mem_parts_chunk hA
#align szemeredi_regularity.increment_is_equipartition SzemerediRegularity.increment_isEquipartition
-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
+/-- The contribution to `Finpartition.energy` of a pair of distinct parts of a `Finpartition`. -/
+private noncomputable def distinctPairs (G : SimpleGraph α) (ε : ℝ) (hP : P.IsEquipartition)
+ (x : {x // x ∈ P.parts.offDiag}) : Finset (Finset α × Finset α) :=
+ (chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts
+
+private theorem distinctPairs_increment :
+ P.parts.offDiag.attach.biUnion (distinctPairs G ε hP) ⊆ (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]
+ simp only [distinctPairs, 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
exact hUV.2.2 (P.disjoint.elim_finset hUV.1 hUV.2.1 i (Finpartition.le _ hUi hi) <|
Finpartition.le _ hVj hi)
-/-- The contribution to `Finpartition.energy` of a pair of distinct parts of a `Finpartition`. -/
-private noncomputable def pairContrib (G : SimpleGraph α) (ε : ℝ) (hP : P.IsEquipartition)
- (x : { x // x ∈ P.parts.offDiag }) : ℚ :=
- ∑ i in (chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts,
- (G.edgeDensity i.fst i.snd : ℚ) ^ 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]
+private lemma pairwiseDisjoint_distinctPairs :
+ (P.parts.offDiag.attach : Set {x // x ∈ P.parts.offDiag}).PairwiseDisjoint
+ (distinctPairs G ε hP) := by
+ simp (config := { unfoldPartialApp := true }) only [distinctPairs, 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
- exact hst (Subtype.ext_val <| Prod.ext
+ 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)
-#align szemeredi_regularity.off_diag_pairs_le_increment_energy SzemerediRegularity.offDiag_pairs_le_increment_energy
+ Finpartition.le _ huv₂.2 hb
-theorem pairContrib_lower_bound [Nonempty α] (x : { i // i ∈ P.parts.offDiag }) (hε₁ : ε ≤ 1)
+variable [Nonempty α]
+
+lemma le_sum_distinctPairs_edgeDensity_sq (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]
+ (G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 +
+ ((if G.IsUniform ε x.1.1 x.1.2 then 0 else ε ^ 4 / 3) - ε ^ 5 / 25) ≤
+ (∑ i in distinctPairs G ε hP x, G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card := by
+ rw [distinctPairs, ← add_sub_assoc, add_sub_right_comm]
push_cast
split_ifs with h
· rw [add_zero]
exact edgeDensity_chunk_uniform hPα hPε _ _
· exact edgeDensity_chunk_not_uniform hPα hPε hε₁ (mem_offDiag.1 x.2).2.2 h
-#align szemeredi_regularity.pair_contrib_lower_bound SzemerediRegularity.pairContrib_lower_bound
-
-theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1) (hP₇ : 7 ≤ P.parts.card)
- (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5)
- (hPG : ¬P.IsUniform G ε) :
- (∑ x in P.parts.offDiag, (G.edgeDensity x.1 x.2 : ℝ) ^ 2 +
- ↑P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) / (P.parts.card : ℝ) ^ 2 ≤
- ∑ x in P.parts.offDiag.attach,
- (pairContrib G ε hP x : ℝ) / ((increment hP G ε).parts.card : ℝ) ^ 2 := by
- conv_rhs =>
- rw [← sum_div, card_increment hPα hPG, stepBound, ← Nat.cast_pow, mul_pow, pow_right_comm,
- Nat.cast_mul, mul_comm, ← div_div, show 4 ^ 2 = 16 by norm_num, sum_div]
- rw [← Nat.cast_pow, Nat.cast_pow 16]
- refine' div_le_div_of_le_of_nonneg _ (Nat.cast_nonneg _)
- norm_num
- trans ∑ x in P.parts.offDiag.attach, ((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 : ℝ)
- swap
- · exact sum_le_sum fun i _ => pairContrib_lower_bound i hε₁ hPα hPε
- have :
- ∑ x in P.parts.offDiag.attach, ((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 : ℝ) =
- ∑ x in P.parts.offDiag, ((G.edgeDensity x.1 x.2 : ℝ) ^ 2 - ε ^ 5 / ↑25 +
- if G.IsUniform ε x.1 x.2 then (0 : ℝ) else ε ^ 4 / 3) := by
- convert sum_attach (β := ℝ); rfl
- rw [this, sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
- zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms]
- rw [Finpartition.IsUniform, not_le] at hPG
- refine' le_trans _ (add_le_add_left (mul_le_mul_of_nonneg_right hPG.le <| by positivity) _)
- conv_rhs =>
- enter [1, 2]
- rw [offDiag_card]
- conv => enter [1, 1, 2]; rw [← mul_one P.parts.card]
- rw [← Nat.mul_sub_left_distrib]
- simp_rw [mul_assoc, sub_add_eq_add_sub, add_sub_assoc, ← mul_sub_left_distrib, mul_div_assoc' ε,
- ← pow_succ, show 4 + 1 = 5 by rfl, div_eq_mul_one_div (ε ^ 5), ← mul_sub_left_distrib,
- mul_left_comm _ (ε ^ 5), sq, Nat.cast_mul, mul_assoc, ← mul_assoc (ε ^ 5)]
- refine' add_le_add_left (mul_le_mul_of_nonneg_left _ <| by sz_positivity) _
- rw [Nat.cast_sub (P.parts_nonempty <| univ_nonempty.ne_empty).card_pos, mul_sub_right_distrib,
- Nat.cast_one, one_mul, le_sub_comm, ← mul_sub_left_distrib, ←
- div_le_iff (show (0 : ℝ) < 1 / 3 - 1 / 25 - 1 / 4 by norm_num)]
- exact le_trans (show _ ≤ (7 : ℝ) by norm_num) (mod_cast hP₇)
-#align szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs
+#align szemeredi_regularity.pair_contrib_lower_bound SzemerediRegularity.le_sum_distinctPairs_edgeDensity_sq
+
+#noalign szemeredi_regularity.off_diag_pairs_le_increment_energy
+#noalign szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs
/-- The increment partition has energy greater than the original one by a known fixed amount. -/
-theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
- (hε : ↑100 < ↑4 ^ P.parts.card * ε ^ 5) (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
- (hPG : ¬P.IsUniform G ε) (hε₁ : ε ≤ 1) :
+theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
+ (hPε : 100 ≤ 4 ^ P.parts.card * ε ^ 5) (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α)
+ (hPG : ¬P.IsUniform G ε) (hε₀ : 0 ≤ ε) (hε₁ : ε ≤ 1) :
↑(P.energy G) + ε ^ 5 / 4 ≤ (increment hP G ε).energy G := by
- rw [coe_energy]
- have h := uniform_add_nonuniform_eq_offDiag_pairs (hP := hP) hε₁ hP₇ hPα hε.le hPG
- rw [add_div, mul_div_cancel_left] at h
- exact h.trans (mod_cast offDiag_pairs_le_increment_energy)
- positivity
+ calc
+ _ = (∑ x in P.parts.offDiag, (G.edgeDensity x.1 x.2 : ℝ) ^ 2 +
+ P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) / P.parts.card ^ 2 := by
+ rw [coe_energy, add_div, mul_div_cancel_left]; positivity
+ _ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs G ε hP x,
+ G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 :=
+ div_le_div_of_le_of_nonneg ?_ $ by positivity
+ _ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs G ε hP x,
+ G.edgeDensity i.1 i.2 ^ 2 : ℝ) / (increment hP G ε).parts.card ^ 2 := by
+ rw [card_increment hPα hPG, coe_stepBound, mul_pow, pow_right_comm,
+ div_mul_eq_div_div_swap, ← sum_div]; norm_num
+ _ ≤ _ := by
+ rw [coe_energy]
+ gcongr
+ rw [← sum_biUnion pairwiseDisjoint_distinctPairs]
+ exact sum_le_sum_of_subset_of_nonneg distinctPairs_increment fun i _ _ ↦ sq_nonneg _
+ rw [Finpartition.IsUniform, not_le, mul_tsub, mul_one, ← offDiag_card] at hPG
+ calc
+ _ ≤ ∑ x in P.parts.offDiag, (edgeDensity G x.1 x.2 : ℝ) ^ 2 +
+ ((nonUniforms P G ε).card * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) :=
+ add_le_add_left ?_ _
+ _ = ∑ x in P.parts.offDiag, ((G.edgeDensity x.1 x.2 : ℝ) ^ 2 +
+ ((if G.IsUniform ε x.1 x.2 then (0 : ℝ) else ε ^ 4 / 3) - ε ^ 5 / 25) : ℝ) := by
+ rw [sum_add_distrib, sum_sub_distrib, sum_const, nsmul_eq_mul, sum_ite, sum_const_zero,
+ zero_add, sum_const, nsmul_eq_mul, ← Finpartition.nonUniforms, ← add_sub_assoc,
+ add_sub_right_comm]
+ _ = _ := (sum_attach ..).symm
+ _ ≤ _ := sum_le_sum fun i _ ↦ le_sum_distinctPairs_edgeDensity_sq i hε₁ hPα hPε
+ calc
+ _ = (6/7 * P.parts.card ^ 2) * ε ^ 5 * (7 / 24) := by ring
+ _ ≤ P.parts.offDiag.card * ε ^ 5 * (22 / 75) := by
+ gcongr ?_ * _ * ?_
+ · rw [← mul_div_right_comm, div_le_iff (by norm_num), offDiag_card]
+ norm_cast
+ rw [tsub_mul]
+ refine le_tsub_of_add_le_left ?_
+ nlinarith
+ · norm_num
+ _ = (P.parts.offDiag.card * ε * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) := by ring
+ _ ≤ ((nonUniforms P G ε).card * (ε ^ 4 / 3) - P.parts.offDiag.card * (ε ^ 5 / 25)) := by
+ gcongr
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
end SzemerediRegularity
The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Orderpow_mono → pow_right_monopow_le_pow → pow_le_pow_rightpow_le_pow_of_le_left → pow_le_pow_leftpow_lt_pow_of_lt_left → pow_lt_pow_leftstrictMonoOn_pow → pow_left_strictMonoOnpow_strictMono_right → pow_right_strictMonopow_lt_pow → pow_lt_pow_rightpow_lt_pow_iff → pow_lt_pow_iff_rightpow_le_pow_iff → pow_le_pow_iff_rightself_lt_pow → lt_self_powstrictAnti_pow → pow_right_strictAntipow_lt_pow_iff_of_lt_one → pow_lt_pow_iff_right_of_lt_onepow_lt_pow_of_lt_one → pow_lt_pow_right_of_lt_onelt_of_pow_lt_pow → lt_of_pow_lt_pow_leftle_of_pow_le_pow → le_of_pow_le_pow_leftpow_lt_pow₀ → pow_lt_pow_right₀Algebra.GroupPower.CovariantClasspow_le_pow_of_le_left' → pow_le_pow_left'nsmul_le_nsmul_of_le_right → nsmul_le_nsmul_rightpow_lt_pow' → pow_lt_pow_right'nsmul_lt_nsmul → nsmul_lt_nsmul_leftpow_strictMono_left → pow_right_strictMono'nsmul_strictMono_right → nsmul_left_strictMonoStrictMono.pow_right' → StrictMono.pow_constStrictMono.nsmul_left → StrictMono.const_nsmulpow_strictMono_right' → pow_left_strictMononsmul_strictMono_left → nsmul_right_strictMonoMonotone.pow_right → Monotone.pow_constMonotone.nsmul_left → Monotone.const_nsmullt_of_pow_lt_pow' → lt_of_pow_lt_pow_left'lt_of_nsmul_lt_nsmul → lt_of_nsmul_lt_nsmul_rightpow_le_pow' → pow_le_pow_right'nsmul_le_nsmul → nsmul_le_nsmul_leftpow_le_pow_of_le_one' → pow_le_pow_right_of_le_one'nsmul_le_nsmul_of_nonpos → nsmul_le_nsmul_left_of_nonposle_of_pow_le_pow' → le_of_pow_le_pow_left'le_of_nsmul_le_nsmul' → le_of_nsmul_le_nsmul_right'pow_le_pow_iff' → pow_le_pow_iff_right'nsmul_le_nsmul_iff → nsmul_le_nsmul_iff_leftpow_lt_pow_iff' → pow_lt_pow_iff_right'nsmul_lt_nsmul_iff → nsmul_lt_nsmul_iff_leftData.Nat.PowNat.pow_lt_pow_of_lt_left → Nat.pow_lt_pow_leftNat.pow_le_iff_le_left → Nat.pow_le_pow_iff_leftNat.pow_lt_iff_lt_left → Nat.pow_lt_pow_iff_leftpow_le_pow_iff_leftpow_lt_pow_iff_leftpow_right_injectivepow_right_injNat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.self_le_pow was a duplicate of le_self_pow.Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.Nat.pow_right_strictMono is defeq to pow_right_strictMono.Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.0 < n or 1 ≤ n to n ≠ 0.Nat lemmas have been protected.@@ -65,7 +65,7 @@ variable {hP G ε}
theorem card_increment (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPG : ¬P.IsUniform G ε) :
(increment hP G ε).parts.card = stepBound P.parts.card := by
have hPα' : stepBound P.parts.card ≤ card α :=
- (mul_le_mul_left' (pow_le_pow_of_le_left' (by norm_num) _) _).trans hPα
+ (mul_le_mul_left' (pow_le_pow_left' (by norm_num) _) _).trans hPα
have hPpos : 0 < stepBound P.parts.card := stepBound_pos (nonempty_of_not_uniform hPG).card_pos
rw [increment, card_bind]
simp_rw [chunk, apply_dite Finpartition.parts, apply_dite card, sum_dite]
exact_mod_cast tactic with mod_cast elaborator where possible (#8404)
We still have the exact_mod_cast tactic, used in a few places, which somehow (?) works a little bit harder to prevent the expected type influencing the elaboration of the term. I would like to get to the bottom of this, and it will be easier once the only usages of exact_mod_cast are the ones that don't work using the term elaborator by itself.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -179,7 +179,7 @@ theorem uniform_add_nonuniform_eq_offDiag_pairs [Nonempty α] (hε₁ : ε ≤ 1
rw [Nat.cast_sub (P.parts_nonempty <| univ_nonempty.ne_empty).card_pos, mul_sub_right_distrib,
Nat.cast_one, one_mul, le_sub_comm, ← mul_sub_left_distrib, ←
div_le_iff (show (0 : ℝ) < 1 / 3 - 1 / 25 - 1 / 4 by norm_num)]
- exact le_trans (show _ ≤ (7 : ℝ) by norm_num) (by exact_mod_cast hP₇)
+ exact le_trans (show _ ≤ (7 : ℝ) by norm_num) (mod_cast hP₇)
#align szemeredi_regularity.uniform_add_nonuniform_eq_off_diag_pairs SzemerediRegularity.uniform_add_nonuniform_eq_offDiag_pairs
/-- The increment partition has energy greater than the original one by a known fixed amount. -/
@@ -190,7 +190,7 @@ theorem energy_increment [Nonempty α] (hP : P.IsEquipartition) (hP₇ : 7 ≤ P
rw [coe_energy]
have h := uniform_add_nonuniform_eq_offDiag_pairs (hP := hP) hε₁ hP₇ hPα hε.le hPG
rw [add_div, mul_div_cancel_left] at h
- exact h.trans (by exact_mod_cast offDiag_pairs_le_increment_energy)
+ exact h.trans (mod_cast offDiag_pairs_le_increment_energy)
positivity
#align szemeredi_regularity.energy_increment SzemerediRegularity.energy_increment
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).
This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true }) in some places, to recover the old behaviour@[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -38,8 +38,6 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
open Finset Fintype SimpleGraph SzemerediRegularity
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
open scoped BigOperators Classical SzemerediRegularity.Positivity
variable {α : Type*} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
@@ -116,8 +114,8 @@ theorem offDiag_pairs_le_increment_energy :
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 only [Set.PairwiseDisjoint, Function.onFun, disjoint_left, inf_eq_inter, mem_inter,
- mem_product]
+ 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
notation3 use elaborator when generating matchers, add support for pi/lambda (#6833)
notation3 was generating matchers directly from syntax, which included a half-baked implementation of a term elaborator. This switches to elaborating the term and then generating matchers from the elaborated term. This
notation3 commandWe now also generate matchers for expansions that have pi types and lambda expressions.
@@ -45,8 +45,7 @@ open scoped BigOperators Classical SzemerediRegularity.Positivity
variable {α : Type*} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
(G : SimpleGraph α) (ε : ℝ)
-local notation3 (prettyPrint := false)
- "m" => (card α / stepBound P.parts.card : ℕ)
+local notation3 "m" => (card α / stepBound P.parts.card : ℕ)
namespace SzemerediRegularity
Type _ and Sort _ (#6499)
We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.
This has nice performance benefits.
@@ -42,7 +42,7 @@ local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue
open scoped BigOperators Classical SzemerediRegularity.Positivity
-variable {α : Type _} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
+variable {α : Type*} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
(G : SimpleGraph α) (ε : ℝ)
local notation3 (prettyPrint := false)
@@ -38,7 +38,7 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
open Finset Fintype SimpleGraph SzemerediRegularity
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
open scoped BigOperators Classical SzemerediRegularity.Positivity
@@ -2,15 +2,12 @@
Copyright (c) 2022 Yaël Dillies, Bhavik Mehta. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yaël Dillies, Bhavik Mehta
-
-! This file was ported from Lean 3 source module combinatorics.simple_graph.regularity.increment
-! leanprover-community/mathlib commit bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Combinatorics.SimpleGraph.Regularity.Chunk
import Mathlib.Combinatorics.SimpleGraph.Regularity.Energy
+#align_import combinatorics.simple_graph.regularity.increment from "leanprover-community/mathlib"@"bf7ef0e83e5b7e6c1169e97f055e58a2e4e9d52d"
+
/-!
# Increment partition for Szemerédi Regularity Lemma
The unported dependencies are
algebra.order.moduleinit.corelinear_algebra.free_module.finite.rankalgebra.order.monoid.cancel.defsalgebra.absalgebra.group_power.lemmasinit.data.list.basiclinear_algebra.free_module.rankinit.data.list.defaultalgebra.order.monoid.cancel.basictopology.subset_propertiesinit.logicThe following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file