Variant splitl x1 x : seq T -> Type :=
Splitl p1 p2 of last x1 p1 = x : splitl x1 x (p1 ++ p2).

(* Specifications: *)
Lemma splitPl x1 p x : x \in x1 :: p -> splitl x1 x p.
Variant splitr x : seq T -> Type :=
Splitr p1 p2 : splitr x (p1 ++ x :: p2).
Lemma splitPr p x : x \in p -> splitr x p.
Lemma prev_nth p x :
prev p x = if x \in p then
if p is y :: p' then nth y p (index x p') else x
else x.
Lemma mem_next p x : (next p x \in p) = (x \in p).
Lemma mem_prev p x : (prev p x \in p) = (x \in p).
Definition ucycleb p := cycle e p && uniq p.