Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 402f898

Browse files
committed
chore(algebra/order/group/basic): Improve lemma names (#16970)
Rename * `div_le''` → `div_le_comm` * `le_div''` → `le_div_comm` * `sub_le` → `sub_le_comm` * `le_sub` → `le_sub_comm` * `div_lt''` → `div_lt_comm` * `lt_div''` → `lt_div_comm` * `sub_lt` → `sub_lt_comm` * `lt_sub` → `lt_sub_comm`
1 parent 51c07ea commit 402f898

26 files changed

Lines changed: 56 additions & 60 deletions

File tree

src/algebra/order/archimedean.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ by simpa only [rat.cast_pos] using exists_rat_btwn x0
262262

263263
lemma exists_rat_near (x : α) (ε0 : 0 < ε) : ∃ q : ℚ, |x - q| < ε :=
264264
let ⟨q, h₁, h₂⟩ := exists_rat_btwn $ ((sub_lt_self_iff x).2 ε0).trans ((lt_add_iff_pos_left x).2 ε0)
265-
in ⟨q, abs_sub_lt_iff.2sub_lt.1 h₁, sub_lt_iff_lt_add.2 h₂⟩⟩
265+
in ⟨q, abs_sub_lt_iff.2sub_lt_comm.1 h₁, sub_lt_iff_lt_add.2 h₂⟩⟩
266266

267267
end linear_ordered_field
268268

src/algebra/order/complete_field.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ begin
135135
{ rw [mem_set_of_eq, ←sub_lt_iff_lt_add] at hq,
136136
obtain ⟨q₁, hq₁q, hq₁ab⟩ := exists_rat_btwn hq,
137137
refine ⟨q₁, q - q₁, _, _, add_sub_cancel'_right _ _⟩; try {norm_cast}; rwa coe_mem_cut_map_iff,
138-
exact_mod_cast sub_lt.mp hq₁q },
138+
exact_mod_cast sub_lt_comm.mp hq₁q },
139139
{ rintro _ ⟨_, _, ⟨qa, ha, rfl⟩, ⟨qb, hb, rfl⟩, rfl⟩,
140140
refine ⟨qa + qb, _, by norm_cast⟩,
141141
rw [mem_set_of_eq, cast_add],

src/algebra/order/floor.lean

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ by rw [add_comm, fract_add_nat]
555555

556556
@[simp] lemma fract_nonneg (a : α) : 0 ≤ fract a := sub_nonneg.2 $ floor_le _
557557

558-
lemma fract_lt_one (a : α) : fract a < 1 := sub_lt.1 $ sub_one_lt_floor _
558+
lemma fract_lt_one (a : α) : fract a < 1 := sub_lt_comm.1 $ sub_one_lt_floor _
559559

560560
@[simp] lemma fract_zero : fract (0 : α) = 0 := by rw [fract, floor_zero, cast_zero, sub_self]
561561

@@ -878,7 +878,8 @@ begin
878878
simpa only [le_add_iff_nonneg_right, sub_nonneg, cast_le] using le_floor.mpr hx, },
879879
{ rw abs_eq_neg_self.mpr (sub_neg.mpr hx).le,
880880
conv_rhs { rw ← fract_add_floor x, },
881-
rw [add_sub_assoc, add_comm, neg_add, neg_sub, le_add_neg_iff_add_le, sub_add_cancel, le_sub],
881+
rw [add_sub_assoc, add_comm, neg_add, neg_sub, le_add_neg_iff_add_le, sub_add_cancel,
882+
le_sub_comm],
882883
norm_cast,
883884
exact floor_le_sub_one_iff.mpr hx, },
884885
end

src/algebra/order/group/basic.lean

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -632,13 +632,11 @@ le_div_iff_mul_le.trans inv_mul_le_iff_le_mul'
632632
lemma inv_le_div_iff_le_mul' : a⁻¹ ≤ b / c ↔ c ≤ a * b :=
633633
by rw [inv_le_div_iff_le_mul, mul_comm]
634634

635-
@[to_additive sub_le]
636-
lemma div_le'' : a / b ≤ c ↔ a / c ≤ b :=
637-
div_le_iff_le_mul'.trans div_le_iff_le_mul.symm
635+
@[to_additive]
636+
lemma div_le_comm : a / b ≤ c ↔ a / c ≤ b := div_le_iff_le_mul'.trans div_le_iff_le_mul.symm
638637

