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_case xs p q h :
h \In lseg p q xs ->
[/\ p = q, xs = [::] & h = empty] \/
exists x, exists r, exists h',
[/\ xs = x :: behead xs, h = p :-> x :+ (p .+ 1 :-> r :+ h') &
h' \In lseg r q (behead xs)].