Proof with auto.
induction l...
simpl.
rewrite IHl.
destruct (Ecmp ee a i); destruct cr...
Qed.
Section Uqs_ind.
Variable P: list (Index e ol) -> M (list (Index e ol)) -> Prop.
Hypothesis Pnil: P nil (ret nil).
Hypothesis Pcons: forall n (v: Vector.t (Index e ol) (S n)),
(forall x0 cr, P (filter (fun f: Index e ol => unsum_bool (cmp_cmp (Ecmp (UE e ol) f (vec.nth v x0)) cr)) (vec.remove v x0)) (qs cmp pick (filter (fun f: Index e ol => unsum_bool (cmp_cmp (Ecmp (UE e ol) f (vec.nth v x0)) cr)) (vec.remove v x0)))) ->
P v
(ne_tree.Node
(ne_list.map
(fun x0: natBelow (S n) =>
ne_tree.map
(map_fst (C:=list (Index e ol)) (app (map (fun i0: Index e ol => unordered_nat_pair i0 (vec.nth v x0)) (vec.remove v x0))))
(foo <- qs cmp pick (filter (fun f: Index e ol => unsum_bool (cmp_cmp (Ecmp (UE e ol) f (vec.nth v x0)) Lt)) (vec.remove v x0));
bar <- qs cmp pick (filter (fun f: Index e ol => unsum_bool (cmp_cmp (Ecmp (UE e ol) f (vec.nth v x0)) Gt)) (vec.remove v x0));
ret (foo ++ (vec.nth v x0 :: filter (fun f0: Index e ol => unsum_bool (cmp_cmp (Ecmp (UE e ol) f0 (vec.nth v x0)) Eq)) (vec.remove v x0)) ++ bar)))
(ne_list.from_vec (vec.nats 0 (S n))))).

Theorem qs_ind: forall l, P l (qs cmp pick l).
Proof with auto.