(** Starting from a well-defined state, an internal execution retains the well-definedeness for any injection that corresponds to the domain of the new memory. *)

(* Specifications: *)
Lemma internal_step_wd:
forall tp m tp' m' i (cnti: containsThread tp i) f fg
(Hcomp: mem_compatible tp m)
(Hmem_wd: valid_mem m)
(Hdomain: domain_memren f m)
(Htp_wd: tp_wd f tp)
(Hge_wd: ge_wd fg the_ge)
(Hfg_incr: ren_domain_incr fg f)
(Hstep: internal_step cnti Hcomp tp' m'),
valid_mem m' /\
(exists f' : memren, ren_domain_incr f f' /\ domain_memren f' m') /\
(forall f' : memren, domain_memren f' m' -> tp_wd f' tp').
Lemma internal_execution_wd:
forall tp m tp' m' i xs f fg
(Hdomain: domain_memren f m)
(Hmem_wd: valid_mem m)
(Htp_wd: tp_wd f tp)
(Hge_wd: ge_wd fg the_ge)
(Hge_incr: ren_domain_incr fg f)
(Hexec: internal_execution [seq x <- xs | x == i] tp m tp' m'),
valid_mem m' /\
(exists f' : memren, ren_domain_incr f f' /\ domain_memren f' m') /\
(forall f' : memren, domain_memren f' m' -> tp_wd f' tp').
Lemma suspend_tp_wd:
forall m tpc tpc' (f : memren) i (pfc : containsThread tpc i)
(Hsuspend: suspend_thread m pfc tpc')
(Htp_wd: tp_wd f tpc),
tp_wd f tpc'.