mathlib documentation

data.nat.cast

def nat.cast {α : Type u_1} [has_zero α] [has_one α] [has_add α] (a : ) :
α

Canonical homomorphism from to a type α with 0, 1 and +.

Equations
@[instance]
def nat.cast_coe {α : Type u_1} [has_zero α] [has_one α] [has_add α] :

Equations
@[simp]
theorem nat.cast_zero {α : Type u_1} [has_zero α] [has_one α] [has_add α] :
0 = 0

theorem nat.cast_add_one {α : Type u_1} [has_zero α] [has_one α] [has_add α] (n : ) :
(n + 1) = n + 1

@[simp]
theorem nat.cast_succ {α : Type u_1} [has_zero α] [has_one α] [has_add α] (n : ) :
(n.succ) = n + 1

@[simp]
theorem nat.cast_ite {α : Type u_1} [has_zero α] [has_one α] [has_add α] (P : Prop) [decidable P] (m n : ) :
(ite P m n) = ite P m n

@[simp]
theorem nat.cast_one {α : Type u_1} [add_monoid α] [has_one α] :
1 = 1

@[simp]
theorem nat.cast_add {α : Type u_1} [add_monoid α] [has_one α] (m n : ) :
(m + n) = m + n

def nat.cast_add_monoid_hom (α : Type u_1) [add_monoid α] [has_one α] :

coe : ℕ → α as an add_monoid_hom.

Equations
@[simp]

@[simp]
theorem nat.cast_bit0 {α : Type u_1} [add_monoid α] [has_one α] (n : ) :

@[simp]
theorem nat.cast_bit1 {α : Type u_1} [add_monoid α] [has_one α] (n : ) :

theorem nat.cast_two {α : Type u_1} [semiring α] :
2 = 2

@[simp]
theorem nat.cast_pred {α : Type u_1} [add_group α] [has_one α] {n : } (a : 0 < n) :
(n - 1) = n - 1

@[simp]
theorem nat.cast_sub {α : Type u_1} [add_group α] [has_one α] {m n : } (h : m n) :
(n - m) = n - m

@[simp]
theorem nat.cast_mul {α : Type u_1} [semiring α] (m n : ) :
m * n = (m) * n

@[simp]
theorem nat.cast_dvd {α : Type u_1} [field α] {m n : } (n_dvd : n m) (n_nonzero : n 0) :
(m / n) = m / n

def nat.cast_ring_hom (α : Type u_1) [semiring α] :

coe : ℕ → α as a ring_hom

Equations
@[simp]
theorem nat.coe_cast_ring_hom {α : Type u_1} [semiring α] :

theorem nat.cast_commute {α : Type u_1} [semiring α] (n : ) (x : α) :

theorem nat.commute_cast {α : Type u_1} [semiring α] (x : α) (n : ) :

@[simp]
theorem nat.cast_nonneg {α : Type u_1} [linear_ordered_semiring α] (n : ) :
0 n

@[simp]
theorem nat.cast_le {α : Type u_1} [linear_ordered_semiring α] {m n : } :
m n m n

@[simp]
theorem nat.cast_lt {α : Type u_1} [linear_ordered_semiring α] {m n : } :
m < n m < n

@[simp]
theorem nat.cast_pos {α : Type u_1} [linear_ordered_semiring α] {n : } :
0 < n 0 < n

theorem nat.cast_add_one_pos {α : Type u_1} [linear_ordered_semiring α] (n : ) :
0 < n + 1

@[simp]
theorem nat.cast_min {α : Type u_1} [decidable_linear_ordered_semiring α] {a b : } :
(min a b) = min a b

@[simp]
theorem nat.cast_max {α : Type u_1} [decidable_linear_ordered_semiring α] {a b : } :
(max a b) = max a b

@[simp]
theorem nat.abs_cast {α : Type u_1} [decidable_linear_ordered_comm_ring α] (a : ) :

theorem nat.coe_nat_dvd {α : Type u_1} [comm_semiring α] (m n : ) (h : m n) :

theorem nat.inv_pos_of_nat {α : Type u_1} [linear_ordered_field α] {n : } :
0 < (n + 1)⁻¹

theorem nat.one_div_pos_of_nat {α : Type u_1} [linear_ordered_field α] {n : } :
0 < 1 / (n + 1)

theorem nat.one_div_le_one_div {α : Type u_1} [linear_ordered_field α] {n m : } (h : n m) :
1 / (m + 1) 1 / (n + 1)

theorem nat.one_div_lt_one_div {α : Type u_1} [linear_ordered_field α] {n m : } (h : n < m) :
1 / (m + 1) < 1 / (n + 1)

@[ext]
theorem add_monoid_hom.ext_nat {A : Type u_1} [add_monoid A] {f g : →+ A} (h : f 1 = g 1) :
f = g

theorem add_monoid_hom.eq_nat_cast {A : Type u_1} [add_monoid A] [has_one A] (f : →+ A) (h1 : f 1 = 1) (n : ) :
f n = n

@[simp]
theorem ring_hom.eq_nat_cast {R : Type u_1} [semiring R] (f : →+* R) (n : ) :
f n = n

@[simp]
theorem ring_hom.map_nat_cast {R : Type u_1} {S : Type u_2} [semiring R] [semiring S] (f : R →+* S) (n : ) :

theorem ring_hom.ext_nat {R : Type u_1} [semiring R] (f g : →+* R) :
f = g

@[simp]
theorem nat.cast_id (n : ) :
n = n

@[simp]
theorem nat.cast_with_bot (n : ) :

@[instance]
def nat.subsingleton_ring_hom {R : Type u_1} [semiring R] :

@[simp]
theorem with_top.coe_nat {α : Type u_1} [has_zero α] [has_one α] [has_add α] (n : ) :

@[simp]
theorem with_top.nat_ne_top {α : Type u_1} [has_zero α] [has_one α] [has_add α] (n : ) :

@[simp]
theorem with_top.top_ne_nat {α : Type u_1} [has_zero α] [has_one α] [has_add α] (n : ) :

theorem with_top.add_one_le_of_lt {i n : with_top } (h : i < n) :
i + 1 n

theorem with_top.nat_induction {P : with_top → Prop} (a : with_top ) (h0 : P 0) (hsuc : ∀ (n : ), P nP (n.succ)) (htop : (∀ (n : ), P n)P ) :
P a