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
    @[implicit_reducible]
    instance Rat.instDecidablePredIsSquare :
    DecidablePred IsSquare

    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]
    theorem Rat.sqrt_ofNat (n : ) :
    sqrt (OfNat.ofNat n) = (Nat.sqrt (OfNat.ofNat n))