Section LList.
Variable T : Type.
Notation llist := (llist T).
Fixpoint lseg (p q : ptr) (xs : seq T) {struct xs} :=
if xs is x::xt then
[Pred h | exists r, exists h',
h = p :-> x :+ (p .+ 1 :-> r :+ h') /\ h' \In lseg r q xt]
else [Pred h | p = q /\ h = empty].

Lemma lseg_neq xs p q h :
p != q -> h \In lseg p q xs ->
exists x, exists r, exists h',
[/\ xs = x :: behead xs,
p :-> x :+ (p .+ 1 :-> r :+ h') = h & h' \In lseg r q (behead xs)].