let mk_cons a b = try let x = d_car a and x' = d_cdr b in if Term.eq x x' then x else raise Not_found with Not_found -> Term.App.mk_app Sym.Product.mk_cons [a; b]