Definition Blist := list bool.Definition Blist_eq_dec := (list_eq_dec bool_dec).Definition Bvector_eq_dec(n : nat)(v1 v2 : Bvector n) : {v1 = v2} + {v1 <> v2}.(* shiftOut gets bits from the head of the list. *)
(* return None when we run out *)
Fixpoint shiftOut(s : Blist)(n : nat) : option (Bvector n * Blist) :=
  match n with
    | 0 => Some ((@Vector.nil bool), s)
    | S n' => 
      match s with
        | nil => None
        | b :: s' => 
          match (shiftOut s' n') with
            | Some (v', s'') => Some (Vector.cons _ b _ v', s'')
            | None => None
          end
      end
  end.

(* Specifications: *)
Theorem shiftOut_app : forall (n : nat)(s1 s1' s2 : Blist) v, shiftOut s1 n = Some (v, s1') -> shiftOut (s1 ++ s2) n = Some (v, s1' ++ s2).
Lemma shiftOut_lt : forall ls n, length ls < n -> shiftOut ls n = None.
Lemma shiftOut_Some : forall (ls : Blist) n, length ls >= n -> exists p, shiftOut ls n = Some p.
Theorem shiftOut_None_inv : forall n ls, shiftOut ls n = None -> n > length ls.
Theorem shiftOut_Some_inv : forall n ls v ls', shiftOut ls n = Some (v, ls') -> (n <= length ls)%nat.
Theorem shiftOut_correct_inv : forall n ls ls' v, shiftOut ls n = Some (v, ls') -> ls = (Vector.to_list v) ++ ls'.
Lemma to_list_length : forall (A : Set)(m : nat)(v : Vector.t A m), length (Vector.to_list v) = m.