Module docstring
{"# Casts of rational numbers into characteristic zero fields (or division rings). "}
{"# Casts of rational numbers into characteristic zero fields (or division rings). "}
Rat.cast_injective
theorem
: Injective ((↑) : ℚ → α)
@[stacks 09FR "Characteristic zero case."]
lemma cast_injective : Injective ((↑) : ℚ → α)
| ⟨n₁, d₁, d₁0, c₁⟩, ⟨n₂, d₂, d₂0, c₂⟩, h => by
have d₁a : (d₁ : α) ≠ 0 := Nat.cast_ne_zero.2 d₁0
have d₂a : (d₂ : α) ≠ 0 := Nat.cast_ne_zero.2 d₂0
rw [mk'_eq_divInt, mk'_eq_divInt] at h ⊢
rw [cast_divInt_of_ne_zero, cast_divInt_of_ne_zero] at h <;> simp [d₁0, d₂0] at h ⊢
rwa [eq_div_iff_mul_eq d₂a, division_def, mul_assoc, (d₁.cast_commute (d₂ : α)).inv_left₀.eq, ←
mul_assoc, ← division_def, eq_comm, eq_div_iff_mul_eq d₁a, eq_comm, ← Int.cast_natCast d₁, ←
Int.cast_mul, ← Int.cast_natCast d₂, ← Int.cast_mul, Int.cast_inj, ← mkRat_eq_iff d₁0 d₂0]
at h
Rat.cast_inj
theorem
: (p : α) = q ↔ p = q
@[simp, norm_cast] lemma cast_inj : (p : α) = q ↔ p = q := cast_injective.eq_iff
Rat.cast_eq_zero
theorem
: (p : α) = 0 ↔ p = 0
@[simp, norm_cast] lemma cast_eq_zero : (p : α) = 0 ↔ p = 0 := cast_injective.eq_iff' cast_zero
Rat.cast_ne_zero
theorem
: (p : α) ≠ 0 ↔ p ≠ 0
lemma cast_ne_zero : (p : α) ≠ 0(p : α) ≠ 0 ↔ p ≠ 0 := cast_eq_zero.ne
Rat.cast_add
theorem
(p q : ℚ) : ↑(p + q) = (p + q : α)
@[simp, norm_cast] lemma cast_add (p q : ℚ) : ↑(p + q) = (p + q : α) :=
cast_add_of_ne_zero (Nat.cast_ne_zero.2 p.pos.ne') (Nat.cast_ne_zero.2 q.pos.ne')
Rat.cast_sub
theorem
(p q : ℚ) : ↑(p - q) = (p - q : α)
@[simp, norm_cast] lemma cast_sub (p q : ℚ) : ↑(p - q) = (p - q : α) :=
cast_sub_of_ne_zero (Nat.cast_ne_zero.2 p.pos.ne') (Nat.cast_ne_zero.2 q.pos.ne')
Rat.cast_mul
theorem
(p q : ℚ) : ↑(p * q) = (p * q : α)
@[simp, norm_cast] lemma cast_mul (p q : ℚ) : ↑(p * q) = (p * q : α) :=
cast_mul_of_ne_zero (Nat.cast_ne_zero.2 p.pos.ne') (Nat.cast_ne_zero.2 q.pos.ne')
Rat.castHom
definition
: ℚ →+* α
Rat.coe_castHom
theorem
: ⇑(castHom α) = ((↑) : ℚ → α)
@[simp] lemma coe_castHom : ⇑(castHom α) = ((↑) : ℚ → α) := rfl
Rat.cast_inv
theorem
(p : ℚ) : ↑(p⁻¹) = (p⁻¹ : α)
Rat.cast_div
theorem
(p q : ℚ) : ↑(p / q) = (p / q : α)
Rat.cast_zpow
theorem
(p : ℚ) (n : ℤ) : ↑(p ^ n) = (p ^ n : α)
Rat.cast_mk
theorem
(a b : ℤ) : (a /. b : α) = a / b
@[norm_cast]
theorem cast_mk (a b : ℤ) : (a /. b : α) = a / b := by
simp only [divInt_eq_div, cast_div, cast_intCast]
NNRat.cast_injective
theorem
: Injective ((↑) : ℚ≥0 → α)
lemma cast_injective : Injective ((↑) : ℚ≥0 → α) := by
rintro p q hpq
rw [NNRat.cast_def, NNRat.cast_def, Commute.div_eq_div_iff] at hpq
on_goal 1 => rw [← p.num_div_den, ← q.num_div_den, div_eq_div_iff]
· norm_cast at hpq ⊢
any_goals norm_cast
any_goals apply den_ne_zero
exact Nat.cast_commute ..
NNRat.cast_inj
theorem
: (p : α) = q ↔ p = q
@[simp, norm_cast] lemma cast_inj : (p : α) = q ↔ p = q := cast_injective.eq_iff
NNRat.cast_eq_zero
theorem
: (q : α) = 0 ↔ q = 0
@[simp, norm_cast] lemma cast_eq_zero : (q : α) = 0 ↔ q = 0 := by rw [← cast_zero, cast_inj]
NNRat.cast_ne_zero
theorem
: (q : α) ≠ 0 ↔ q ≠ 0
lemma cast_ne_zero : (q : α) ≠ 0(q : α) ≠ 0 ↔ q ≠ 0 := cast_eq_zero.not
NNRat.cast_add
theorem
(p q : ℚ≥0) : ↑(p + q) = (p + q : α)
@[simp, norm_cast] lemma cast_add (p q : ℚ≥0) : ↑(p + q) = (p + q : α) :=
cast_add_of_ne_zero (Nat.cast_ne_zero.2 p.den_pos.ne') (Nat.cast_ne_zero.2 q.den_pos.ne')
NNRat.cast_mul
theorem
(p q) : (p * q : ℚ≥0) = (p * q : α)
@[simp, norm_cast] lemma cast_mul (p q) : (p * q : ℚ≥0) = (p * q : α) :=
cast_mul_of_ne_zero (Nat.cast_ne_zero.2 p.den_pos.ne') (Nat.cast_ne_zero.2 q.den_pos.ne')
NNRat.castHom
definition
: ℚ≥0 →+* α
NNRat.coe_castHom
theorem
: ⇑(castHom α) = (↑)
@[simp, norm_cast] lemma coe_castHom : ⇑(castHom α) = (↑) := rfl
NNRat.cast_inv
theorem
(p) : (p⁻¹ : ℚ≥0) = (p : α)⁻¹
NNRat.cast_div
theorem
(p q) : (p / q : ℚ≥0) = (p / q : α)
NNRat.cast_zpow
theorem
(q : ℚ≥0) (p : ℤ) : ↑(q ^ p) = ((q : α) ^ p : α)
NNRat.cast_divNat
theorem
(a b : ℕ) : (divNat a b : α) = a / b
@[simp]
lemma cast_divNat (a b : ℕ) : (divNat a b : α) = a / b := by
rw [← cast_natCast, ← cast_natCast b, ← cast_div]
congr
ext
apply Rat.mkRat_eq_div