639-
@[to_additive le_sub]
640-
lemma le_div'' : a ≤ b / c ↔ c ≤ b / a :=
641-
le_div_iff_mul_le'.trans le_div_iff_mul_le.symm
638+
@[to_additive]
639+
lemma le_div_comm : a ≤ b / c ↔ c ≤ b / a := le_div_iff_mul_le'.trans le_div_iff_mul_le.symm
642640

643641
end has_le
644642

@@ -747,13 +745,11 @@ alias sub_lt_iff_lt_add' ↔ lt_add_of_sub_left_lt sub_left_lt_of_lt_add
747745
lemma inv_lt_div_iff_lt_mul' : b⁻¹ < a / c ↔ c < a * b :=
748746
lt_div_iff_mul_lt.trans inv_mul_lt_iff_lt_mul'
749747

750-
@[to_additive sub_lt]
751-
lemma div_lt'' : a / b < c ↔ a / c < b :=
752-
div_lt_iff_lt_mul'.trans div_lt_iff_lt_mul.symm
748+
@[to_additive]
749+
lemma div_lt_comm : a / b < c ↔ a / c < b := div_lt_iff_lt_mul'.trans div_lt_iff_lt_mul.symm
753750

754-
@[to_additive lt_sub]
755-
lemma lt_div'' : a < b / c ↔ c < b / a :=
756-
lt_div_iff_mul_lt'.trans lt_div_iff_mul_lt.symm
751+
@[to_additive]
752+
lemma lt_div_comm : a < b / c ↔ c < b / a := lt_div_iff_mul_lt'.trans lt_div_iff_mul_lt.symm
757753

758754
end has_lt
759755

@@ -1161,13 +1157,13 @@ lemma abs_sub_lt_iff : |a - b| < c ↔ a - b < c ∧ b - a < c :=
11611157
by rw [abs_lt, neg_lt_sub_iff_lt_add', sub_lt_iff_lt_add', and_comm, sub_lt_iff_lt_add']
11621158

11631159
lemma sub_le_of_abs_sub_le_left (h : |a - b| ≤ c) : b - c ≤ a :=
1164-
sub_le.1 $ (abs_sub_le_iff.1 h).2
1160+
sub_le_comm.1 $ (abs_sub_le_iff.1 h).2
11651161

11661162
lemma sub_le_of_abs_sub_le_right (h : |a - b| ≤ c) : a - c ≤ b :=
11671163
sub_le_of_abs_sub_le_left (abs_sub_comm a b ▸ h)
11681164

11691165
lemma sub_lt_of_abs_sub_lt_left (h : |a - b| < c) : b - c < a :=
1170-
sub_lt.1 $ (abs_sub_lt_iff.1 h).2
1166+
sub_lt_comm.1 $ (abs_sub_lt_iff.1 h).2
11711167

11721168
lemma sub_lt_of_abs_sub_lt_right (h : |a - b| < c) : a - c < b :=
11731169
sub_lt_of_abs_sub_lt_left (abs_sub_comm a b ▸ h)

src/analysis/complex/roots_of_unity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ begin
166166
exact mul_nonpos_of_nonpos_of_nonneg (sub_nonpos.mpr $ by exact_mod_cast h.le)
167167
(div_nonneg (by simp [real.pi_pos.le]) $ by simp) },
168168
rw [←mul_rotate', mul_div_assoc, neg_lt, ←mul_neg, mul_lt_iff_lt_one_right real.pi_pos,
169-
←neg_div, ←neg_mul, neg_sub, div_lt_iff, one_mul, sub_mul, sub_lt, ←mul_sub_one],
169+
←neg_div, ←neg_mul, neg_sub, div_lt_iff, one_mul, sub_mul, sub_lt_comm, ←mul_sub_one],
170170
norm_num,
171171
exact_mod_cast not_le.mp h₂,
172172
{ exact (nat.cast_pos.mpr hn.bot_lt) }

