(* 
 In the product the sum of the leaves is multiplied by the integer
 and added to the weight of the tree
*)
Definition prod2list l1 l2 :=
  fold_left plus
    (map2 (fun a b => a * sum_leaves f b + weight_tree f b) l1 l2) 0.

Theorem prod2list_reorder2 : forall a b c b1 c1 l1 l2 l3 l4 l5, length l1 = length l3 -> length l2 = length l4 -> (forall b, In b l1 -> b <= a) -> (forall b, In b l2 -> b <= a) -> permutation (l3 ++ b :: c :: l4) (b1 :: c1 :: l5) -> ordered (sum_order f) (b1 :: c1 :: l5) -> exists l6 : _, (exists l7 : _, length l1 = length l6 /\ length l2 = length l7 /\ permutation (b1 :: c1 :: l5) (l6 ++ b1 :: c1 :: l7) /\ prod2list (l1 ++ a :: a :: l2) (l6 ++ b1 :: c1 :: l7) <= prod2list (l1 ++ a :: a :: l2) (l3 ++ b :: c :: l4)).