proposition: Lemma log2_pr n m: 2 ^ m <= n < 2^m.+1 -> log2 n = m.+1.
proof: Proof. case: n; first by rewrite leqn0 expn_eq0 => /andP [/andP []]. move => n; move:(log2_bnd n) => /andP [ea eb] /andP[ec ed]. apply /eqP; move: (leq_ltn_trans ec eb) (leq_ltn_trans ea ed). by rewrite {1 3}(log2S_k n) eqn_leq ltn_exp2l // ltn_exp2l //; move => -> ->. Qed.
imports: mathcomp(ssreflect ssrfun ssrbool eqtype ssrnat) mathcomp(seq choice fintype order bigop ssralg) mathcomp(div ssrnum ssrint rat prime path binomial) mathcomp(tuple finset) gaia(fibm)