Fixpoint nat_log_inf (p : positive) : nat :=
  match p with
  | xH => 0 (* 1 *)
  | xO q => S (nat_log_inf q) (* 2n *)
  | xI q => S (nat_log_inf q) (* 2n+1 *)
  end.Fixpoint nat_log_sup (p : positive) : nat :=
  match p with
  | xH => 0 (* 1 *)
  | xO n => S (nat_log_sup n) (* 2n *)
  | xI n => S (S (nat_log_inf n)) (* 2n+1 *)
  end.

Lemma log_inf_log_inf : forall p : positive, Z_of_nat (nat_log_inf p) = log_inf p.