Section tabulate_vec.
Variable X : Type.
Fixpoint tabulate (n : nat) (f : Fin.t n -> X) {struct n} : Vector.t X n.
End tabulate_vec.
(* Lemma vec_replace_nth X x n (t : Vector.t X n) (i : Fin.t n) : x = Vector.nth (Vector.replace t i x) i.  Lemma vec_replace_nth_nochange X x n (t : Vector.t X n) (i j : Fin.t n) : Fin.to_nat i <> Fin.to_nat j -> Vector.nth t i = Vector.nth (Vector.replace t j x) i. *)
Instance Vector_eq_dec n A: eq_dec A -> eq_dec (Vector.t A n).
(** Tactic for simplifying a hypothesis of the form [In x v] *)
Ltac simpl_vector_inv :=
repeat match goal with
| [ H : [||] = (_ ::: _) |- _ ] => now inv H
| [ H : (_ ::: _) = [||]  |- _ ] => now inv H
| [ H : Fin.F1 = Fin.FS _ |- _] => now inv H
| [ H : Fin.FS _ = Fin.F1 |- _] => now inv H
| [ H : Fin.FS _ = Fin.FS _ |- _] =>
first
[ apply Fin.FS_inj in H as ->
| apply Fin.FS_inj in H as <-
| apply Fin.FS_inj in H
]
end.
Ltac simpl_vector_in :=
repeat
match goal with
| _ => first
[ progress destruct_vector_in
| progress simpl_vector_inv
| progress auto
| congruence
]
| [ H : Vector.In _ (Vector.map _ _) |- _] =>
let x := fresh "x" in
eapply vect_in_map_iff in H as (x&<-&H)
| [ H : Vector.In _ (Vector.map _ _) |- _] =>
let x := fresh "x" in
let H' := fresh H in
eapply vect_in_map_iff in H as (x&H&H')
| [ H : Vector.In _ (tabulate _) |- _ ] =>
let i := fresh "i" in
apply in_tabulate in H as (i&->)
| [ H : Vector.In _ (tabulate _) |- _ ] =>
let i := fresh "i" in
let H := fresh "H" in
apply in_tabulate in H as (i&H)
end.
Ltac vector_not_in :=
let H := fresh "H" in
intros H; simpl_vector_in.
Goal Vector.In (Fin.F1 (n := 10)) [|Fin1; Fin2; Fin3 |] -> False.
Arguments Vector.eqb {_}  _ {_ _}.

Lemma vector_eqb_spec X n eqb:
(forall (x1 x2 : X) , reflect (x1 = x2) (eqb x1 x2))
-> forall x y , reflect (x=y) (Vector.eqb (n:=n) eqb x y).