Definition get_monL : list (poly A0 eqA ltM) -> list (mon n) := map get_mon.Inductive RO : list (poly A0 eqA ltM) -> list (poly A0 eqA ltM) -> Prop :=
    RO0 :
      forall (a : poly A0 eqA ltM) (P : list (poly A0 eqA ltM)),
      ~
      zerop A A0 eqA n ltM
        (nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec
           os a P) ->
      RO
        (P ++
         nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec
           os a P :: nil) P.Inductive RO : list (poly A0 eqA ltM) -> list (poly A0 eqA ltM) -> Prop :=
    RO0 :
      forall (a : poly A0 eqA ltM) (P : list (poly A0 eqA ltM)),
      ~
      zerop A A0 eqA n ltM
        (nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec
           os a P) ->
      RO
        (P ++
         nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec
           os a P :: nil) P.Definition BadM (l : list (mon n)) := GoodR (mon n) (mdiv n) l -> False.

(* Specifications: *)
Lemma l1 : forall (cs : list (poly A0 eqA ltM)) (ms : list (mon n)), Bar (mon n) (GoodR (mon n) (mdiv n)) ms -> forall bs : list (poly A0 eqA ltM), ms = get_monL bs -> (forall f : poly A0 eqA ltM, In f bs -> ~ zerop A A0 eqA n ltM f) -> BadM ms -> Acc RO (cs ++ rev bs).
Theorem wf_incl : well_founded RO.
Lemma RO_lem : forall (a : poly A0 eqA ltM) (P : list (poly A0 eqA ltM)), ~ zerop A A0 eqA n ltM (nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec os a P) -> RO (addEnd A A0 eqA n ltM (nf A A0 A1 eqA plusA invA minusA multA divA cs eqA_dec n ltM ltM_dec os a P) P) P.