Definition init_mem : { m | Genv.init_mem prog = Some m } := init_m prog init_mem_not_none.Definition spr :=
    semax_prog_rule'
      (Concurrent_Espec unit CS ext_link) V G prog
      (proj1_sig init_mem) 0 all_safe (proj2_sig init_mem).Definition initial_corestate : corestate := projT1 (projT2 spr).Definition initial_jm (n : nat) : juicy_mem := proj1_sig (snd (projT2 (projT2 spr)) n tt).Definition initial_machine_state (n : nat) :=
    @OrdinalPool.mk LocksAndResources (@JSem (globalenv prog))
      (pos.mkPos (le_n 1))
      (fun _ => Krun initial_corestate)
      (fun _ => m_phi (initial_jm n))
      (addressFiniteMap.AMap.empty _).Definition NoExternal_Espec : external_specification mem external_function unit :=
    Build_external_specification
      _ _ _
      (* no external calls from the machine *)
      (fun _ => False)
      (fun _ _ _ _ _ _ _ => False)
      (fun _ _ _ _ _ _ _ => False)
      (* when the machine is halted, it means no more schedule, there
      is nothing to check: *)
      (fun _ _ _ => Logic.True).Definition NoExternal_Hrel : nat -> mem -> mem -> Prop := fun _ _ _ => False.

(* Specifications: *)
Theorem jmsafe_initial_state sch n : jmsafe (globalenv prog) n ((proj1_sig init_mem), (nil, sch, initial_machine_state n)).
Lemma initial_corestate_initial : exists b, Genv.find_symbol (globalenv prog) (prog_main prog) = Some b /\ exists m', forall n, initial_core (Clight_new.cl_core_sem (globalenv prog)) n (proj1_sig init_mem) initial_corestate m' (Vptr b Ptrofs.zero) nil.
Lemma jmsafe_csafe n m tr sch s : jmsafe (globalenv prog) n (m, (tr, sch, s)) -> jm_csafe (sch, tr, s) m n.
Theorem safety_initial_state (sch : schedule) (n : nat) : jm_csafe (sch, nil, initial_machine_state n) (proj1_sig init_mem) n.