
theorem Th21: :: Ex 4.61 ii
  for n being Ordinal holds InvLexOrder n is admissible
proof
  let n be Ordinal;
  set ILO = InvLexOrder n;
  now
    let x, y be object such that
A1: x in Bags n and
A2: y in Bags n;
    reconsider p=x,q=y as bag of n by A1,A2;
    now
      assume
A3:   not [p,q] in ILO;
      then
A4:   p <> q by Def6;
      set s = SgmX(RelIncl n, support p \/ support q);
A5:   dom p = n by PARTFUN1:def 2;
A6:   dom q = n by PARTFUN1:def 2;
A7:   field(RelIncl n) = n by WELLORD2:def 1;
      RelIncl n is being_linear-order by ORDERS_1:19;
      then
A8:   RelIncl n linearly_orders support p \/ support q by A7,ORDERS_1:37,38;
      then
A9:   rng s = support p \/ support q by PRE_POLY:def 2;
      defpred P[Nat] means $1 in dom s & q.(s.$1) <> p.(s.$1);
A10:  for k being Nat st P[k] holds k <= len s by FINSEQ_3:25;
A11:  ex k being Nat st P[k]
      proof
        assume
A12:    not thesis;
        now
          let x be object;
          assume x in n;
          per cases;
          suppose p.x <> 0;
            then x in support p by PRE_POLY:def 7;
            then x in support p \/ support q by XBOOLE_0:def 3;
            then ex k being Nat st ( k in dom s)&( s.k = x) by A9,FINSEQ_2:10;
            hence p.x = q.x by A12;
          end;
          suppose q.x <> 0;
            then x in support q by PRE_POLY:def 7;
            then x in support p \/ support q by XBOOLE_0:def 3;
            then ex k being Nat st ( k in dom s)&( s.k = x) by A9,FINSEQ_2:10;
            hence p.x = q.x by A12;
          end;
          suppose p.x = 0 & q.x = 0;
            hence p.x = q.x;
          end;
        end;
        hence contradiction by A4,A5,A6,FUNCT_1:2;
      end;
      consider j being Nat such that
A13:  P[j] and
A14:  for k being Nat st P[k] holds k <= j from NAT_1:sch 6(A10,A11);
A15:  s.j in rng s by A13,FUNCT_1:3;
      then reconsider J = s.j as Ordinal by A9;
      now
        take J;
        thus J in n by A9,A15;
A16:    now
          let k be Ordinal such that
A17:      J in k and
A18:      k in n and
A19:      q.k <> p.k;
          now
            assume that
A20:        not k in support p and
A21:        not k in support q;
            p.k = 0 by A20,PRE_POLY:def 7;
            hence contradiction by A19,A21,PRE_POLY:def 7;
          end;
          then k in support p \/ support q by XBOOLE_0:def 3;
          then consider m being Nat such that
A22:      m in dom s and
A23:      s.m = k by A9,FINSEQ_2:10;
A24:      m <= j by A14,A19,A22,A23;
          m <> j by A17,A23;
          then m < j by A24,XXREAL_0:1;
          then [s/.m,s/.j] in RelIncl n by A8,A13,A22,PRE_POLY:def 2;
          then [s.m,s/.j] in RelIncl n by A22,PARTFUN1:def 6;
          then [s.m,s.j] in RelIncl n by A13,PARTFUN1:def 6;
          then s.m c= s.j by A9,A15,A18,A23,WELLORD2:def 1;
          hence contradiction by A17,A23,ORDINAL1:5;
        end;
        then q.J <= p.J by A3,A9,A15,Def6;
        hence q.J < p.J by A13,XXREAL_0:1;
        thus for k being Ordinal st J in k & k in n holds q.k = p.k by A16;
      end;
      hence [q,p] in ILO by Def6;
    end;
    hence [x,y] in ILO or [y,x] in ILO;
  end;
  hence ILO is_strongly_connected_in Bags n;
  now
    let a be bag of n;
    per cases;
    suppose EmptyBag n = a;
      hence [EmptyBag n, a] in ILO by Def6;
    end;
    suppose
A25:  EmptyBag n <> a;
      set s = SgmX(RelIncl n, support a);
A26:  field(RelIncl n) = n by WELLORD2:def 1;
      RelIncl n is being_linear-order by ORDERS_1:19;
      then
A27:  RelIncl n linearly_orders support a by A26,ORDERS_1:37,38;
      then
A28:  rng s = support a by PRE_POLY:def 2;
      then rng s <> {} by A25,PRE_POLY:81;
      then
A29:  len s in dom s by FINSEQ_5:6,RELAT_1:38;
      then
A30:  s.len s in rng s by FUNCT_1:3;
      then reconsider j = s.len s as Ordinal by A28;
      now
        take j;
        thus j in n by A28,A30;
A31:    a.j <> 0 by A28,A30,PRE_POLY:def 7;
        (EmptyBag n).j = 0 by PBOOLE:5;
        hence (EmptyBag n).j < a.j by A31;
        let k be Ordinal such that
A32:    j in k and
A33:    k in n;
A34:    j c= k by A32,ORDINAL1:def 2;
        now
          assume (EmptyBag n).k <> a.k;
          then a.k <> 0 by PBOOLE:5;
          then k in support a by PRE_POLY:def 7;
          then consider i being Nat such that
A35:      i in dom s and
A36:      s.i = k by A28,FINSEQ_2:10;
A37:      i <= len s by A35,FINSEQ_3:25;
          per cases by A37,XXREAL_0:1;
          suppose i = len s;
            hence contradiction by A32,A36;
          end;
          suppose i < len s;
            then [s/.i,s/.len s] in RelIncl n by A27,A29,A35,PRE_POLY:def 2;
            then [s.i,s/.len s] in RelIncl n by A35,PARTFUN1:def 6;
            then [s.i,s.len s] in RelIncl n by A29,PARTFUN1:def 6;
            then k c= j by A28,A30,A33,A36,WELLORD2:def 1;
            then j = k by A34,XBOOLE_0:def 10;
            hence contradiction by A32;
          end;
        end;
        hence (EmptyBag n).k = a.k;
      end;
      hence [EmptyBag n,a] in ILO by Def6;
    end;
  end;
  hence for a being bag of n holds [EmptyBag n, a] in ILO;
  now
    let a,b,c be bag of n such that
A38: [a,b] in ILO;
    per cases;
    suppose
A39:  a = b;
      a+c in Bags n by PRE_POLY:def 12;
      hence [a+c, b+c] in ILO by A39,ORDERS_1:3;
    end;
    suppose a <> b;
      then consider i being Ordinal such that
A40:  i in n and
A41:  a.i < b.i and
A42:  for k being Ordinal st i in k & k in n holds a.k = b.k by A38,Def6;
      now
        take i;
        thus i in n by A40;
A43:    (a+c).i = a.i+c.i by PRE_POLY:def 5;
        (b+c).i = b.i+c.i by PRE_POLY:def 5;
        hence (a+c).i < (b+c).i by A41,A43,XREAL_1:6;
        let k be Ordinal such that
A44:    i in k and
A45:    k in n;
A46:    (a+c).k = a.k+c.k by PRE_POLY:def 5;
        (b+c).k = b.k + c.k by PRE_POLY:def 5;
        hence (a+c).k = (b+c).k by A42,A44,A45,A46;
      end;
      hence [a+c, b+c] in ILO by Def6;
    end;
  end;
  hence thesis;
end;
