Documentation

CslibFrontier.Foundations.Data.Rat.Basic

Properties of integer quotients Rat.divInt #

Elementary properties of Rat.divInt a b: the reduced numerator magnitude in terms of Nat.gcd a.natAbs b.natAbs, the numerator sign bit, and magnitude bounds on numerator and denominator.

Main results #

theorem Rat.natAbs_num_divInt_of_ne_zero (a b : ℤ) (hb : b ≠ 0) :

Reduced numerator magnitude of Rat.divInt a b for b ≠ 0.

theorem Rat.natAbs_num_divInt (a b : ℤ) :

Reduced numerator magnitude of Rat.divInt a b for arbitrary integers a, b.

theorem Rat.natAbs_num_divInt_le (a b : ℤ) (hb : b ≠ 0) :

Reduced numerator magnitude of Rat.divInt a b is bounded by |a|.

theorem Rat.den_divInt_le (a b : ℤ) (hb : b ≠ 0) :

Reduced denominator of Rat.divInt a b is bounded by |b|.

theorem Rat.decide_num_divInt_lt_zero_of_ne_zero (a b : ℤ) (hb : b ≠ 0) :
decide ((divInt a b).num < 0) = if a = 0 then false else decide (a < 0) ^^ decide (b < 0)

Sign bit of Rat.divInt a b for b ≠ 0.

theorem Rat.decide_num_divInt_lt_zero (a b : ℤ) :
decide ((divInt a b).num < 0) = if a = 0 then false else if b = 0 then false else decide (a < 0) ^^ decide (b < 0)

Sign bit of Rat.divInt a b for arbitrary integers a, b.

theorem Rat.natAbs_num_add_le (a b : ℚ) :

Reduced numerator magnitude of a + b is bounded by |a.num| * b.den + |b.num| * a.den.

theorem Rat.den_add_le (a b : ℚ) :
(a + b).den ≤ a.den * b.den

Reduced denominator of a + b is bounded by a.den * b.den.

theorem Rat.natAbs_num_sub_le (a b : ℚ) :

Reduced numerator magnitude of a - b is bounded by |a.num| * b.den + |b.num| * a.den.

theorem Rat.den_sub_le (a b : ℚ) :
(a - b).den ≤ a.den * b.den

Reduced denominator of a - b is bounded by a.den * b.den.

Reduced numerator magnitude of a * b is bounded by |a.num| * |b.num|.

theorem Rat.den_mul_le (a b : ℚ) :
(a * b).den ≤ a.den * b.den

Reduced denominator of a * b is bounded by a.den * b.den.

Reduced numerator magnitude of a⁻¹ is bounded by a.den.

theorem Rat.den_inv_le (a : ℚ) :

Reduced denominator of a⁻¹ is bounded by max |a.num| 1.

theorem Rat.natAbs_num_div_le (a b : ℚ) :

Reduced numerator magnitude of a / b is bounded by |a.num| * b.den.

theorem Rat.den_div_le (a b : ℚ) :
(a / b).den ≤ a.den * max b.num.natAbs 1

Reduced denominator of a / b is bounded by a.den * max |b.num| 1.