let combine_subs (std_ls : t_equal) (xor_ls : t_equal) (rem_ls : t_equal) fv ctr
  : t_subst =

  (* add_help adds (n,t) to sub. If to_purify is false it is assumed that t is
   * purified and normalized with respect to sub.
   *)

  let add_help to_purify sub (n,t) = add_elem to_purify n t sub
  in

  (* This could raise the exception No_Solution or NeedXorUnification but it
   * must not due to assumptions.
   *)

  let combined_sub =
    (try
      (* std_ls is purified and normalized with respect to std_ls, because no
       * variable in std_ls is instantiated in rem_ls. Hence, we can use
       * (add_help false).
       * But the xor terms in xor_ls are not yet normalized, so we have to use
       * (add_help true) here. *)

      it_list (add_help true)
              (it_list (add_help false) (rem_ls,fv,[]) std_ls)
              xor_ls
    with
    | No_Solution ->
        failwith ("combine_subs: combining subs failed in add_elem with the "^
                  "exception No_Solution")
    | NeedXorUnification _ ->
        failwith ("combine_subs: combining subs failed in add_elem with the "^
                  "exception NeedXorUnification")
    )
  in

  (* And finally add the negative constraints ctr.
   * This may raise the exception No_Solution. *)

  add_ctr combined_sub ctr