Module Type NZSqrtUpProp
(Import A : NZDecOrdAxiomsSig')
(Import B : NZSqrt' A)
(Import C : NZMulOrderProp A)
(Import D : NZSqrtProp A B C).
(** * [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 *)
Definition sqrt_up a :=
match compare 0 a with
| Lt => S √(P a)
| _ => 0
end.
Local Notation "√° a" := (sqrt_up a) (at level 6, no associativity).

(* Specifications: *)
Lemma sqrt_up_eqn0 : forall a, a<=0 -> √°a == 0.
Lemma sqrt_up_eqn : forall a, 0<a -> √°a == S √(P a).
Lemma sqrt_up_spec : forall a, 0<a -> (P √°a)² < a <= (√°a)².
(** First, [sqrt_up] is non-negative *)
Lemma sqrt_up_nonneg : forall a, 0<=√°a.
#[global]
Instance sqrt_up_wd : Proper (eq==>eq) sqrt_up.