(* A local function to compute all covers of a certain length *)
Fixpoint all_cover_aux (l : list (btree A)) (n : nat) {struct n} : list (btree A) :=
  match n with
  | O => nil
  | S n1 =>
      flat_map
        (fun l1 =>
         match l1 with
         | nil => nil
         | a :: nil => a :: nil
         | a :: b :: l2 => all_cover_aux (node a b :: l2) n1
         end) (all_permutations l)
  end.(* A function to compute all covers *)
Definition all_cover l := all_cover_aux l (length l).

Theorem cover_all_cover_aux : forall (n : nat) l t, n = length l -> cover l t -> In t (all_cover_aux l n).