let build_fimpl_call kf ki bhv n output inputs =
  let out_type = output.term_type in
  let input_term i acc = match i with Nothing -> acc
    | Location {it_content=lv} -> lv::acc
  in
  let inputs = List.fold_right input_term inputs [] in
  let fimpl_sig = (out_type, List.map (fun i -> i.term_type) inputs) in
  let fun_impl = get_implicit_fun kf ki bhv n fimpl_sig in
  let inputs = 
    List.map (fun x -> Logic_const.term (Told x) x.term_type) inputs 
  in
  let fun_impl = Logic_const.term (Tapp (fun_impl, [], inputs)) out_type in
  let p_eq = Logic_const.prel (Req, output, fun_impl) in
    p_eq