(* log2 *)

Function ceil_log2_S (n: nat) {wf lt n}: nat :=
  match n with
  | 0 => 0
  | S _ => S (ceil_log2_S (div2 n))
  end.

Lemma ceil_log2_S_def n: ceil_log2_S n = match n with | 0 => 0 | S _ => S (ceil_log2_S (div2 n)) end.