Documentation

Mathlib.Data.Rat.Sqrt

Square root on rational numbers #

This file defines the square root function on rational numbers Rat.sqrt and proves several theorems about it.

def Rat.sqrt (q : ℚ) :

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.

Instances For
    theorem Rat.sqrt_eq (q : ℚ) :
    sqrt (q * q) = |q|
    theorem Rat.exists_mul_self (x : ℚ) :
    (∃ (q : ℚ), q * q = x) ↔ sqrt x * sqrt x = x
    theorem Rat.sqrt_nonneg (q : ℚ) :
    0 ≤ sqrt q
    @[implicit_reducible]

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

    @[simp]
    theorem Rat.sqrt_intCast (z : ℤ) :
    sqrt ↑z = ↑(Int.sqrt z)
    @[simp]
    theorem Rat.sqrt_natCast (n : ℕ) :
    sqrt ↑n = ↑n.sqrt
    @[simp]