Instance CompSpecs : compspecs. make_compspecs prog. Defined.
Definition Vprog : varspecs.  mk_varspecs prog. Defined.
Definition sum_Z : list Z -> Z := fold_right Z.add 0.
Definition sumarray_spec :=
DECLARE _sumarray
WITH a: val, sh : share, contents : list Z, size: Z
PRE [ _a OF (tptr tuint), _n OF tint ]
PROP  (readable_share sh; 0 <= size <= Int.max_signed)
LOCAL (temp _a a; temp _n (Vint (Int.repr size)))
SEP   (data_at sh (tarray tuint size) (map Vint (map Int.repr contents)) a)
POST [ tuint ]
PROP () LOCAL(temp ret_temp  (Vint (Int.repr (sum_Z contents))))
SEP (data_at sh (tarray tuint size) (map Vint (map Int.repr contents)) a).
Definition Gprog : funspecs := ltac:(with_library prog [sumarray_spec]).

(* Specifications: *)
Lemma sum_Z_app:
forall a b, sum_Z (a++b) =  sum_Z a + sum_Z b.