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).

Lemma no_func_in_pattern p:
functions_of_term (term_from_pattern p) = [].