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.

Lemma ctl_inj_trans:
forall c c' c'' (f f' f'' : memren)
(Hcore_inj: ctl_inj f c c'')
(Hcore_inj': ctl_inj f' c c')
(Hf: forall b b' b'',
f b = Some b'' ->
f' b = Some b' ->
f'' b' = Some b''),
ctl_inj f'' c' c''.