Ltac exploit_match:=
      unfold match_thread_target,match_thread_source,match_thread_compiled in *;
      match goal with
      | [ H: getThreadC ?i = _ ?c,
             H0: context[match_state2match_thread] |- _ ] =>
        rewrite H in H0; inversion H0; subst; simpl in *; clear H0
      end;
      fold match_thread_target in *;
      fold match_thread_source in *;
      fold match_thread_compiled in *.(* Build the concur_match *)
    Ltac destroy_ev_step_sum:=
      match goal with
      | [ H: ev_step_sum _ _ _ _ _ _ _ |- _ ] => inversion H; clear H
      end.

Lemma Create_step_diagram: forall (U : list nat) (tr1 tr2 : HybridMachineSig.event_trace) (st1 : ThreadPool (Some hb)) (m1' : mem) (tid : nat) (cd : option compiler_index) (st2 : ThreadPool (Some (S hb))) (mu : meminj) (m2 : mem) (Htid : ThreadPool.containsThread st1 tid) (c : semC) (b : block) (ofs : Integers.Ptrofs.int) (arg : val) (virtue1 virtue2 : PTree.t (BinNums.Z -> option (option permission)) * PTree.t (BinNums.Z -> option (option permission))) (threadPerm' newThreadPerm : access_map * access_map), HybridMachineSig.schedPeek U = Some tid -> forall Hcmpt : mem_compatible st1 m1', concur_match cd mu st1 m1' st2 m2 -> List.Forall2 (inject_mevent mu) tr1 tr2 -> bounded_maps.sub_map (fst virtue2) (snd (getMaxPerm m1')) /\ bounded_maps.sub_map (snd virtue2) (snd (getMaxPerm m1')) -> bounded_maps.sub_map (fst virtue1) (snd (getMaxPerm m1')) /\ bounded_maps.sub_map (snd virtue1) (snd (getMaxPerm m1')) -> invariant st1 -> ThreadPool.getThreadC Htid = Kblocked c -> Val.inject (Mem.flat_inj (Mem.nextblock m1')) arg arg -> semantics.at_external (semantics.csem (event_semantics.msem semSem)) c (restrPermMap (fst (ssrfun.pair_of_and (Hcmpt tid Htid)))) = Some (CREATE, (Vptr b ofs :: arg :: nil)%list) -> permMapJoin (fst newThreadPerm) (fst threadPerm') (fst (ThreadPool.getThreadR Htid)) -> permMapJoin (snd newThreadPerm) (snd threadPerm') (snd (ThreadPool.getThreadR Htid)) -> exists e' (st2' : t) (m2' : mem) (cd' : option compiler_index) (mu' : meminj), concur_match cd' mu' (ThreadPool.addThread (ThreadPool.updThread Htid (Kresume c Vundef) threadPerm') (Vptr b ofs) arg newThreadPerm) m1' st2' m2' /\ List.Forall2 (inject_mevent mu') (seq.cat tr1 (Events.external tid (Events.spawn (b, Integers.Ptrofs.intval ofs) (*Some (ThreadPool.getThreadR Htid, virtue1)*) (Some (build_delta_content (fst virtue1) m1')) (*Some virtue2*) (Some (build_delta_content (fst virtue2) m1'))) :: nil)) (seq.cat tr2 (Events.external tid e' :: nil)) /\ HybridMachineSig.external_step (scheduler:=HybridMachineSig.HybridCoarseMachine.scheduler) U tr2 st2 m2 (HybridMachineSig.schedSkip U) (seq.cat tr2 (Events.external tid e' :: nil)) st2' m2'.