apply BC_to_TRS_main_has_unique_max_rank with (n:=n0) (s:=s0).
      now apply H1.
Qed.

(*****************************************************************************)
(*                                                                           *)
(*                     Translation produces a QI                             *)
(*                                                                           *)
(*****************************************************************************)
Definition  valid_QI_prog trs := valid_QI variable function constructor
  trs.(rules) mcs qic (qif trs) cs.Definition subterm_QI_prog trs := subterm function (qif trs).
Definition monotonicity_QI_prog trs := monotonicity_qif function (qif trs).
Definition compatible_QI_prog trs := compatible_QI variable function constructor 
  trs.(rules) qic (qif trs).

Qed. Lemma ta_of_p_subst qif2 p qic s qif1: