Variable P: list T -> list T -> Prop.
Hypothesis Pnil: P nil nil.
Hypothesis Pcons: forall h t,
P (filter (gt h) t) (qs (filter (gt h) t)) ->
P (filter (le h) t) (qs (filter (le h) t)) -> P (h :: t) (qs (filter (gt h) t) ++ h :: nil ++ qs (filter (le h) t)).

Lemma qs_rect: forall l, P l (qs l).
Proof with auto with arith.