Skip to content

Commit 2c1517a

Browse files
committed
chore(SimpleGraph/Regularity): Don't use Classical (#12575)
The classical decidability instances were found in theorem statements, making them harder to use.
1 parent 2f50e34 commit 2c1517a

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

Mathlib/Combinatorics/SimpleGraph/Regularity/Chunk.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
3838

3939

4040
open Finpartition Finset Fintype Rel Nat
41-
42-
open scoped BigOperators Classical SzemerediRegularity.Positivity
41+
open scoped BigOperators SzemerediRegularity.Positivity
4342

4443
namespace SzemerediRegularity
4544

46-
variable {α : Type*} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
47-
(G : SimpleGraph α) (ε : ℝ) {U : Finset α} (hU : U ∈ P.parts) (V : Finset α)
45+
variable {α : Type*} [Fintype α] [DecidableEq α] {P : Finpartition (univ : Finset α)}
46+
(hP : P.IsEquipartition) (G : SimpleGraph α) [DecidableRel G.Adj] (ε : ℝ) {U : Finset α}
47+
(hU : U ∈ P.parts) (V : Finset α)
4848

4949
local notation3 "m" => (card α / stepBound P.parts.card : ℕ)
5050

Mathlib/Combinatorics/SimpleGraph/Regularity/Increment.lean

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Once ported to mathlib4, this file will be a great golfing ground for Heather's
3838

3939
open Finset Fintype SimpleGraph SzemerediRegularity
4040

41-
open scoped BigOperators Classical SzemerediRegularity.Positivity
41+
open scoped BigOperators SzemerediRegularity.Positivity
4242

43-
variable {α : Type*} [Fintype α] {P : Finpartition (univ : Finset α)} (hP : P.IsEquipartition)
44-
(G : SimpleGraph α) (ε : ℝ)
43+
variable {α : Type*} [Fintype α] [DecidableEq α] {P : Finpartition (univ : Finset α)}
44+
(hP : P.IsEquipartition) (G : SimpleGraph α) [DecidableRel G.Adj] (ε : ℝ)
4545

4646
local notation3 "m" => (card α / stepBound P.parts.card : ℕ)
4747

@@ -77,8 +77,9 @@ theorem card_increment (hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hP
7777
rw [filter_card_add_filter_neg_card_eq_card, card_attach]
7878
#align szemeredi_regularity.card_increment SzemerediRegularity.card_increment
7979

80-
theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α) (ε : ℝ) :
81-
(increment hP G ε).IsEquipartition := by
80+
variable (hP G ε)
81+
82+
theorem increment_isEquipartition : (increment hP G ε).IsEquipartition := by
8283
simp_rw [IsEquipartition, Set.equitableOn_iff_exists_eq_eq_add_one]
8384
refine' ⟨m, fun A hA => _⟩
8485
rw [mem_coe, increment, mem_bind] at hA
@@ -87,12 +88,14 @@ theorem increment_isEquipartition (hP : P.IsEquipartition) (G : SimpleGraph α)
8788
#align szemeredi_regularity.increment_is_equipartition SzemerediRegularity.increment_isEquipartition
8889

