Instance CompSpecs : compspecs.Definition Vprog : varspecs.Definition makelock_spec := DECLARE _makelock (makelock_spec _).Definition freelock2_spec := DECLARE _freelock2 (freelock2_spec _).Definition acquire_spec := DECLARE _acquire acquire_spec.Definition release2_spec := DECLARE _release2 release2_spec.Definition spawn_spec := DECLARE _spawn spawn_spec.Definition load_SC_spec := DECLARE _load_SC load_SC_spec.Definition store_SC_spec := DECLARE _store_SC store_SC_spec.Definition CAS_SC_spec := DECLARE _CAS_SC CAS_SC_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.(* Having size as a large known constant tends to make everything slow, so here's a hack. *)
Definition has_size : {x : Z | x = 16384}.Instance hf1 : hash_fun := { size := proj1_sig has_size; hash i := (i * 654435761) mod (proj1_sig has_size) }.(* We don't need histories, but we do need to know that a non-zero key is persistent. *)
Instance zero_PCM : Ghost := { valid a := True;
  Join_G a b c := if eq_dec a 0 then c = b else c = a /\ (b = 0 \/ a = b) }.Instance zero_order : PCM_order (fun a b => a = 0 \/ a = b).Definition wf_table T := forall k i, k <> 0 -> fst (Znth i T) = k -> lookup T k = Some i.Inductive hashtable_hist_el :=
  | HSet (k : Z) (v : Z) | HGet (k : Z) (v : Z) | HAdd (k : Z) (v : Z) (r : bool).Inductive hashtable_hist_el :=
  | HSet (k : Z) (v : Z) | HGet (k : Z) (v : Z) | HAdd (k : Z) (v : Z) (r : bool).Inductive hashtable_hist_el :=
  | HSet (k : Z) (v : Z) | HGet (k : Z) (v : Z) | HAdd (k : Z) (v : Z) (r : bool).Inductive hashtable_hist_el :=
  | HSet (k : Z) (v : Z) | HGet (k : Z) (v : Z) | HAdd (k : Z) (v : Z) (r : bool).Notation hist := (nat -> option hashtable_hist_el).Definition f_lock_pred tsh sh gsh entries gh p t locksp lockt resultsp res :=
  selflock (f_lock_inv sh gsh entries gh p t locksp lockt resultsp res) tsh lockt.

Lemma wf_table_upd : forall T k v i (Hwf : wf_table T) (HT : Zlength T = size) (Hi : lookup T k = Some i) (Hk : k <> 0), wf_table (upd_Znth i T (k, v)).