Definition decompose n (v: vect n) : option (list (vect n)) :=
let d := first_deg n v in
let l := decomposek n d v in
if all_hom1 n l then
if v ?= joinl n l then Some l else None
else None.

(* Specifications: *)
Lemma  decompose_cor n v :
match decompose n v with
| None => ~ is_decomposable n v
| Some l => decomposable n l v
end.