The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V06. Rings, fields and ordered algebra

Mathlib.Algebra.Field.Rat

18 declarations. Mathlib docs · Source

The rational numbers form a field

This file contains the field instance on the rational numbers.

See note [foundational algebra order theory].

Tags

rat, rationals, field, ℚ, numerator, denominator, num, denom

Extra instances to short-circuit type class resolution

These also prevent non-computable instances being used to construct these instances non-computably.

instance Rat.instField E3 #

Field ℚ

instance Rat.instDivisionRing E0 #

DivisionRing ℚ

theorem Rat.inv_nonneg E1 #

∀ {a : ℚ}, 0 ≤ a → 0 ≤ a⁻¹

theorem Rat.div_nonneg E1 #

∀ {a b : ℚ}, 0 ≤ a → 0 ≤ b → 0 ≤ a / b

instance NNRat.instInv E0 #

Inv ℚ≥0

instance NNRat.instDiv E0 #

Div ℚ≥0

instance NNRat.instZPow E0 #

Pow ℚ≥0 ℤ

theorem NNRat.coe_inv E0 #

∀ (q : ℚ≥0), ↑q⁻¹ = (↑q)⁻¹

theorem NNRat.coe_div E0 #

∀ (p q : ℚ≥0), ↑(p / q) = ↑p / ↑q

theorem NNRat.coe_zpow E0 #

∀ (p : ℚ≥0) (n : ℤ), ↑(p ^ n) = ↑p ^ n

theorem NNRat.inv_def E0 #

∀ (q : ℚ≥0), q⁻¹ = NNRat.divNat q.den q.num

theorem NNRat.div_def E0 #

∀ (p q : ℚ≥0), p / q = NNRat.divNat (p.num * q.den) (p.den * q.num)

theorem NNRat.divNat_eq_div E1 #

∀ (a b : ℕ), NNRat.divNat a b = ↑a / ↑b

theorem NNRat.num_inv_of_ne_zero E1 #

∀ {q : ℚ≥0}, q ≠ 0 → q⁻¹.num = q.den

theorem NNRat.den_inv_of_ne_zero E1 #

∀ {q : ℚ≥0}, q ≠ 0 → q⁻¹.den = q.num

theorem NNRat.num_div_den E0 #

∀ (q : ℚ≥0), ↑q.num / ↑q.den = q

instance NNRat.instSemifield E0 #

Semifield ℚ≥0

theorem NNRatCast.ofScientific_eq_ite E1 #

∀ {K : Type u_1} [inst : NNRatCast K] (m : ℕ) (b : Bool) (d : ℕ),
  OfScientific.ofScientific m b d = ↑(if b = true then NNRat.divNat m (10 ^ d) else ↑(m * 10 ^ d))