(** ** Parity *)

Definition Even n := exists m, n = 2*m.Definition Odd n := exists m, n = 2*m+1.

(* Specifications: *)
Lemma Even_0 : Even 0.
Lemma Even_1 : ~ Even 1.
Lemma Even_2 n : Even n <-> Even (S (S n)).
Lemma Odd_0 : ~ Odd 0.
Lemma Odd_1 : Odd 1.
Lemma Odd_2 n : Odd n <-> Odd (S (S n)).
Lemma even_spec : forall n, even n = true <-> Even n.
Lemma odd_spec : forall n, odd n = true <-> Odd n.
Lemma divmod_spec : forall x y q u, u <= y -> let (q',u') := divmod x y q u in x + (S y)*q + (y-u) = (S y)*q' + (y-u') /\ u' <= y.
Lemma div_mod_eq x y : x = y*(x/y) + x mod y.
Lemma div_mod x y : y <> 0 -> x = y*(x/y) + x mod y.
Lemma mod_bound_pos x y : 0<=x -> 0<y -> 0 <= x mod y < y.
Lemma sqrt_iter_spec : forall k p q r, q = p+p -> r<=q -> let s := sqrt_iter k p q r in s*s <= k + p*p + (q - r) < (S s)*(S s).
Lemma sqrt_specif n : (sqrt n)*(sqrt n) <= n < S (sqrt n) * S (sqrt n).