Documentation

Mathlib.Data.Rat.Cast.Defs

Casts for Rational Numbers #

Summary #

We define the canonical injection from ℚ into an arbitrary division ring and prove various casting lemmas showing the well-behavedness of this injection.

Notations #

Tags #

rat, rationals, field, ℚ, numerator, denominator, num, denom, cast, coercion, casting

@[simp]
theorem Rat.cast_coe_int {α : Type u_3} [DivisionRing α] (n : ℤ) :
↑↑n = ↑n
@[simp]
theorem Rat.cast_coe_nat {α : Type u_3} [DivisionRing α] (n : ℕ) :
↑↑n = ↑n
@[simp]
theorem Rat.cast_zero {α : Type u_3} [DivisionRing α] :
↑0 = 0
@[simp]
theorem Rat.cast_one {α : Type u_3} [DivisionRing α] :
↑1 = 1
theorem Rat.cast_commute {α : Type u_3} [DivisionRing α] (r : ℚ) (a : α) :
Commute (↑r) a
theorem Rat.cast_comm {α : Type u_3} [DivisionRing α] (r : ℚ) (a : α) :
↑r * a = a * ↑r
theorem Rat.commute_cast {α : Type u_3} [DivisionRing α] (a : α) (r : ℚ) :
Commute a ↑r
theorem Rat.cast_mk_of_ne_zero {α : Type u_3} [DivisionRing α] (a : ℤ) (b : ℤ) (b0 : ↑b ≠ 0) :
↑(Rat.divInt a b) = ↑a / ↑b
theorem Rat.cast_add_of_ne_zero {α : Type u_3} [DivisionRing α] {m : ℚ} {n : ℚ} :
↑m.den ≠ 0 → ↑n.den ≠ 0 → ↑(m + n) = ↑m + ↑n
@[simp]
theorem Rat.cast_neg {α : Type u_3} [DivisionRing α] (n : ℚ) :
↑(-n) = -↑n
theorem Rat.cast_sub_of_ne_zero {α : Type u_3} [DivisionRing α] {m : ℚ} {n : ℚ} (m0 : ↑m.den ≠ 0) (n0 : ↑n.den ≠ 0) :
↑(m - n) = ↑m - ↑n
theorem Rat.cast_mul_of_ne_zero {α : Type u_3} [DivisionRing α] {m : ℚ} {n : ℚ} :
↑m.den ≠ 0 → ↑n.den ≠ 0 → ↑(m * n) = ↑m * ↑n
theorem Rat.cast_inv_of_ne_zero {α : Type u_3} [DivisionRing α] {n : ℚ} :
↑n.num ≠ 0 → ↑n.den ≠ 0 → ↑n⁻¹ = (↑n)⁻¹
theorem Rat.cast_div_of_ne_zero {α : Type u_3} [DivisionRing α] {m : ℚ} {n : ℚ} (md : ↑m.den ≠ 0) (nn : ↑n.num ≠ 0) (nd : ↑n.den ≠ 0) :
↑(m / n) = ↑m / ↑n
theorem Rat.cast_id (n : ℚ) :
↑n = n
@[simp]
theorem Rat.cast_eq_id :
(fun (x : ℚ) => x) = id
@[simp]
theorem map_ratCast {F : Type u_1} {α : Type u_3} {β : Type u_4} [DivisionRing α] [DivisionRing β] [RingHomClass F α β] (f : F) (q : ℚ) :
f ↑q = ↑q
@[simp]
theorem eq_ratCast {F : Type u_1} {k : Type u_5} [DivisionRing k] [RingHomClass F ℚ k] (f : F) (r : ℚ) :
f r = ↑r
theorem MonoidWithZeroHom.ext_rat' {F : Type u_1} {M₀ : Type u_5} [MonoidWithZero M₀] [MonoidWithZeroHomClass F ℚ M₀] {f : F} {g : F} (h : ∀ (m : ℤ), f ↑m = g ↑m) :
f = g

If f and g agree on the integers then they are equal φ.

If f and g agree on the integers then they are equal φ.

See note [partially-applied ext lemmas] for why comp is used here.

theorem MonoidWithZeroHom.ext_rat_on_pnat {F : Type u_1} {M₀ : Type u_5} [MonoidWithZero M₀] [MonoidWithZeroHomClass F ℚ M₀] {f : F} {g : F} (same_on_neg_one : f (-1) = g (-1)) (same_on_pnat : ∀ (n : ℕ), 0 < n → f ↑n = g ↑n) :
f = g

Positive integer values of a morphism φ and its value on -1 completely determine φ.

theorem RingHom.ext_rat {F : Type u_1} {R : Type u_5} [Semiring R] [RingHomClass F ℚ R] (f : F) (g : F) :
f = g

Any two ring homomorphisms from ℚ to a semiring are equal. If the codomain is a division ring, then this lemma follows from eq_ratCast.

instance Rat.distribSMul {K : Type u_5} [DivisionRing K] :
Equations
Equations