End DrySafety.
(*  Existing Instance HybridMachineSig.HybridCoarseMachine.DilMem. Existing Instance HybridMachineSig.HybridCoarseMachine.scheduler. Import Machine_sim.  Program Definition juicy_dry_sim ge U rmap0 pmap main (Hinit_perm : match_rmap_perm rmap0 pmap) (Hinit_locks : no_locks_perm rmap0) : Machine_sim (new_MachineSemantics(machineSig := JMS ge) U (Some rmap0)) (new_MachineSemantics(machineSig := DMS ge) U (Some pmap)) ge ge main eq (fun j ge1 vals1 m1 ge2 vals2 m2 => ge1 = ge2 /\ vals1 = vals2 /\ m1 = m2) (fun j ge1 v1 m1 ge2 v2 m2 => ge1 = ge2 /\ v1 = v2 /\ m1 = m2) := {| match_state (d : Erasure.core_data) j c1 m1 c2 m2 := m1 = m2 /\ match_st ge c1 c2; core_ord_wf := Erasure.core_ord_wf |}. Next Obligation. Next Obligation. Next Obligation. admit. Admitted. Next Obligation. exists (fun _ => None), v1; repeat split; auto. Qed.*)
(** *Lets proof that again with the new kind of safety*)
(*  (* Is this still needed? Is this the right way to do it? *)
Section ksafe.
Context (jvalid : jmachine_state -> Prop).
Context (dvalid : dmachine_state -> Prop).
Hypothesis assume: forall js ds, match_st js ds ->
forall sch jtr dtr, jvalid (sch, jtr, js) <-> dvalid (sch, dtr, ds).
Existing Instance HybridCoarseMachine.DilMem.
Existing Instance JuicyMachineShell.
Existing Instance HybridCoarseMachine.scheduler.
Definition j_new_step ge (st : jmachine_state * Mem.mem) sch st' sch' :=
sch = fst (fst (fst st)) /\ sch' = fst (fst (fst st')) /\
MachStep ge (fst st) (snd st) (fst st') (snd st').
Definition d_new_step ge (st : dmachine_state * Mem.mem) sch st' sch' :=
sch = fst (fst (fst st)) /\ sch' = fst (fst (fst st')) /\
MachStep ge (fst st) (snd st) (fst st') (snd st').
Notation jksafe := (fun ge => safety.ksafe _ _ (j_new_step ge) (fun st sch => sch = fst (fst (fst st)) /\ jvalid (fst st))).
Notation dksafe := (fun ge => safety.ksafe _ _ (d_new_step ge) (fun st sch => sch = fst (fst (fst st)) /\ dvalid (fst st))).

(* Specifications: *)
Lemma new_erasure_safety'': forall n ge js jtr ds dtr m,
ErasureProof.match_st js ds ->
invariant ds ->
(forall sch, jvalid (sch, jtr, js) -> jksafe ge ((sch, jtr, js), m) sch n) ->
(forall sch, dvalid (sch, dtr, ds) -> dksafe ge ((sch, dtr, ds), m) sch n).
Lemma new_erasure_safety': forall n ge js ds m,
(forall sch, JuicyMachine.valid (sch, nil, js)) ->
ErasureProof.match_st js ds ->
DMS.invariant ds ->
(forall sch, JuicyMachine.ksafe_new_step ge (sch, nil, js) m n) ->
forall sch, DryMachine.ksafe_new_step ge (sch, nil, ds) m n.