Proof using.
intros.
assert (H_eq: update2 A_eq_dec f n h ms h' h = f h' h).
unfold update2.
break_if; auto.
break_and.
subst.
intuition.
rewrite (collate_ls_f_eq _ _ _ _ _ _ _ H_eq).
trivial.
Qed.

Lemma collate_ls_cases :
forall s (f : A -> A -> list B) to m a b,
collate_ls A_eq_dec s f to m a b = f a b \/
exists l,
(forall x, In x l -> x = m) /\
collate_ls A_eq_dec s f to m a b = f a b ++ l.