combinatorics.simple_graph.regularity.lemma
⟷
Mathlib.Combinatorics.SimpleGraph.Regularity.Lemma
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)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -147,8 +147,8 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
have hi : (i : ℝ) ≤ 4 / ε ^ 5 :=
by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (by exact_mod_cast P.energy_le_one G)
- rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
- norm_num at hi
+ rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
+ norm_num at hi
rwa [le_div_iff' (pow_pos hε _)]
have hsize : P.parts.card ≤ (step_bound^[⌊4 / ε ^ 5⌋₊]) t :=
hP₃.trans (monotone_iterate_of_id_le le_step_bound (Nat.le_floor hi) _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -116,7 +116,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
⟨P, hP₁, (le_initial_bound _ _).trans hP₂, hP₃.trans _,
hP₄.resolve_right fun hPenergy => lt_irrefl (1 : ℝ) _⟩
· rw [iterate_succ_apply']
- exact mul_le_mul_left' (pow_le_pow_of_le_left (by norm_num) (by norm_num) _) _
+ exact mul_le_mul_left' (pow_le_pow_left (by norm_num) (by norm_num) _) _
calc
1 = ε ^ 5 / 4 * (4 / ε ^ 5) := by rw [mul_comm, div_mul_div_cancel 4 (pow_pos hε 5).ne'];
norm_num
@@ -143,7 +143,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
-- We gather a few numerical facts.
have hεl' : 100 < 4 ^ P.parts.card * ε ^ 5 :=
(hundred_lt_pow_initial_bound_mul hε l).trans_le
- (mul_le_mul_of_nonneg_right (pow_le_pow (by norm_num) hP₂) <| by positivity)
+ (mul_le_mul_of_nonneg_right (pow_le_pow_right (by norm_num) hP₂) <| by positivity)
have hi : (i : ℝ) ≤ 4 / ε ^ 5 :=
by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (by exact_mod_cast P.energy_le_one G)
@@ -153,7 +153,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
have hsize : P.parts.card ≤ (step_bound^[⌊4 / ε ^ 5⌋₊]) t :=
hP₃.trans (monotone_iterate_of_id_le le_step_bound (Nat.le_floor hi) _)
have hPα : P.parts.card * 16 ^ P.parts.card ≤ card α :=
- (Nat.mul_le_mul hsize (Nat.pow_le_pow_of_le_right (by norm_num) hsize)).trans hα
+ (Nat.mul_le_mul hsize (Nat.pow_le_pow_right (by norm_num) hsize)).trans hα
-- We return the increment equipartition of `P`, which has energy `≥ ε ^ 5 / 4 * (i + 1)`.
refine'
⟨increment hP₁ G ε, increment_is_equipartition hP₁ G ε, _, _,
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2021 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.Increment
+import Combinatorics.SimpleGraph.Regularity.Increment
#align_import combinatorics.simple_graph.regularity.lemma from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2021 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.lemma
-! 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.Increment
+#align_import combinatorics.simple_graph.regularity.lemma from "leanprover-community/mathlib"@"08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5"
+
/-!
# Szemerédi's 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.lemma
-! leanprover-community/mathlib commit 1d4d3ca5ec44693640c4f5e407a6b611f77accc8
+! leanprover-community/mathlib commit 08b63ab58a6ec1157ebeafcbbe6c7a3fb3c9f6d5
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -13,6 +13,9 @@ import Mathbin.Combinatorics.SimpleGraph.Regularity.Increment
/-!
# Szemerédi's Regularity Lemma
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
In this file, we prove Szemerédi's Regularity Lemma (aka SRL). This is a landmark result in
combinatorics roughly stating that any sufficiently big graph behaves like a random graph. This is
useful because random graphs are well-behaved in many aspects.
mathlib commit https://github.com/leanprover-community/mathlib/commit/fdc286cc6967a012f41b87f76dcd2797b53152af
@@ -73,6 +73,7 @@ open scoped Classical
variable {α : Type _} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
+#print szemeredi_regularity /-
/-- Effective **Szemerédi Regularity Lemma**: For any sufficiently large graph, there is an
`ε`-uniform equipartition of bounded size (where the bound does not depend on the graph). -/
theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
@@ -166,4 +167,5 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
· rw [Nat.cast_succ, mul_add, mul_one]
exact add_le_add_right hP₄ _
#align szemeredi_regularity szemeredi_regularity
+-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -123,7 +123,6 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
((mul_lt_mul_left <| by positivity).2 (Nat.lt_floor_add_one _))
_ ≤ (P.energy G : ℝ) := by rwa [← Nat.cast_add_one]
_ ≤ 1 := by exact_mod_cast P.energy_le_one G
-
-- Let's do the actual induction.
intro i
induction' i with i ih
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -147,8 +147,8 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
have hi : (i : ℝ) ≤ 4 / ε ^ 5 :=
by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (by exact_mod_cast P.energy_le_one G)
- rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
- norm_num at hi
+ rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
+ norm_num at hi
rwa [le_div_iff' (pow_pos hε _)]
have hsize : P.parts.card ≤ (step_bound^[⌊4 / ε ^ 5⌋₊]) t :=
hP₃.trans (monotone_iterate_of_id_le le_step_bound (Nat.le_floor hi) _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -69,7 +69,7 @@ We currently only prove the equipartition version of SRL.
open Finpartition Finset Fintype Function szemeredi_regularity
-open Classical
+open scoped Classical
variable {α : Type _} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -117,9 +117,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
· rw [iterate_succ_apply']
exact mul_le_mul_left' (pow_le_pow_of_le_left (by norm_num) (by norm_num) _) _
calc
- 1 = ε ^ 5 / 4 * (4 / ε ^ 5) :=
- by
- rw [mul_comm, div_mul_div_cancel 4 (pow_pos hε 5).ne']
+ 1 = ε ^ 5 / 4 * (4 / ε ^ 5) := by rw [mul_comm, div_mul_div_cancel 4 (pow_pos hε 5).ne'];
norm_num
_ < ε ^ 5 / 4 * (⌊4 / ε ^ 5⌋₊ + 1) :=
((mul_lt_mul_left <| by positivity).2 (Nat.lt_floor_add_one _))
mathlib commit https://github.com/leanprover-community/mathlib/commit/75e7fca56381d056096ce5d05e938f63a6567828
Prove the triangle counting lemma. Definitions that are internal to the proof are made private.
@@ -79,7 +79,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
-- If `card α ≤ bound ε l`, then the partition into singletons is acceptable.
· refine' ⟨⊥, bot_isEquipartition _, _⟩
rw [card_bot, card_univ]
- exact ⟨hl, hα, botIsUniform _ hε⟩
+ exact ⟨hl, hα, bot_isUniform _ hε⟩
-- Else, let's start from a dummy equipartition of size `initialBound ε l`.
let t := initialBound ε l
have htα : t ≤ (univ : Finset α).card :=
@@ -89,7 +89,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
obtain hε₁ | hε₁ := le_total 1 ε
-- If `ε ≥ 1`, then this dummy equipartition is `ε`-uniform, so we're done.
· exact ⟨dum, hdum₁, (le_initialBound ε l).trans hdum₂.ge,
- hdum₂.le.trans (initialBound_le_bound ε l), (dum.isUniformOne G).mono hε₁⟩
+ hdum₂.le.trans (initialBound_le_bound ε l), (dum.isUniform_one G).mono hε₁⟩
-- Else, set up the induction on energy. We phrase it through the existence for each `i` of an
-- equipartition of size bounded by `stepBound^[i] (initialBound ε l)` and which is either
-- `ε`-uniform or has energy at least `ε ^ 5 / 4 * i`.
This is a very large PR, but it has been reviewed piecemeal already in PRs to the bump/v4.7.0
branch as we update to intermediate nightlies.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: damiano <adomani@gmail.com>
@@ -135,7 +135,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
have hi : (i : ℝ) ≤ 4 / ε ^ 5 := by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (mod_cast P.energy_le_one G)
rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
- norm_num at hi
+ set_option tactic.skipAssignedInstances false in norm_num at hi
rwa [le_div_iff' (pow_pos hε _)]
have hsize : P.parts.card ≤ stepBound^[⌊4 / ε ^ 5⌋₊] t :=
hP₃.trans (monotone_iterate_of_id_le le_stepBound (Nat.le_floor hi) _)
have
, replace
and suffices
(#10640)
No changes to tactic file, it's just boring fixes throughout the library.
This follows on from #6964.
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -97,10 +97,10 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
rw [← Fintype.card_pos_iff]
exact (bound_pos _ _).trans_le hα
suffices h : ∀ i, ∃ P : Finpartition (univ : Finset α), P.IsEquipartition ∧ t ≤ P.parts.card ∧
- P.parts.card ≤ stepBound^[i] t ∧ (P.IsUniform G ε ∨ ε ^ 5 / 4 * i ≤ P.energy G)
+ P.parts.card ≤ stepBound^[i] t ∧ (P.IsUniform G ε ∨ ε ^ 5 / 4 * i ≤ P.energy G) by
-- For `i > 4 / ε ^ 5` we know that the partition we get can't have energy `≥ ε ^ 5 / 4 * i > 1`,
-- so it must instead be `ε`-uniform and we won.
- · obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := h (⌊4 / ε ^ 5⌋₊ + 1)
+ obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := h (⌊4 / ε ^ 5⌋₊ + 1)
refine' ⟨P, hP₁, (le_initialBound _ _).trans hP₂, hP₃.trans _,
hP₄.resolve_right fun hPenergy => lt_irrefl (1 : ℝ) _⟩
· rw [iterate_succ_apply']
by using calc
, gcongr
and positivity
. This should be much more maintainable now.
Nicely enough, this reduces the total number of lines.
@@ -129,8 +129,8 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
-- Else, `P` must instead have energy at least `ε ^ 5 / 4 * i`.
replace hP₄ := hP₄.resolve_left huniform
-- We gather a few numerical facts.
- have hεl' : ↑100 < ↑4 ^ P.parts.card * ε ^ 5 :=
- (hundred_lt_pow_initialBound_mul hε l).trans_le
+ have hεl' : 100 ≤ 4 ^ P.parts.card * ε ^ 5 :=
+ (hundred_lt_pow_initialBound_mul hε l).le.trans
(mul_le_mul_of_nonneg_right (pow_le_pow_right (by norm_num) hP₂) <| by positivity)
have hi : (i : ℝ) ≤ 4 / ε ^ 5 := by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (mod_cast P.energy_le_one G)
@@ -143,7 +143,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
(Nat.mul_le_mul hsize (Nat.pow_le_pow_of_le_right (by norm_num) hsize)).trans hα
-- We return the increment equipartition of `P`, which has energy `≥ ε ^ 5 / 4 * (i + 1)`.
refine' ⟨increment hP₁ G ε, increment_isEquipartition hP₁ G ε, _, _, Or.inr <| le_trans _ <|
- energy_increment hP₁ ((seven_le_initialBound ε l).trans hP₂) hεl' hPα huniform hε₁⟩
+ energy_increment hP₁ ((seven_le_initialBound ε l).trans hP₂) hεl' hPα huniform hε.le hε₁⟩
· rw [card_increment hPα huniform]
exact hP₂.trans (le_stepBound _)
· rw [card_increment hPα huniform, iterate_succ_apply']
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.Order
pow_mono
→ pow_right_mono
pow_le_pow
→ pow_le_pow_right
pow_le_pow_of_le_left
→ pow_le_pow_left
pow_lt_pow_of_lt_left
→ pow_lt_pow_left
strictMonoOn_pow
→ pow_left_strictMonoOn
pow_strictMono_right
→ pow_right_strictMono
pow_lt_pow
→ pow_lt_pow_right
pow_lt_pow_iff
→ pow_lt_pow_iff_right
pow_le_pow_iff
→ pow_le_pow_iff_right
self_lt_pow
→ lt_self_pow
strictAnti_pow
→ pow_right_strictAnti
pow_lt_pow_iff_of_lt_one
→ pow_lt_pow_iff_right_of_lt_one
pow_lt_pow_of_lt_one
→ pow_lt_pow_right_of_lt_one
lt_of_pow_lt_pow
→ lt_of_pow_lt_pow_left
le_of_pow_le_pow
→ le_of_pow_le_pow_left
pow_lt_pow₀
→ pow_lt_pow_right₀
Algebra.GroupPower.CovariantClass
pow_le_pow_of_le_left'
→ pow_le_pow_left'
nsmul_le_nsmul_of_le_right
→ nsmul_le_nsmul_right
pow_lt_pow'
→ pow_lt_pow_right'
nsmul_lt_nsmul
→ nsmul_lt_nsmul_left
pow_strictMono_left
→ pow_right_strictMono'
nsmul_strictMono_right
→ nsmul_left_strictMono
StrictMono.pow_right'
→ StrictMono.pow_const
StrictMono.nsmul_left
→ StrictMono.const_nsmul
pow_strictMono_right'
→ pow_left_strictMono
nsmul_strictMono_left
→ nsmul_right_strictMono
Monotone.pow_right
→ Monotone.pow_const
Monotone.nsmul_left
→ Monotone.const_nsmul
lt_of_pow_lt_pow'
→ lt_of_pow_lt_pow_left'
lt_of_nsmul_lt_nsmul
→ lt_of_nsmul_lt_nsmul_right
pow_le_pow'
→ pow_le_pow_right'
nsmul_le_nsmul
→ nsmul_le_nsmul_left
pow_le_pow_of_le_one'
→ pow_le_pow_right_of_le_one'
nsmul_le_nsmul_of_nonpos
→ nsmul_le_nsmul_left_of_nonpos
le_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_left
pow_lt_pow_iff'
→ pow_lt_pow_iff_right'
nsmul_lt_nsmul_iff
→ nsmul_lt_nsmul_iff_left
Data.Nat.Pow
Nat.pow_lt_pow_of_lt_left
→ Nat.pow_lt_pow_left
Nat.pow_le_iff_le_left
→ Nat.pow_le_pow_iff_left
Nat.pow_lt_iff_lt_left
→ Nat.pow_lt_pow_iff_left
pow_le_pow_iff_left
pow_lt_pow_iff_left
pow_right_injective
pow_right_inj
Nat.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
.@@ -104,7 +104,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
refine' ⟨P, hP₁, (le_initialBound _ _).trans hP₂, hP₃.trans _,
hP₄.resolve_right fun hPenergy => lt_irrefl (1 : ℝ) _⟩
· rw [iterate_succ_apply']
- exact mul_le_mul_left' (pow_le_pow_of_le_left (by norm_num) (by norm_num) _) _
+ exact mul_le_mul_left' (pow_le_pow_left (by norm_num) (by norm_num) _) _
calc
(1 : ℝ) = ε ^ 5 / ↑4 * (↑4 / ε ^ 5) := by
rw [mul_comm, div_mul_div_cancel 4 (pow_pos hε 5).ne']; norm_num
@@ -131,7 +131,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
-- We gather a few numerical facts.
have hεl' : ↑100 < ↑4 ^ P.parts.card * ε ^ 5 :=
(hundred_lt_pow_initialBound_mul hε l).trans_le
- (mul_le_mul_of_nonneg_right (pow_le_pow (by norm_num) hP₂) <| by positivity)
+ (mul_le_mul_of_nonneg_right (pow_le_pow_right (by norm_num) hP₂) <| by positivity)
have hi : (i : ℝ) ≤ 4 / ε ^ 5 := by
have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (mod_cast P.energy_le_one G)
rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
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>
@@ -111,14 +111,14 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
_ < ε ^ 5 / 4 * (⌊4 / ε ^ 5⌋₊ + 1) :=
((mul_lt_mul_left <| by positivity).2 (Nat.lt_floor_add_one _))
_ ≤ (P.energy G : ℝ) := by rwa [← Nat.cast_add_one]
- _ ≤ 1 := by exact_mod_cast P.energy_le_one G
+ _ ≤ 1 := mod_cast P.energy_le_one G
-- Let's do the actual induction.
intro i
induction' i with i ih
-- For `i = 0`, the dummy equipartition is enough.
· refine' ⟨dum, hdum₁, hdum₂.ge, hdum₂.le, Or.inr _⟩
rw [Nat.cast_zero, mul_zero]
- exact_mod_cast dum.energy_nonneg G
+ exact mod_cast dum.energy_nonneg G
-- For the induction step at `i + 1`, find `P` the equipartition at `i`.
obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := ih
by_cases huniform : P.IsUniform G ε
@@ -133,7 +133,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
(hundred_lt_pow_initialBound_mul hε l).trans_le
(mul_le_mul_of_nonneg_right (pow_le_pow (by norm_num) hP₂) <| by positivity)
have hi : (i : ℝ) ≤ 4 / ε ^ 5 := by
- have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (by exact_mod_cast P.energy_le_one G)
+ have hi : ε ^ 5 / 4 * ↑i ≤ 1 := hP₄.trans (mod_cast P.energy_le_one G)
rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
norm_num at hi
rwa [le_div_iff' (pow_pos hε _)]
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>
@@ -68,8 +68,6 @@ open Finpartition Finset Fintype Function SzemerediRegularity
open scoped Classical
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
variable {α : Type*} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
/-- Effective **Szemerédi Regularity Lemma**: For any sufficiently large graph, there is an
MulZeroClass.
in mul_zero
/zero_mul
(#6682)
Search&replace MulZeroClass.mul_zero
-> mul_zero
, MulZeroClass.zero_mul
-> zero_mul
.
These were introduced by Mathport, as the full name of mul_zero
is actually MulZeroClass.mul_zero
(it's exported with the short name).
@@ -119,7 +119,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
induction' i with i ih
-- For `i = 0`, the dummy equipartition is enough.
· refine' ⟨dum, hdum₁, hdum₂.ge, hdum₂.le, Or.inr _⟩
- rw [Nat.cast_zero, MulZeroClass.mul_zero]
+ rw [Nat.cast_zero, mul_zero]
exact_mod_cast dum.energy_nonneg G
-- For the induction step at `i + 1`, find `P` the equipartition at `i`.
obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := ih
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -70,7 +70,7 @@ open scoped Classical
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-variable {α : Type _} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
+variable {α : Type*} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
/-- Effective **Szemerédi Regularity Lemma**: For any sufficiently large graph, there is an
`ε`-uniform equipartition of bounded size (where the bound does not depend on the graph). -/
@@ -68,7 +68,7 @@ open Finpartition Finset Fintype Function SzemerediRegularity
open scoped Classical
-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
variable {α : Type _} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
@@ -2,14 +2,11 @@
Copyright (c) 2021 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.lemma
-! leanprover-community/mathlib commit 1d4d3ca5ec44693640c4f5e407a6b611f77accc8
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Combinatorics.SimpleGraph.Regularity.Increment
+#align_import combinatorics.simple_graph.regularity.lemma from "leanprover-community/mathlib"@"1d4d3ca5ec44693640c4f5e407a6b611f77accc8"
+
/-!
# Szemerédi's Regularity Lemma
@@ -96,13 +96,13 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
· exact ⟨dum, hdum₁, (le_initialBound ε l).trans hdum₂.ge,
hdum₂.le.trans (initialBound_le_bound ε l), (dum.isUniformOne G).mono hε₁⟩
-- Else, set up the induction on energy. We phrase it through the existence for each `i` of an
- -- equipartition of size bounded by `stepBound^[i]) (initialBound ε l)` and which is either
+ -- equipartition of size bounded by `stepBound^[i] (initialBound ε l)` and which is either
-- `ε`-uniform or has energy at least `ε ^ 5 / 4 * i`.
have : Nonempty α := by
rw [← Fintype.card_pos_iff]
exact (bound_pos _ _).trans_le hα
suffices h : ∀ i, ∃ P : Finpartition (univ : Finset α), P.IsEquipartition ∧ t ≤ P.parts.card ∧
- P.parts.card ≤ (stepBound^[i]) t ∧ (P.IsUniform G ε ∨ ε ^ 5 / 4 * i ≤ P.energy G)
+ P.parts.card ≤ stepBound^[i] t ∧ (P.IsUniform G ε ∨ ε ^ 5 / 4 * i ≤ P.energy G)
-- For `i > 4 / ε ^ 5` we know that the partition we get can't have energy `≥ ε ^ 5 / 4 * i > 1`,
-- so it must instead be `ε`-uniform and we won.
· obtain ⟨P, hP₁, hP₂, hP₃, hP₄⟩ := h (⌊4 / ε ^ 5⌋₊ + 1)
@@ -142,7 +142,7 @@ theorem szemeredi_regularity (hε : 0 < ε) (hl : l ≤ card α) :
rw [div_mul_eq_mul_div, div_le_iff (show (0 : ℝ) < 4 by norm_num)] at hi
norm_num at hi
rwa [le_div_iff' (pow_pos hε _)]
- have hsize : P.parts.card ≤ (stepBound^[⌊4 / ε ^ 5⌋₊]) t :=
+ have hsize : P.parts.card ≤ stepBound^[⌊4 / ε ^ 5⌋₊] t :=
hP₃.trans (monotone_iterate_of_id_le le_stepBound (Nat.le_floor hi) _)
have hPα : P.parts.card * 16 ^ P.parts.card ≤ card α :=
(Nat.mul_le_mul hsize (Nat.pow_le_pow_of_le_right (by norm_num) hsize)).trans hα
The unported dependencies are
algebra.order.module
init.core
linear_algebra.free_module.finite.rank
algebra.order.monoid.cancel.defs
algebra.abs
algebra.group_power.lemmas
init.data.list.basic
linear_algebra.free_module.rank
init.data.list.default
algebra.order.monoid.cancel.basic
topology.subset_properties
init.logic
The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file