Skip to content

Commit 1ea46f1

Browse files
committed
Lint to mathlib standards
1 parent 976b7fe commit 1ea46f1

File tree

11 files changed

+32
-53
lines changed

11 files changed

+32
-53
lines changed

LeanAPAP/FiniteField.lean

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ open Finset hiding card
2121
open scoped ENNReal NNReal BigOperators Combinatorics.Additive Pointwise mu
2222

2323
universe u
24-
variable {G : Type u} [AddCommGroup G] [DecidableEq G] [Fintype G] {A C : Finset G} {x y γ ε : ℝ}
24+
variable {G : Type u} [AddCommGroup G] [Fintype G] {A C : Finset G} {x y γ ε : ℝ}
2525

2626
local notation "𝓛" x:arg => 1 + log x⁻¹
2727

@@ -37,6 +37,7 @@ private lemma curlog_pos (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : 0 < 𝓛 x := by
3737
have : 0 ≤ log x⁻¹ := by bound
3838
positivity
3939

40+
set_option linter.flexible false in
4041
private lemma rpow_inv_neg_curlog_le (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : x⁻¹ ^ (𝓛 x)⁻¹ ≤ exp 1 := by
4142
obtain rfl | hx₀ := hx₀.eq_or_lt
4243
· simp; positivity
@@ -87,8 +88,9 @@ private lemma curlog_rpow_le (hx₀ : 0 < x) (hy : 1 ≤ y) : 𝓛 (x ^ y) ≤ y
8788
private lemma curlog_pow_le {n : ℕ} (hx₀ : 0 < x) (hn : n ≠ 0) : 𝓛 (x ^ n) ≤ n * 𝓛 x := by
8889
rw [← rpow_natCast]; exact curlog_rpow_le hx₀ <| mod_cast Nat.one_le_iff_ne_zero.2 hn
8990

90-
lemma global_dichotomy [MeasurableSpace G] [DiscreteMeasurableSpace G] (hA : A.Nonempty)
91-
(hγC : γ ≤ C.dens) (hγ : 0 < γ) (hAC : ε ≤ |card G * ⟪μ_[ℝ] A ∗ μ A, μ C⟫_[ℝ] - 1|) :
91+
lemma global_dichotomy [DecidableEq G] [MeasurableSpace G] [DiscreteMeasurableSpace G]
92+
(hA : A.Nonempty) (hγC : γ ≤ C.dens) (hγ : 0 < γ)
93+
(hAC : ε ≤ |card G * ⟪μ_[ℝ] A ∗ μ A, μ C⟫_[ℝ] - 1|) :
9294
ε / (2 * card G) ≤ ‖balance (μ_[ℝ] A) ○ balance (μ A)‖_[↑(2 * ⌈𝓛 γ⌉₊), μ univ] := by
9395
have hC : C.Nonempty := by simpa using hγ.trans_le hγC
9496
have hγ₁ : γ ≤ 1 := hγC.trans (by norm_cast; exact dens_le_one)
@@ -140,8 +142,9 @@ lemma global_dichotomy [MeasurableSpace G] [DiscreteMeasurableSpace G] (hA : A.N
140142

141143
variable {q n : ℕ} [Module (ZMod q) G] {A₁ A₂ : Finset G} (S : Finset G) {α : ℝ}
142144

143-
lemma ap_in_ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε)
144-
(hε₁ : ε ≤ 1) (hαA₁ : α ≤ A₁.dens) (hαA₂ : α ≤ A₂.dens) :
145+
set_option linter.flexible false in
146+
lemma ap_in_ff [DecidableEq G] (hq₃ : 3 ≤ q) (hq : q.Prime) (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹)
147+
(hε₀ : 0 < ε) (hε₁ : ε ≤ 1) (hαA₁ : α ≤ A₁.dens) (hαA₂ : α ≤ A₂.dens) :
145148
∃ (V : Submodule (ZMod q) G) (_ : DecidablePred (· ∈ V)),
146149
↑(finrank (ZMod q) G - finrank (ZMod q) V) ≤ 2 ^ 32 * 𝓛 α ^ 2 * 𝓛 (ε * α) ^ 2 * ε⁻¹ ^ 2
147150
|∑ x ∈ S, (μ (Set.toFinset V) ∗ μ A₁ ∗ μ A₂) x - ∑ x ∈ S, (μ A₁ ∗ μ A₂) x| ≤ ε := by
@@ -237,16 +240,18 @@ lemma ap_in_ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hα₀ : 0 < α) (hα₂ : α
237240
have : ∑ x ∈ S, (μ_[ℝ] A₁ ∗ μ A₂) x = (μ_[ℝ] A₁ ∗ μ A₂ ○ 𝟭 S) 0 := by simp [dconv_indicate]
238241
sorry
239242

240-
lemma ap_in_ff' (hq₃ : 3 ≤ q) (hq : q.Prime) (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹) (hε₀ : 0 < ε)
241-
(hε₁ : ε ≤ 1) (hαA₁ : α ≤ A₁.dens) (hαA₂ : α ≤ A₂.dens) :
243+
lemma ap_in_ff' [DecidableEq G] (hq₃ : 3 ≤ q) (hq : q.Prime) (hα₀ : 0 < α) (hα₂ : α ≤ 2⁻¹)
244+
(hε₀ : 0 < ε) (hε₁ : ε ≤ 1) (hαA₁ : α ≤ A₁.dens) (hαA₂ : α ≤ A₂.dens) :
242245
∃ (V : Submodule (ZMod q) G) (_ : DecidablePred (· ∈ V)),
243246
↑(finrank (ZMod q) G - finrank (ZMod q) V) ≤ 2 ^ 32 * 𝓛 α ^ 2 * 𝓛 (ε * α) ^ 2 * ε⁻¹ ^ 2
244247
|∑ x ∈ S, (μ (Set.toFinset V) ∗ μ A₁ ○ μ A₂) x - ∑ x ∈ S, (μ A₁ ○ μ A₂) x| ≤ ε := by
245248
simpa [← conjneg_mu] using ap_in_ff S hq₃ hq (A₂ := -A₂) hα₀ hα₂ hε₀ hε₁ hαA₁ (by simpa)
246249

250+
set_option linter.flexible false in
247251
set_option maxHeartbeats 400000 in
248-
lemma di_in_ff [MeasurableSpace G] [DiscreteMeasurableSpace G] (hq₃ : 3 ≤ q) (hq : q.Prime)
249-
(hε₀ : 0 < ε) (hε₁ : ε < 1) (hγC : γ ≤ C.dens) (hγ : 0 < γ)
252+
-- FIXME: Get rid of raised heartbeats
253+
lemma di_in_ff [DecidableEq G] [MeasurableSpace G] [DiscreteMeasurableSpace G] (hq₃ : 3 ≤ q)
254+
(hq : q.Prime) (hε₀ : 0 < ε) (hε₁ : ε < 1) (hγC : γ ≤ C.dens) (hγ : 0 < γ)
250255
(hAC : ε ≤ |card G * ⟪μ_[ℝ] A ∗ μ A, μ C⟫_[ℝ] - 1|) :
251256
∃ (V : Submodule (ZMod q) G) (_ : DecidablePred (· ∈ V)),
252257
↑(finrank (ZMod q) G - finrank (ZMod q) V) ≤
@@ -446,6 +451,7 @@ lemma di_in_ff [MeasurableSpace G] [DiscreteMeasurableSpace G] (hq₃ : 3 ≤ q)
446451
· exact conv_nonneg mu_nonneg mu_nonneg
447452
· exact mu_nonneg
448453

454+
set_option linter.flexible false in
449455
theorem ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hA₀ : A.Nonempty) (hA : ThreeAPFree (α := G) A) :
450456
finrank (ZMod q) G ≤ 2 ^ 156 * 𝓛 A.dens ^ 9 := by
451457
let n : ℝ := finrank (ZMod q) G
@@ -487,6 +493,7 @@ theorem ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hA₀ : A.Nonempty) (hA : ThreeAPFr
487493
2⁻¹ ≤ card V * ⟪μ_[ℝ] B ∗ μ B, μ (B.image (2 • ·))⟫_[ℝ]) := by
488494
induction i with
489495
| zero =>
496+
classical
490497
exact ⟨G, inferInstance, inferInstance, inferInstance, inferInstance, A, by simp [n], hA,
491498
by simp [α], by simp [α, nnratCast_dens]⟩
492499
| succ i ih =>
@@ -520,7 +527,6 @@ theorem ff (hq₃ : 3 ≤ q) (hq : q.Prime) (hA₀ : A.Nonempty) (hA : ThreeAPFr
520527
· congr 1 with x
521528
simp
522529
· simp
523-
simp at hx
524530
refine ⟨V', inferInstance, inferInstance, inferInstance, inferInstance, B', ?_, ?_, ?_,
525531
fun h ↦ ?_⟩
526532
· calc

LeanAPAP/Physics/AlmostPeriodicity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ lemma my_other_markov (hc : 0 ≤ c) (hε : 0 ≤ ε) (hg : ∀ a ∈ A, 0 ≤ g
7676
classical
7777
rw [one_sub_mul, sub_le_comm, ← cast_card_sdiff (filter_subset _ A), ← filter_not,
7878
filter_false_of_mem]
79-
· simp; positivity
79+
· simp only [card_empty, CharP.cast_eq_zero]; positivity
8080
intro i hi
8181
rw [(sum_eq_zero_iff_of_nonneg hg).1 (h.antisymm (sum_nonneg hg)) i hi]
8282
simp

LeanAPAP/Prereqs/Bohr/Basic.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ noncomputable instance [Finite G] : SupSet (BohrSet G) where
191191
mem_frequencies := by simp
192192
}
193193

194-
lemma iInf_lt_top {α β : Type*} [CompleteLattice β] {S : Set α} {f : α → β}:
194+
lemma iInf_lt_top {α β : Type*} [CompleteLattice β] {S : Set α} {f : α → β} :
195195
(⨅ i ∈ S, f i) < ⊤ ↔ ∃ i ∈ S, f i < ⊤ := by
196196
simp [lt_top_iff_ne_top]
197197

@@ -257,8 +257,6 @@ lemma nnreal_smul_ne_top_iff {x : ℝ≥0} {y : ℝ≥0∞} (hx : x ≠ 0) : x
257257
by_contra hy
258258
simp [hy, ENNReal.smul_top, hx] at h
259259

260-
open scoped Classical
261-
262260
noncomputable instance instSMul : SMul ℝ (BohrSet G) where
263261
smul ρ B := BohrSet.mk B.frequencies
264262
(fun ψ => if ψ ∈ B.frequencies then Real.nnabs ρ * B.ewidth ψ else ⊤) fun ψ => by
@@ -342,7 +340,6 @@ lemma smul_add_smul_subset [Finite G] {B : BohrSet G} {ρ₁ ρ₂ : ℝ} (hρ
342340
add_subset_of_ewidth fun ψ => by
343341
simp only [Pi.add_apply, ewidth_smul]; split <;> simp [add_nonneg, add_mul, *]
344342

345-
346343
end BohrSet
347344

348345
-- variable {ρ : ℝ}

LeanAPAP/Prereqs/Chang.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private lemma curlog_pos (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : 0 < 𝓛 x := by
2525

2626
private lemma rpow_inv_neg_curlog_le (hx₀ : 0 ≤ x) (hx₁ : x ≤ 1) : x⁻¹ ^ (𝓛 x)⁻¹ ≤ exp 1 := by
2727
obtain rfl | hx₀ := hx₀.eq_or_lt
28-
· simp; positivity
28+
· simp only [inv_zero, log_zero, add_zero, inv_one, rpow_one]; positivity
2929
obtain rfl | hx₁ := hx₁.eq_or_lt
3030
· simp
3131
have hx := (one_lt_inv₀ hx₀).2 hx₁

LeanAPAP/Prereqs/Convolution/Compact.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ lemma IsSelfAdjoint.cconv (hf : IsSelfAdjoint f) (hg : IsSelfAdjoint g) : IsSelf
241241
lemma IsSelfAdjoint.cdconv (hf : IsSelfAdjoint f) (hg : IsSelfAdjoint g) : IsSelfAdjoint (f ○ₙ g) :=
242242
(conj_cdconv _ _).trans <| congr_arg₂ _ hf hg
243243

244-
@[simp]lemma conjneg_cconv (f g : G → R) : conjneg (f ∗ₙ g) = conjneg f ∗ₙ conjneg g := by
244+
@[simp] lemma conjneg_cconv (f g : G → R) : conjneg (f ∗ₙ g) = conjneg f ∗ₙ conjneg g := by
245245
funext a
246246
simp only [cconv_apply, conjneg_apply, map_expect, map_mul]
247247
exact Finset.expect_equiv (Equiv.neg (G × G)) (by simp [eq_comm, ← neg_eq_iff_eq_neg, add_comm])

LeanAPAP/Prereqs/Convolution/Discrete/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ lemma IsSelfAdjoint.conv (hf : IsSelfAdjoint f) (hg : IsSelfAdjoint g) : IsSelfA
228228
lemma IsSelfAdjoint.dconv (hf : IsSelfAdjoint f) (hg : IsSelfAdjoint g) : IsSelfAdjoint (f ○ g) :=
229229
(conj_dconv _ _).trans <| congr_arg₂ _ hf hg
230230

231-
@[simp]lemma conjneg_conv (f g : G → R) : conjneg (f ∗ g) = conjneg f ∗ conjneg g := by
231+
@[simp] lemma conjneg_conv (f g : G → R) : conjneg (f ∗ g) = conjneg f ∗ conjneg g := by
232232
funext a
233233
simp only [conv_apply, conjneg_apply, map_sum, map_mul]
234234
exact sum_equiv (Equiv.neg _) (by simp [← neg_eq_iff_eq_neg, add_comm]) (by simp)

LeanAPAP/Prereqs/Convolution/Norm.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ lemma dLpNorm_conv_le {p : ℝ≥0} (hp : 1 ≤ p) (f g : G → 𝕜) : ‖f ∗
9595
simp
9696
· have : 1 - (p : ℝ)⁻¹ ≠ 0 := sub_ne_zero.2 (inv_ne_one.2 <| NNReal.coe_ne_one.2 hp.ne').symm
9797
simp [NNReal.mul_rpow, hp₀.ne', this]
98-
9998
calc
10099
∑ x, ‖∑ y, f y * g (x - y)‖₊ ^ (p : ℝ) ≤
101100
∑ x, (∑ y, ‖f y‖₊ ^ (p : ℝ) * ‖g (x - y)‖₊) * (∑ y, ‖g (x - y)‖₊) ^ (p - 1 : ℝ) :=

LeanAPAP/Prereqs/LpNorm/Discrete/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ lemma dLpNorm_eq_dL1Norm_rpow (hp : p ≠ 0) (f : α → 𝕜) :
322322
lemma dLpNorm_rpow' {p : ℝ≥0∞} (hp₀ : p ≠ 0) (hp : p ≠ ∞) (hq : q ≠ 0) (f : α → 𝕜) :
323323
‖f‖_[p] ^ (q : ℝ) = ‖(fun a ↦ ‖f a‖) ^ (q : ℝ)‖_[p / q] := by
324324
lift p to ℝ≥0 using hp
325-
simp at hp₀
325+
simp only [ne_eq, ENNReal.coe_eq_zero] at hp₀
326326
rw [← ENNReal.coe_div hq, dLpNorm_rpow (div_ne_zero hp₀ hq) hq (fun _ ↦ norm_nonneg _),
327327
dLpNorm_norm, ← ENNReal.coe_mul, div_mul_cancel₀ _ hq]
328328

LeanAPAP/Prereqs/MarcinkiewiczZygmund.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private lemma step_one' (hA : A.Nonempty) (f : ι → ℝ) (hf : ∀ i, ∑ a
6565
-- when the corresponding ε is -1
6666
-- but the order here is a bit subtle (ie this explanation is an oversimplification)
6767
private lemma step_two_aux (A : Finset ι) (f : ι → ℝ) (ε : Fin n → ℝ)
68-
(hε : ε ∈ ({-1, 1} : Finset ℝ)^^n) (g : (Fin n → ℝ) → ℝ) :
68+
(hε : ε ∈ ({-1, 1} : Finset ℝ) ^^ n) (g : (Fin n → ℝ) → ℝ) :
6969
∑ a ∈ A ^^ n, ∑ b ∈ A ^^ n, g (ε * (f ∘ a - f ∘ b)) =
7070
∑ a ∈ A ^^ n, ∑ b ∈ A ^^ n, g (f ∘ a - f ∘ b) := by
7171
rw [← sum_product', ← sum_product']

LeanAPAP/Prereqs/Rudin.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private lemma rudin_ineq_aux (hp : 2 ≤ p) (f : G → ℂ) (hf : AddDissociated
7676
have : (‖re ∘ f‖ₙ_[↑p] / p) ^ p ≤ (2 * exp 2⁻¹) ^ p := by
7777
calc
7878
_ = 𝔼 a, |(f a).re| ^ p / p ^ p := by
79-
simp [div_pow, cLpNorm_pow_eq_expect_norm hp₀]; rw [expect_div]
79+
simp [div_pow, cLpNorm_pow_eq_expect_norm hp₀, expect_div]
8080
_ ≤ 𝔼 a, |(f a).re| ^ p / p ! := by gcongr; norm_cast; exact p.factorial_le_pow
8181
_ ≤ 𝔼 a, exp |(f a).re| := by gcongr; exact pow_div_factorial_le_exp _ (abs_nonneg _) _
8282
_ ≤ _ := rudin_exp_abs_ineq f hf

0 commit comments

Comments
 (0)