@@ -6,7 +6,8 @@ Authors: Robert Y. Lewis, Keeley Hoek
66module
77
88public import Mathlib.Data.Int.DivMod
9- public import Mathlib.Order.Lattice
9+ public import Mathlib.Data.Nat.Init
10+ public import Mathlib.Logic.Equiv.Defs
1011public import Mathlib.Tactic.Common
1112public import Batteries.Data.Fin.Basic
1213public import Mathlib.Tactic.Attr.Core
@@ -28,7 +29,7 @@ This file expands on the development in the core library.
2829@[expose] public section
2930
3031
31- assert_not_exists Monoid Finset
32+ assert_not_exists Monoid Finset Preorder
3233
3334open Fin Nat Function
3435
@@ -420,18 +421,18 @@ lemma natCast_lt_natCast (han : a ≤ n) (hbn : b ≤ n) : (a : Fin (n + 1)) < b
420421 rw [← Nat.lt_succ_iff] at han hbn; simp [lt_def, Nat.mod_eq_of_lt, han, hbn]
421422
422423lemma natCast_mono (hbn : b ≤ n) (hab : a ≤ b) : (a : Fin (n + 1 )) ≤ b :=
423- (natCast_le_natCast (hab.trans hbn) hbn).2 hab
424+ (natCast_le_natCast (Nat.le_trans hab hbn) hbn).2 hab
424425
425426lemma natCast_strictMono (hbn : b ≤ n) (hab : a < b) : (a : Fin (n + 1 )) < b :=
426- (natCast_lt_natCast (hab.le.trans hbn) hbn).2 hab
427+ (natCast_lt_natCast (Nat.le_trans (Nat.le_of_lt hab) hbn) hbn).2 hab
427428
428429@[simp]
429430lemma castLE_natCast {m n : ℕ} [NeZero m] (h : m ≤ n) (a : ℕ) :
430- haveI : NeZero n := ⟨Nat.pos_iff_ne_zero.mp (lt_of_lt_of_le m.pos_of_neZero h)⟩
431+ haveI : NeZero n := ⟨Nat.pos_iff_ne_zero.mp (Nat. lt_of_lt_of_le m.pos_of_neZero h)⟩
431432 Fin.castLE h (a.cast : Fin m) = (a % m : ℕ) := by
432433 ext
433434 simp only [val_castLE, val_natCast]
434- rw [Nat.mod_eq_of_lt (a := a % m) (lt_of_lt_of_le (Nat.mod_lt _ m.pos_of_neZero) h)]
435+ rw [Nat.mod_eq_of_lt (a := a % m) (Nat. lt_of_lt_of_le (Nat.mod_lt _ m.pos_of_neZero) h)]
435436
436437end OfNatCoe
437438
@@ -481,7 +482,7 @@ theorem liftFun_iff_succ {α : Type*} (r : α → α → Prop) [IsTrans α r] {f
481482 · simp at h
482483 · intro j ihj hij
483484 rw [← le_castSucc_iff] at hij
484- obtain hij | hij := ( le_def.1 hij).eq_or_lt
485+ obtain hij | hij := Nat.eq_or_lt_of_le <| le_def.1 hij
485486 · obtain rfl := Fin.ext hij
486487 exact H _
487488 · exact _root_.trans (ihj hij) (H j)
@@ -508,7 +509,7 @@ theorem add_one_le_of_lt {n : ℕ} {a b : Fin (n + 1)} (h : a < b) : a + 1 ≤ b
508509theorem exists_eq_add_of_le {n : ℕ} {a b : Fin n} (h : a ≤ b) : ∃ k ≤ b, b = a + k := by
509510 obtain ⟨k, hk⟩ : ∃ k : ℕ, (b : ℕ) = a + k := Nat.exists_eq_add_of_le h
510511 have hkb : k ≤ b := by lia
511- refine ⟨⟨k, hkb.trans_lt b.is_lt⟩, hkb, ?_⟩
512+ refine ⟨⟨k, Nat.lt_of_le_of_lt hkb b.is_lt⟩, hkb, ?_⟩
512513 simp [Fin.ext_iff, Fin.val_add, ← hk, Nat.mod_eq_of_lt b.is_lt]
513514
514515theorem exists_eq_add_of_lt {n : ℕ} {a b : Fin (n + 1 )} (h : a < b) :
@@ -517,7 +518,7 @@ theorem exists_eq_add_of_lt {n : ℕ} {a b : Fin (n + 1)} (h : a < b) :
517518 · lia
518519 obtain ⟨k, hk⟩ : ∃ k : ℕ, (b : ℕ) = a + k + 1 := Nat.exists_eq_add_of_lt h
519520 have hkb : k < b := by lia
520- refine ⟨⟨k, hkb.trans b.is_lt⟩, hkb, by fin_omega, ?_⟩
521+ refine ⟨⟨k, Nat.lt_trans hkb b.is_lt⟩, hkb, by fin_omega, ?_⟩
521522 simp [Fin.ext_iff, Fin.val_add, ← hk, Nat.mod_eq_of_lt b.is_lt]
522523
523524lemma pos_of_ne_zero {n : ℕ} {a : Fin (n + 1 )} (h : a ≠ 0 ) : 0 < a :=
0 commit comments