As an example in the VST project, the reverse.c file has a linked list like this:
struct list {unsigned head; struct list *tail;};
unsigned sumlist (struct list *p) {
unsigned s = 0;
struct list *t = p;
unsigned h;
while (t) {
h = t->head;
t = t->tail;
s = s + h;
}
return s;
}
and it's separation logic is wrote as:
SEP (lseg LS sh (map Vint contents) p nullval)
in which the LS is defined as:
Instance LS: listspec _list _tail (fun _ _ => emp).
Proof. eapply mk_listspec; reflexivity. Defined.
My question is if I have a double linked list, how to write its corresponding separation logic. for example: the double linked list like this:
struct list {unsigned head; struct list *prev;struct list *tail;};
so, what should be the "SEP (lseg LS?? sh (map Vint contents) p nullval)
"?