Inductive ForallV  : forall n, vector n -> Prop :=
    | ForallV_nil : ForallV Vnil
    | ForallV_cons : forall n e es, P e -> @ForallV n es -> ForallV (Vcons e es).Inductive ForallV  : forall n, vector n -> Prop :=
    | ForallV_nil : ForallV Vnil
    | ForallV_cons : forall n e es, P e -> @ForallV n es -> ForallV (Vcons e es).Inductive ForallV  : forall n, vector n -> Prop :=
    | ForallV_nil : ForallV Vnil
    | ForallV_cons : forall n e es, P e -> @ForallV n es -> ForallV (Vcons e es).Definition ForallV_vector_hd n (v : vector (S n)) (f : ForallV v) : P (vector_hd v) :=
      match f in @ForallV n v return match n as n return vector n -> Prop with
                                       | 0 => fun _ => True
                                       | S _ => fun v => P (vector_hd v)
                                     end v
      with
        | ForallV_nil => I
        | ForallV_cons _ _ _ pf _ => pf
      end.Definition ForallV_vector_tl n (v : vector (S n)) (f : ForallV v) : ForallV (vector_tl v) :=
      match f in @ForallV n v return match n as n return vector n -> Prop with
                                       | 0 => fun _ => True
                                       | S _ => fun v => ForallV (vector_tl v)
                                     end v
      with
        | ForallV_nil => I
        | ForallV_cons _ _ _ _ pf => pf
      end.Fixpoint vector_dec {n} (a : vector n)
      : forall b : vector n, {a = b} + {a <> b} :=
      match a in vector n
            return forall b : vector n, {a = b} + {a <> b}
      with
      | Vnil => fun b => left match b in vector 0 with
                                | Vnil => eq_refl
                                end
      | Vcons _ a a' => fun b =>
        match b as b in vector (S n)
              return forall a',
                (forall a : vector n, {a' = a} + {a' <> a}) ->
                {Vcons a a' = b} + {Vcons a a' <> b}
        with
        | Vcons _ b b' => fun a' rec =>
                            match Tdec a b , rec b' with
                            | left pf , left pf' =>
                              left match pf , pf' with
                                   | eq_refl , eq_refl => eq_refl
                                   end
                            | right pf , _ =>
                              right (fun x : Vcons a a' = Vcons b b' =>
                                       pf match x in _ = z
                                                return a = vector_hd z
                                          with
                                          | eq_refl => eq_refl
                                          end)
                            | left _ , right pf =>
                              right (fun x : Vcons a a' = Vcons b b' =>
                                       pf match x in _ = z
                                                return a' = vector_tl z
                                          with
                                          | eq_refl => eq_refl
                                          end)
                            end
        end a' (@vector_dec _ a')
      end.Inductive vector_In : forall {n}, vector n -> Prop :=
    | vHere : forall n rst, @vector_In (S n) (Vcons a rst)
    | vNext : forall n rst b, @vector_In n rst ->
                              @vector_In (S n) (Vcons b rst).Inductive vector_In : forall {n}, vector n -> Prop :=
    | vHere : forall n rst, @vector_In (S n) (Vcons a rst)
    | vNext : forall n rst b, @vector_In n rst ->
                              @vector_In (S n) (Vcons b rst).Inductive vector_In : forall {n}, vector n -> Prop :=
    | vHere : forall n rst, @vector_In (S n) (Vcons a rst)
    | vNext : forall n rst b, @vector_In n rst ->
                              @vector_In (S n) (Vcons b rst).

Lemma ForallV_vector_In : forall {n} t (vs : vector n) P, ForallV P vs -> vector_In t vs -> P t.