Skip to content

Commit d48d30a

Browse files
committed
chore: superfluous parentheses part 2 (#12131)
Co-authored-by: Moritz Firsching <firsching@google.com>
1 parent 22092a2 commit d48d30a

File tree

243 files changed

+440
-441
lines changed

Some content is hidden

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

243 files changed

+440
-441
lines changed

Archive/Imo/Imo1962Q1.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ theorem case_more_digits {c n : ℕ} (h1 : (digits 10 c).length ≥ 6) (h2 : Pro
119119
exact case_0_digit h5 h2
120120
calc
121121
n ≥ 10 * c := le.intro h2.left.symm
122-
_ ≥ 10 ^ (digits 10 c).length := (base_pow_length_digits_le 10 c (by decide) h3)
122+
_ ≥ 10 ^ (digits 10 c).length := base_pow_length_digits_le 10 c (by decide) h3
123123
_ ≥ 10 ^ 6 := pow_le_pow_right (by decide) h1
124124
_ ≥ 153846 := by norm_num
125125
#align imo1962_q1.case_more_digits Imo1962Q1.case_more_digits

Archive/Imo/Imo1972Q5.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ theorem imo1972_q5 (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x - y
4141
calc
4242
2 * (‖f x‖ * ‖g y‖) = ‖2 * f x * g y‖ := by simp [abs_mul, mul_assoc]
4343
_ = ‖f (x + y) + f (x - y)‖ := by rw [hf1]
44-
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := (norm_add_le _ _)
45-
_ ≤ k + k := (add_le_add (hk₁ _) (hk₁ _))
44+
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := norm_add_le _ _
45+
_ ≤ k + k := add_le_add (hk₁ _) (hk₁ _)
4646
_ = 2 * k := (two_mul _).symm
4747
set k' := k / ‖g y‖
4848
-- Demonstrate that `k' < k` using `hneg`.
@@ -98,6 +98,6 @@ theorem imo1972_q5' (f g : ℝ → ℝ) (hf1 : ∀ x, ∀ y, f (x + y) + f (x -
9898
calc
9999
2 * (‖f x‖ * ‖g y‖) = ‖2 * f x * g y‖ := by simp [abs_mul, mul_assoc]
100100
_ = ‖f (x + y) + f (x - y)‖ := by rw [hf1]
101-
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := (abs_add _ _)
101+
_ ≤ ‖f (x + y)‖ + ‖f (x - y)‖ := abs_add _ _
102102
_ ≤ 2 * k := by linarith [h (x + y), h (x - y)]
103103
linarith

Archive/Imo/Imo1981Q3.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ theorem m_n_bounds {m n : ℕ} (h1 : NatPredicate N m n) : m ≤ fib K ∧ n ≤
163163
rw [← fib_add_two] at HK
164164
calc
165165
N < fib (K + 2) := HK
166-
_ ≤ fib (k + 1) := (fib_mono h8)
166+
_ ≤ fib (k + 1) := fib_mono h8
167167
_ = n := hn.symm
168168
have h9 : n ≤ N := h1.n_le_N
169169
exact absurd h7 h9.not_lt

Archive/Imo/Imo1988Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ theorem imo1988_q6 {a b : ℕ} (h : a * b + 1 ∣ a ^ 2 + b ^ 2) :
227227
apply ne_of_lt
228228
calc
229229
x * x + x * x = x * x * 2 := by rw [mul_two]
230-
_ ≤ x * x * k := (Nat.mul_le_mul_left (x * x) k_lt_one)
230+
_ ≤ x * x * k := Nat.mul_le_mul_left (x * x) k_lt_one
231231
_ < (x * x + 1) * k := by linarith
232232
· -- Show the descent step.
233233
intro x y hx x_lt_y _ _ z h_root _ hV₀

Archive/Imo/Imo1994Q1.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ theorem imo1994_q1 (n : ℕ) (m : ℕ) (A : Finset ℕ) (hm : A.card = m + 1)
6767
2 * ∑ i : Fin (m + 1), a i = ∑ i : Fin (m + 1), a i + ∑ i : Fin (m + 1), a i := two_mul _
6868
_ = ∑ i : Fin (m + 1), a i + ∑ i : Fin (m + 1), a (rev i) := by rw [Equiv.sum_comp rev]
6969
_ = ∑ i : Fin (m + 1), (a i + a (rev i)) := sum_add_distrib.symm
70-
_ ≥ ∑ i : Fin (m + 1), (n + 1) := (sum_le_sum hpair)
70+
_ ≥ ∑ i : Fin (m + 1), (n + 1) := sum_le_sum hpair
7171
_ = (m + 1) * (n + 1) := by rw [sum_const, card_fin, Nat.nsmul_eq_mul]
7272
-- It remains to prove the key inequality, by contradiction
7373
rintro k -

Archive/Imo/Imo2008Q2.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ theorem imo2008_q2b : Set.Infinite rationalSolutions := by
114114
have h₂ : q < t * (t + 1) := by
115115
calc
116116
q < q + 1 := by linarith
117-
_ ≤ t := (le_max_left (q + 1) 1)
117+
_ ≤ t := le_max_left (q + 1) 1
118118
_ ≤ t + t ^ 2 := by linarith [sq_nonneg t]
119119
_ = t * (t + 1) := by ring
120120
exact ⟨h₁, h₂⟩

Archive/Imo/Imo2011Q3.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ theorem imo2011_q3 (f : ℝ → ℝ) (hf : ∀ x y, f (x + y) ≤ y * f x + f (f
2828
have hxt : ∀ x t, f t ≤ t * f x - x * f x + f (f x) := fun x t =>
2929
calc
3030
f t = f (x + (t - x)) := by rw [add_eq_of_eq_sub' rfl]
31-
_ ≤ (t - x) * f x + f (f x) := (hf x (t - x))
31+
_ ≤ (t - x) * f x + f (f x) := hf x (t - x)
3232
_ = t * f x - x * f x + f (f x) := by rw [sub_mul]
3333
have h_ab_combined : ∀ a b, a * f a + b * f b ≤ 2 * f a * f b := fun a b => by
3434
linarith [hxt b (f a), hxt a (f b)]

Archive/Imo/Imo2011Q5.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ theorem imo2011_q5 (f : ℤ → ℤ) (hpos : ∀ n : ℤ, 0 < f n) (hdvd : ∀ m
3636
have h_neg_d_lt_fn : -d < f n := by
3737
calc
3838
-d = f (m - n) - f m := neg_sub _ _
39-
_ < f (m - n) := (sub_lt_self _ (hpos m))
40-
_ ≤ f n - f m := (le_of_dvd (sub_pos.mpr h_fm_lt_fn) ?_)
39+
_ < f (m - n) := sub_lt_self _ (hpos m)
40+
_ ≤ f n - f m := le_of_dvd (sub_pos.mpr h_fm_lt_fn) ?_
4141
_ < f n := sub_lt_self _ (hpos m)
4242
-- ⊢ f (m - n) ∣ f n - f m
4343
rw [← dvd_neg, neg_sub]

Archive/Imo/Imo2013Q5.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ theorem f_pos_of_pos {f : ℚ → ℝ} {q : ℚ} (hq : 0 < q)
9595
have hmul_pos :=
9696
calc
9797
(0 : ℝ) < q.num := Int.cast_pos.mpr num_pos
98-
_ = ((q.num.natAbs : ℤ) : ℝ) := (congr_arg Int.cast (Int.natAbs_of_nonneg num_pos.le).symm)
98+
_ = ((q.num.natAbs : ℤ) : ℝ) := congr_arg Int.cast (Int.natAbs_of_nonneg num_pos.le).symm
9999
_ ≤ f q.num.natAbs := (H4 q.num.natAbs ((@Int.natAbs_pos q.num).mpr num_pos.ne.symm))
100100
_ = f q.num := by rw [Nat.cast_natAbs, abs_of_nonneg num_pos.le]
101101
_ = f (q * q.den) := by rw [← Rat.mul_den_eq_num]
@@ -168,7 +168,7 @@ theorem fixed_point_of_gt_1 {f : ℚ → ℝ} {x : ℚ} (hx : 1 < x)
168168
calc
169169
f x + f (a ^ N - x) ≤ f (x + (a ^ N - x)) := H2 x (a ^ N - x) hxp (by positivity)
170170
_ = f (a ^ N) := by ring_nf
171-
_ = a ^ N := (fixed_point_of_pos_nat_pow hNp H1 H4 H5 ha1 hae)
171+
_ = a ^ N := fixed_point_of_pos_nat_pow hNp H1 H4 H5 ha1 hae
172172
_ = x + (a ^ N - x) := by ring
173173
have heq := h1.antisymm (mod_cast h2)
174174
linarith [H5 x hx, H5 _ h_big_enough]
@@ -204,12 +204,12 @@ theorem imo2013_q5 (f : ℚ → ℝ) (H1 : ∀ x y, 0 < x → 0 < y → f (x * y
204204
↑a * 1 = ↑a := mul_one (a : ℝ)
205205
_ = f a := hae.symm
206206
_ = f (a * 1) := by rw [mul_one]
207-
_ ≤ f a * f 1 := ((H1 a 1) (zero_lt_one.trans ha1) zero_lt_one)
207+
_ ≤ f a * f 1 := (H1 a 1) (zero_lt_one.trans ha1) zero_lt_one
208208
_ = ↑a * f 1 := by rw [hae]
209209
calc
210210
(n : ℝ) = (n : ℝ) * 1 := (mul_one _).symm
211211
_ ≤ (n : ℝ) * f 1 := by gcongr
212-
_ ≤ f (n * 1) := (H3 1 zero_lt_one n hn)
212+
_ ≤ f (n * 1) := H3 1 zero_lt_one n hn
213213
_ = f n := by rw [mul_one]
214214
have H5 : ∀ x : ℚ, 1 < x → (x : ℝ) ≤ f x := by
215215
intro x hx

Archive/Wiedijk100Theorems/SumOfPrimeReciprocalsDiverges.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ theorem card_le_mul_sum {x k : ℕ} : (card (U x k) : ℝ) ≤ x * ∑ p in P x
132132
have h : card (Finset.biUnion P N) ≤ ∑ p in P, card (N p) := card_biUnion_le
133133
calc
134134
(card (Finset.biUnion P N) : ℝ) ≤ ∑ p in P, (card (N p) : ℝ) := by assumption_mod_cast
135-
_ ≤ ∑ p in P, x * (1 / (p : ℝ)) := (sum_le_sum fun p _ => ?_)
135+
_ ≤ ∑ p in P, x * (1 / (p : ℝ)) := sum_le_sum fun p _ => ?_
136136
_ = x * ∑ p in P, 1 / (p : ℝ) := by rw [mul_sum]
137137
simp only [N, mul_one_div, Nat.card_multiples, Nat.cast_div_le]
138138
#align theorems_100.card_le_mul_sum Theorems100.card_le_mul_sum
@@ -168,7 +168,7 @@ theorem card_le_two_pow {x k : ℕ} :
168168
card M₁ ≤ card (image f K) := card_le_card h
169169
_ ≤ card K := card_image_le
170170
_ ≤ 2 ^ card (image Nat.succ (range k)) := by simp only [K, card_powerset]; rfl
171-
_ ≤ 2 ^ card (range k) := (pow_le_pow_right one_le_two card_image_le)
171+
_ ≤ 2 ^ card (range k) := pow_le_pow_right one_le_two card_image_le
172172
_ = 2 ^ k := by rw [card_range k]
173173
#align theorems_100.card_le_two_pow Theorems100.card_le_two_pow
174174

@@ -205,7 +205,7 @@ theorem card_le_two_pow_mul_sqrt {x k : ℕ} : card (M x k) ≤ 2 ^ k * Nat.sqrt
205205
calc
206206
card (M x k) ≤ card (image f K) := card_le_card h1
207207
_ ≤ card K := card_image_le
208-
_ = card M₁ * card M₂ := (card_product M₁ M₂)
208+
_ = card M₁ * card M₂ := card_product M₁ M₂
209209
_ ≤ 2 ^ k * x.sqrt := mul_le_mul' card_le_two_pow h2
210210
#align theorems_100.card_le_two_pow_mul_sqrt Theorems100.card_le_two_pow_mul_sqrt
211211

@@ -236,7 +236,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
236236
have h3 :=
237237
calc
238238
(card U' : ℝ) ≤ x * ∑ p in P, 1 / (p : ℝ) := card_le_mul_sum
239-
_ < x * (1 / 2) := (mul_lt_mul_of_pos_left (h1 x) (by norm_num [x]))
239+
_ < x * (1 / 2) := mul_lt_mul_of_pos_left (h1 x) (by norm_num [x])
240240
_ = x / 2 := mul_one_div (x : ℝ) 2
241241
have h4 :=
242242
calc
@@ -246,7 +246,7 @@ theorem Real.tendsto_sum_one_div_prime_atTop :
246246
refine' lt_irrefl (x : ℝ) _
247247
calc
248248
(x : ℝ) = (card U' : ℝ) + (card M' : ℝ) := by assumption_mod_cast
249-
_ < x / 2 + x / 2 := (add_lt_add_of_lt_of_le h3 h4)
249+
_ < x / 2 + x / 2 := add_lt_add_of_lt_of_le h3 h4
250250
_ = x := add_halves (x : ℝ)
251251
#align theorems_100.real.tendsto_sum_one_div_prime_at_top Theorems100.Real.tendsto_sum_one_div_prime_atTop
252252

0 commit comments

Comments
 (0)