(* NOT TRUE, because the shares might not match Lemma extensionally_yesat: forall pp k sh l, extensionally (yesat pp k sh l) = yesat pp k sh l. *)
Program Definition noat (l: AV.address) : pred rmap :=
fun m => identity (m @ l).
Next Obligation.
intros; intro; intros.
apply (age1_resource_at_identity _ _ l H); auto.
Qed.
Definition resource_share (r: resource) : option share :=
match r with
| YES sh _ _ _ => Some sh
| NO sh _ => Some sh
| PURE _ _ => None
end.
Definition nonlock (r: resource) : Prop :=
match r with
| YES _ _ k _ => isVAL k \/ isFUN k
| NO _ _ => True
| PURE _ _ => False
end.

(* Specifications: *)
Lemma age1_nonlock: forall phi phi' l,
age1 phi = Some phi' -> (nonlock (phi @ l) <-> nonlock (phi' @ l)).
Lemma age1_resource_share: forall phi phi' l,
age1 phi = Some phi' -> (resource_share (phi @ l) = resource_share (phi' @ l)).
Lemma resource_share_join_exists: forall r1 r2 r sh1 sh2,
resource_share r1 = Some sh1 ->
resource_share r2 = Some sh2 ->
join r1 r2 r ->
exists sh, join sh1 sh2 sh /\ resource_share r = Some sh.
Lemma resource_share_join: forall r1 r2 r sh1 sh2 sh,
resource_share r1 = Some sh1 ->
resource_share r2 = Some sh2 ->
join r1 r2 r ->
join sh1 sh2 sh ->
resource_share r = Some sh.
Lemma resource_share_joins: forall r1 r2 sh1 sh2,
resource_share r1 = Some sh1 ->
resource_share r2 = Some sh2 ->
joins r1 r2 ->
joins sh1 sh2.
Lemma nonlock_join: forall r1 r2 r,
nonlock r1 ->
nonlock r2 ->
join r1 r2 r ->
nonlock r.