(* --- 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.

(* Specifications: *)
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.
Lemma fin_of_lt_irrel:
forall {m n : nat} (H1 H2 : Nat.lt n m), Fin.of_nat_lt H1 = Fin.of_nat_lt H2.
Lemma nth_error_OK:
forall {A : Type} {m : nat} (v : Vector.t A m) (n : nat) (a : A) (H : nth_error_opt v n = Some a),
nth_order v (nth_error_opt_some v n a H) = a.