Additional lemmas about the Rational Numbers #
@[simp]
theorem
Rat.mk_den_one
{r : Int}
:
{ num := r, den := 1, den_nz := Nat.one_ne_zero, reduced := ⋯ } = ↑r
@[simp]
theorem
Rat.maybeNormalize_eq
{num : Int}
{den g : Nat}
(den_nz : den / g ≠ 0)
(reduced : (num.tdiv ↑g).natAbs.Coprime (den / g))
:
maybeNormalize num den g den_nz reduced = { num := num.tdiv ↑g, den := den / g, den_nz := den_nz, reduced := reduced }
@[simp]
theorem
Rat.ofScientific_ofNat_ofNat
{m : Nat}
{s : Bool}
{e : Nat}
:
Rat.ofScientific (OfNat.ofNat m) s (OfNat.ofNat e) = OfScientific.ofScientific m s e
Rat.ofScientific
applied to numeric literals is the same as a scientific literal.
The following lemmas are later subsumed by e.g. Int.cast_add
and Int.cast_mul
in Mathlib
but it is convenient to have these earlier, for users who only need Int
and Rat
.