mathlib3 documentation

data.nat.cast.basic

Cast of natural numbers (additional theorems) #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file proves additional properties about the canonical homomorphism from the natural numbers into an additive monoid with a one (nat.cast).

Main declarations #

@[simp, norm_cast]
theorem nat.cast_mul {α : Type u_1} [non_assoc_semiring α] (m n : ) :
(m * n) = m * n
def nat.cast_ring_hom (α : Type u_1) [non_assoc_semiring α] :

coe : ℕ → α as a ring_hom

Equations
theorem nat.cast_commute {α : Type u_1} [non_assoc_semiring α] (n : ) (x : α) :
theorem nat.cast_comm {α : Type u_1} [non_assoc_semiring α] (n : ) (x : α) :
n * x = x * n
theorem nat.commute_cast {α : Type u_1} [non_assoc_semiring α] (x : α) (n : ) :
theorem nat.mono_cast {α : Type u_1} [ordered_semiring α] :
@[simp]
theorem nat.cast_nonneg {α : Type u_1} [ordered_semiring α] (n : ) :
0 n
theorem nat.cast_add_one_pos {α : Type u_1} [ordered_semiring α] [nontrivial α] (n : ) :
0 < n + 1
@[simp]
theorem nat.cast_pos {α : Type u_1} [ordered_semiring α] [nontrivial α] {n : } :
0 < n 0 < n
@[simp, norm_cast]
theorem nat.cast_le {α : Type u_1} [ordered_semiring α] [char_zero α] {m n : } :
m n m n
@[simp, norm_cast]
theorem nat.cast_lt {α : Type u_1} [ordered_semiring α] [char_zero α] {m n : } :
m < n m < n
@[simp, norm_cast]
theorem nat.one_lt_cast {α : Type u_1} [ordered_semiring α] [char_zero α] {n : } :
1 < n 1 < n
@[simp, norm_cast]
theorem nat.one_le_cast {α : Type u_1} [ordered_semiring α] [char_zero α] {n : } :
1 n 1 n
@[simp, norm_cast]
theorem nat.cast_lt_one {α : Type u_1} [ordered_semiring α] [char_zero α] {n : } :
n < 1 n = 0
@[simp, norm_cast]
theorem nat.cast_le_one {α : Type u_1} [ordered_semiring α] [char_zero α] {n : } :
n 1 n 1
@[simp, norm_cast]

A version of nat.cast_sub that works for ℝ≥0 and ℚ≥0. Note that this proof doesn't work for ℕ∞ and ℝ≥0∞, so we use type-specific lemmas for these types.

@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
theorem nat.abs_cast {α : Type u_1} [linear_ordered_ring α] (a : ) :
theorem nat.coe_nat_dvd {α : Type u_1} [semiring α] {m n : } (h : m n) :
theorem has_dvd.dvd.nat_cast {α : Type u_1} [semiring α] {m n : } (h : m n) :

Alias of nat.coe_nat_dvd.

theorem ext_nat' {A : Type u_3} {F : Type u_5} [add_monoid A] [add_monoid_hom_class F A] (f g : F) (h : f 1 = g 1) :
f = g
@[ext]
theorem add_monoid_hom.ext_nat {A : Type u_3} [add_monoid A] {f g : →+ A} (h : f 1 = g 1) :
f = g
theorem eq_nat_cast' {A : Type u_3} {F : Type u_5} [add_monoid_with_one A] [add_monoid_hom_class F A] (f : F) (h1 : f 1 = 1) (n : ) :
f n = n
theorem map_nat_cast' {B : Type u_4} {F : Type u_5} [add_monoid_with_one B] {A : Type u_1} [add_monoid_with_one A] [add_monoid_hom_class F A B] (f : F) (h : f 1 = 1) (n : ) :
theorem ext_nat'' {A : Type u_3} {F : Type u_4} [mul_zero_one_class A] [monoid_with_zero_hom_class F A] (f g : F) (h_pos : {n : }, 0 < n f n = g n) :
f = g

If two monoid_with_zero_homs agree on the positive naturals they are equal.

@[ext]
theorem monoid_with_zero_hom.ext_nat {A : Type u_3} [mul_zero_one_class A] {f g : →*₀ A} :
( {n : }, 0 < n f n = g n) f = g
@[simp]
theorem eq_nat_cast {R : Type u_3} {F : Type u_5} [non_assoc_semiring R] [ring_hom_class F R] (f : F) (n : ) :
f n = n
@[simp]
theorem map_nat_cast {R : Type u_3} {S : Type u_4} {F : Type u_5} [non_assoc_semiring R] [non_assoc_semiring S] [ring_hom_class F R S] (f : F) (n : ) :
theorem ext_nat {R : Type u_3} {F : Type u_5} [non_assoc_semiring R] [ring_hom_class F R] (f g : F) :
f = g
theorem ne_zero.nat_of_injective {R : Type u_3} {S : Type u_4} {F : Type u_5} [non_assoc_semiring R] [non_assoc_semiring S] {n : } [h : ne_zero n] [ring_hom_class F R S] {f : F} (hf : function.injective f) :
theorem ne_zero.nat_of_ne_zero {R : Type u_1} {S : Type u_2} [semiring R] [semiring S] {F : Type u_3} [ring_hom_class F R S] (f : F) {n : } [hn : ne_zero n] :

This is primed to match eq_int_cast'.

@[simp, norm_cast]
theorem nat.cast_id (n : ) :
n = n
@[protected, instance]
Equations
@[protected, instance]
def pi.has_nat_cast {α : Type u_1} {π : α Type u_3} [Π (a : α), has_nat_cast (π a)] :
has_nat_cast (Π (a : α), π a)
Equations
theorem pi.nat_apply {α : Type u_1} {π : α Type u_3} [Π (a : α), has_nat_cast (π a)] (n : ) (a : α) :
n a = n
@[simp]
theorem pi.coe_nat {α : Type u_1} {π : α Type u_3} [Π (a : α), has_nat_cast (π a)] (n : ) :
n = λ (_x : α), n
theorem sum.elim_nat_cast_nat_cast {α : Type u_1} {β : Type u_2} {γ : Type u_3} [has_nat_cast γ] (n : ) :
@[protected, instance]
def pi.add_monoid_with_one {α : Type u_1} {π : α Type u_3} [Π (a : α), add_monoid_with_one (π a)] :
add_monoid_with_one (Π (a : α), π a)
Equations

Order dual #

@[protected, instance]
Equations
@[simp]
theorem to_dual_nat_cast {α : Type u_1} [has_nat_cast α] (n : ) :
@[simp]
theorem of_dual_nat_cast {α : Type u_1} [has_nat_cast α] (n : ) :

Lexicographic order #

@[protected, instance]
def lex.has_nat_cast {α : Type u_1} [h : has_nat_cast α] :
Equations
@[protected, instance]
Equations
@[simp]
theorem to_lex_nat_cast {α : Type u_1} [has_nat_cast α] (n : ) :
@[simp]
theorem of_lex_nat_cast {α : Type u_1} [has_nat_cast α] (n : ) :