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 / V02. Numbers

Mathlib.Data.Rat.Sqrt

8 declarations. Mathlib docs · Source

def Rat.sqrt E1 #

ℚ → ℚ

Square root function on rational numbers, defined by taking the (integer) square root of the numerator and the square root (on natural numbers) of the denominator.

theorem Rat.sqrt_eq E0 #

∀ (q : ℚ), Rat.sqrt (q * q) = |q|

theorem Rat.exists_mul_self E1 #

∀ (x : ℚ), (∃ q, q * q = x) ↔ Rat.sqrt x * Rat.sqrt x = x

theorem Rat.sqrt_nonneg E1 #

∀ (q : ℚ), 0 ≤ Rat.sqrt q

instance Rat.instDecidablePredIsSquare E0 #

DecidablePred IsSquare

IsSquare can be decided on ℚ by checking against the square root.

theorem Rat.sqrt_intCast E0 #

∀ (z : ℤ), Rat.sqrt ↑z = ↑(Int.sqrt z)

theorem Rat.sqrt_natCast E0 #

∀ (n : ℕ), Rat.sqrt ↑n = ↑n.sqrt

theorem Rat.sqrt_ofNat E0 #

∀ (n : ℕ), Rat.sqrt (OfNat.ofNat n) = ↑(Nat.sqrt (OfNat.ofNat n))