@@ -9,7 +9,6 @@ import Mathlib.Logic.Nontrivial.Defs
9
9
import Mathlib.Tactic.Cases
10
10
import Mathlib.Tactic.GCongr.Core
11
11
import Mathlib.Tactic.PushNeg
12
- import Mathlib.Tactic.Use
13
12
import Mathlib.Util.AssertExists
14
13
15
14
#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
88
87
alias _root_.LT.lt.nat_succ_le := succ_le_of_lt
89
88
#align has_lt.lt.nat_succ_le LT.lt.nat_succ_le
90
89
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
92
91
#align nat.not_succ_lt_self Nat.not_succ_lt_self
93
92
94
93
#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⟩
97
96
#align nat.succ_le_iff Nat.succ_le_iff
98
97
99
98
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, ?_⟩
101
100
rintro (hmn | rfl)
102
101
· exact le_succ_of_le hmn
103
- · rfl
102
+ · exact Nat.le_refl _
104
103
105
104
alias ⟨of_le_succ, _⟩ := le_succ_iff
106
105
#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, _ =>
113
112
#align nat.lt_iff_le_pred Nat.lt_iff_le_pred
114
113
115
114
lemma le_of_pred_lt : ∀ {m}, pred m < n → m ≤ n
116
- | 0 => le_of_lt
115
+ | 0 => Nat. le_of_lt
117
116
| _ + 1 => id
118
117
#align nat.le_of_pred_lt Nat.le_of_pred_lt
119
118
@@ -150,7 +149,7 @@ lemma le_one_iff_eq_zero_or_eq_one : ∀ {n : ℕ}, n ≤ 1 ↔ n = 0 ∨ n = 1
150
149
@[simp] lemma lt_one_iff : n < 1 ↔ n = 0 := Nat.lt_succ_iff.trans $ by rw [le_zero_eq]
151
150
#align nat.lt_one_iff Nat.lt_one_iff
152
151
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
154
153
#align nat.one_le_of_lt Nat.one_le_of_lt
155
154
156
155
@[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 :
295
294
#align nat.add_eq_three_iff Nat.add_eq_three_iff
296
295
297
296
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]
299
298
#align nat.le_add_one_iff Nat.le_add_one_iff
300
299
301
300
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]
303
302
rintro rfl
304
303
exact n.le_succ
305
304
#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
356
355
#align nat.zero_eq_mul Nat.zero_eq_mul
357
356
358
357
lemma two_mul_ne_two_mul_add_one : 2 * n ≠ 2 * m + 1 :=
359
- mt (congr_arg (· % 2 ))
358
+ mt (congrArg (· % 2 ))
360
359
(by rw [Nat.add_comm, add_mul_mod_self_left, mul_mod_right, mod_eq_of_lt] <;> simp)
361
360
#align nat.two_mul_ne_two_mul_add_one Nat.two_mul_ne_two_mul_add_one
362
361
@@ -368,10 +367,12 @@ protected lemma mul_left_inj (ha : a ≠ 0) : b * a = c * a ↔ b = c :=
368
367
protected lemma mul_right_inj (ha : a ≠ 0 ) : a * b = a * c ↔ b = c :=
369
368
Nat.mul_left_cancel_iff (Nat.pos_iff_ne_zero.2 ha) _ _
370
369
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)
372
372
#align nat.mul_ne_mul_left Nat.mul_ne_mul_left
373
373
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)
375
376
#align nat.mul_ne_mul_right Nat.mul_ne_mul_right
376
377
377
378
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
418
419
#align nat.eq_zero_of_double_le Nat.eq_zero_of_double_le
419
420
420
421
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
422
423
#align nat.eq_zero_of_mul_le Nat.eq_zero_of_mul_le
423
424
424
425
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
428
429
#align nat.mul_self_le_mul_self Nat.mul_self_le_mul_self
429
430
430
431
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
432
433
433
434
lemma mul_self_lt_mul_self (h : m < n) : m * m < n * n := mul_lt_mul'' h h
434
435
#align nat.mul_self_lt_mul_self Nat.mul_self_lt_mul_self
435
436
436
437
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⟩
438
440
#align nat.mul_self_le_mul_self_iff Nat.mul_self_le_mul_self_iff
439
441
440
442
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]
442
444
#align nat.mul_self_lt_mul_self_iff Nat.mul_self_lt_mul_self_iff
443
445
444
446
lemma le_mul_self : ∀ n : ℕ, n ≤ n * n
445
- | 0 => le_refl _
447
+ | 0 => Nat. le_refl _
446
448
| n + 1 => by simp [Nat.mul_add]
447
449
#align nat.le_mul_self Nat.le_mul_self
448
450
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]
450
453
#align nat.mul_self_inj Nat.mul_self_inj
451
454
452
455
@[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
486
489
#align nat.le_div_iff_mul_le' Nat.le_div_iff_mul_le'
487
490
488
491
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]
490
493
#align nat.div_lt_iff_lt_mul' Nat.div_lt_iff_lt_mul'
491
494
492
495
lemma one_le_div_iff (hb : 0 < b) : 1 ≤ a / b ↔ b ≤ a := by rw [le_div_iff_mul_le hb, Nat.one_mul]
493
496
#align nat.one_le_div_iff Nat.one_le_div_iff
494
497
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]
496
500
#align nat.div_lt_one_iff Nat.div_lt_one_iff
497
501
498
502
@[gcongr]
499
503
protected lemma div_le_div_right (h : a ≤ b) : a / c ≤ b / c :=
500
504
(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
502
506
#align nat.div_le_div_right Nat.div_le_div_right
503
507
504
508
lemma lt_of_div_lt_div (h : a / c < b / c) : a < b :=
505
509
Nat.lt_of_not_le fun hab ↦ Nat.not_le_of_lt h $ Nat.div_le_div_right hab
506
510
#align nat.lt_of_div_lt_div Nat.lt_of_div_lt_div
507
511
508
512
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 $
510
514
calc
511
515
a = a % b := by simpa [h] using (mod_add_div a b).symm
512
516
_ < b := mod_lt a hb
513
517
_ ≤ a := hba
514
518
#align nat.div_pos Nat.div_pos
515
519
516
520
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
518
522
#align nat.lt_mul_of_div_lt Nat.lt_mul_of_div_lt
519
523
520
524
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
544
548
545
549
@[simp]
546
550
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⟩
548
552
rw [← Nat.mul_div_cancel' hda, ← Nat.mul_div_cancel' hdb, h]
549
553
#align nat.div_left_inj Nat.div_left_inj
550
554
@@ -560,27 +564,27 @@ lemma div_mul_div_comm : b ∣ a → d ∣ c → (a / b) * (c / d) = (a * c) / (
560
564
561
565
lemma eq_zero_of_le_div (hn : 2 ≤ n) (h : m ≤ m / n) : m = 0 :=
562
566
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
564
568
#align nat.eq_zero_of_le_div Nat.eq_zero_of_le_div
565
569
566
570
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
568
572
· simp
569
573
· calc
570
574
a / c * b / a ≤ b * a / c / a :=
571
575
Nat.div_le_div_right (by rw [Nat.mul_comm]; exact mul_div_le_mul_div_assoc _ _ _)
572
576
_ = 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 ]
574
578
#align nat.div_mul_div_le_div Nat.div_mul_div_le_div
575
579
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
577
581
#align nat.eq_zero_of_le_half Nat.eq_zero_of_le_half
578
582
579
583
lemma le_half_of_half_lt_sub (h : a / 2 < a - b) : b ≤ a / 2 := by
580
584
rw [Nat.le_div_iff_mul_le Nat.two_pos]
581
585
rw [Nat.div_lt_iff_lt_mul Nat.two_pos, Nat.mul_sub_right_distrib, Nat.lt_sub_iff_add_lt,
582
586
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)
584
588
#align nat.le_half_of_half_lt_sub Nat.le_half_of_half_lt_sub
585
589
586
590
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
615
619
616
620
@[gcongr]
617
621
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 _ _)
619
623
#align nat.div_le_div_left Nat.div_le_div_left
620
624
621
625
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 :=
671
675
(Nat.pow_lt_pow_iff_right ha).2 h
672
676
673
677
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)
675
679
mpr h := Nat.pow_le_pow_left h _
676
680
#align nat.pow_le_iff_le_left Nat.pow_le_pow_iff_left
677
681
@@ -738,7 +742,7 @@ lemma one_lt_two_pow' (n : ℕ) : 1 < 2 ^ (n + 1) := one_lt_pow n.succ_ne_zero (
738
742
#align nat.one_lt_two_pow' Nat.one_lt_two_pow'
739
743
740
744
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)]
742
746
exact Nat.lt_of_le_of_lt (Nat.le_mul_of_pos_left _ ha)
743
747
((Nat.mul_lt_mul_left ha).2 $ Nat.lt_pow_self hb _)
744
748
#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
811
815
#align nat.le_rec_on_succ' Nat.leRecOn_succ'
812
816
813
817
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]
818
823
#align nat.le_rec_on_trans Nat.leRecOn_trans
819
824
820
825
lemma leRecOn_succ_left {C : ℕ → Sort *} {n m} (h1 : n ≤ m) (h2 : n + 1 ≤ m)
821
826
{next : ∀ {k}, C k → C (k + 1 )} (x : C n) :
822
827
(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']
824
830
#align nat.le_rec_on_succ_left Nat.leRecOn_succ_left
825
831
826
832
lemma leRecOn_injective {C : ℕ → Sort *} {n m} (hnm : n ≤ m) (next : ∀ {k}, C k → C (k + 1 ))
827
833
(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
830
837
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)
834
842
#align nat.le_rec_on_injective Nat.leRecOn_injective
835
843
836
844
lemma leRecOn_surjective {C : ℕ → Sort *} {n m} (hnm : n ≤ m) (next : ∀ {k}, C k → C (k + 1 ))
837
845
(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, ?_⟩
841
850
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]
847
857
#align nat.le_rec_on_surjective Nat.leRecOn_surjective
848
858
849
859
/-- Recursion principle based on `<`. -/
@@ -905,17 +915,18 @@ lemma decreasingInduction_succ' {P : ℕ → Sort*} (h : ∀ n, P (n + 1) → P
905
915
906
916
lemma decreasingInduction_trans {P : ℕ → Sort *} (h : ∀ n, P (n + 1 ) → P n)
907
917
(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) =
909
919
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]
913
924
#align nat.decreasing_induction_trans Nat.decreasingInduction_trans
914
925
915
926
lemma decreasingInduction_succ_left {P : ℕ → Sort *} (h : ∀ n, P (n + 1 ) → P n)
916
927
(smn : m + 1 ≤ n) (mn : m ≤ n) (hP : P n) :
917
928
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,
919
930
decreasingInduction_succ']
920
931
apply Nat.le_succ
921
932
#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)
975
986
apply diag_induction P ha hb hd (a + 1 ) b h
976
987
have _ : a + (b + 1 ) < (a + 1 ) + (b + 1 ) := by simp
977
988
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
979
990
termination_by a b _c => a + b
980
991
decreasing_by all_goals assumption
981
992
#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) :
1022
1033
rw [mul_mod, mod_mod, ← mul_mod]
1023
1034
1024
1035
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]
1026
1039
#align nat.pow_mod Nat.pow_mod
1027
1040
1028
1041
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
1039
1052
1040
1053
lemma lt_of_pow_dvd_right (hb : b ≠ 0 ) (ha : 2 ≤ a) (h : a ^ n ∣ b) : n < b := by
1041
1054
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 _)
1043
1056
#align nat.lt_of_pow_dvd_right Nat.lt_of_pow_dvd_right
1044
1057
1045
1058
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
1054
1067
lemma not_dvd_of_pos_of_lt (h1 : 0 < n) (h2 : n < m) : ¬m ∣ n := by
1055
1068
rintro ⟨k, rfl⟩
1056
1069
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
1059
1072
#align nat.not_dvd_of_pos_of_lt Nat.not_dvd_of_pos_of_lt
1060
1073
1061
1074
lemma mod_eq_iff_lt (hn : n ≠ 0 ) : m % n = m ↔ m < n :=
@@ -1109,7 +1122,7 @@ lemma add_mod_eq_ite :
1109
1122
· rw [Nat.mod_eq_sub_mod h, Nat.mod_eq_of_lt]
1110
1123
exact (Nat.sub_lt_iff_lt_add h).mpr (Nat.add_lt_add (m.mod_lt (zero_lt_succ _))
1111
1124
(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)
1113
1126
#align nat.add_mod_eq_ite Nat.add_mod_eq_ite
1114
1127
1115
1128
/-- `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] :
1396
1409
instance decidableLoHiLe (lo hi : ℕ) (P : ℕ → Prop ) [DecidablePred P] :
1397
1410
Decidable (∀ x, lo ≤ x → x ≤ hi → P x) :=
1398
1411
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
1400
1413
#align nat.decidable_lo_hi_le Nat.decidableLoHiLe
1401
1414
1402
1415
end Nat
0 commit comments