Definition triple0 A B C (t: A * B * C): A := fst (fst t).Definition triple1 A B C (t: A * B * C): B := snd (fst t).Definition triple2 A B C (t: A * B * C): C := snd t.Fixpoint rsplits T (l: list T): list (list T * T * list T) :=
  match l with
  | nil => nil
  | h :: t => (nil, h, t) :: map (fun p => (h :: triple0 p, triple1 p, triple2 p)) (rsplits t)
  end.

Lemma map_length_filter_permuted_splits T (l l': list T): Permutation l l' -> forall p, Permutation (map (fun x => length (filter (p (fst x)) (snd x))) (splits l)) (map (fun x => length (filter (p (fst x)) (snd x))) (splits l')).