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.Order.Ring.Unbundled.Rat

33 declarations. Mathlib docs · Source

The rational numbers possess a linear order

This file constructs the order on ℚ and proves various facts relating the order to ring structure on ℚ. This only uses unbundled type classes, e.g. CovariantClass, relating the order structure and algebra structure on ℚ. For the bundled LinearOrderedCommRing instance on ℚ, see Algebra.Order.Ring.Rat.

Tags

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

Extra instances to short-circuit type class resolution

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

Miscellaneous lemmas

theorem Rat.mkRat_nonneg E0 #

∀ {a : ℤ}, 0 ≤ a → ∀ (b : ℕ), 0 ≤ mkRat a b

theorem Rat.ofScientific_nonneg E1 #

∀ (m : ℕ) (s : Bool) (e : ℕ), 0 ≤ Rat.ofScientific m s e

instance NNRatCast.toOfScientific E0 #

{K : Type u_1} → [NNRatCast K] → OfScientific K

theorem NNRatCast.toOfScientific_def E0 #

∀ {K : Type u_1} [inst : NNRatCast K] (m : ℕ) (b : Bool) (d : ℕ),
  OfScientific.ofScientific m b d = ↑⟨OfScientific.ofScientific m b d, ⋯⟩

theorem NNRat.cast_ofScientific E0 #

∀ {K : Type u_1} [inst : NNRatCast K] (m : ℕ) (s : Bool) (e : ℕ),
  ↑(OfScientific.ofScientific m s e) = OfScientific.ofScientific m s e

Casting a scientific literal via ℚ≥0 is the same as casting directly.

theorem Rat.divInt_le_divInt E1 #

∀ {a b c d : ℤ}, 0 < b → 0 < d → (Rat.divInt a b ≤ Rat.divInt c d ↔ a * d ≤ c * b)

theorem Rat.lt_iff_le_not_ge E1 #

∀ (a b : ℚ), a < b ↔ a ≤ b ∧ ¬b ≤ a

instance Rat.linearOrder E0 #

LinearOrder ℚ

theorem Rat.mkRat_nonneg_iff E0 #

∀ (a : ℤ) {b : ℕ}, b ≠ 0 → (0 ≤ mkRat a b ↔ 0 ≤ a)

theorem Rat.mkRat_pos_iff E0 #

∀ (a : ℤ) {b : ℕ}, b ≠ 0 → (0 < mkRat a b ↔ 0 < a)

theorem Rat.mkRat_pos E1 #

∀ {a : ℤ}, 0 < a → ∀ {b : ℕ}, b ≠ 0 → 0 < mkRat a b

theorem Rat.mkRat_nonpos_iff E0 #

∀ (a : ℤ) {b : ℕ}, b ≠ 0 → (mkRat a b ≤ 0 ↔ a ≤ 0)

theorem Rat.mkRat_nonpos E1 #

∀ {a : ℤ}, a ≤ 0 → ∀ (b : ℕ), mkRat a b ≤ 0

theorem Rat.mkRat_neg_iff E0 #

∀ (a : ℤ) {b : ℕ}, b ≠ 0 → (mkRat a b < 0 ↔ a < 0)

theorem Rat.mkRat_neg E1 #

∀ {a : ℤ}, a < 0 → ∀ {b : ℕ}, b ≠ 0 → mkRat a b < 0

instance Rat.instDistribLattice E0 #

DistribLattice ℚ

instance Rat.instLattice E0 #

Lattice ℚ

instance Rat.instSemilatticeInf E0 #

SemilatticeInf ℚ

instance Rat.instSemilatticeSup E0 #

SemilatticeSup ℚ

instance Rat.instInf E0 #

Min ℚ

instance Rat.instSup E0 #

Max ℚ

instance Rat.instPartialOrder E0 #

PartialOrder ℚ

instance Rat.instPreorder E0 #

Preorder ℚ

instance Rat.instAddLeftMono E0 #

AddLeftMono ℚ

theorem Rat.num_nonpos E0 #

∀ {a : ℚ}, a.num ≤ 0 ↔ a ≤ 0

theorem Rat.num_pos E0 #

∀ {a : ℚ}, 0 < a.num ↔ 0 < a

theorem Rat.num_neg E0 #

∀ {a : ℚ}, a.num < 0 ↔ a < 0

theorem Rat.num_le_denom_iff E0 #

∀ {q : ℚ}, q.num ≤ ↑q.den ↔ q ≤ 1

theorem Rat.num_lt_denom_iff E0 #

∀ {q : ℚ}, q.num < ↑q.den ↔ q < 1

theorem Rat.abs_def E0 #

∀ (q : ℚ), |q| = Rat.divInt ↑q.num.natAbs ↑q.den

theorem Rat.abs_def' E1 #

∀ (q : ℚ), |q| = { num := |q.num|, den := q.den, den_nz := ⋯, reduced := ⋯ }

theorem Rat.num_abs_eq_abs_num E0 #

∀ (q : ℚ), |q|.num = |q.num|

theorem Rat.den_abs_eq_den E0 #

∀ (q : ℚ), |q|.den = q.den