Proof using name_map_bijective multi_map_congr.
move => net net' tr.
case => {net net' tr}.
- move => net net' tr m ms out d l from to H_eq H_hnd H_eq' H_eq_tr.
destruct (pt_map_msg m) eqn:?.
left.
destruct (net_handlers (tot_map_name to) (tot_map_name from) m0 (pt_ext_map_data (onwState net to) to)) eqn:?.
destruct p as [out' d'].
exists (map2fst (tot_map_name to) (map inr out')).
rewrite H_eq' /= /pt_ext_map_onet /=.
apply (@StepOrdered_deliver _ _ _ _ _ m0 (filterMap pt_map_msg ms) out' (pt_ext_map_data d to) (filterMap pt_map_name_msg l) (tot_map_name from) (tot_map_name to)) => //=.
* rewrite 2!tot_map_name_inv_inverse H_eq /=.
case H_m1: pt_map_msg => [m1|]; last by rewrite Heqo in H_m1.
rewrite H_m1 in Heqo.
by inversion Heqo.
* rewrite tot_map_name_inv_inverse.
have H_q := @pt_ext_net_handlers_some _ _ _ _ _ _ _ multi_map_congr _ _ _ _ _ _ _ _ Heqo Heqp.
rewrite /pt_ext_mapped_net_handlers /= in H_q.
by repeat break_let; repeat tuple_inversion.
* by rewrite /= pt_ext_map_update_eq collate_pt_map_update2_eq.
right.
have [H_eq_d H_ms] := pt_ext_net_handlers_none _ _ _ _ Heqo H_hnd.
rewrite H_eq' /pt_ext_map_onet /=.
rewrite pt_ext_map_update_eq /= H_eq_d.
rewrite collate_pt_map_eq H_ms /=.
set nwS1 := update _ _ _ _.
set nwS2 := fun n => pt_ext_map_data _ _.
set nwP1 := fun _ _ => _.
set nwP2 := fun _ _ => _.
have H_eq_s: nwS1 = nwS2.
rewrite /nwS1 /nwS2 {nwS1 nwS2}.
apply functional_extensionality => n.
rewrite /update /=.
case (name_eq_dec _ _) => H_dec //.
by rewrite H_dec tot_map_name_inv_inverse.
have H_eq_p: nwP1 = nwP2.
rewrite /nwP1 /nwP2 /=.
apply functional_extensionality => src.
apply functional_extensionality => dst.
rewrite /update2 /=.
case (sumbool_and _ _ _ _) => H_dec //.
move: H_dec => [H_eq_from H_eq_to].
rewrite -H_eq_from -H_eq_to H_eq /=.
case H_m': (pt_map_msg _) => [m'|] //.
by rewrite H_m' in Heqo.
by rewrite H_eq_s H_eq_p.
- move => h net net' tr out inp d l H_hnd H_eq H_eq_tr.
destruct (pt_ext_map_input inp h (onwState net h)) eqn:?.
left.
destruct (input_handlers (tot_map_name h) i (pt_ext_map_data (onwState net h) h)) eqn:?.
destruct p as [out' d'].
exists ((tot_map_name h, inl i) :: map2fst (tot_map_name h) (map inr out')).
apply (@StepOrdered_input _ _ (tot_map_name h) _ _ _ out' i (pt_ext_map_data d h) (filterMap pt_map_name_msg l)) => //=; last by rewrite H_eq /pt_ext_map_onet /= pt_ext_map_update_eq collate_pt_map_eq.
have H_q := @pt_ext_input_handlers_some _ _ _ _ _ _ _ multi_map_congr h inp (onwState net h) _ _ _ _ Heqo Heqp.
rewrite /pt_ext_mapped_input_handlers /= in H_q.
rewrite tot_map_name_inv_inverse.
by repeat break_let; repeat tuple_inversion.
right.
rewrite /=.
have [H_d H_l] := pt_ext_input_handlers_none h inp (onwState net h) Heqo H_hnd.
rewrite H_eq /= /pt_ext_map_onet /=.
rewrite pt_ext_map_update_eq /= H_d.
rewrite collate_pt_map_eq H_l /=.
set nwS1 := update _ _ _ _.
set nwS2 := fun n => pt_ext_map_data _ _.
have H_eq_n: nwS1 = nwS2.
rewrite /nwS1 /nwS2 /=.
apply functional_extensionality => n.
rewrite /update /=.
case (name_eq_dec _ _) => H_dec //.
by rewrite H_dec tot_map_name_inv_inverse.
by rewrite H_eq_n.
Qed.

Corollary step_ordered_pt_ext_mapped_simulation_star_1 :
forall net tr,
@step_ordered_star _ multi_fst step_ordered_init net tr ->
exists tr', @step_ordered_star _ multi_snd step_ordered_init (pt_ext_map_onet net) tr'.