Skip to content

Commit 6c1021b

Browse files
committed
fix: precedence of , and abs (#5619)
1 parent 8dc87f2 commit 6c1021b

File tree

46 files changed

+159
-160
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+159
-160
lines changed

Mathlib/Algebra/Abs.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class NegPart (α : Type _) where
6363
#align has_neg_part NegPart
6464

6565
@[inherit_doc Abs.abs]
66-
macro atomic("|" noWs) a:term noWs "|" : term => `(abs $a)
66+
macro:max atomic("|" noWs) a:term noWs "|" : term => `(abs $a)
6767

6868
/-- Unexpander for the notation `|a|` for `abs a`.
6969
Tries to add discretionary parentheses in unparseable cases. -/
@@ -76,7 +76,7 @@ def Abs.abs.unexpander : Lean.PrettyPrinter.Unexpander
7676
| _ => throw ()
7777

7878
@[inherit_doc]
79-
postfix:1000 "⁺" => PosPart.pos
79+
postfix:max "⁺" => PosPart.pos
8080

8181
@[inherit_doc]
82-
postfix:1000 "⁻" => NegPart.neg
82+
postfix:max "⁻" => NegPart.neg

Mathlib/Algebra/Order/Field/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ theorem max_div_div_right_of_nonpos (hc : c ≤ 0) (a b : α) : max (a / c) (b /
997997
Eq.symm <| Antitone.map_min fun _ _ => div_le_div_of_nonpos_of_le hc
998998
#align max_div_div_right_of_nonpos max_div_div_right_of_nonpos
999999

1000-
theorem abs_inv (a : α) : |a⁻¹| = (|a|)⁻¹ :=
1000+
theorem abs_inv (a : α) : |a⁻¹| = |a|⁻¹ :=
10011001
map_inv₀ (absHom : α →*₀ α) a
10021002
#align abs_inv abs_inv
10031003

Mathlib/Algebra/Order/Group/Abs.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ theorem abs_le_abs (h₀ : a ≤ b) (h₁ : -a ≤ b) : |a| ≤ |b| :=
7373
(abs_le'.2 ⟨h₀, h₁⟩).trans (le_abs_self b)
7474
#align abs_le_abs abs_le_abs
7575

76-
theorem abs_by_cases (P : α → Prop) {a : α} (h1 : P a) (h2 : P (-a)) : P (|a|) :=
76+
theorem abs_by_cases (P : α → Prop) {a : α} (h1 : P a) (h2 : P (-a)) : P |a| :=
7777
sup_ind _ _ h1 h2
7878
#align abs_by_cases abs_by_cases
7979

@@ -251,7 +251,7 @@ theorem le_of_abs_le (h : |a| ≤ b) : a ≤ b :=
251251
@[to_additive]
252252
theorem apply_abs_le_mul_of_one_le' {β : Type _} [MulOneClass β] [Preorder β]
253253
[CovariantClass β β (· * ·) (· ≤ ·)] [CovariantClass β β (swap (· * ·)) (· ≤ ·)] {f : α → β}
254-
{a : α} (h₁ : 1 ≤ f a) (h₂ : 1 ≤ f (-a)) : f (|a|) ≤ f a * f (-a) :=
254+
{a : α} (h₁ : 1 ≤ f a) (h₂ : 1 ≤ f (-a)) : f |a| ≤ f a * f (-a) :=
255255
(le_total a 0).rec (fun ha => (abs_of_nonpos ha).symm ▸ le_mul_of_one_le_left' h₁) fun ha =>
256256
(abs_of_nonneg ha).symm ▸ le_mul_of_one_le_right' h₂
257257
#align apply_abs_le_mul_of_one_le' apply_abs_le_mul_of_one_le'
@@ -260,15 +260,15 @@ theorem apply_abs_le_mul_of_one_le' {β : Type _} [MulOneClass β] [Preorder β]
260260
@[to_additive]
261261
theorem apply_abs_le_mul_of_one_le {β : Type _} [MulOneClass β] [Preorder β]
262262
[CovariantClass β β (· * ·) (· ≤ ·)] [CovariantClass β β (swap (· * ·)) (· ≤ ·)] {f : α → β}
263-
(h : ∀ x, 1 ≤ f x) (a : α) : f (|a|) ≤ f a * f (-a) :=
263+
(h : ∀ x, 1 ≤ f x) (a : α) : f |a| ≤ f a * f (-a) :=
264264
apply_abs_le_mul_of_one_le' (h _) (h _)
265265
#align apply_abs_le_mul_of_one_le apply_abs_le_mul_of_one_le
266266
#align apply_abs_le_add_of_nonneg apply_abs_le_add_of_nonneg
267267

268268
/-- The **triangle inequality** in `LinearOrderedAddCommGroup`s. -/
269269
theorem abs_add (a b : α) : |a + b| ≤ |a| + |b| :=
270270
abs_le.2
271-
⟨(neg_add (|a|) (|b|)).symm ▸
271+
⟨(neg_add |a| |b|).symm ▸
272272
add_le_add ((@neg_le α ..).2 <| neg_le_abs_self _) ((@neg_le α ..).2 <| neg_le_abs_self _),
273273
add_le_add (le_abs_self _) (le_abs_self _)⟩
274274
#align abs_add abs_add
@@ -322,28 +322,28 @@ theorem abs_eq (hb : 0 ≤ b) : |a| = b ↔ a = b ∨ a = -b := by
322322
rintro (rfl | rfl) <;> simp only [abs_neg, abs_of_nonneg hb]
323323
#align abs_eq abs_eq
324324

325-
theorem abs_le_max_abs_abs (hab : a ≤ b) (hbc : b ≤ c) : |b| ≤ max (|a|) (|c|) :=
325+
theorem abs_le_max_abs_abs (hab : a ≤ b) (hbc : b ≤ c) : |b| ≤ max |a| |c| :=
326326
abs_le'.2
327327
by simp [hbc.trans (le_abs_self c)], by
328328
simp [((@neg_le_neg_iff α ..).mpr hab).trans (neg_le_abs_self a)]⟩
329329
#align abs_le_max_abs_abs abs_le_max_abs_abs
330330

331-
theorem min_abs_abs_le_abs_max : min (|a|) (|b|) ≤ |max a b| :=
331+
theorem min_abs_abs_le_abs_max : min |a| |b| ≤ |max a b| :=
332332
(le_total a b).elim (fun h => (min_le_right _ _).trans_eq <| congr_arg _ (max_eq_right h).symm)
333333
fun h => (min_le_left _ _).trans_eq <| congr_arg _ (max_eq_left h).symm
334334
#align min_abs_abs_le_abs_max min_abs_abs_le_abs_max
335335

336-
theorem min_abs_abs_le_abs_min : min (|a|) (|b|) ≤ |min a b| :=
336+
theorem min_abs_abs_le_abs_min : min |a| |b| ≤ |min a b| :=
337337
(le_total a b).elim (fun h => (min_le_left _ _).trans_eq <| congr_arg _ (min_eq_left h).symm)
338338
fun h => (min_le_right _ _).trans_eq <| congr_arg _ (min_eq_right h).symm
339339
#align min_abs_abs_le_abs_min min_abs_abs_le_abs_min
340340

341-
theorem abs_max_le_max_abs_abs : |max a b| ≤ max (|a|) (|b|) :=
341+
theorem abs_max_le_max_abs_abs : |max a b| ≤ max |a| |b| :=
342342
(le_total a b).elim (fun h => (congr_arg _ <| max_eq_right h).trans_le <| le_max_right _ _)
343343
fun h => (congr_arg _ <| max_eq_left h).trans_le <| le_max_left _ _
344344
#align abs_max_le_max_abs_abs abs_max_le_max_abs_abs
345345

346-
theorem abs_min_le_max_abs_abs : |min a b| ≤ max (|a|) (|b|) :=
346+
theorem abs_min_le_max_abs_abs : |min a b| ≤ max |a| |b| :=
347347
(le_total a b).elim (fun h => (congr_arg _ <| min_eq_left h).trans_le <| le_max_left _ _) fun h =>
348348
(congr_arg _ <| min_eq_right h).trans_le <| le_max_right _ _
349349
#align abs_min_le_max_abs_abs abs_min_le_max_abs_abs

Mathlib/Algebra/Order/Group/MinMax.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ theorem max_sub_max_le_max (a b c d : α) : max a b - max c d ≤ max (a - c) (b
9191
_ ≤ max (a - c) (b - d) + max c d := add_le_add (le_max_right _ _) (le_max_right _ _)
9292
#align max_sub_max_le_max max_sub_max_le_max
9393

94-
theorem abs_max_sub_max_le_max (a b c d : α) : |max a b - max c d| ≤ max (|a - c|) (|b - d|) := by
94+
theorem abs_max_sub_max_le_max (a b c d : α) : |max a b - max c d| ≤ max |a - c| |b - d| := by
9595
refine' abs_sub_le_iff.2 ⟨_, _⟩
9696
· exact (max_sub_max_le_max _ _ _ _).trans (max_le_max (le_abs_self _) (le_abs_self _))
9797
· rw [abs_sub_comm a c, abs_sub_comm b d]
9898
exact (max_sub_max_le_max _ _ _ _).trans (max_le_max (le_abs_self _) (le_abs_self _))
9999
#align abs_max_sub_max_le_max abs_max_sub_max_le_max
100100

101-
theorem abs_min_sub_min_le_max (a b c d : α) : |min a b - min c d| ≤ max (|a - c|) (|b - d|) := by
101+
theorem abs_min_sub_min_le_max (a b c d : α) : |min a b - min c d| ≤ max |a - c| |b - d| := by
102102
simpa only [max_neg_neg, neg_sub_neg, abs_sub_comm] using
103103
abs_max_sub_max_le_max (-a) (-b) (-c) (-d)
104104
#align abs_min_sub_min_le_max abs_min_sub_min_le_max

Mathlib/Algebra/Order/LatticeGroup.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ theorem m_neg_abs [CovariantClass α α (· * ·) (· ≤ ·)] (a : α) : |a|⁻
358358

359359
@[to_additive pos_abs]
360360
theorem m_pos_abs [CovariantClass α α (· * ·) (· ≤ ·)] (a : α) : |a|⁺ = |a| := by
361-
nth_rw 2 [← pos_div_neg (|a|)]
361+
nth_rw 2 [← pos_div_neg |a|]
362362
rw [div_eq_mul_inv]
363363
symm
364364
rw [mul_right_eq_self, inv_eq_one]

Mathlib/Algebra/Parity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ theorem Even.neg_one_zpow (h : Even n) : (-1 : α) ^ n = 1 := by rw [h.neg_zpow,
196196

197197
end DivisionMonoid
198198

199-
theorem even_abs [SubtractionMonoid α] [LinearOrder α] {a : α} : Even (|a|) ↔ Even a := by
199+
theorem even_abs [SubtractionMonoid α] [LinearOrder α] {a : α} : Even |a| ↔ Even a := by
200200
cases abs_choice a
201201
· have h : abs a = a := by assumption
202202
simp only [h, even_neg]

Mathlib/Analysis/Complex/PhragmenLindelof.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,4 +890,3 @@ theorem eqOn_right_half_plane_of_superexponential_decay {g : ℂ → E}
890890
#align phragmen_lindelof.eq_on_right_half_plane_of_superexponential_decay PhragmenLindelof.eqOn_right_half_plane_of_superexponential_decay
891891

892892
end PhragmenLindelof
893-

Mathlib/Analysis/Convex/Gauge.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ theorem gauge_smul_left_of_nonneg [MulActionWithZero α E] [SMulCommClass α ℝ
290290

291291
theorem gauge_smul_left [Module α E] [SMulCommClass α ℝ ℝ] [IsScalarTower α ℝ ℝ]
292292
[IsScalarTower α ℝ E] {s : Set E} (symmetric : ∀ x ∈ s, -x ∈ s) (a : α) :
293-
gauge (a • s) = (|a|)⁻¹ • gauge s := by
293+
gauge (a • s) = |a|⁻¹ • gauge s := by
294294
rw [← gauge_smul_left_of_nonneg (abs_nonneg a)]
295295
obtain h | h := abs_choice a
296296
· rw [h]

Mathlib/Analysis/InnerProductSpace/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,7 @@ theorem abs_real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_ne_zero_mul {x : F
15721572
itself, divided by the product of their norms, has value 1. -/
15731573
theorem real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul {x : F} {r : ℝ} (hx : x ≠ 0)
15741574
(hr : 0 < r) : ⟪x, r • x⟫_ℝ / (‖x‖ * ‖r • x‖) = 1 := by
1575-
rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ (|r|),
1575+
rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ |r|,
15761576
mul_assoc, abs_of_nonneg hr.le, div_self]
15771577
exact mul_ne_zero hr.ne' (mul_self_ne_zero.2 (norm_ne_zero_iff.2 hx))
15781578
#align real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul
@@ -1581,7 +1581,7 @@ theorem real_inner_div_norm_mul_norm_eq_one_of_ne_zero_of_pos_mul {x : F} {r :
15811581
itself, divided by the product of their norms, has value -1. -/
15821582
theorem real_inner_div_norm_mul_norm_eq_neg_one_of_ne_zero_of_neg_mul {x : F} {r : ℝ} (hx : x ≠ 0)
15831583
(hr : r < 0) : ⟪x, r • x⟫_ℝ / (‖x‖ * ‖r • x‖) = -1 := by
1584-
rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ (|r|),
1584+
rw [real_inner_smul_self_right, norm_smul, Real.norm_eq_abs, ← mul_assoc ‖x‖, mul_comm _ |r|,
15851585
mul_assoc, abs_of_neg hr, neg_mul, div_neg_eq_neg_div, div_self]
15861586
exact mul_ne_zero hr.ne (mul_self_ne_zero.2 (norm_ne_zero_iff.2 hx))
15871587
#align real_inner_div_norm_mul_norm_eq_neg_one_of_ne_zero_of_neg_mul real_inner_div_norm_mul_norm_eq_neg_one_of_ne_zero_of_neg_mul

Mathlib/Analysis/MellinTransform.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ theorem mellin_div_const (f : ℝ → ℂ) (s a : ℂ) : mellin (fun t => f t /
127127
#align mellin_div_const mellin_div_const
128128

129129
theorem mellin_comp_rpow (f : ℝ → E) (s : ℂ) {a : ℝ} (ha : a ≠ 0) :
130-
mellin (fun t => f (t ^ a)) s = (|a|)⁻¹ • mellin f (s / a) := by
130+
mellin (fun t => f (t ^ a)) s = |a|⁻¹ • mellin f (s / a) := by
131131
-- note: this is also true for a = 0 (both sides are zero), but this is mathematically
132132
-- uninteresting and rather time-consuming to check
133133
simp_rw [mellin]

0 commit comments

Comments
 (0)