Library hmAlloc_example
Load seplog_header.
Require Import topsy_hm.
Require Import topsy_hmAlloc.
Require Import Bool.
Definition hmAlloc_example (result entry cptr fnd stts nptr sz:var.v) (v:val) :=
hmAlloc result 1 entry cptr fnd stts nptr sz;
ifte (var_e result =/= nat_e 0) thendo (
(var_e result *<- int_e v)
) elsedo (
skip
).
Definition hmAlloc_example_specif := forall v x e p, p > 0 ->
{{ (nat_e x |-> int_e e) ** (fun s h => exists l,
(s |b= var_e hmStart == nat_e p) /\
Heap_List l p s h /\ In_hl l (x,1,alloc) p) }}
hmAlloc_example result entry cptr fnd stts nptr sz v
{{ fun s h => s |b= var_e result =/= nat_e 0 ->
((nat_e x |-> int_e e) ** (fun s h => exists l,
Heap_List l p s h /\ In_hl l (x,1,alloc) p) **
(var_e result |-> int_e v) ** TT) s h}}.
Lemma hmAlloc_example_verif : hmAlloc_example_specif.