Instance CompSpecs : compspecs.Definition Vprog : varspecs.Definition release2_spec := DECLARE _release2 release2_spec.Definition freelock2_spec := DECLARE _freelock2 (freelock2_spec _).Definition spawn_spec := DECLARE _spawn spawn_spec.(* One might think it should just return an unknown number, but in fact it needs to follow a known hash
   function at the logic level to be useful. *)

Definition tentry := Tstruct _entry noattr.Instance hf1 : hash_fun := { size := 16384; hash i := (i * 654435761) mod 16384 }.Definition v_R (h : list hist_el) (v : Z) := emp.(* Entries are no longer consecutive. *)
Definition wf_hists h := Forall (fun x => (ordered_hist (fst x) /\ Forall int_op (map snd (fst x))) /\
  (ordered_hist (snd x) /\ Forall int_op (map snd (snd x)))) h.Definition make_map h :=
  map (fun hs => (make_int (value_of_hist (fst hs)), make_int (value_of_hist (snd hs)))) h.Definition atomic_entry sh pk pv gk gv hk hv :=
  atomic_loc_hist sh pk gk 0 k_R hk * atomic_loc_hist sh pv gv 0 v_R hv.Definition atomic_entries sh entries ghosts hists := fold_right sepcon emp
  (map (fun x => let '((pk, pv), (gk, gv), (hk, hv)) := x in atomic_entry sh pk pv gk gv hk hv)
    (combine (combine entries ghosts) hists)).Definition f_lock_pred tsh sh entries ghosts p t locksp lockt resultsp res :=
  selflock (f_lock_inv sh entries ghosts p t locksp lockt resultsp res) tsh lockt.

(* Specifications: *)
Lemma body_integer_hash: semax_body Vprog Gprog f_integer_hash integer_hash_spec.
Lemma update_entries_hist : forall sh entries ghosts h i hk hv pki pvi gki gvi (Hlen : Zlength entries = Zlength h) (Hleng : Zlength ghosts = Zlength entries) (Hpi : Znth i entries (Vundef, Vundef) = (pki, pvi)) (Hgi : Znth i ghosts (Vundef, Vundef) = (gki, gvi)) (Hi : 0 <= i < Zlength entries), atomic_entries sh entries ghosts (upd_Znth i h (hk, hv)) = fold_right sepcon emp (upd_Znth i (map (fun x => let '((pk, pv), (gk, gv), (hk, hv)) := x in atomic_loc_hist sh pk gk 0 k_R hk * atomic_loc_hist sh pv gv 0 v_R hv) (combine (combine entries ghosts) h)) (atomic_loc_hist sh pki gki 0 k_R hk * atomic_loc_hist sh pvi gvi 0 v_R hv)).
Lemma k_R_precise : forall v, precise (EX h : _, k_R h v).
Lemma v_R_precise : forall v, precise (EX h : _, v_R h v).
Lemma body_set_item : semax_body Vprog Gprog f_set_item set_item_spec.
Lemma body_get_item : semax_body Vprog Gprog f_get_item get_item_spec.
Lemma body_add_item : semax_body Vprog Gprog f_add_item add_item_spec.
Lemma Zlength_empty : Zlength empty_hists = size.
Lemma body_init_table : semax_body Vprog Gprog f_init_table init_table_spec.
Lemma body_freeze_table : semax_body Vprog Gprog f_freeze_table freeze_table_spec.
Lemma lock_struct_array : forall sh z (v : list val) p, data_at sh (tarray (tptr (Tstruct _lock_t noattr)) z) v p = data_at sh (tarray (tptr tlock) z) v p.
Lemma add_item_trace_wf : forall h k v i s h' (Hwf : wf_hists h) (Htrace : add_item_trace h k v i s h'), wf_hists h'.