Section ThreadPoolInjections.
Existing Instance dryResources.
Context {asmSem : Semantics}
{tpool : ThreadPool.ThreadPool}
{CI: CoreInj}.
(** Renamings on Thread Pools *)
(*not clear what should happen with vf. Normally it should be in the genv and hence should be mapped to itself, but let's not expose this here, this seems to have changed.*)
Definition ctl_inj f cc cf : Prop :=
match cc, cf with
| Kinit vf arg, Kinit vf' arg' =>
val_obs f vf vf' /\ val_obs f arg arg'
| Krun c, Krun c' => core_inj f c c'
| Kblocked c, Kblocked c' => core_inj f c c'
| Kresume c arg, Kresume c' arg' => core_inj f c c' /\ val_obs f arg arg'
| _, _  => False
end.
(*Again we do not require that the first argument to Kinit is valid as we never map it, although maybe we should, seems to have changed as well..*)
Definition ctl_wd f t : Prop :=
match t with
| Krun c => core_wd f c
| Kblocked c => core_wd f c
| Kresume c v => core_wd f c /\ valid_val f v
| Kinit vf v => valid_val f vf /\ valid_val f v
end.
Definition tp_wd (f: memren) (tp : t) : Prop :=
forall i (cnti: containsThread tp i),
ctl_wd f (getThreadC cnti).

Lemma tp_wd_remLock :
forall (tp : t) (f : memren) (addr : address)
(Htp_wd: tp_wd f tp),
tp_wd f (remLockSet tp addr).