Section extensions.
Context {CS: compspecs} {Espec : OracleKind}.
Ltac inv_safe H :=
inv H;
try solve[match goal with
| H : semantics.at_external _ _ _ = _ |- _ =>
simpl in H; congruence
| H : j_at_external _ _ _ = _ |- _ =>
simpl in H; congruence
| H : semantics.halted _ _ _ |- _ =>
simpl in H; unfold cl_halted in H; contradiction
end].
(* Lemma control_as_safe_refl psi n k : control_as_safe psi n k k. *)
(* Definition control_as_safex {Espec: OracleKind} ge n c1 k1 c2 k2 := forall (ora : OK_ty) f (ve : env) (te : temp_env) (m : juicy_mem) (n' : nat), n' <= n -> jsafeN (@OK_spec Espec) ge n' ora (State f c1 k1 ve te) m -> jsafeN (@OK_spec Espec) ge n' ora (State f c2 k2 ve te) m. *)

Lemma semax_loop:
forall Delta Q Q' incr body R,
semax Espec Delta Q body (loop1_ret_assert Q' R) ->
semax Espec Delta Q' incr (loop2_ret_assert Q R) ->
semax Espec Delta Q (Sloop body incr) R.