Infix "+" := Z.add : Z_scope.Notation "- x" := (Z.opp x) : Z_scope.Infix "-" := Z.sub : Z_scope.Infix "*" := Z.mul : Z_scope.Infix "^" := Z.pow : Z_scope.Infix "/" := Z.div : Z_scope.Infix "mod" := Z.modulo (at level 40, no associativity) : Z_scope.Infix "÷" := Z.quot (at level 40, left associativity) : Z_scope.Infix "?=" := Z.compare (at level 70, no associativity) : Z_scope.Infix "=?" := Z.eqb (at level 70, no associativity) : Z_scope.Infix "<=?" := Z.leb (at level 70, no associativity) : Z_scope.Infix "<?" := Z.ltb (at level 70, no associativity) : Z_scope.Infix ">=?" := Z.geb (at level 70, no associativity) : Z_scope.Infix ">?" := Z.gtb (at level 70, no associativity) : Z_scope.Notation "( x | y )" := (Z.divide x y) (at level 0) : Z_scope.Infix "<=" := Z.le : Z_scope.Infix "<" := Z.lt : Z_scope.Infix ">=" := Z.ge : Z_scope.Infix ">" := Z.gt : Z_scope.

(* Specifications: *)
Lemma id p : Z.to_pos (Z.pos p) = p.
Lemma inj p q : Z.pos p = Z.pos q -> p = q.
Lemma inj_iff p q : Z.pos p = Z.pos q <-> p = q.
Lemma is_pos p : 0 < Z.pos p.
Lemma is_nonneg p : 0 <= Z.pos p.
Lemma inj_1 : Z.pos 1 = 1.
Lemma inj_xO p : Z.pos p~0 = 2 * Z.pos p.
Lemma inj_xI p : Z.pos p~1 = 2 * Z.pos p + 1.
Lemma inj_succ p : Z.pos (Pos.succ p) = Z.succ (Z.pos p).
Lemma inj_add p q : Z.pos (p+q) = Z.pos p + Z.pos q.
Lemma inj_sub p q : (p < q)%positive -> Z.pos (q-p) = Z.pos q - Z.pos p.
Lemma inj_sub_max p q : Z.pos (p - q) = Z.max 1 (Z.pos p - Z.pos q).
Lemma inj_pred p : p <> 1%positive -> Z.pos (Pos.pred p) = Z.pred (Z.pos p).
Lemma inj_mul p q : Z.pos (p*q) = Z.pos p * Z.pos q.
Lemma inj_pow_pos p q : Z.pos (p^q) = Z.pow_pos (Z.pos p) q.
Lemma inj_pow p q : Z.pos (p^q) = (Z.pos p)^(Z.pos q).
Lemma inj_square p : Z.pos (Pos.square p) = Z.square (Z.pos p).
Lemma inj_compare p q : (p ?= q)%positive = (Z.pos p ?= Z.pos q).
Lemma inj_leb p q : (p <=? q)%positive = (Z.pos p <=? Z.pos q).
Lemma inj_ltb p q : (p <? q)%positive = (Z.pos p <? Z.pos q).
Lemma inj_eqb p q : (p =? q)%positive = (Z.pos p =? Z.pos q).
Lemma inj_max p q : Z.pos (Pos.max p q) = Z.max (Z.pos p) (Z.pos q).
Lemma inj_min p q : Z.pos (Pos.min p q) = Z.min (Z.pos p) (Z.pos q).
Lemma inj_sqrt p : Z.pos (Pos.sqrt p) = Z.sqrt (Z.pos p).
Lemma inj_gcd p q : Z.pos (Pos.gcd p q) = Z.gcd (Z.pos p) (Z.pos q).
Lemma inj_divide p q : (Z.pos p|Z.pos q) <-> (p|q)%positive.
Lemma inj_testbit a n : 0<=n -> Z.testbit (Z.pos a) n = N.testbit (N.pos a) (Z.to_N n).
Lemma inj_neg p q : Z.neg p = Z.neg q -> p = q.
Lemma inj_neg_iff p q : Z.neg p = Z.neg q <-> p = q.
Lemma inj_pos p q : Z.pos p = Z.pos q -> p = q.
Lemma inj_pos_iff p q : Z.pos p = Z.pos q <-> p = q.
Lemma neg_is_neg p : Z.neg p < 0.
Lemma neg_is_nonpos p : Z.neg p <= 0.
Lemma pos_is_pos p : 0 < Z.pos p.
Lemma pos_is_nonneg p : 0 <= Z.pos p.
Lemma neg_le_pos p q : Zneg p <= Zpos q.
Lemma neg_lt_pos p q : Zneg p < Zpos q.
Lemma neg_le_neg p q : (q <= p)%positive -> Zneg p <= Zneg q.
Lemma neg_lt_neg p q : (q < p)%positive -> Zneg p < Zneg q.
Lemma pos_le_pos p q : (p <= q)%positive -> Zpos p <= Zpos q.
Lemma pos_lt_pos p q : (p < q)%positive -> Zpos p < Zpos q.
Lemma neg_xO p : Z.neg p~0 = 2 * Z.neg p.
Lemma neg_xI p : Z.neg p~1 = 2 * Z.neg p - 1.
Lemma pos_xO p : Z.pos p~0 = 2 * Z.pos p.
Lemma pos_xI p : Z.pos p~1 = 2 * Z.pos p + 1.
Lemma opp_neg p : - Z.neg p = Z.pos p.
Lemma opp_pos p : - Z.pos p = Z.neg p.
Lemma add_neg_neg p q : Z.neg p + Z.neg q = Z.neg (p+q).
Lemma add_pos_neg p q : Z.pos p + Z.neg q = Z.pos_sub p q.
Lemma add_neg_pos p q : Z.neg p + Z.pos q = Z.pos_sub q p.
Lemma add_pos_pos p q : Z.pos p + Z.pos q = Z.pos (p+q).
Lemma divide_pos_neg_r n p : (n|Z.pos p) <-> (n|Z.neg p).
Lemma divide_pos_neg_l n p : (Z.pos p|n) <-> (Z.neg p|n).
Lemma testbit_neg a n : 0<=n -> Z.testbit (Z.neg a) n = negb (N.testbit (Pos.pred_N a) (Z.to_N n)).
Lemma testbit_pos a n : 0<=n -> Z.testbit (Z.pos a) n = N.testbit (N.pos a) (Z.to_N n).
Lemma id x : 0 < x -> Z.pos (Z.to_pos x) = x.
Lemma inj x y : 0 < x -> 0 < y -> Z.to_pos x = Z.to_pos y -> x = y.
Lemma inj_iff x y : 0 < x -> 0 < y -> (Z.to_pos x = Z.to_pos y <-> x = y).
Lemma to_pos_nonpos x : x <= 0 -> Z.to_pos x = 1%positive.
Lemma inj_1 : Z.to_pos 1 = 1%positive.
Lemma inj_double x : 0 < x -> Z.to_pos (Z.double x) = (Z.to_pos x)~0%positive.
Lemma inj_succ_double x : 0 < x -> Z.to_pos (Z.succ_double x) = (Z.to_pos x)~1%positive.
Lemma inj_succ x : 0 < x -> Z.to_pos (Z.succ x) = Pos.succ (Z.to_pos x).
Lemma inj_add x y : 0 < x -> 0 < y -> Z.to_pos (x+y) = (Z.to_pos x + Z.to_pos y)%positive.
Lemma inj_sub x y : 0 < x < y -> Z.to_pos (y-x) = (Z.to_pos y - Z.to_pos x)%positive.
Lemma inj_pred x : 1 < x -> Z.to_pos (Z.pred x) = Pos.pred (Z.to_pos x).
Lemma inj_mul x y : 0 < x -> 0 < y -> Z.to_pos (x*y) = (Z.to_pos x * Z.to_pos y)%positive.
Lemma inj_pow x y : 0 < x -> 0 < y -> Z.to_pos (x^y) = (Z.to_pos x ^ Z.to_pos y)%positive.
Lemma inj_pow_pos x p : 0 < x -> Z.to_pos (Z.pow_pos x p) = ((Z.to_pos x)^p)%positive.
Lemma inj_compare x y : 0 < x -> 0 < y -> (x ?= y) = (Z.to_pos x ?= Z.to_pos y)%positive.
Lemma inj_leb x y : 0 < x -> 0 < y -> (x <=? y) = (Z.to_pos x <=? Z.to_pos y)%positive.
Lemma inj_ltb x y : 0 < x -> 0 < y -> (x <? y) = (Z.to_pos x <? Z.to_pos y)%positive.
Lemma inj_eqb x y : 0 < x -> 0 < y -> (x =? y) = (Z.to_pos x =? Z.to_pos y)%positive.
Lemma inj_max x y : Z.to_pos (Z.max x y) = Pos.max (Z.to_pos x) (Z.to_pos y).
Lemma inj_min x y : Z.to_pos (Z.min x y) = Pos.min (Z.to_pos x) (Z.to_pos y).
Lemma inj_sqrt x : Z.to_pos (Z.sqrt x) = Pos.sqrt (Z.to_pos x).
Lemma inj_gcd x y : 0 < x -> 0 < y -> Z.to_pos (Z.gcd x y) = Pos.gcd (Z.to_pos x) (Z.to_pos y).