(* Right-hand side of a rule *)

Definition rhs_of_rule (r : rule) : term :=
  match r with rule_intro _ _ t => t end.(* Injecte les membres gauches des règles dans les term *)
Definition lhs_of_rule (r : rule) : term :=
  match r with rule_intro f lp _ => fapply f (map term_from_pattern lp) end.Definition max_rhs (prog : list rule) : nat :=
  maxl (map term_size (map rhs_of_rule prog)).

Lemma compatible_sizes: forall v, term_size (term_from_value v) = value_size v.