Order for Rational Numbers #
Summary #
We define the order on ℚ
, prove that ℚ
is a discrete, linearly ordered field, and define
functions such as abs
and sqrt
that depend on this order.
Tags #
rat, rationals, field, ℚ, numerator, denominator, num, denom, order, ordering, sqrt, abs
A rational number is called nonnegative if its numerator is nonnegative.
Equations
- Rat.Nonneg r = (0 ≤ r.num)
Instances For
@[simp]
Equations
- Rat.decidableNonneg a = Rat.casesOn (motive := fun t => a = t → Decidable (Rat.Nonneg a)) a (fun num den den_nz reduced h => (_ : Rat.mk' num den = a) ▸ id inferInstance) (_ : a = a)
Relation a ≤ b
on ℚ
defined as a ≤ b ↔ Rat.Nonneg (b - a)
. Use a ≤ b
instead of
Rat.le a b
.
Equations
- Rat.le' a b = Rat.Nonneg (b - a)
Instances For
def
Rat.numDenCasesOn''
{C : ℚ → Sort u}
(a : ℚ)
(H : (n : ℤ) → (d : ℕ) → (nz : d ≠ 0) → (red : Nat.Coprime (Int.natAbs n) d) → C (Rat.mk' n d))
:
C a
Define a (dependent) function or prove ∀ r : ℚ, p r
by dealing with rational
numbers of the form mk' n d
with d ≠ 0
.
Equations
- Rat.numDenCasesOn'' a H = Rat.numDenCasesOn a fun n d h h' => Eq.mpr (_ : C (Rat.divInt n ↑d) = C (Rat.mk' n d)) (H n d (_ : d ≠ 0) h')
Instances For
theorem
Rat.le_def
{a : ℤ}
{b : ℤ}
{c : ℤ}
{d : ℤ}
(b0 : 0 < b)
(d0 : 0 < d)
:
Rat.divInt a b ≤ Rat.divInt c d ↔ a * d ≤ c * b
Equations
- Rat.linearOrder = LinearOrder.mk Rat.le_total (fun x x_1 => inferInstance) decidableEqOfDecidableLE decidableLTOfDecidableLE
Equations
- Rat.instDistribLatticeRat = inferInstance
Equations
- Rat.instSemilatticeInfRat = inferInstance
Equations
- Rat.instSemilatticeSupRat = inferInstance
Equations
- Rat.instPartialOrderRat = inferInstance
Equations
- One or more equations did not get rendered due to their size.
Equations
- Rat.instLinearOrderedCommRingRat = inferInstance
Equations
- Rat.instLinearOrderedRingRat = inferInstance
Equations
- Rat.instLinearOrderedSemiringRat = inferInstance
Equations
- Rat.instOrderedSemiringRat = inferInstance
Equations
- Rat.instLinearOrderedAddCommGroupRat = inferInstance
Equations
- Rat.instOrderedAddCommGroupRat = inferInstance
Equations
- Rat.instOrderedCancelAddCommMonoidRat = inferInstance
Equations
- Rat.instOrderedAddCommMonoidRat = inferInstance