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_add_last xs x p r h :
h \In lseg p r (rcons xs x) <->
exists q, exists h',
h = h' :+ (q :-> x :+ q .+ 1 :-> r) /\ h' \In lseg p q xs.