(* --- BEGIN Talia's equivalent definition of nth to reuse later --- *)
Fixpoint nth_error_opt {A : Type} {m : nat} (v : Vector.t A m) (n : nat) : option A :=
match n with
| O =>
match v with
| Vector.nil _ => None
| Vector.cons _ h _ _ => Some h
end
| S p =>
match v with
| Vector.nil _ => None
| Vector.cons _ _ n1 t0 => nth_error_opt t0 p
end
end.

Lemma nth_error_opt_some:
forall {A : Type} {m : nat} (v : Vector.t A m) (n : nat) (a : A),
nth_error_opt v n = Some a -> Nat.lt n m.