Skip to content
Rainbow docs menu

Reference · Rationals

rainbow.math.rational.division

Rationalssrc/rainbow/math/rational/division.clj2 definitions, 3 theorems

Exact division of nonnegative rationals. The reciprocal of p/(q+1) is (q+1)/p; division is multiplication by the reciprocal. For a positive rational (numerator a successor), dividing it by itself is equivalent to one -- the cancellation law that underlies Newton steps, secant ratios, and normalization. Division by zero is total but junk (the reciprocal of 0 is not a genuine inverse), so the cancellation law is stated only for positive numerators.

nnrat/reciprocal

DefinitionSource, line 64

nnrat/reciprocal :
  (x₁ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

nnrat/divide

DefinitionSource, line 71

nnrat/divide :
  (x₁ x₂ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

nnrat/reciprocal-unfold

TheoremHolds by unfolding a definitionNo axiomsSource, line 81

nnrat/reciprocal-unfold :
  (value : ℚ≥0)
  → nnrat/reciprocal value = nnrat/make (nnrat/denominator value) (nat/predecessor (nnrat/numerator value))

= = equality/Eqℚ≥0 = nnrat/NonnegativeRational

nnrat/divide-unfold

TheoremHolds by unfolding a definitionNo axiomsSource, line 93

nnrat/divide-unfold :
  (left right : ℚ≥0)
  → nnrat/divide left right = left · nnrat/reciprocal right

= = equality/Eq· = nnrat/multiplyℚ≥0 = nnrat/NonnegativeRational

nnrat/divide-self-positive

TheoremFor all inputsNo axiomsSource, line 110

nnrat/divide-self-positive :
  (p q : ℕ)
  → nnrat/divide (nnrat/make (data/succ p) q) (nnrat/make (data/succ p) q) = 1

1 = nnrat/one= = nnrat/equivalent: equality of rational valuesℕ = data/Nat