
theorem Th23: :: Exercise 4.61: iiia
  for n being Ordinal, o being TermOrder of n
  st (for a,b,c being bag of n st [a,b] in o
  holds [a+c, b+c] in o) & o is_strongly_connected_in Bags n
  holds Graded o is admissible
proof
  let n be Ordinal, o be TermOrder of n such that
A1: for a,b,c being bag of n st [a,b] in o holds [a+c,b+c] in o and
A2: o is_strongly_connected_in Bags n;
  now
    let x,y be object such that
A3: x in Bags n and
A4: y in Bags n;
    reconsider x9=x, y9=y as bag of n by A3,A4;
    assume
A5: not [x,y] in Graded o;
    then
A6: TotDegree x9 >= TotDegree y9 by A1,Def7;
    per cases by A6,XXREAL_0:1;
    suppose TotDegree y9 < TotDegree x9;
      hence [y,x] in Graded o by A1,Def7;
    end;
    suppose
A7:   TotDegree y9 = TotDegree x9;
      then not [x,y] in o by A1,A5,Def7;
      then [y,x] in o by A2,A3,A4;
      hence [y,x] in Graded o by A1,A7,Def7;
    end;
  end;
  hence Graded o is_strongly_connected_in Bags n;
  now
    let a be bag of n;
A8: TotDegree EmptyBag n = 0 by Th14;
    per cases;
    suppose a = EmptyBag n;
      hence [EmptyBag n, a] in Graded o by ORDERS_1:3;
    end;
    suppose a <> EmptyBag n;
      then TotDegree a <> 0 by Th14;
      hence [EmptyBag n, a] in Graded o by A1,A8,Def7;
    end;
  end;
  hence for a being bag of n holds [EmptyBag n, a] in Graded o;
  now
    let a, b, c be bag of n such that
A9: [a,b] in Graded o;
    per cases by A1,A9,Def7;
    suppose
A10:  TotDegree a < TotDegree b;
A11:  TotDegree (a+c) = TotDegree a + TotDegree c by Th12;
      TotDegree (b+c) = TotDegree b + TotDegree c by Th12;
      then TotDegree (a+c) < TotDegree (b+c) by A10,A11,XREAL_1:8;
      hence [a+c, b+c] in Graded o by A1,Def7;
    end;
    suppose
A12:  TotDegree a = TotDegree b & [a,b] in o;
      then TotDegree (a+c) = TotDegree b + TotDegree c by Th12;
      then
A13:  TotDegree (a+c) = TotDegree(b+c) by Th12;
      [a+c, b+c] in o by A1,A12;
      hence [a+c, b+c] in Graded o by A1,A13,Def7;
    end;
  end;
  hence thesis;
end;
