Fixpoint filter_aux (f: key -> bool) (s: tree) (n: positive) (l: list key) : (positive * list key) :=
 match s with
 | T _ sl k sr => let (n,l') := filter_aux f sr n l
                           in if f k then filter_aux f sl (Psucc n) (k::l')
                                        else filter_aux f sl n l'
 | EE => (n,l)
 end.Definition Kle x y := K.lt x y \/ K.eq x y.

Lemma HdRel_le_lt: forall u v l, K.lt u v -> HdRel Kle v l -> HdRel K.lt u l.