Cast of naturals #
This file defines the canonical homomorphism from the natural numbers into a type α
with 0
,
1
and +
(typically an add_monoid
with one).
Main declarations #
cast
: Canonical homomorphismℕ → α
whereα
has a0
,1
and+
.bin_cast
: Binary representation version ofcast
.cast_add_monoid_hom
:cast
bundled as anadd_monoid_hom
.cast_ring_hom
:cast
bundled as aring_hom
.
Implementation note #
Setting up the coercions priorities is tricky. See Note [coercion into rings].
@[simp]
coe : ℕ → α
as an add_monoid_hom
.
Equations
- nat.cast_add_monoid_hom α = {to_fun := coe coe_to_lift, map_zero' := _, map_add' := _}
@[simp]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
Equations
- nat.cast_ring_hom α = {to_fun := coe coe_to_lift, map_one' := _, map_mul' := _, map_zero' := _, map_add' := _}
@[simp]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
@[simp, norm_cast]
Alias of coe_nat_dvd
.
Natural division is always less than division in the field.
@[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.map_nat_cast
{A : Type u_1}
{B : Type u_2}
[add_monoid A]
[has_one A]
[add_monoid B]
[has_one B]
(f : A →+ B)
(h1 : ⇑f 1 = 1)
(n : ℕ) :
@[ext]
theorem
monoid_with_zero_hom.ext_nat
{A : Type u_1}
[monoid_with_zero A]
{f g : monoid_with_zero_hom ℕ A}
(h_pos : ∀ {n : ℕ}, 0 < n → ⇑f n = ⇑g n) :
f = g
If two monoid_with_zero_hom
s agree on the positive naturals they are equal.
@[simp]
@[simp]
theorem
ring_hom.map_nat_cast
{R : Type u_1}
{S : Type u_2}
[non_assoc_semiring R]
[non_assoc_semiring S]
(f : R →+* S)
(n : ℕ) :
@[protected, instance]