(* fetching rhs functions names *)
Definition rhs_funcs ru :=  (* => Syntax.v ? *)
  match ru with
  | rule_intro _ _ t => functions_of_term t
  end.Definition all_rhs_funcs prg := flat_map rhs_funcs prg.

Lemma rvd_make_rec n s g h0 h1 f: (* we can't really make a generic Lemma (ie, have 'rvd' as a parameter) because the hard part is proving it on the rules, and that depends on the property. The recursive parts on g, h0 and h1 is very easy. *) Forall rule_vars_defined g.(rules) → Forall rule_vars_defined h0.(rules) → Forall rule_vars_defined h1.(rules) → Forall rule_vars_defined (make_rec (S n) s g h0 h1 f).(rules).