(** Size of integers, in bits. *)
Definition Zsize (x: Z) : Z :=
match x with
| Zpos p => Zpos (Pos.size p)
| _ => 0
end.
Definition size (x: int) : Z := Zsize (unsigned x).
Remark Zsize_pos: forall x, 0 <= Zsize x.
Remark Zsize_pos': forall x, 0 < x -> 0 < Zsize x.

Theorem bits_size_3:
forall x n,
0 <= n ->
(forall i, n <= i < zwordsize -> testbit x i = false) ->
size x <= n.