Module Zabs2Nat.
(** Results about [Z.abs_nat], converting absolute values of [Z] integers to [nat]. *)

(* Specifications: *)
Lemma abs_nat_spec n : Z.abs_nat n = Z.to_nat (Z.abs n).
Lemma abs_nat_nonneg n : 0<=n -> Z.abs_nat n = Z.to_nat n.
Lemma id_abs n : Z.of_nat (Z.abs_nat n) = Z.abs n.
Lemma id n : Z.abs_nat (Z.of_nat n) = n.
(** [Z.abs_nat], basic equations *)
Lemma inj_0 : Z.abs_nat 0 = 0%nat.
Lemma inj_pos p : Z.abs_nat (Zpos p) = Pos.to_nat p.
Lemma inj_neg p : Z.abs_nat (Zneg p) = Pos.to_nat p.
(** [Z.abs_nat] and usual operations, with non-negative integers *)
Lemma inj_succ n : 0<=n -> Z.abs_nat (Z.succ n) = S (Z.abs_nat n).
Lemma inj_add n m : 0<=n -> 0<=m ->
Z.abs_nat (n+m) = (Z.abs_nat n + Z.abs_nat m)%nat.
Lemma inj_mul n m : Z.abs_nat (n*m) = (Z.abs_nat n * Z.abs_nat m)%nat.
Lemma inj_sub n m : 0<=m<=n ->
Z.abs_nat (n-m) = (Z.abs_nat n - Z.abs_nat m)%nat.
Lemma inj_pred n : 0<n -> Z.abs_nat (Z.pred n) = Nat.pred (Z.abs_nat n).
Lemma inj_compare n m : 0<=n -> 0<=m ->
(Z.abs_nat n ?= Z.abs_nat m)%nat = (n ?= m).
Lemma inj_le n m : 0<=n -> 0<=m -> (n<=m <-> (Z.abs_nat n <= Z.abs_nat m)%nat).
Lemma inj_lt n m : 0<=n -> 0<=m -> (n<m <-> (Z.abs_nat n < Z.abs_nat m)%nat).
Lemma inj_min n m : 0<=n -> 0<=m ->
Z.abs_nat (Z.min n m) = Nat.min (Z.abs_nat n) (Z.abs_nat m).
Lemma inj_max n m : 0<=n -> 0<=m ->
Z.abs_nat (Z.max n m) = Nat.max (Z.abs_nat n) (Z.abs_nat m).