src/analysis/complex/upper_half_plane/metric.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ lemma im_pos_of_dist_center_le {z : ℍ} {r : ℝ} {w : ℂ} (h : dist w (center
288288
calc 0 < z.im * (cosh r - sinh r) : mul_pos z.im_pos (sub_pos.2 $ sinh_lt_cosh _)
289289
... = (z.center r).im - z.im * sinh r : mul_sub _ _ _
290290
... ≤ (z.center r).im - dist (z.center r : ℂ) w : sub_le_sub_left (by rwa [dist_comm]) _
291-
... ≤ w.im : sub_le.1 $ (le_abs_self _).trans (abs_im_le_abs $ z.center r - w)
291+
... ≤ w.im : sub_le_comm.1 $ (le_abs_self _).trans (abs_im_le_abs $ z.center r - w)
292292

293293
lemma image_coe_closed_ball (z : ℍ) (r : ℝ) :
294294
(coe : ℍ → ℂ) '' closed_ball z r = closed_ball (z.center r) (z.im * sinh r) :=

src/analysis/convex/uniform.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ begin
7171
{ rintro z hz hδz,
7272
nth_rewrite 2 ←one_smul ℝ z,
7373
rwa [←sub_smul, norm_smul_of_nonneg (sub_nonneg_of_le $ one_le_inv (hδ'.trans_le hδz) hz),
74-
sub_mul, inv_mul_cancel (hδ'.trans_le hδz).ne', one_mul, sub_le] },
74+
sub_mul, inv_mul_cancel (hδ'.trans_le hδz).ne', one_mul, sub_le_comm] },
7575
set x' := ∥x∥⁻¹ • x,
7676
set y' := ∥y∥⁻¹ • y,
7777
have hxy' : ε/3 ≤ ∥x' - y'∥ :=

src/analysis/special_functions/gamma.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ begin
510510
{ rw mem_nhds_iff, use S,
511511
refine ⟨subset.rfl, _, hn⟩,
512512
have : S = re⁻¹' Ioi (1 - n : ℝ),
513-
{ ext, rw [preimage,Ioi, mem_set_of_eq, mem_set_of_eq, mem_set_of_eq], exact sub_lt },
513+
{ ext, rw [preimage,Ioi, mem_set_of_eq, mem_set_of_eq, mem_set_of_eq], exact sub_lt_comm },
514514
rw this,
515515
refine continuous.is_open_preimage continuous_re _ is_open_Ioi, },
516516
apply eventually_eq_of_mem this,

src/analysis/special_functions/stirling.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ end
163163
lemma log_stirling_seq_bounded_by_constant : ∃ c, ∀ (n : ℕ), c ≤ log (stirling_seq n.succ) :=
164164
begin
165165
obtain ⟨d, h⟩ := log_stirling_seq_bounded_aux,
166-
exact ⟨log (stirling_seq 1) - d, λ n, sub_le.mp (h n)⟩,
166+
exact ⟨log (stirling_seq 1) - d, λ n, sub_le_comm.mp (h n)⟩,
167167
end
168168

169169
/-- The sequence `stirling_seq` is positive for `n > 0` -/

src/combinatorics/additive/behrend.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ end
269269

270270
lemma two_div_one_sub_two_div_e_le_eight : 2 / (1 - 2 / exp 1) ≤ 8 :=
271271
begin
272-
rw [div_le_iff, mul_sub, mul_one, mul_div_assoc', le_sub, div_le_iff (exp_pos _)],
272+
rw [div_le_iff, mul_sub, mul_one, mul_div_assoc', le_sub_comm, div_le_iff (exp_pos _)],
273273
{ linarith [exp_one_gt_d9] },
274274
rw [sub_pos, div_lt_one];
275275
exact exp_one_gt_d9.trans' (by norm_num),
@@ -329,8 +329,8 @@ begin
329329
have : 0 < 1 - 2 / exp 1,
330330
{ rw [sub_pos, div_lt_one (exp_pos _)],
331331
exact lt_of_le_of_lt (by norm_num) exp_one_gt_d9 },
332-
rwa [le_sub, div_eq_mul_one_div x, div_eq_mul_one_div x, ←mul_sub, div_sub', ←div_eq_mul_one_div,
333-
mul_div_assoc', one_le_div, ←div_le_iff this],
332+
rwa [le_sub_comm, div_eq_mul_one_div x, div_eq_mul_one_div x, ←mul_sub, div_sub',
333+
←div_eq_mul_one_div, mul_div_assoc', one_le_div, ←div_le_iff this],
334334
{ exact zero_lt_two },
335335
{ exact two_ne_zero }
336336
end

0 commit comments

Comments
 (0)