(* Copyright 2012-2015 by Adam Petcher.				* * Use of this source code is governed by the license described	* * in the LICENSE file at the root of the source tree.		*)
(* This file contains the definition of the base 2 logarithm function (rounded down) over natural numbers. *)
(* Some of the definitions and theory in this file were added to Coq 8.4, so we should refactor this at some point. *)
Set Implicit Arguments.
(* log2 is like log_inf except it returns nat, so I don't have to reason about an unnecessary conversion. This function is only used to implement lognat below.*)
Fixpoint log2(n : positive) : nat :=
match n with
| xH => 0
| xO n' | xI n' => (S (log2 n'))
end.
intros. auto.
Qed.
intros. omega.
Qed.
induction a;
simpl in *; try apply le_s; auto.
Qed.
induction a;
simpl in *; try apply le_s; auto.
Qed.
Definition nat_to_pos (n : nat) : (n <> 0) -> positive :=
fun _ => (P_of_succ_nat (pred n)).
intros. omega.
Qed.
intros. omega.
Qed.
intros.
destruct a.
congruence.
unfold nat_to_pos in *.
simpl in *.
intros. auto.
Qed.
intros. omega.
Qed.

Lemma factor_double_s : forall a,
(2 * (S a)) = (S (S (2 * a))).