Skip to content

Commit cd81a4d

Browse files
committed
chore: exchange Nat.sub_lt_iff_lt_add and Nat.sub_lt_iff_lt_add' (#24080)
This PR swaps `Nat.sub_lt_iff_lt_add` and `Nat.sub_lt_iff_lt_add'` to align them with the top-level `sub_lt_iff_lt_add` and `sub_lt_iff_lt_add'` lemmas. leanprover/lean4#7971 will upstream these lemmas with this swapped meaning. Co-authored-by: Markus Himmel <markus@lean-fro.org>
1 parent 14e3303 commit cd81a4d

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

Archive/Imo/Imo2024Q3.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ lemma apply_nth_add_one_eq_of_lt {m n : ℕ} (hn : N < Nat.nth (a · = m) n) :
139139

140140
lemma lt_toFinset_card {j : ℕ} (h : M a N ≤ a (j + 1)) (hf : {i | a i = a j}.Finite) :
141141
M a N - 1 < #hf.toFinset := by
142-
rw [Nat.sub_lt_iff_lt_add (M_pos _ _), Nat.lt_one_add_iff]
142+
rw [Nat.sub_lt_iff_lt_add' (M_pos _ _), Nat.lt_one_add_iff]
143143
exact (hc.apply_eq_card (N_lt_of_M_le_apply h) ▸ h).trans (Finset.card_le_card (by simp))
144144

145145
lemma nth_ne_zero_of_M_le_of_lt {i k : ℕ} (hi : M a N ≤ a i) (hk : k < a (i + 1)) :
@@ -636,7 +636,7 @@ lemma apply_add_one_eq_card_small_le_card_eq {i : ℕ} (hi : N' a N < i) (hib :
636636
rw [← Nat.count_eq_card_filter_range] at htr
637637
constructor
638638
· rwa [add_lt_add_iff_right, ← Nat.lt_nth_iff_count_lt hts,
639-
Nat.sub_lt_iff_lt_add (hc.one_le_apply _), Nat.lt_one_add_iff]
639+
Nat.sub_lt_iff_lt_add' (hc.one_le_apply _), Nat.lt_one_add_iff]
640640
· rw [hc.apply_nth_add_one_eq_of_infinite hts]
641641
· exact Nat.sub_add_cancel (hc.one_le_apply _)
642642
· refine (Nat.le_nth fun hf ↦ absurd hf hts).trans ((Nat.nth_le_nth hts).2 ?_)

Mathlib/Data/List/Rotate.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ theorem getElem?_rotate {l : List α} {n m : ℕ} (hml : m < l.length) :
199199
rw [length_drop] at hm
200200
have hm' := Nat.sub_le_iff_le_add'.1 hm
201201
have : n % length l + m - length l < length l := by
202-
rw [Nat.sub_lt_iff_lt_add' hm']
202+
rw [Nat.sub_lt_iff_lt_add hm']
203203
exact Nat.add_lt_add hlt hml
204204
conv_rhs => rw [Nat.add_comm m, ← mod_add_mod, mod_eq_sub_mod hm', mod_eq_of_lt this]
205205
omega
206-
· rwa [Nat.sub_lt_iff_lt_add hm, length_drop, Nat.sub_add_cancel hlt.le]
206+
· rwa [Nat.sub_lt_iff_lt_add' hm, length_drop, Nat.sub_add_cancel hlt.le]
207207

208208
theorem getElem_rotate (l : List α) (n : ℕ) (k : Nat) (h : k < (l.rotate n).length) :
209209
(l.rotate n)[k] =

Mathlib/Data/Nat/Init.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ protected lemma eq_sub_of_add_eq' (h : b + c = a) : c = a - b := by omega
244244

245245
protected lemma lt_sub_iff_add_lt : a < c - b ↔ a + b < c := ⟨add_lt_of_lt_sub, lt_sub_of_add_lt⟩
246246
protected lemma lt_sub_iff_add_lt' : a < c - b ↔ b + a < c := by omega
247-
protected lemma sub_lt_iff_lt_add (hba : b ≤ a) : a - b < c ↔ a < b + c := by omega
248-
protected lemma sub_lt_iff_lt_add' (hba : b ≤ a) : a - b < c ↔ a < c + b := by omega
247+
protected lemma sub_lt_iff_lt_add (hba : b ≤ a) : a - b < c ↔ a < c + b := by omega
248+
protected lemma sub_lt_iff_lt_add' (hba : b ≤ a) : a - b < c ↔ a < b + c := by omega
249249

250250
protected lemma sub_sub_sub_cancel_right (h : c ≤ b) : a - c - (b - c) = a - b := by omega
251251
protected lemma add_sub_sub_cancel (h : c ≤ a) : a + b - (a - c) = b + c := by omega
@@ -1033,7 +1033,7 @@ lemma add_mod_eq_ite :
10331033
rw [Nat.add_mod]
10341034
by_cases h : k + 1 ≤ m % (k + 1) + n % (k + 1)
10351035
· rw [if_pos h, Nat.mod_eq_sub_mod h, Nat.mod_eq_of_lt]
1036-
exact (Nat.sub_lt_iff_lt_add h).mpr (Nat.add_lt_add (m.mod_lt (zero_lt_succ _))
1036+
exact (Nat.sub_lt_iff_lt_add' h).mpr (Nat.add_lt_add (m.mod_lt (zero_lt_succ _))
10371037
(n.mod_lt (zero_lt_succ _)))
10381038
· rw [if_neg h]
10391039
exact Nat.mod_eq_of_lt (Nat.lt_of_not_ge h)

Mathlib/Order/WellFoundedSet.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ theorem partiallyWellOrderedOn_sublistForall₂ (r : α → α → Prop) [IsPreo
776776
split_ifs at hmn with hm
777777
· apply hf1.2 m (g n') (lt_of_lt_of_le hm (g.monotone n'.zero_le))
778778
exact _root_.trans hmn (List.tail_sublistForall₂_self _)
779-
· rw [← Nat.sub_lt_iff_lt_add (le_of_not_lt hm)] at mn
779+
· rw [← Nat.sub_lt_iff_lt_add' (le_of_not_lt hm)] at mn
780780
apply hf1.2 _ _ (g.lt_iff_lt.2 mn)
781781
rw [← List.cons_head!_tail (hnil (g (m - g 0))), ← List.cons_head!_tail (hnil (g n'))]
782782
exact List.SublistForall₂.cons (hg _ _ (le_of_lt mn)) hmn

0 commit comments

Comments
 (0)