(* 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.

(* Specifications: *)
Lemma rhs_funcs_eq prg: (* pour pouvoir faire des fold et pas que des unfold *)
flat_map rhs_funcs prg = all_rhs_funcs prg.
Lemma rvd_make_comp n s h gN gS f:
Forall rule_vars_defined h.(rules) →
Forall rule_vars_defined (flat_map rules gN) →
Forall rule_vars_defined (flat_map rules gS) →
Forall rule_vars_defined (make_comp n s h gN gS f).(rules).