(* Turn a vector in a list of scalar to be used for multiple product *)
Fixpoint v2l (n: nat) : vect n -> list K :=
  match n return vect n -> list K with
    O => fun k => k :: nil
  | S n1 => fun x => let (x1, x2) := x in
                      (v2l n1 x1 ++ v2l n1 x2)%list
  end.

(* Specifications: *)
Lemma v2l_length n v : length (v2l n v) = exp 2 n.
Lemma mprod_2l n (v: vect n) : v2l n v *X* all_prods n (base n 1) = v.
Lemma cbl_all_prods n v : cbl _ (all_prods _ (base n 1)) v.
Lemma all_prods_free n: free _ (all_prods _ (base n 1)).
Lemma vect_hom_induct n (P: vect n -> Prop) : (forall k v, hom n k v -> P v) -> (forall v1 v2, P v1 -> P v2 -> P (v1 + v2)) -> (forall v, P v).
Lemma joinl0 n : joinl n nil = 0.
Lemma joinl1 n x : joinl n (x::nil) = x.
Lemma joinl0_base1_perm n l1 l2 : perm l1 l2 -> (forall x, In x l1 -> cbl _ (base n 1) x) -> joinl n l1 = 0 -> joinl n l2 = 0.
Lemma joinl_hom1 n l : (forall x, In x l -> hom n 1 x) -> hom n (length l) (joinl n l).
Lemma joinl_all n : 0 < n -> joinl n (base n 1) = E.