Set Implicit Arguments.
Fixpoint nats (b: nat) (w: nat) {struct w}: list nat :=
match w with
| 0 => nil
| S w' => b :: nats (S b) w'
end.
Proof with auto.
induction w in b |- * ...
simpl.
intros.
rewrite IHw...
Qed.
Proof with auto.
induction w in x, b |- *; intros H H0.
exfalso.
rewrite plus_0_r in H0.
apply (lt_not_le x b H0)...
simpl.
destruct (le_lt_eq_dec _ _ H); [right | left]...
apply IHw...
omega.
Qed.
Proof with auto.
induction w in x, b |- *; simpl; intros.
inversion H.
inversion H.
omega.
destruct (IHw x (S b) H0).
omega.
Qed.
Proof with auto.
induction w in b |- *; simpl; intros.
apply NoDup_nil.
apply NoDup_cons...
intro.
destruct (In_nats_inv _ _ _ H).
apply (le_Sn_n _ H0).
Qed.
Proof with auto.
induction y in x, z |- *...
intros.
simpl.
rewrite IHy.
rewrite <- plus_n_Sm...
Qed.
Proof with auto.
induction w in b |- *...
intros.
rewrite nats_Sw.
rewrite IHw.
simpl.
rewrite plus_n_Sm...
Qed.
Proof with auto.
induction n...
simpl pow.
rewrite plus_0_r.
rewrite nats_plus.
rewrite IHn.
rewrite nats_Sw'.
rewrite map_app.
simpl.
rewrite concat_app.
rewrite plus_0_r.
simpl.
rewrite app_nil_r...
Qed.
Proof with auto.
induction w in b |- *...
simpl.
intros.
rewrite IHw...
Qed.
Require vec.

Lemma filtered_sort (T: Set) (R: relation T) (P: preorder T R) (p: T -> T -> bool) (pc: forall x y, p y x = true -> ~ R y x) (l: list T): vec.sorted R (vec.from_list l) ->
elemsR le (map (fun x => length (filter (p (fst x)) (snd x))) (splits l)) (nats 0 (length l)).