Library Coq.Numbers.NatInt.NZSqrt
Square Root Function
Interface of a sqrt function, then its specification on naturals
Derived properties of power
First, sqrt is non-negative
The spec of sqrt indeed determines it
Hence sqrt is a morphism
An alternate specification
Sqrt is exact on squares
Sqrt and predecessors of squares
Sqrt is a monotone function (but not a strict one)
No reverse result for <=, consider for instance √2 <= √1
When left side is a square, we have an equivalence for <=
When right side is a square, we have an equivalence for <
Sqrt and basic constants
Sqrt and multiplication.
Due to rounding error, we don't have the usual √(a*b) = √a*√b
but only lower and upper bounds.
And we can't find better approximations in general.
- The lower bound is exact for squares
- Concerning the upper bound, for any c>0, take a=b=c²-1,
then √(a*b) = c² -1 while S √a = S √b = c
Sqrt and successor :
- the sqrt function climbs by at most 1 at a time
- otherwise it stays at the same value
- the +1 steps occur for squares
Sqrt and addition
convexity inequality for sqrt: sqrt of middle is above middle
of square roots.
sqrt_up : a square root that rounds up instead of down
Local Notation "a ²" := (
a*a) (
at level 5,
no associativity,
format "a ²").
For once, we define instead of axiomatizing, thanks to sqrt
First, sqrt_up is non-negative
sqrt_up is a morphism
The spec of sqrt_up indeed determines it
sqrt_up is exact on squares
sqrt_up and successors of squares
Basic constants
Links between sqrt and sqrt_up
sqrt_up is a monotone function (but not a strict one)
No reverse result for <=, consider for instance √°3 <= √°2
When left side is a square, we have an equivalence for <
When right side is a square, we have an equivalence for <=
sqrt_up and multiplication.
Due to rounding error, we don't have the usual
√(a*b) = √a*√b
but only lower and upper bounds.
And we can't find better approximations in general.
- The upper bound is exact for squares
- Concerning the lower bound, for any c>0, take a=b=c²+1,
then √°(a*b) = c²+1 while P √°a = P √°b = c
sqrt_up and successor :
- the sqrt_up function climbs by at most 1 at a time
- otherwise it stays at the same value
- the +1 steps occur after squares
sqrt_up and addition
Convexity-like inequality for sqrt_up: sqrt_up of middle is above middle
of square roots. We cannot say more, for instance take a=b=2, then
2+2 <= S 3