Proof using.
intros.
subst_max.
do_in_app.
break_or_hyp.
- auto with datatypes.
- find_apply_lem_hyp in_inv.
break_or_hyp; auto using in_or_app || congruence.
Qed.
Hint Resolve in_rest_app_cons : struct_util.

Lemma remove_filter_commute :
forall (l : list A) A_eq_dec f x,
remove A_eq_dec x (filter f l) = filter f (remove A_eq_dec x l).