Proof using name_map_bijective.
elim => //=.
move => n' ns IH n H_in.
case: H_in => H_in.
left.
exact: tot_map_name_injective.
right.
exact: IH.
Qed.

(* Specifications: *)
Lemma nodup_perm_map_map_pair_perm :
forall h m failed ns ns',
NoDup ns ->
Permutation (map tot_map_name ns) ns' ->
Permutation
(map (fun nm : name * msg => (tot_map_name (fst nm), tot_map_msg (snd nm))) (map2snd m (filter_rel adjacent_to_dec h (remove_all name_eq_dec failed ns))))
(map2snd (tot_map_msg m) (filter_rel adjacent_to_dec (tot_map_name h) (remove_all name_eq_dec (map tot_map_name failed) ns'))).