8990
/-- The contribution to `Finpartition.energy` of a pair of distinct parts of a `Finpartition`. -/
90-
private noncomputable def distinctPairs (G : SimpleGraph α) (ε : ℝ) (hP : P.IsEquipartition)
91-
(x : {x // x ∈ P.parts.offDiag}) : Finset (Finset α × Finset α) :=
91+
private noncomputable def distinctPairs (x : {x // x ∈ P.parts.offDiag}) :
92+
Finset (Finset α × Finset α) :=
9293
(chunk hP G ε (mem_offDiag.1 x.2).1).parts ×ˢ (chunk hP G ε (mem_offDiag.1 x.2).2.1).parts
9394

95+
variable {hP G ε}
96+
9497
private theorem distinctPairs_increment :
95-
P.parts.offDiag.attach.biUnion (distinctPairs G ε hP) ⊆ (increment hP G ε).parts.offDiag := by
98+
P.parts.offDiag.attach.biUnion (distinctPairs hP G ε) ⊆ (increment hP G ε).parts.offDiag := by
9699
rintro ⟨Ui, Vj⟩
97100
simp only [distinctPairs, increment, mem_offDiag, bind_parts, mem_biUnion, Prod.exists,
98101
exists_and_left, exists_prop, mem_product, mem_attach, true_and_iff, Subtype.exists, and_imp,
@@ -105,7 +108,7 @@ private theorem distinctPairs_increment :
105108

106109
private lemma pairwiseDisjoint_distinctPairs :
107110
(P.parts.offDiag.attach : Set {x // x ∈ P.parts.offDiag}).PairwiseDisjoint
108-
(distinctPairs G ε hP) := by
111+
(distinctPairs hP G ε) := by
109112
simp (config := { unfoldPartialApp := true }) only [distinctPairs, Set.PairwiseDisjoint,
110113
Function.onFun, disjoint_left, inf_eq_inter, mem_inter, mem_product]
111114
rintro ⟨⟨s₁, s₂⟩, hs⟩ _ ⟨⟨t₁, t₂⟩, ht⟩ _ hst ⟨u, v⟩ huv₁ huv₂
@@ -124,7 +127,7 @@ lemma le_sum_distinctPairs_edgeDensity_sq (x : {i // i ∈ P.parts.offDiag}) (h
124127
(hPα : P.parts.card * 16 ^ P.parts.card ≤ card α) (hPε : ↑100 ≤ ↑4 ^ P.parts.card * ε ^ 5) :
125128
(G.edgeDensity x.1.1 x.1.2 : ℝ) ^ 2 +
126129
((if G.IsUniform ε x.1.1 x.1.2 then 0 else ε ^ 4 / 3) - ε ^ 5 / 25) ≤
127-
(∑ i in distinctPairs G ε hP x, G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card := by
130+
(∑ i in distinctPairs hP G ε x, G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card := by
128131
rw [distinctPairs, ← add_sub_assoc, add_sub_right_comm]
129132
split_ifs with h
130133
· rw [add_zero]
@@ -144,9 +147,9 @@ theorem energy_increment (hP : P.IsEquipartition) (hP₇ : 7 ≤ P.parts.card)
144147
_ = (∑ x in P.parts.offDiag, (G.edgeDensity x.1 x.2 : ℝ) ^ 2 +
145148
P.parts.card ^ 2 * (ε ^ 5 / 4) : ℝ) / P.parts.card ^ 2 := by
146149
rw [coe_energy, add_div, mul_div_cancel_left₀]; positivity
147-
_ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs G ε hP x,
150+
_ ≤ (∑ x in P.parts.offDiag.attach, (∑ i in distinctPairs hP G ε x,
148151
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / 16 ^ P.parts.card) / P.parts.card ^ 2 := ?_
149-
_ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs G ε hP x,
152+
_ = (∑ x in P.parts.offDiag.attach, ∑ i in distinctPairs hP G ε x,
150153
G.edgeDensity i.1 i.2 ^ 2 : ℝ) / (increment hP G ε).parts.card ^ 2 := by
151154
rw [card_increment hPα hPG, coe_stepBound, mul_pow, pow_right_comm,
152155
div_mul_eq_div_div_swap, ← sum_div]; norm_num

Mathlib/Combinatorics/SimpleGraph/Regularity/Lemma.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,8 @@ We currently only prove the equipartition version of SRL.
6666

6767
open Finpartition Finset Fintype Function SzemerediRegularity
6868

69-
open scoped Classical
70-
71-
variable {α : Type*} [Fintype α] (G : SimpleGraph α) {ε : ℝ} {l : ℕ}
69+
variable {α : Type*} [DecidableEq α] [Fintype α] (G : SimpleGraph α) [DecidableRel G.Adj] {ε : ℝ}
70+
{l : ℕ}
7271

7372
/-- Effective **Szemerédi Regularity Lemma**: For any sufficiently large graph, there is an
7473
`ε`-uniform equipartition of bounded size (where the bound does not depend on the graph). -/

0 commit comments

Comments
 (0)