Definition assert := env -> pred rmap.
Bind Scope pred with assert.
(****** PROGRAM SAFETY AS A SEPARATION-LOGIC PREDICATE *)
Program Definition cohere (concrete: heap) : pred rmap :=
fun w =>
forall p v, heap_get (concrete) p = Some v  <->
w @ p = YES pfullshare (VAL v) NoneP.
Next Obligation.
unfold hereditary; intros.
rewrite H0.
apply age1_YES; auto.
Qed.
Program Definition assert_safe
(p: program) (vars: varset) (ctl: control) : assert :=
fun s w => forall s' h, varcompat vars s' ->
locals2env s' = s -> cohere h w -> safeN p (s',h,ctl) (level w).
Next Obligation.
unfold hereditary; intros.
eapply safeN_less; [ | apply H0]; auto. subst.
apply age_level in H.   rewrite H. change R.rmap with rmap. omega.
clear - H H3. hnf in H3|-*. intros. rewrite H3.
generalize (age1_YES _ _ p pfullshare (VAL v) H); intros.
intuition.
Qed.

(* Specifications: *)
Lemma assert_safe0:
forall p vars k s w,
(forall w', age w w' -> app_pred (assert_safe p vars k s) w) ->
app_pred (assert_safe p vars k s) w.