Module docstring
{"# Cast of natural numbers: lemmas about order
"}
{"# Cast of natural numbers: lemmas about order
"}
Nat.mono_cast
theorem
: Monotone (Nat.cast : ℕ → α)
@[mono]
theorem mono_cast : Monotone (Nat.cast : ℕ → α) :=
monotone_nat_of_le_succ fun n ↦ by
rw [Nat.cast_succ]; exact le_add_of_nonneg_right zero_le_one
GCongr.natCast_le_natCast
theorem
{a b : ℕ} (h : a ≤ b) : (a : α) ≤ b
@[gcongr]
theorem _root_.GCongr.natCast_le_natCast {a b : ℕ} (h : a ≤ b) : (a : α) ≤ b := mono_cast h
Nat.cast_nonneg'
theorem
(n : ℕ) : 0 ≤ (n : α)
/-- See also `Nat.cast_nonneg`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem cast_nonneg' (n : ℕ) : 0 ≤ (n : α) :=
@Nat.cast_zero α _ ▸ mono_cast (Nat.zero_le n)
Nat.ofNat_nonneg'
theorem
(n : ℕ) [n.AtLeastTwo] : 0 ≤ (ofNat(n) : α)
/-- See also `Nat.ofNat_nonneg`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem ofNat_nonneg' (n : ℕ) [n.AtLeastTwo] : 0 ≤ (ofNat(n) : α) := cast_nonneg' n
Nat.cast_add_one_pos
theorem
(n : ℕ) : 0 < (n : α) + 1
theorem cast_add_one_pos (n : ℕ) : 0 < (n : α) + 1 := by
apply zero_lt_one.trans_le
convert (@mono_cast α _).imp (?_ : 1 ≤ n + 1)
<;> simp
Nat.cast_pos'
theorem
{n : ℕ} : (0 : α) < n ↔ 0 < n
/-- See also `Nat.cast_pos`, specialised for an `OrderedSemiring`. -/
@[simp low]
theorem cast_pos' {n : ℕ} : (0 : α) < n ↔ 0 < n := by cases n <;> simp [cast_add_one_pos]
Nat.strictMono_cast
theorem
: StrictMono (Nat.cast : ℕ → α)
theorem strictMono_cast : StrictMono (Nat.cast : ℕ → α) :=
mono_cast.strictMono_of_injective cast_injective
GCongr.natCast_lt_natCast
theorem
{a b : ℕ} (h : a < b) : (a : α) < b
@[gcongr]
lemma _root_.GCongr.natCast_lt_natCast {a b : ℕ} (h : a < b) : (a : α) < b := strictMono_cast h
Nat.castOrderEmbedding
definition
: ℕ ↪o α
/-- `Nat.cast : ℕ → α` as an `OrderEmbedding` -/
@[simps! -fullyApplied]
def castOrderEmbedding : ℕℕ ↪o α :=
OrderEmbedding.ofStrictMono Nat.cast Nat.strictMono_cast
Nat.cast_le
theorem
: (m : α) ≤ n ↔ m ≤ n
@[simp, norm_cast]
theorem cast_le : (m : α) ≤ n ↔ m ≤ n :=
strictMono_cast.le_iff_le
Nat.cast_lt
theorem
: (m : α) < n ↔ m < n
@[simp, norm_cast, mono]
theorem cast_lt : (m : α) < n ↔ m < n :=
strictMono_cast.lt_iff_lt
Nat.one_lt_cast
theorem
: 1 < (n : α) ↔ 1 < n
@[simp, norm_cast]
theorem one_lt_cast : 1 < (n : α) ↔ 1 < n := by rw [← cast_one, cast_lt]
Nat.one_le_cast
theorem
: 1 ≤ (n : α) ↔ 1 ≤ n
@[simp, norm_cast]
theorem one_le_cast : 1 ≤ (n : α) ↔ 1 ≤ n := by rw [← cast_one, cast_le]
Nat.cast_lt_one
theorem
: (n : α) < 1 ↔ n = 0
@[simp, norm_cast]
theorem cast_lt_one : (n : α) < 1 ↔ n = 0 := by
rw [← cast_one, cast_lt, Nat.lt_succ_iff, le_zero]
Nat.cast_le_one
theorem
: (n : α) ≤ 1 ↔ n ≤ 1
@[simp, norm_cast]
theorem cast_le_one : (n : α) ≤ 1 ↔ n ≤ 1 := by rw [← cast_one, cast_le]
Nat.cast_nonpos
theorem
: (n : α) ≤ 0 ↔ n = 0
@[simp] lemma cast_nonpos : (n : α) ≤ 0 ↔ n = 0 := by norm_cast; omega
Nat.ofNat_le_cast
theorem
: (ofNat(m) : α) ≤ n ↔ (OfNat.ofNat m : ℕ) ≤ n
@[simp]
theorem ofNat_le_cast : (ofNat(m) : α) ≤ n ↔ (OfNat.ofNat m : ℕ) ≤ n :=
cast_le
Nat.ofNat_lt_cast
theorem
: (ofNat(m) : α) < n ↔ (OfNat.ofNat m : ℕ) < n
@[simp]
theorem ofNat_lt_cast : (ofNat(m) : α) < n ↔ (OfNat.ofNat m : ℕ) < n :=
cast_lt
Nat.cast_le_ofNat
theorem
: (m : α) ≤ (ofNat(n) : α) ↔ m ≤ OfNat.ofNat n
@[simp]
theorem cast_le_ofNat : (m : α) ≤ (ofNat(n) : α) ↔ m ≤ OfNat.ofNat n :=
cast_le
Nat.cast_lt_ofNat
theorem
: (m : α) < (ofNat(n) : α) ↔ m < OfNat.ofNat n
@[simp]
theorem cast_lt_ofNat : (m : α) < (ofNat(n) : α) ↔ m < OfNat.ofNat n :=
cast_lt
Nat.one_lt_ofNat
theorem
: 1 < (ofNat(n) : α)
@[simp]
theorem one_lt_ofNat : 1 < (ofNat(n) : α) :=
one_lt_cast.mpr AtLeastTwo.one_lt
Nat.one_le_ofNat
theorem
: 1 ≤ (ofNat(n) : α)
@[simp]
theorem one_le_ofNat : 1 ≤ (ofNat(n) : α) :=
one_le_cast.mpr NeZero.one_le
Nat.not_ofNat_le_one
theorem
: ¬(ofNat(n) : α) ≤ 1
@[simp]
theorem not_ofNat_le_one : ¬(ofNat(n) : α) ≤ 1 :=
(cast_le_one.not.trans not_le).mpr AtLeastTwo.one_lt
Nat.not_ofNat_lt_one
theorem
: ¬(ofNat(n) : α) < 1
@[simp]
theorem not_ofNat_lt_one : ¬(ofNat(n) : α) < 1 :=
mt le_of_lt not_ofNat_le_one
Nat.ofNat_le
theorem
: (ofNat(m) : α) ≤ (ofNat(n) : α) ↔ (OfNat.ofNat m : ℕ) ≤ OfNat.ofNat n
theorem ofNat_le :
(ofNat(m) : α) ≤ (ofNat(n) : α) ↔ (OfNat.ofNat m : ℕ) ≤ OfNat.ofNat n :=
cast_le
Nat.ofNat_lt
theorem
: (ofNat(m) : α) < (ofNat(n) : α) ↔ (OfNat.ofNat m : ℕ) < OfNat.ofNat n
theorem ofNat_lt :
(ofNat(m) : α) < (ofNat(n) : α) ↔ (OfNat.ofNat m : ℕ) < OfNat.ofNat n :=
cast_lt
instNontrivialOfCharZero
instance
[AddMonoidWithOne α] [CharZero α] : Nontrivial α
instance [AddMonoidWithOne α] [CharZero α] : Nontrivial α where exists_pair_ne :=
⟨1, 0, (Nat.cast_one (R := α) ▸ Nat.cast_ne_zero.2 (by decide))⟩
NeZero.nat_of_injective
theorem
{n : ℕ} [NeZero (n : R)] [RingHomClass F R S] {f : F} (hf : Function.Injective f) : NeZero (n : S)
theorem NeZero.nat_of_injective {n : ℕ} [NeZero (n : R)] [RingHomClass F R S] {f : F}
(hf : Function.Injective f) : NeZero (n : S) :=
⟨fun h ↦ NeZero.natCast_ne n R <| hf <| by simpa only [map_natCast, map_zero f]⟩