Section remove_all.
Variable A : Type.
Hypothesis A_eq_dec : forall x y : A, {x = y} + {x <> y}.
Fixpoint remove_all (to_delete l : list A) : list A :=
match to_delete with
| [] => l
| d :: ds => remove_all ds (remove A_eq_dec d l)
end.
Proof using.
induction ds; intros; simpl in *; intuition.
eauto using in_remove.
Qed.
Proof using.
induction ds; intros; simpl in *; intuition auto using remove_preserve.
Qed.
Proof using.
induction ds; intros; simpl in *; intuition.
- subst. find_apply_lem_hyp in_remove_all_was_in.
eapply remove_In; eauto.
- eauto.
Qed.
Proof using.
intros. induction ys; simpl in *; intuition.
Qed.
Proof using.
induction ys; intros; simpl in *; intuition.
break_if; subst; simpl in *; intuition.
specialize (IHys a0 (remove A_eq_dec a l)). intuition.
Qed.
Proof using.
induction l; intros; simpl in *; intuition.
- rewrite remove_all_nil in *. simpl in *. intuition.
- pose proof remove_all_cons ys a l. intuition.
+ repeat find_rewrite. right. intuition eauto.
subst; intuition.
+ repeat find_rewrite. simpl in *. intuition eauto.
Qed.
Proof using.
induction l; intros; simpl in *; intuition;
pose proof remove_all_cons xs a l; subst; intuition;
repeat find_rewrite; simpl in *; intuition.
Qed.
Proof using.
intros.
induction l'.
- rewrite remove_all_nil; auto.
- invc_NoDup.
concludes.
pose proof remove_all_cons l a l'.
break_or_hyp; break_and; find_rewrite; auto.
constructor; auto.
intro.
find_apply_lem_hyp in_remove_all_was_in; auto.
Qed.

Lemma remove_all_NoDup_split :
forall l l' l0 l1 a,
NoDup l' ->
remove_all l l' = l0 ++ a :: l1 ->
remove_all l (remove A_eq_dec a l') = l0 ++ l1.