Fixpoint path x (p : seq T) :=
  if p is y :: p' then e x y && path y p' else true.

(* Specifications: *)
Lemma cat_path x p1 p2 : path x (p1 ++ p2) = path x p1 && path (last x p1) p2.
Lemma rcons_path x p y : path x (rcons p y) = path x p && e (last x p) y.
Lemma pathP x p x0 : reflect (forall i, i < size p -> e (nth x0 (x :: p) i) (nth x0 p i)) (path x p).