reserve i,j,k,n,m for Nat,
        b,b1,b2 for bag of n;

theorem Th14:
  b1 < b2 iff b1 bag_extend k < b2 bag_extend k
proof
  set B1=b1 bag_extend k,B2=b2 bag_extend k;
A1:B1|n=b1 & B2|n=b2 & B1.n=k=B2.n by HILBASIS:def 1;
A2:dom b2 = n =dom b1 by PARTFUN1:def 2;
  thus b1 < b2 implies b1 bag_extend k < b2 bag_extend k
  proof
    assume b1<b2;
    then consider o be Ordinal such that
A3: b1.o < b2.o and
A4: for l be Ordinal st l in o holds b1.l = b2.l by PRE_POLY:def 9;
A5: o in dom b2 by A3,FUNCT_1:def 2;
    then
A6: B2.o = b2.o & B1.o = b1.o by A1,FUNCT_1:47,A2;
    for l be Ordinal st l in o holds B1.l = B2.l
    proof
      let l be Ordinal;assume
A7:     l in o;
      then B2.l = b2.l & B1.l = b1.l by A1,FUNCT_1:47,A2,A5,ORDINAL1:10;
      hence thesis by A7,A4;
    end;
    hence thesis by A3,A6,PRE_POLY:def 9;
  end;
  assume B1 < B2;
  then consider o be Ordinal such that
A8:B1.o < B2.o and
A9:for l be Ordinal st l in o holds B1.l = B2.l by PRE_POLY:def 9;
  o in dom B2 by A8,FUNCT_1:def 2;
  then o in Segm (n+1);
  then o in (Segm n)\/{n} by AFINSQ_1:2;
  then
A10: o in n or o=n by ZFMISC_1:136;
  then
A11:B2.o = b2.o & B1.o = b1.o by A1,A8,FUNCT_1:47,A2;
  for l be Ordinal st l in o holds b1.l = b2.l
  proof
    let l be Ordinal;
    assume
A12: l in o;
    then B2.l = b2.l & B1.l = b1.l by A2,A10,A1,FUNCT_1:47,ORDINAL1:10;
    hence thesis by A12,A9;
  end;
  hence thesis by A8,A11,PRE_POLY:def 9;
end;
