(* ArithCompl.v *)
(**********************************)
(* Some complements of arithmetic *)
(**********************************)
Require Export Wf_nat.
Require Export ZArith.
Require Export Znumtheory.
Require Export Reals.
Open Scope Z_scope.
Unset Standard Proposition Elimination Names.
(***************)
(* Regarding Z *)
(***************)
Definition is_sqr (n : Z) : Prop :=
0 <= n /\ exists i : Z, i * i = n /\ 0 <= i.

(* Specifications: *)
Lemma is_sqr_sqr : forall n: Z, is_sqr (n * n).
Lemma is_sqr_mult : forall p q : Z, is_sqr p -> is_sqr q -> is_sqr (p * q).
Lemma sqr_0 : forall z : Z, z * z = 0 -> z = 0.
Lemma sqr_compat : forall a b : Z, a * a = b * b -> a = b \/ a = -b.
Lemma sqr_le : forall a : Z, a <= a * a.
Lemma sqr_spos : forall z : Z, z <> 0 -> z * z > 0.
Lemma sqr_poss : forall z : Z, 0 < z * z -> z <> 0.
Lemma sqr_lt : forall a : Z, a <> 0 -> a <> 1 -> a < a * a.
Lemma sqr_sum : forall a b : Z, b <> 0 -> a * a + b * b <> 0.
Lemma sqr_sum2 : forall a b : Z, 0 <= a * a + b * b.
Lemma sqr_sum3 : forall a b : Z, b > 0 -> a * a + b * b > 0.
Lemma sqr_sum4: forall a b : Z, a * a + b * b = 0 -> a = 0 /\ b = 0.
Lemma sqr_sub1 : forall a b : Z, 0 <= b -> b <= a -> 0 <= a * a - b * b.
Lemma sqr_sub2 : forall a b : Z, 0 <= b -> b < a -> 0 < a * a - b * b.
Lemma sqr_sub3 : forall a b : Z, 0 < a -> 0 < b -> 0 < a * a - b * b -> b < a.
Lemma sqr_2 : forall a : Z, 0 <= 2 * (a * a).
Lemma sqr_gt : forall a b : Z, a >= 0 -> a < b -> a * a < b * b.
Lemma sqr_ge : forall a b : Z, a >= 0 -> a <= b -> a * a <= b * b.
Lemma Zle_square_simpl : forall n m:Z,
0 <= n -> 0 <= m -> m * m <= n * n -> m <= n.
Lemma neq_1 : forall u v m n : Z,
m <> 0 -> n <> 0 -> u * u = m * m + n * n -> v * v = n * n - m * m ->
u <> 1 /\ v <> 1.
Lemma Zmult_eq_reg_l : forall z z1 z2, z * z1 = z * z2 -> z <> 0 -> z1 = z2.
Lemma Zmult_neq_0 : forall a b : Z, a * b <> 0 -> a <> 0 /\ b <> 0.
Definition both_odd (x y : Z) := Zodd x /\ Zodd y.