(*
Lemma FUNspec_parametric: forall fml cc A P Q,
   spec_parametric (fun l sh => yesat (SomeP (SpecTT A) (packPQ P Q)) (FUN fml cc) sh).
Proof.
intros.
exists (SomeP (SpecTT A) (packPQ P Q)).
exists (fun k => k=FUN fml cc).
intros.
simpl.
apply exists_ext; intro p.
unfold yesat_raw.
apply prop_ext; split; intros.
econstructor; eauto.
destruct H as [k [? ?]].
subst; auto.
Qed.
*)
Definition val2address (v: val) : option AV.address := 
  match v with Vptr b ofs => Some (b, Ptrofs.signed ofs) | _ => None end.

(* Specifications: *)
Lemma VALspec_readable: forall l sh w, (VALspec sh l * TT) %pred w -> readable l w.
Lemma VALspec1: VALspec_range 1 = VALspec.
Lemma level_later {A} `{H : ageable A}: forall {w: A} {n': nat}, laterR (level w) n' -> exists w', laterR w w' /\ n' = level w'.
Lemma VALspec_range_bytes_readable: forall n sh loc m, VALspec_range n sh loc m -> bytes_readable loc n m.
Lemma VALspec_range_bytes_writable: forall n sh loc m, writable_share sh -> VALspec_range n sh loc m -> bytes_writable loc n m.
Lemma yesat_join_sub: forall pp k l sh m m', join_sub m m' -> yesat pp k sh l m -> exists sh', yesat pp k sh' l m'.
Lemma VALspec_range_precise: forall n sh l, precise (VALspec_range n sh l).
Lemma nonlock_permission_bytes_precise: forall sh p n, precise (nonlock_permission_bytes sh p n).
Lemma address_mapsto_precise: forall ch v sh l, precise (address_mapsto ch v sh l).
Lemma LKspec_precise lock_size: forall R sh l, precise (LKspec lock_size R sh l).
Lemma VALspec_range_0: forall sh loc, VALspec_range 0 sh loc = emp.
Lemma nonlock_permission_bytes_0: forall sh a, nonlock_permission_bytes sh a 0 = emp.
Lemma is_resource_pred_YES_VAL sh: is_resource_pred (fun l' => EX v: memval, yesat NoneP (VAL v) sh l') (fun r _ n => (exists b0 rsh, r = YES sh rsh (VAL b0) (SomeP (ConstType unit) (fun _ => tt)))).
Lemma is_resource_pred_YES_VAL' sh v: is_resource_pred (fun l' => yesat NoneP (VAL (v l')) sh l') (fun r l n => (exists rsh, r = YES sh rsh (VAL (v l)) (SomeP (ConstType unit) (fun _ => tt)))).
Lemma is_resource_pred_nonlock_shareat sh: is_resource_pred (fun i : address => shareat i sh && nonlockat i) (fun r _ _ => resource_share r = Some sh /\ nonlock r).
Lemma VALspec_range_split2: forall (n m r: Z) (sh: Share.t) (b: block) (ofs: Z), r = n + m -> n >= 0 -> m >= 0 -> VALspec_range r sh (b, ofs) = VALspec_range n sh (b, ofs) * VALspec_range m sh (b, ofs + n).
Lemma nonlock_permission_bytes_split2: forall (n m r: Z) (sh: Share.t) (b: block) (ofs: Z), r = n + m -> n >= 0 -> m >= 0 -> nonlock_permission_bytes sh (b, ofs) r = nonlock_permission_bytes sh (b, ofs) n * nonlock_permission_bytes sh (b, ofs + n) m.
Lemma share_joins_self: forall sh: share, joins sh sh -> nonunit sh -> False.
Lemma address_mapsto_value_cohere': forall ch v1 v2 sh1 sh2 a r (Hmaps1 : address_mapsto ch v1 sh1 a r) (Hmaps2 : address_mapsto ch v2 sh2 a r), v1=v2.