Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
Section closed_safety.
Variable (G C D Z M : Type).
Variable sem : CoreSemantics G C M.
Variable ge : G.
Fixpoint safeN (n : nat) (c : C) (m : M) : Prop :=
match n with
| O => True
| S n' =>
match halted sem c with
| None =>
exists c', exists m',
corestep sem ge c m c' m' /\
safeN n' c' m'
| Some i => True
end
end.

Lemma safe_corestepN_backward c m c' m' n n0 :
corestepN sem ge n0 c m c' m' ->
safeN (n - n0) c' m' ->
safeN n c m.