Section Safety.
Variable CPROOF: CSL_proof.
Definition CS :=   CPROOF.(CSL_CS).
Definition V :=   CPROOF.(CSL_V).
Definition G :=   CPROOF.(CSL_G).
Definition ext_link :=   CPROOF.(CSL_ext_link).
Definition ext_link_inj :=   CPROOF.(CSL_ext_link_inj).
Definition prog :=   CPROOF.(CSL_prog).
Definition all_safe :=   CPROOF.(CSL_all_safe).
Definition init_mem_not_none :=   CPROOF.(CSL_init_mem_not_none).
Definition Jspec' := (@OK_spec (Concurrent_Espec unit CS ext_link)).
(* another, looser invariant to have more standard preservation statement *)
Definition inv Gamma n state :=
exists m, (n <= m)%nat /\ state_invariant(ge := globalenv prog) Jspec' Gamma m state.

Lemma num_tp_update : forall tp tp' phi phi', tp_update(ge := globalenv prog) tp phi tp' phi' ->
num_threads tp' = num_threads tp.