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 safety_bupd : forall state n Gamma, (exists state', state_step state state' /\
(state_invariant Jspec' Gamma n state' \/ state_invariant Jspec' Gamma (S n) state')) ->
exists state',
state_step(ge := globalenv prog) state state' /\
(state_bupd (state_invariant Jspec' Gamma n) state' \/
state_bupd (state_invariant Jspec' Gamma (S n)) state').