Skip to content

Commit 2baa320

Browse files
chore: reduce mathlib dependencies in Data.Nat.Defs (#11918)
It seems that most of this file belongs in Std. This changes some proofs to avoid dependencies on mathlib, notably on the typeclass-mediated order lemmas.
1 parent eb95964 commit 2baa320

File tree

1 file changed

+74
-61
lines changed

1 file changed

+74
-61
lines changed

Mathlib/Data/Nat/Defs.lean

Lines changed: 74 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Mathlib.Logic.Nontrivial.Defs
99
import Mathlib.Tactic.Cases
1010
import Mathlib.Tactic.GCongr.Core
1111
import Mathlib.Tactic.PushNeg
12-
import Mathlib.Tactic.Use
1312
import Mathlib.Util.AssertExists
1413

1514
#align_import data.nat.basic from "leanprover-community/mathlib"@"bd835ef554f37ef9b804f0903089211f89cb370b"
@@ -88,7 +87,7 @@ lemma succ_succ_ne_one (n : ℕ) : n.succ.succ ≠ 1 := by simp
8887
alias _root_.LT.lt.nat_succ_le := succ_le_of_lt
8988
#align has_lt.lt.nat_succ_le LT.lt.nat_succ_le
9089

91-
lemma not_succ_lt_self : ¬ succ n < n := not_lt_of_ge n.le_succ
90+
lemma not_succ_lt_self : ¬ succ n < n := Nat.not_lt_of_ge n.le_succ
9291
#align nat.not_succ_lt_self Nat.not_succ_lt_self
9392

9493
#align nat.lt_succ_iff Nat.lt_succ_iff
@@ -97,10 +96,10 @@ lemma succ_le_iff : succ m ≤ n ↔ m < n := ⟨lt_of_succ_le, succ_le_of_lt⟩
9796
#align nat.succ_le_iff Nat.succ_le_iff
9897

9998
lemma le_succ_iff : m ≤ n.succ ↔ m ≤ n ∨ m = n.succ := by
100-
refine ⟨fun hmn ↦ (lt_or_eq_of_le hmn).imp_left le_of_lt_succ, ?_⟩
99+
refine ⟨fun hmn ↦ (Nat.lt_or_eq_of_le hmn).imp_left le_of_lt_succ, ?_⟩
101100
rintro (hmn | rfl)
102101
· exact le_succ_of_le hmn
103-
· rfl
102+
· exact Nat.le_refl _
104103

105104
alias ⟨of_le_succ, _⟩ := le_succ_iff
106105
#align nat.of_le_succ Nat.of_le_succ
@@ -113,7 +112,7 @@ lemma lt_iff_le_pred : ∀ {n}, 0 < n → (m < n ↔ m ≤ n - 1) | _ + 1, _ =>
113112
#align nat.lt_iff_le_pred Nat.lt_iff_le_pred
114113

115114
lemma le_of_pred_lt : ∀ {m}, pred m < n → m ≤ n
116-
| 0 => le_of_lt
115+
| 0 => Nat.le_of_lt
117116
| _ + 1 => id
118117
#align nat.le_of_pred_lt Nat.le_of_pred_lt
119118

@@ -150,7 +149,7 @@ lemma le_one_iff_eq_zero_or_eq_one : ∀ {n : ℕ}, n ≤ 1 ↔ n = 0 ∨ n = 1
150149
@[simp] lemma lt_one_iff : n < 1 ↔ n = 0 := Nat.lt_succ_iff.trans $ by rw [le_zero_eq]
151150
#align nat.lt_one_iff Nat.lt_one_iff
152151

153-
lemma one_le_of_lt (h : a < b) : 1 ≤ b := lt_of_le_of_lt (Nat.zero_le _) h
152+
lemma one_le_of_lt (h : a < b) : 1 ≤ b := Nat.lt_of_le_of_lt (Nat.zero_le _) h
154153
#align nat.one_le_of_lt Nat.one_le_of_lt
155154

156155
@[simp] lemma min_eq_zero_iff : min m n = 0 ↔ m = 0 ∨ n = 0 := by omega
@@ -295,11 +294,11 @@ lemma add_eq_three_iff :
295294
#align nat.add_eq_three_iff Nat.add_eq_three_iff
296295

297296
lemma le_add_one_iff : m ≤ n + 1 ↔ m ≤ n ∨ m = n + 1 := by
298-
rw [le_iff_lt_or_eq, lt_add_one_iff]
297+
rw [Nat.le_iff_lt_or_eq, lt_add_one_iff]
299298
#align nat.le_add_one_iff Nat.le_add_one_iff
300299

301300
lemma le_and_le_add_one_iff : n ≤ m ∧ m ≤ n + 1 ↔ m = n ∨ m = n + 1 := by
302-
rw [le_add_one_iff, and_or_left, ← le_antisymm_iff, eq_comm, and_iff_right_of_imp]
301+
rw [le_add_one_iff, and_or_left, ← Nat.le_antisymm_iff, eq_comm, and_iff_right_of_imp]
303302
rintro rfl
304303
exact n.le_succ
305304
#align nat.le_and_le_add_one_iff Nat.le_and_le_add_one_iff
@@ -356,7 +355,7 @@ protected lemma zero_eq_mul : 0 = m * n ↔ m = 0 ∨ n = 0 := by rw [eq_comm, N
356355
#align nat.zero_eq_mul Nat.zero_eq_mul
357356

358357
lemma two_mul_ne_two_mul_add_one : 2 * n ≠ 2 * m + 1 :=
359-
mt (congr_arg (· % 2))
358+
mt (congrArg (· % 2))
360359
(by rw [Nat.add_comm, add_mul_mod_self_left, mul_mod_right, mod_eq_of_lt] <;> simp)
361360
#align nat.two_mul_ne_two_mul_add_one Nat.two_mul_ne_two_mul_add_one
362361

@@ -368,10 +367,12 @@ protected lemma mul_left_inj (ha : a ≠ 0) : b * a = c * a ↔ b = c :=
368367
protected lemma mul_right_inj (ha : a ≠ 0) : a * b = a * c ↔ b = c :=
369368
Nat.mul_left_cancel_iff (Nat.pos_iff_ne_zero.2 ha) _ _
370369

371-
protected lemma mul_ne_mul_left (ha : a ≠ 0) : b * a ≠ c * a ↔ b ≠ c := (Nat.mul_left_inj ha).not
370+
protected lemma mul_ne_mul_left (ha : a ≠ 0) : b * a ≠ c * a ↔ b ≠ c :=
371+
not_congr (Nat.mul_left_inj ha)
372372
#align nat.mul_ne_mul_left Nat.mul_ne_mul_left
373373

374-
protected lemma mul_ne_mul_right (ha : a ≠ 0) : a * b ≠ a * c ↔ b ≠ c := (Nat.mul_right_inj ha).not
374+
protected lemma mul_ne_mul_right (ha : a ≠ 0) : a * b ≠ a * c ↔ b ≠ c :=
375+
not_congr (Nat.mul_right_inj ha)
375376
#align nat.mul_ne_mul_right Nat.mul_ne_mul_right
376377

377378
lemma mul_eq_left (ha : a ≠ 0) : a * b = a ↔ b = 1 := by simpa using Nat.mul_right_inj ha (c := 1)
@@ -418,7 +419,7 @@ lemma eq_zero_of_double_le (h : 2 * n ≤ n) : n = 0 := by omega
418419
#align nat.eq_zero_of_double_le Nat.eq_zero_of_double_le
419420

420421
lemma eq_zero_of_mul_le (hb : 2 ≤ n) (h : n * m ≤ m) : m = 0 :=
421-
eq_zero_of_double_le <| le_trans (Nat.mul_le_mul_right _ hb) h
422+
eq_zero_of_double_le <| Nat.le_trans (Nat.mul_le_mul_right _ hb) h
422423
#align nat.eq_zero_of_mul_le Nat.eq_zero_of_mul_le
423424

424425
lemma succ_mul_pos (m : ℕ) (hn : 0 < n) : 0 < succ m * n := Nat.mul_pos m.succ_pos hn
@@ -428,25 +429,27 @@ lemma mul_self_le_mul_self (h : m ≤ n) : m * m ≤ n * n := Nat.mul_le_mul h h
428429
#align nat.mul_self_le_mul_self Nat.mul_self_le_mul_self
429430

430431
lemma mul_lt_mul'' (hac : a < c) (hbd : b < d) : a * b < c * d :=
431-
Nat.mul_lt_mul_of_lt_of_le hac (le_of_lt hbd) $ by omega
432+
Nat.mul_lt_mul_of_lt_of_le hac (Nat.le_of_lt hbd) $ by omega
432433

433434
lemma mul_self_lt_mul_self (h : m < n) : m * m < n * n := mul_lt_mul'' h h
434435
#align nat.mul_self_lt_mul_self Nat.mul_self_lt_mul_self
435436

436437
lemma mul_self_le_mul_self_iff : m * m ≤ n * n ↔ m ≤ n :=
437-
⟨le_imp_le_of_lt_imp_lt mul_self_lt_mul_self, mul_self_le_mul_self⟩
438+
fun h => Nat.le_of_not_lt fun h' => Nat.not_le_of_gt (mul_self_lt_mul_self h') h,
439+
mul_self_le_mul_self⟩
438440
#align nat.mul_self_le_mul_self_iff Nat.mul_self_le_mul_self_iff
439441

440442
lemma mul_self_lt_mul_self_iff : m * m < n * n ↔ m < n := by
441-
simp only [← not_le, mul_self_le_mul_self_iff]
443+
simp only [← Nat.not_le, mul_self_le_mul_self_iff]
442444
#align nat.mul_self_lt_mul_self_iff Nat.mul_self_lt_mul_self_iff
443445

444446
lemma le_mul_self : ∀ n : ℕ, n ≤ n * n
445-
| 0 => le_refl _
447+
| 0 => Nat.le_refl _
446448
| n + 1 => by simp [Nat.mul_add]
447449
#align nat.le_mul_self Nat.le_mul_self
448450

449-
lemma mul_self_inj : m * m = n * n ↔ m = n := by simp [le_antisymm_iff, mul_self_le_mul_self_iff]
451+
lemma mul_self_inj : m * m = n * n ↔ m = n := by
452+
simp [Nat.le_antisymm_iff, mul_self_le_mul_self_iff]
450453
#align nat.mul_self_inj Nat.mul_self_inj
451454

452455
@[simp] lemma lt_mul_self_iff : ∀ {n : ℕ}, n < n * n ↔ 1 < n
@@ -486,35 +489,36 @@ lemma le_div_iff_mul_le' (hb : 0 < b) : a ≤ c / b ↔ a * b ≤ c := le_div_if
486489
#align nat.le_div_iff_mul_le' Nat.le_div_iff_mul_le'
487490

488491
lemma div_lt_iff_lt_mul' (hb : 0 < b) : a / b < c ↔ a < c * b := by
489-
simp only [← not_le, le_div_iff_mul_le' hb]
492+
simp only [← Nat.not_le, le_div_iff_mul_le' hb]
490493
#align nat.div_lt_iff_lt_mul' Nat.div_lt_iff_lt_mul'
491494

492495
lemma one_le_div_iff (hb : 0 < b) : 1 ≤ a / b ↔ b ≤ a := by rw [le_div_iff_mul_le hb, Nat.one_mul]
493496
#align nat.one_le_div_iff Nat.one_le_div_iff
494497

495-
lemma div_lt_one_iff (hb : 0 < b) : a / b < 1 ↔ a < b := by simp only [← not_le, one_le_div_iff hb]
498+
lemma div_lt_one_iff (hb : 0 < b) : a / b < 1 ↔ a < b := by
499+
simp only [← Nat.not_le, one_le_div_iff hb]
496500
#align nat.div_lt_one_iff Nat.div_lt_one_iff
497501

498502
@[gcongr]
499503
protected lemma div_le_div_right (h : a ≤ b) : a / c ≤ b / c :=
500504
(c.eq_zero_or_pos.elim fun hc ↦ by simp [hc]) fun hc ↦
501-
(le_div_iff_mul_le' hc).2 <| le_trans (Nat.div_mul_le_self _ _) h
505+
(le_div_iff_mul_le' hc).2 <| Nat.le_trans (Nat.div_mul_le_self _ _) h
502506
#align nat.div_le_div_right Nat.div_le_div_right
503507

504508
lemma lt_of_div_lt_div (h : a / c < b / c) : a < b :=
505509
Nat.lt_of_not_le fun hab ↦ Nat.not_le_of_lt h $ Nat.div_le_div_right hab
506510
#align nat.lt_of_div_lt_div Nat.lt_of_div_lt_div
507511

508512
protected lemma div_pos (hba : b ≤ a) (hb : 0 < b) : 0 < a / b :=
509-
Nat.pos_of_ne_zero fun h ↦ lt_irrefl a $
513+
Nat.pos_of_ne_zero fun h ↦ Nat.lt_irrefl a $
510514
calc
511515
a = a % b := by simpa [h] using (mod_add_div a b).symm
512516
_ < b := mod_lt a hb
513517
_ ≤ a := hba
514518
#align nat.div_pos Nat.div_pos
515519

516520
lemma lt_mul_of_div_lt (h : a / c < b) (hc : 0 < c) : a < b * c :=
517-
lt_of_not_ge <| not_le_of_gt h ∘ (Nat.le_div_iff_mul_le hc).2
521+
Nat.lt_of_not_ge <| Nat.not_le_of_gt h ∘ (Nat.le_div_iff_mul_le hc).2
518522
#align nat.lt_mul_of_div_lt Nat.lt_mul_of_div_lt
519523

520524
lemma mul_div_le_mul_div_assoc (a b c : ℕ) : a * (b / c) ≤ a * b / c :=
@@ -544,7 +548,7 @@ lemma lt_div_mul_add (hb : 0 < b) : a < a / b * b + b := by
544548

545549
@[simp]
546550
protected lemma div_left_inj (hda : d ∣ a) (hdb : d ∣ b) : a / d = b / d ↔ a = b := by
547-
refine ⟨fun h ↦ ?_, congr_arg fun b ↦ b / d⟩
551+
refine ⟨fun h ↦ ?_, congrArg fun b ↦ b / d⟩
548552
rw [← Nat.mul_div_cancel' hda, ← Nat.mul_div_cancel' hdb, h]
549553
#align nat.div_left_inj Nat.div_left_inj
550554

@@ -560,27 +564,27 @@ lemma div_mul_div_comm : b ∣ a → d ∣ c → (a / b) * (c / d) = (a * c) / (
560564

561565
lemma eq_zero_of_le_div (hn : 2 ≤ n) (h : m ≤ m / n) : m = 0 :=
562566
eq_zero_of_mul_le hn <| by
563-
rw [Nat.mul_comm]; exact (Nat.le_div_iff_mul_le' (lt_of_lt_of_le (by decide) hn)).1 h
567+
rw [Nat.mul_comm]; exact (Nat.le_div_iff_mul_le' (Nat.lt_of_lt_of_le (by decide) hn)).1 h
564568
#align nat.eq_zero_of_le_div Nat.eq_zero_of_le_div
565569

566570
lemma div_mul_div_le_div (a b c : ℕ) : a / c * b / a ≤ b / c := by
567-
obtain rfl | ha := eq_or_ne a 0
571+
obtain rfl | ha := Nat.eq_zero_or_pos a
568572
· simp
569573
· calc
570574
a / c * b / a ≤ b * a / c / a :=
571575
Nat.div_le_div_right (by rw [Nat.mul_comm]; exact mul_div_le_mul_div_assoc _ _ _)
572576
_ = b / c := by rw [Nat.div_div_eq_div_mul, Nat.mul_comm b, Nat.mul_comm c,
573-
Nat.mul_div_mul_left _ _ (Nat.pos_of_ne_zero ha)]
577+
Nat.mul_div_mul_left _ _ ha]
574578
#align nat.div_mul_div_le_div Nat.div_mul_div_le_div
575579

576-
lemma eq_zero_of_le_half (h : n ≤ n / 2) : n = 0 := eq_zero_of_le_div (le_refl _) h
580+
lemma eq_zero_of_le_half (h : n ≤ n / 2) : n = 0 := eq_zero_of_le_div (Nat.le_refl _) h
577581
#align nat.eq_zero_of_le_half Nat.eq_zero_of_le_half
578582

579583
lemma le_half_of_half_lt_sub (h : a / 2 < a - b) : b ≤ a / 2 := by
580584
rw [Nat.le_div_iff_mul_le Nat.two_pos]
581585
rw [Nat.div_lt_iff_lt_mul Nat.two_pos, Nat.mul_sub_right_distrib, Nat.lt_sub_iff_add_lt,
582586
Nat.mul_two a] at h
583-
exact le_of_lt (Nat.lt_of_add_lt_add_left h)
587+
exact Nat.le_of_lt (Nat.lt_of_add_lt_add_left h)
584588
#align nat.le_half_of_half_lt_sub Nat.le_half_of_half_lt_sub
585589

586590
lemma half_le_of_sub_le_half (h : a - b ≤ a / 2) : a / 2 ≤ b := by
@@ -615,7 +619,7 @@ lemma two_mul_odd_div_two (hn : n % 2 = 1) : 2 * (n / 2) = n - 1 := by
615619

616620
@[gcongr]
617621
lemma div_le_div_left (hcb : c ≤ b) (hc : 0 < c) : a / b ≤ a / c :=
618-
(Nat.le_div_iff_mul_le hc).2 <| le_trans (Nat.mul_le_mul_left _ hcb) (div_mul_le_self _ _)
622+
(Nat.le_div_iff_mul_le hc).2 <| Nat.le_trans (Nat.mul_le_mul_left _ hcb) (div_mul_le_self _ _)
619623
#align nat.div_le_div_left Nat.div_le_div_left
620624

621625
lemma div_eq_self : m / n = m ↔ m = 0 ∨ n = 1 := by
@@ -671,7 +675,7 @@ protected lemma pow_lt_pow_right (ha : 1 < a) (h : m < n) : a ^ m < a ^ n :=
671675
(Nat.pow_lt_pow_iff_right ha).2 h
672676

673677
protected lemma pow_le_pow_iff_left {n : ℕ} (hn : n ≠ 0) : a ^ n ≤ b ^ n ↔ a ≤ b where
674-
mp := by simpa only [← Nat.not_le, not_imp_not] using (Nat.pow_lt_pow_left · hn)
678+
mp := by simpa only [← Nat.not_le, Decidable.not_imp_not] using (Nat.pow_lt_pow_left · hn)
675679
mpr h := Nat.pow_le_pow_left h _
676680
#align nat.pow_le_iff_le_left Nat.pow_le_pow_iff_left
677681

@@ -738,7 +742,7 @@ lemma one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) := one_lt_pow n.succ_ne_zero (
738742
#align nat.one_lt_two_pow' Nat.one_lt_two_pow'
739743

740744
lemma mul_lt_mul_pow_succ (ha : 0 < a) (hb : 1 < b) : n * b < a * b ^ (n + 1) := by
741-
rw [Nat.pow_succ, ← Nat.mul_assoc, Nat.mul_lt_mul_right (lt_trans Nat.zero_lt_one hb)]
745+
rw [Nat.pow_succ, ← Nat.mul_assoc, Nat.mul_lt_mul_right (Nat.lt_trans Nat.zero_lt_one hb)]
742746
exact Nat.lt_of_le_of_lt (Nat.le_mul_of_pos_left _ ha)
743747
((Nat.mul_lt_mul_left ha).2 $ Nat.lt_pow_self hb _)
744748
#align nat.mul_lt_mul_pow_succ Nat.mul_lt_mul_pow_succ
@@ -811,39 +815,45 @@ lemma leRecOn_succ' {C : ℕ → Sort*} {n} {h : n ≤ n + 1} {next : ∀ {k}, C
811815
#align nat.le_rec_on_succ' Nat.leRecOn_succ'
812816

813817
lemma leRecOn_trans {C : ℕ → Sort*} {n m k} (hnm : n ≤ m) (hmk : m ≤ k) {next} (x : C n) :
814-
(leRecOn (le_trans hnm hmk) (@next) x : C k) = leRecOn hmk (@next) (leRecOn hnm (@next) x) := by
815-
induction' hmk with k hmk ih
816-
· rw [leRecOn_self]
817-
· rw [leRecOn_succ (le_trans hnm hmk), ih, leRecOn_succ]
818+
(leRecOn (Nat.le_trans hnm hmk) (@next) x : C k) =
819+
leRecOn hmk (@next) (leRecOn hnm (@next) x) := by
820+
induction hmk with
821+
| refl => rw [leRecOn_self]
822+
| step hmk ih => rw [leRecOn_succ (Nat.le_trans hnm hmk), ih, leRecOn_succ]
818823
#align nat.le_rec_on_trans Nat.leRecOn_trans
819824

820825
lemma leRecOn_succ_left {C : ℕ → Sort*} {n m} (h1 : n ≤ m) (h2 : n + 1 ≤ m)
821826
{next : ∀ {k}, C k → C (k + 1)} (x : C n) :
822827
(leRecOn h2 next (next x) : C m) = (leRecOn h1 next x : C m) := by
823-
rw [Subsingleton.elim h1 (le_trans (le_succ n) h2), leRecOn_trans (le_succ n) h2, leRecOn_succ']
828+
rw [Subsingleton.elim h1 (Nat.le_trans (le_succ n) h2), leRecOn_trans (le_succ n) h2,
829+
leRecOn_succ']
824830
#align nat.le_rec_on_succ_left Nat.leRecOn_succ_left
825831

826832
lemma leRecOn_injective {C : ℕ → Sort*} {n m} (hnm : n ≤ m) (next : ∀ {k}, C k → C (k + 1))
827833
(Hnext : ∀ n, Injective (@next n)) : Injective (@leRecOn C n m hnm next) := by
828-
induction' hnm with m hnm ih
829-
· intro x y H
834+
induction hnm with
835+
| refl =>
836+
intro x y H
830837
rwa [leRecOn_self, leRecOn_self] at H
831-
intro x y H
832-
rw [leRecOn_succ hnm, leRecOn_succ hnm] at H
833-
exact ih (Hnext _ H)
838+
| step hnm ih =>
839+
intro x y H
840+
rw [leRecOn_succ hnm, leRecOn_succ hnm] at H
841+
exact ih (Hnext _ H)
834842
#align nat.le_rec_on_injective Nat.leRecOn_injective
835843

836844
lemma leRecOn_surjective {C : ℕ → Sort*} {n m} (hnm : n ≤ m) (next : ∀ {k}, C k → C (k + 1))
837845
(Hnext : ∀ n, Surjective (@next n)) : Surjective (@leRecOn C n m hnm next) := by
838-
induction' hnm with m hnm ih
839-
· intro x
840-
use x
846+
induction hnm with
847+
| refl =>
848+
intro x
849+
refine ⟨x, ?_⟩
841850
rw [leRecOn_self]
842-
intro x
843-
obtain ⟨w, rfl⟩ := Hnext _ x
844-
obtain ⟨x, rfl⟩ := ih w
845-
use x
846-
rw [leRecOn_succ]
851+
| step hnm ih =>
852+
intro x
853+
obtain ⟨w, rfl⟩ := Hnext _ x
854+
obtain ⟨x, rfl⟩ := ih w
855+
refine ⟨x, ?_⟩
856+
rw [leRecOn_succ]
847857
#align nat.le_rec_on_surjective Nat.leRecOn_surjective
848858

849859
/-- Recursion principle based on `<`. -/
@@ -905,17 +915,18 @@ lemma decreasingInduction_succ' {P : ℕ → Sort*} (h : ∀ n, P (n + 1) → P
905915

906916
lemma decreasingInduction_trans {P : ℕ → Sort*} (h : ∀ n, P (n + 1) → P n)
907917
(hmn : m ≤ n) (hnk : n ≤ k) (hP : P k) :
908-
(decreasingInduction h (le_trans hmn hnk) hP : P m) =
918+
(decreasingInduction h (Nat.le_trans hmn hnk) hP : P m) =
909919
decreasingInduction h hmn (decreasingInduction h hnk hP) := by
910-
induction' hnk with k hnk ih
911-
· rw [decreasingInduction_self]
912-
· rw [decreasingInduction_succ h (le_trans hmn hnk), ih, decreasingInduction_succ]
920+
induction hnk with
921+
| refl => rw [decreasingInduction_self]
922+
| step hnk ih =>
923+
rw [decreasingInduction_succ h (Nat.le_trans hmn hnk), ih, decreasingInduction_succ]
913924
#align nat.decreasing_induction_trans Nat.decreasingInduction_trans
914925

915926
lemma decreasingInduction_succ_left {P : ℕ → Sort*} (h : ∀ n, P (n + 1) → P n)
916927
(smn : m + 1 ≤ n) (mn : m ≤ n) (hP : P n) :
917928
decreasingInduction h mn hP = h m (decreasingInduction h smn hP) := by
918-
rw [Subsingleton.elim mn (le_trans (le_succ m) smn), decreasingInduction_trans,
929+
rw [Subsingleton.elim mn (Nat.le_trans (le_succ m) smn), decreasingInduction_trans,
919930
decreasingInduction_succ']
920931
apply Nat.le_succ
921932
#align nat.decreasing_induction_succ_left Nat.decreasingInduction_succ_left
@@ -975,7 +986,7 @@ theorem diag_induction (P : ℕ → ℕ → Prop) (ha : ∀ a, P (a + 1) (a + 1)
975986
apply diag_induction P ha hb hd (a + 1) b h
976987
have _ : a + (b + 1) < (a + 1) + (b + 1) := by simp
977988
apply diag_induction P ha hb hd a (b + 1)
978-
apply lt_of_le_of_lt (Nat.le_succ _) h
989+
apply Nat.lt_of_le_of_lt (Nat.le_succ _) h
979990
termination_by a b _c => a + b
980991
decreasing_by all_goals assumption
981992
#align nat.diag_induction Nat.diag_induction
@@ -1022,7 +1033,9 @@ lemma mul_div_mul_comm_of_dvd_dvd (hba : b ∣ a) (hdc : d ∣ c) :
10221033
rw [mul_mod, mod_mod, ← mul_mod]
10231034

10241035
lemma pow_mod (a b n : ℕ) : a ^ b % n = (a % n) ^ b % n := by
1025-
induction' b with b ih; rfl; simp [Nat.pow_succ, Nat.mul_mod, ih]
1036+
induction b with
1037+
| zero => rfl
1038+
| succ b ih => simp [Nat.pow_succ, Nat.mul_mod, ih]
10261039
#align nat.pow_mod Nat.pow_mod
10271040

10281041
lemma not_pos_pow_dvd : ∀ {a n : ℕ} (_ : 1 < a) (_ : 1 < n), ¬ a ^ n ∣ a
@@ -1039,7 +1052,7 @@ lemma not_pos_pow_dvd : ∀ {a n : ℕ} (_ : 1 < a) (_ : 1 < n), ¬ a ^ n ∣ a
10391052

10401053
lemma lt_of_pow_dvd_right (hb : b ≠ 0) (ha : 2 ≤ a) (h : a ^ n ∣ b) : n < b := by
10411054
rw [← Nat.pow_lt_pow_iff_right (succ_le_iff.1 ha)]
1042-
exact lt_of_le_of_lt (le_of_dvd (Nat.pos_iff_ne_zero.2 hb) h) (lt_pow_self ha _)
1055+
exact Nat.lt_of_le_of_lt (le_of_dvd (Nat.pos_iff_ne_zero.2 hb) h) (lt_pow_self ha _)
10431056
#align nat.lt_of_pow_dvd_right Nat.lt_of_pow_dvd_right
10441057

10451058
lemma div_dvd_of_dvd (h : n ∣ m) : m / n ∣ m := ⟨n, (Nat.div_mul_cancel h).symm⟩
@@ -1054,8 +1067,8 @@ protected lemma div_div_self (h : n ∣ m) (hm : m ≠ 0) : m / (m / n) = n := b
10541067
lemma not_dvd_of_pos_of_lt (h1 : 0 < n) (h2 : n < m) : ¬m ∣ n := by
10551068
rintro ⟨k, rfl⟩
10561069
rcases Nat.eq_zero_or_pos k with (rfl | hk)
1057-
· exact lt_irrefl 0 h1
1058-
· exact not_lt.2 (Nat.le_mul_of_pos_right _ hk) h2
1070+
· exact Nat.lt_irrefl 0 h1
1071+
· exact Nat.not_lt.2 (Nat.le_mul_of_pos_right _ hk) h2
10591072
#align nat.not_dvd_of_pos_of_lt Nat.not_dvd_of_pos_of_lt
10601073

10611074
lemma mod_eq_iff_lt (hn : n ≠ 0) : m % n = m ↔ m < n :=
@@ -1109,7 +1122,7 @@ lemma add_mod_eq_ite :
11091122
· rw [Nat.mod_eq_sub_mod h, Nat.mod_eq_of_lt]
11101123
exact (Nat.sub_lt_iff_lt_add h).mpr (Nat.add_lt_add (m.mod_lt (zero_lt_succ _))
11111124
(n.mod_lt (zero_lt_succ _)))
1112-
· exact Nat.mod_eq_of_lt (lt_of_not_ge h)
1125+
· exact Nat.mod_eq_of_lt (Nat.lt_of_not_ge h)
11131126
#align nat.add_mod_eq_ite Nat.add_mod_eq_ite
11141127

11151128
/-- `m` is not divisible by `n` if it is between `n * k` and `n * (k + 1)` for some `k`. -/
@@ -1396,7 +1409,7 @@ instance decidableLoHi (lo hi : ℕ) (P : ℕ → Prop) [H : DecidablePred P] :
13961409
instance decidableLoHiLe (lo hi : ℕ) (P : ℕ → Prop) [DecidablePred P] :
13971410
Decidable (∀ x, lo ≤ x → x ≤ hi → P x) :=
13981411
decidable_of_iff (∀ x, lo ≤ x → x < hi + 1 → P x) <|
1399-
ball_congr fun _ _ => imp_congr Nat.lt_succ_iff Iff.rfl
1412+
forall₂_congr fun _ _ imp_congr Nat.lt_succ_iff Iff.rfl
14001413
#align nat.decidable_lo_hi_le Nat.decidableLoHiLe
14011414

14021415
end Nat

0 commit comments

Comments
 (0)