Proof using.
intros h h' l1 l2 f m H_in.
apply functional_extensionality; intro from.
apply functional_extensionality; intro to.
case (A_eq_dec h' from); intro H_dec.
- rewrite <- H_dec.
case (A_eq_dec h to); intro H_dec'.
* rewrite <- H_dec'.
rewrite collate_not_in.
+ subst.
rewrite collate_not_in; auto.
intro.
contradict H_in.
rewrite map_app.
apply in_or_app.
left.
assumption.
+ intro.
contradict H_in.
rewrite map_app.
apply in_or_app.
left.
assumption.
* rewrite collate_neq_update2; auto.
rewrite collate_app.
rewrite collate_app.
simpl.
rewrite collate_neq_update2; auto.
- rewrite collate_neq; auto.
rewrite collate_neq; auto.
unfold update2.
break_if; auto.
break_and; subst.
intuition.
Qed.

Lemma NoDup_Permutation_collate_eq :
forall h (f : A -> A -> list B) l l',
NoDup (map fst l) ->
Permutation l l' ->
collate A_eq_dec h f l = collate A_eq_dec h f l'.