Definition isVAL (r : resource) :=
  match r with
  | YES _ _ (VAL _) _ => Logic.True
  | _ => False
  end.

(* Specifications: *)
Lemma isVAL_join_sub r1 r2 : join_sub r1 r2 -> isVAL r1 -> isVAL r2.
Lemma restrPermMap_Max' m p Hlt loc : access_at (@restrPermMap p m Hlt) loc Max = access_at m loc Max.
Lemma join_pures_same phi1 phi2 phi3 : join phi1 phi2 phi3 -> pures_same phi1 phi2 /\ pures_same phi2 phi3 /\ pures_same phi1 phi3.
Lemma pures_same_trans phi1 phi2 phi3 : pures_same phi1 phi2 -> pures_same phi2 phi3 -> pures_same phi1 phi3.
Lemma pures_same_necR phi1 phi2 phi1' : level phi1 = level phi2 -> pures_same phi1 phi2 -> necR phi1 phi1' -> exists phi2', level phi1' = level phi2' /\ pures_same phi1' phi2' /\ necR phi2 phi2'.
Lemma pures_same_matchfunspecs e Gamma phi1 phi2 : level phi1 = level phi2 -> pures_same phi1 phi2 -> matchfunspecs e Gamma phi1 -> matchfunspecs e Gamma phi2.
Lemma matchfunspecs_common_join e Gamma phi phi' psi Phi Phi' : join phi psi Phi -> join phi' psi Phi' -> matchfunspecs e Gamma Phi -> matchfunspecs e Gamma Phi'.
Lemma perm_of_res'_resource_fmap r f g : perm_of_res' (resource_fmap f g r) = perm_of_res' r.
Lemma approx_approx n x : approx n (approx n x) = approx n x.
Lemma approx'_approx n n' x : (n' <= n)%nat -> approx n (approx n' x) = approx n' x.
Lemma approx_approx' n n' x : (n' <= n)%nat -> approx n' (approx n x) = approx n' x.
Lemma shape_of_args F V args b ofs ge : Val.has_type_list args (AST.Tint :: nil) -> Vptr b ofs = mpred.eval_id _lock (make_ext_args (filter_genv (symb2genv (@genv_symb_injective F V ge))) (_lock :: nil) args) -> args = Vptr b ofs :: nil.
Lemma join_all_res : forall ge i (tp : jstate ge) (cnti : containsThread tp i) c Phi, join_all (updThread cnti (Krun c) (getThreadR cnti)) Phi <-> join_all tp Phi.