Definition lock_inv : share -> val -> mpred -> mpred :=
fun sh v R =>
(EX b : block, EX ofs : _,
!!(v = Vptr b ofs) &&
LKspec LKSIZE
R sh (b, Ptrofs.unsigned ofs))%logic.
Definition rec_inv sh v (Q R: mpred): Prop :=
(R = Q * |>lock_inv sh v R)%logic.
Definition weak_rec_inv sh v (Q R: mpred): mpred :=
(! (R <=> Q * |>lock_inv sh v R))%pred.

(* Specifications: *)
Lemma lockinv_isptr sh v R : lock_inv sh v R = (!! isptr v && lock_inv sh v R)%logic.
Lemma unfash_fash_equiv: forall P Q: mpred,
(P <=> Q |--
(subtypes.unfash (subtypes.fash P): mpred) <=> (subtypes.unfash (subtypes.fash Q): mpred))%pred.
Lemma iffp_equiv: forall P1 Q1 P2 Q2: mpred,
((P1 <=> Q1) && (P2 <=> Q2) |-- (P1 <--> P2) <=> (Q1 <--> Q2))%pred.
Lemma sepcon_equiv: forall P1 Q1 P2 Q2: mpred,
((P1 <=> Q1) && (P2 <=> Q2) |-- (P1 * P2) <=> (Q1 * Q2))%pred.
Lemma later_equiv: forall P Q: mpred,
(P <=> Q |-- |> P <=> |> Q)%pred.
Lemma nonexpansive_lock_inv : forall sh p, nonexpansive (lock_inv sh p).
Lemma rec_inv1_nonexpansive: forall sh v Q,
nonexpansive (weak_rec_inv sh v Q).
Lemma rec_inv2_nonexpansive: forall sh v R,
nonexpansive (fun Q => weak_rec_inv sh v Q R).
Lemma exclusive_weak_exclusive: forall R,
exclusive_mpred R ->
TT |-- weak_exclusive_mpred R.
Lemma rec_inv_weak_rec_inv: forall sh v Q R,
rec_inv sh v Q R ->
TT |-- weak_rec_inv sh v Q R.