Section VALUE_OF_BOOLEAN_VECTORS.
(** Computations are done in the usual convention. The values correspond either to the binary coding (nat) or to the two's complement coding (int). We perform the computation via Horner scheme. The two's complement coding only makes sense on vectors whose size is greater or equal to one (a sign bit should be present). *)
Definition bit_value (b:bool) : Z :=
match b with
| true => 1%Z
| false => 0%Z
end.

Lemma two_compl_value_Sn :
forall (n:nat) (bv:Bvector (S n)) (b:bool),
two_compl_value (S n) (Bcons b (S n) bv) =
(bit_value b + 2 * two_compl_value n bv)%Z.