Definition nb_rhs_functions (r: rule) :=
  match r with
    | rule_intro _ _ t => length (functions_of_term t)
  end.Definition max_nb_rhs_functions (prog : list rule) : nat :=
  maxl (map nb_rhs_functions prog).

(* Specifications: *)
Lemma no_func_in_pattern p: functions_of_term (term_from_pattern p) = [].
Lemma no_funcs_in_patterns l: flat_map functions_of_term (map term_from_pattern l) = [].