(** ** Properties of integer zero extension and sign extension. *)

(* Specifications: *)
Lemma Ziter_base:
forall (A: Type) n (f: A -> A) x, n <= 0 -> Z.iter n f x = x.
Lemma Ziter_succ:
forall (A: Type) n (f: A -> A) x,
0 <= n -> Z.iter (Z.succ n) f x = f (Z.iter n f x).
Lemma Znatlike_ind:
forall (P: Z -> Prop),
(forall n, n <= 0 -> P n) ->
(forall n, 0 <= n -> P n -> P (Z.succ n)) ->
forall n, P n.
Lemma Zzero_ext_spec:
forall n x i, 0 <= i ->
Z.testbit (Zzero_ext n x) i = if zlt i n then Z.testbit x i else false.
Lemma bits_zero_ext:
forall n x i, 0 <= i ->
testbit (zero_ext n x) i = if zlt i n then testbit x i else false.
Lemma Zsign_ext_spec:
forall n x i, 0 <= i -> 0 < n ->
Z.testbit (Zsign_ext n x) i = Z.testbit x (if zlt i n then i else n - 1).
Lemma bits_sign_ext:
forall n x i, 0 <= i < zwordsize -> 0 < n ->
testbit (sign_ext n x) i = testbit x (if zlt i n then i else n - 1).