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

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.