Skip to content

Commit 827b149

Browse files
committed
chore(Order): use new ge/gt naming convention - Part 1 (leanprover-community#24775)
This is the first PR in a sequence of PRs to apply the new naming convention for order lemmas. This PR changes some lemmas that have multiple occurences of `lt` or `le` in their name, and where `<` and `≤` have their arguments swapped in some places. Then those occurrences of `<` and `≤` are referred to as `gt` and `ge`. Names that will be changed by a follow up PR are `Ne.lt_or_lt`, `Ne.not_le_or_not_le`, `LT.lt.not_le` & friends, The first commit is an automatic replacement of lemma names. The second commit adds deprecations for the renamed lemmas. Later commits are manual fixes. This should make it easy to review.
1 parent e9d22cd commit 827b149

File tree

449 files changed

+997
-967
lines changed

Some content is hidden

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

449 files changed

+997
-967
lines changed

Archive/Imo/Imo1959Q2.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ variable {x A : ℝ}
3737

3838
theorem isGood_iff : IsGood x A ↔
3939
sqrt (2 * x - 1) + 1 + |sqrt (2 * x - 1) - 1| = A * sqrt 21 / 2 ≤ x := by
40-
cases le_or_lt (1 / 2) x with
40+
cases le_or_gt (1 / 2) x with
4141
| inl hx =>
4242
have hx' : 02 * x - 1 := by linarith
4343
have h₁ : x + sqrt (2 * x - 1) = (sqrt (2 * x - 1) + 1) ^ 2 / 2 := by
@@ -85,7 +85,7 @@ theorem IsGood.sqrt_two_lt_iff_one_lt (h : IsGood x A) : sqrt 2 < A ↔ 1 < x :=
8585
fun hA ↦ not_le.1 fun hx ↦ hA.ne' <| h.eq_sqrt_two_iff_le_one.2 hx, h.sqrt_two_lt_of_one_lt⟩
8686

8787
theorem IsGood.sqrt_two_le (h : IsGood x A) : sqrt 2 ≤ A :=
88-
(le_or_lt x 1).elim (fun hx ↦ (h.eq_sqrt_two_iff_le_one.2 hx).ge) fun hx ↦
88+
(le_or_gt x 1).elim (fun hx ↦ (h.eq_sqrt_two_iff_le_one.2 hx).ge) fun hx ↦
8989
(h.sqrt_two_lt_of_one_lt hx).le
9090

9191
theorem isGood_iff_of_sqrt_two_lt (hA : sqrt 2 < A) : IsGood x A ↔ x = (A / 2) ^ 2 + 1 / 2 := by

Archive/Imo/Imo1960Q2.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ theorem isGood_iff {x} : IsGood x ↔ x ∈ Ico (-1/2) (45/8) \ {0} := by
4242
-- First, note that the denominator is equal to zero at `x = 0`, hence it's not a solution.
4343
rcases eq_or_ne x 0 with rfl | hx
4444
· simp [isGood_iff']
45-
cases lt_or_le x (-1/2) with
45+
cases lt_or_ge x (-1/2) with
4646
| inl hx2 =>
4747
-- Next, if `x < -1/2`, then the square root is undefined.
4848
have : 2 * x + 1 < 0 := by linarith

Archive/Imo/Imo1986Q5.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ theorem map_of_lt_two (hx : x < 2) : f x = 2 / (2 - x) := by
6161
rw [hf.map_add_rev, hf.map_eq_zero, tsub_add_cancel_of_le hx.le]
6262

6363
theorem map_eq (x : ℝ≥0) : f x = 2 / (2 - x) :=
64-
match lt_or_le x 2 with
64+
match lt_or_ge x 2 with
6565
| .inl hx => hf.map_of_lt_two hx
6666
| .inr hx => by rwa [tsub_eq_zero_of_le hx, div_zero, hf.map_eq_zero]
6767

@@ -75,7 +75,7 @@ theorem isGood_iff {f : ℝ≥0 → ℝ≥0} : IsGood f ↔ f = fun x ↦ 2 / (2
7575
case map_ne_zero => intro x hx; simpa [tsub_eq_zero_iff_le]
7676
case map_add_rev =>
7777
intro x y
78-
cases lt_or_le y 2 with
78+
cases lt_or_ge y 2 with
7979
| inl hy =>
8080
have hy' : 2 - y ≠ 0 := (tsub_pos_of_lt hy).ne'
8181
rw [div_mul_div_comm, tsub_mul, mul_assoc, div_mul_cancel₀ _ hy', mul_comm x,

Archive/Imo/Imo1988Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ theorem constant_descent_vieta_jumping (x y : ℕ) {claim : Prop} {H : ℕ →
6868
-- First of all, we may assume that x ≤ y.
6969
-- We justify this using H_symm.
7070
wlog hxy : x ≤ y
71-
· rw [H_symm] at h₀; apply this y x h₀ B C base _ _ _ _ _ _ (le_of_not_le hxy); assumption'
71+
· rw [H_symm] at h₀; apply this y x h₀ B C base _ _ _ _ _ _ (le_of_not_ge hxy); assumption'
7272
-- In fact, we can easily deal with the case x = y.
7373
by_cases x_eq_y : x = y
7474
· subst x_eq_y; exact H_diag h₀

Archive/Imo/Imo2015Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ include ha hbN
127127
lemma b_pos : 0 < b := by
128128
by_contra! h; rw [nonpos_iff_eq_zero] at h; subst h
129129
replace hbN : ∀ t, #(pool a t) = 0 := fun t ↦ by
130-
obtain h | h := le_or_lt t N
130+
obtain h | h := le_or_gt t N
131131
· have : #(pool a t) ≤ #(pool a N) := monotone_card_pool ha h
132132
rwa [hbN _ le_rfl, nonpos_iff_eq_zero] at this
133133
· exact hbN _ h.le

Archive/Imo/Imo2024Q6.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ lemma apply_fExample_add_apply_of_fract_le {x y : ℚ} (h : Int.fract y ≤ Int.
203203

204204
lemma aquaesulian_fExample : Aquaesulian fExample := by
205205
intro x y
206-
rcases lt_or_le (Int.fract x) (Int.fract y) with h | h
206+
rcases lt_or_ge (Int.fract x) (Int.fract y) with h | h
207207
· rw [add_comm (fExample x), add_comm x]
208208
exact .inr (apply_fExample_add_apply_of_fract_le h.le)
209209
· exact .inl (apply_fExample_add_apply_of_fract_le h)

Archive/Wiedijk100Theorems/AscendingDescendingSequences.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ theorem erdos_szekeres {r s n : ℕ} {f : Fin n → α} (hn : r * s < n) (hf : I
122122
rintro x ⟨rfl | _⟩ y ⟨rfl | _⟩ _
123123
· apply (irrefl _ ‹j < j›).elim
124124
· exfalso
125-
apply not_le_of_lt (_root_.trans ‹i < j› ‹j < y›) (le_max_of_eq ‹y ∈ t› ‹t.max = i›)
125+
apply not_le_of_gt (_root_.trans ‹i < j› ‹j < y›) (le_max_of_eq ‹y ∈ t› ‹t.max = i›)
126126
· first
127127
| apply lt_of_le_of_lt _ ‹f i < f j›
128128
| apply lt_of_lt_of_le ‹f j < f i› _
@@ -133,7 +133,7 @@ theorem erdos_szekeres {r s n : ℕ} {f : Fin n → α} (hn : r * s < n) (hf : I
133133
-- Finally show that this new subsequence is one longer than the old one.
134134
· rw [card_insert_of_notMem, ht₂]
135135
intro
136-
apply not_le_of_lt ‹i < j› (le_max_of_eq ‹j ∈ t› ‹t.max = i›)
136+
apply not_le_of_gt ‹i < j› (le_max_of_eq ‹j ∈ t› ‹t.max = i›)
137137
-- Finished both goals!
138138
-- Now that we have uniqueness of each label, it remains to do some counting to finish off.
139139
-- Suppose all the labels are small.
@@ -158,7 +158,7 @@ theorem erdos_szekeres {r s n : ℕ} {f : Fin n → α} (hn : r * s < n) (hf : I
158158
-- Need to get `a_i ≤ r`, here phrased as: there is some `a < r` with `a+1 = a_i`.
159159
exact ⟨⟨(ab i).1 - 1, by omega⟩, (ab i).2 - 1, by omega⟩
160160
-- To get our contradiction, it suffices to prove `n ≤ r * s`
161-
apply not_le_of_lt hn
161+
apply not_le_of_gt hn
162162
-- Which follows from considering the cardinalities of the subset above, since `ab` is injective.
163163
simpa [ran, Nat.succ_injective, card_image_of_injective, ‹Injective ab›] using card_le_card this
164164

Archive/Wiedijk100Theorems/CubingACube.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ theorem Ico_lemma {α} [LinearOrder α] {x₁ x₂ y₁ y₂ z₁ z₂ w : α} (
3838
simp only [not_and, not_lt, mem_Ico] at hw
3939
refine ⟨max x₁ (min w y₂), ?_, ?_, ?_⟩
4040
· simp [le_refl, lt_trans h₁ (lt_trans hy h₂), h₂]
41-
· simp +contextual [hw, lt_irrefl, not_le_of_lt h₁]
41+
· simp +contextual [hw, lt_irrefl, not_le_of_gt h₁]
4242
· simp [hw.2.1, hw.2.2, hz₁, lt_of_lt_of_le h₁ hz₂]
4343

4444
/-- A (hyper)-cube (in standard orientation) is a vector `b` consisting of the bottom-left point
@@ -190,7 +190,7 @@ theorem shiftUp_bottom_subset_bottoms (hc : (cs i).xm ≠ 1) :
190190
intro j; exact side_subset h (hps j)
191191
rw [← h.2, mem_iUnion] at this; rcases this with ⟨i', hi'⟩
192192
rw [mem_iUnion]; use i'; refine ⟨?_, fun j => hi' j.succ⟩
193-
have : i ≠ i' := by rintro rfl; apply not_le_of_lt (hi' 0).2; rw [hp0]; rfl
193+
have : i ≠ i' := by rintro rfl; apply not_le_of_gt (hi' 0).2; rw [hp0]; rfl
194194
have := h.1 this
195195
rw [onFun, comp_apply, comp_apply, toSet_disjoint, exists_fin_succ] at this
196196
rcases this with (h0 | ⟨j, hj⟩)
@@ -290,7 +290,7 @@ theorem nontrivial_bcubes : (bcubes cs c).Nontrivial := by
290290
have h2i' : i' ∈ bcubes cs c := ⟨hi'.1.symm, v.2.1 i' hi'.1.symm ⟨tail p, hi'.2, hp.2⟩⟩
291291
refine ⟨i, h2i, i', h2i', ?_⟩
292292
rintro rfl
293-
apply not_le_of_lt (hi'.21, Nat.le_of_succ_le_succ h.three_le⟩).2
293+
apply not_le_of_gt (hi'.21, Nat.le_of_succ_le_succ h.three_le⟩).2
294294
simp only [tail, Cube.tail, p]
295295
rw [if_pos, add_le_add_iff_right]
296296
· exact (hi.2 _).1

Archive/Wiedijk100Theorems/FriendshipGraphs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ include hG in
334334
theorem friendship_theorem [Nonempty V] : ExistsPolitician G := by
335335
by_contra npG
336336
rcases hG.isRegularOf_not_existsPolitician npG with ⟨d, dreg⟩
337-
rcases lt_or_le d 3 with dle2 | dge3
337+
rcases lt_or_ge d 3 with dle2 | dge3
338338
· exact npG (hG.existsPolitician_of_degree_le_two dreg (Nat.lt_succ_iff.mp dle2))
339339
· exact hG.false_of_three_le_degree dreg dge3
340340

Counterexamples/AharoniKorman.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,16 +490,16 @@ lemma not_apply_lt : ¬ f x < x := f.not_lt_of_eq (by simp)
490490
lemma not_lt_apply : ¬ x < f x := f.not_lt_of_eq (by simp)
491491

492492
lemma le_apply_of_le (hC : IsChain (· ≤ ·) C) (hy : y ∈ C) (hx : y ≤ x) : y ≤ f x :=
493-
hC.le_of_not_lt (f.mem x) hy fun hxy ↦ f.not_apply_lt (hxy.trans_le hx)
493+
hC.le_of_not_gt (f.mem x) hy fun hxy ↦ f.not_apply_lt (hxy.trans_le hx)
494494

495495
lemma apply_le_of_le (hC : IsChain (· ≤ ·) C) (hy : y ∈ C) (hx : x ≤ y) : f x ≤ y :=
496-
hC.le_of_not_lt hy (f.mem x) fun hxy ↦ f.not_lt_apply (hx.trans_lt hxy)
496+
hC.le_of_not_gt hy (f.mem x) fun hxy ↦ f.not_lt_apply (hx.trans_lt hxy)
497497

498498
lemma lt_apply_of_lt (hC : IsChain (· ≤ ·) C) (hy : y ∈ C) (hx : y < x) : y < f x :=
499-
hC.lt_of_not_le (f.mem x) hy fun hxy ↦ f.not_apply_lt (hxy.trans_lt hx)
499+
hC.lt_of_not_ge (f.mem x) hy fun hxy ↦ f.not_apply_lt (hxy.trans_lt hx)
500500

501501
lemma apply_lt_of_lt (hC : IsChain (· ≤ ·) C) (hy : y ∈ C) (hx : x < y) : f x < y :=
502-
hC.lt_of_not_le hy (f.mem x) fun hxy ↦ f.not_lt_apply (hx.trans_le hxy)
502+
hC.lt_of_not_ge hy (f.mem x) fun hxy ↦ f.not_lt_apply (hx.trans_le hxy)
503503

504504
lemma apply_mem_Icc_of_mem_Icc (hC : IsChain (· ≤ ·) C) (hy : y ∈ C) (hz : z ∈ C)
505505
(hx : x ∈ Set.Icc y z) : f x ∈ Set.Icc y z :=
@@ -788,7 +788,7 @@ theorem apply_eq_of_line_eq (f : SpinalMap C) {n : ℕ} (hC : IsChain (· ≤ ·
788788
(h₁l : lo ≤ x) (h₂l : lo ≤ y) (h₁h : x ≤ hi) (h₂h : y ≤ hi) :
789789
f x = f y := by
790790
wlog hxy : (ofHollom y).1 ≤ (ofHollom x).1 generalizing x y
791-
· exact (this h.symm h₂l h₁l h₂h h₁h (le_of_not_le hxy)).symm
791+
· exact (this h.symm h₂l h₁l h₂h h₁h (le_of_not_ge hxy)).symm
792792
have hx : x ∈ level n := ordConnected_level.out hlo.2 hhi.2 ⟨h₁l, h₁h⟩
793793
have hy : y ∈ level n := ordConnected_level.out hlo.2 hhi.2 ⟨h₂l, h₂h⟩
794794
induction hx using induction_on_level with | h x₁ y₁ =>
@@ -896,7 +896,7 @@ lemma x0y0_mem (h : (C ∩ level (n + 1)).Nonempty) :
896896
lemma x0y0_min (z : ℕ × ℕ) (hC : IsChain (· ≤ ·) C) (h : embed (n + 1) z ∈ C) :
897897
embed (n + 1) (x0y0 n C) ≤ embed (n + 1) z := by
898898
have : (C ∩ level (n + 1)).Nonempty := ⟨_, h, by simp [level_eq_range]⟩
899-
refine hC.le_of_not_lt h (x0y0_mem this) ?_
899+
refine hC.le_of_not_gt h (x0y0_mem this) ?_
900900
rw [x0y0, dif_pos this, OrderEmbedding.lt_iff_lt]
901901
exact wellFounded_lt.not_lt_min {x | embed (n + 1) x ∈ C} ?_ h
902902

@@ -1061,7 +1061,7 @@ theorem not_S_hits_next (f : SpinalMap C) (hC : IsChain (· ≤ ·) C)
10611061
-- Then we have `(a, b, n + 1) ≤ j`...
10621062
have hj' : h(a, b, n + 1) ≤ j := by
10631063
induction hjCn.2 using induction_on_level with | h c d =>
1064-
apply hC.le_of_not_lt hjCn.1 hp.1 ?_
1064+
apply hC.le_of_not_gt hjCn.1 hp.1 ?_
10651065
intro h
10661066
have : c + d < a + b := add_lt_add_of_lt h
10671067
simp only [toHollom_le_toHollom_iff_fixed_right] at hj
@@ -1082,7 +1082,7 @@ theorem not_S_hits_next (f : SpinalMap C) (hC : IsChain (· ≤ ·) C)
10821082
-- The left case is exactly symmetric
10831083
have hj' : h(a, b, n + 1) ≤ j := by
10841084
induction hjCn.2 using induction_on_level with | h c d =>
1085-
apply hC.le_of_not_lt hjCn.1 hp.1 ?_
1085+
apply hC.le_of_not_gt hjCn.1 hp.1 ?_
10861086
intro h
10871087
have : c + d < a + b := add_lt_add_of_lt h
10881088
simp only [toHollom_le_toHollom_iff_fixed_right] at hj

0 commit comments

Comments
 (0)