Library hmAlloc_example_old
Load seplog_header.
Require Import topsy_hm_old.
Require Import topsy_hmAlloc_old.
Definition hmAlloc_example (result entry cptr fnd stts nptr sz:var.v) (v: Z):=
(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 (result entry cptr fnd stts nptr sz:var.v) (v: Z) x e startl,
startl > 0 ->
var.set (hmStart::result::entry::cptr::fnd::stts::nptr::sz::nil) ->
{{ ((nat_e x) |-> (int_e e)) **
(fun s => fun h => exists l,
eval (var_e hmStart) s = eval (nat_e startl) s /\
Heap_List l startl 0 s h /\ (In (x,1,Allocated) l)) }}
hmAlloc_example result entry cptr fnd stts nptr sz v
{{ fun s => fun h =>
eval (var_e result) s <> eval (nat_e 0) s ->
(((nat_e x) |-> (int_e e)) **
(fun s => fun h => exists l,
Heap_List l startl 0 s h /\ (In (x,1,Allocated) l)) ** (((var_e result) |-> (int_e v))) ** TT) s h}}.
Lemma hmAlloc_example_verif : hmAlloc_example_specif.