Mathlib.Data.Int.Sqrt
6 declarations. Mathlib docs · Source
def Int.sqrt E1 #
ℤ → ℤ
sqrt z is the square root of an integer z. If z is positive, it returns the largest
integer r such that r * r ≤ n. If it is negative, it returns 0. For example, sqrt (-1) = 0,
sqrt 1 = 1, sqrt 2 = 1
theorem Int.sqrt_eq E0 #
∀ (n : ℤ), Int.sqrt (n * n) = ↑n.natAbs
theorem Int.exists_mul_self E1 #
∀ (x : ℤ), (∃ n, n * n = x) ↔ Int.sqrt x * Int.sqrt x = x
theorem Int.sqrt_nonneg E1 #
∀ (n : ℤ), 0 ≤ Int.sqrt n
theorem Int.sqrt_natCast E0 #
∀ (n : ℕ), Int.sqrt ↑n = ↑n.sqrt
theorem Int.sqrt_ofNat E0 #
∀ (n : ℕ), Int.sqrt (OfNat.ofNat n) = ↑(OfNat.ofNat n).sqrt