Section Log_pos. (* Log of positive integers *)
(** First we build [log_inf] and [log_sup] *)
Fixpoint log_inf (p:positive) : Z :=
match p with
| xH => 0 (* 1 *)
| xO q => Z.succ (log_inf q)       (* 2n *)
| xI q => Z.succ (log_inf q)       (* 2n+1 *)
end.
Fixpoint log_sup (p:positive) : Z :=
match p with
| xH => 0	(* 1 *)
| xO n => Z.succ (log_sup n) (* 2n *)
| xI n => Z.succ (Z.succ (log_inf n))	(* 2n+1 *)
end.
Hint Unfold log_inf log_sup : core.

Lemma Zlog2_up_log_sup : forall p, Z.log2_up (Zpos p) = log_sup p.