(** * Binary interpretation of bitstrings *)
Fixpoint bs2nat (v:bs) : nat :=
match v with
| nil => 0
| false :: v' => 2 * bs2nat v'
| true  :: v' => S (2 * bs2nat v')
end.
Fixpoint succ_bs (v : bs) : bs :=
match v with
| nil => [true]
| false :: v' => true :: v'
| true :: v' => false :: succ_bs v'
end.

Lemma succ_bs_correct v : bs2nat (succ_bs v) = bs2nat v + 1.
Fixpoint nat2bs (n:nat) : bs :=
match n with
| 0 => nil
| S n' => succ_bs (nat2bs n')
end.