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_funcs_in_patterns l:
flat_map functions_of_term (map term_from_pattern l) = [].