induction l; simpl; intros.
apply NoDup_nil.
inversion_clear H.
induction a...
inversion_clear H0.
simpl.
apply NoDup_cons...
intro.
destruct (in_app_or _ _ _ H0)...
apply (H1 a).
left...
destruct (In_concat_inv _ _ H4).
destruct H5.
apply InP_In with x...
apply IHa...
intros.
apply H1.
right...
Qed.

(* Specifications: *)
Lemma In_filter_inv A (f: A -> bool) (x: A) (l: list A): In x (filter f l) -> In x l /\ f x = true.
Definition addToPartitioning (c: comparison) (l: list T) (h: T) (H: {p: Partitioning | Permutation (p Eq ++ p Lt ++ p Gt) l}): {p: Partitioning | Permutation (p Eq ++ p Lt ++ p Gt) (h :: l)} :=
exist (fun p => Permutation (p Eq ++ p Lt ++ p Gt) (h :: l))
(fun c' => if cmp_cmp c c' then h :: proj1_sig H c' else proj1_sig H c')
(partition_oblig c h H).