
theorem Th30:
  for n being Nat holds NaivelyOrderedBags n = product (n --> OrderedNAT)
proof
  let n be Nat;
   reconsider n0=n as Element of NAT by ORDINAL1:def 12;
  set CNOB = the carrier of NaivelyOrderedBags n;
  set IROB = the InternalRel of NaivelyOrderedBags n;
  set CP = the carrier of product(n-->OrderedNAT);
  set IP = the InternalRel of product (n-->OrderedNAT);
  CNOB = Bags n by Def11;
  then
A1: CNOB = CP by Th29;
  now
    let a,b be object;
    hereby
      assume
A2:   [a,b] in IROB;
      then
A3:   a in dom IROB by XTUPLE_0:def 12;
A4:   b in rng IROB by A2,XTUPLE_0:def 13;
A5:   a in CNOB by A3;
A6:   b in CNOB by A4;
A7:   a in Bags n by A5,Def11;
A8:   b in Bags n by A6,Def11;
      then reconsider a9=a, b9=b as Element of CP by A7,Th29;
      a9 in the carrier of product(n0-->OrderedNAT);
      then
A9:   a9 in product Carrier (n -->OrderedNAT) by YELLOW_1:def 4;
      now
        set f = a9, g = b9;
A10:    a9 is bag of n by A7;
A11:    b is bag of n by A8;
        reconsider f, g as Function by A7,A8;
        take f, g;
        thus f = a9 & g = b9;
        let i be object;
        assume
A12:    i in n;
        set R = (n-->OrderedNAT).i;
A13:    R = OrderedNAT by A12,FUNCOP_1:7;
        reconsider R as RelStr by A12,FUNCOP_1:7;
        take R;
        set xi = f.i;
        set yi = g.i;
        dom f = n by A10,PARTFUN1:def 2;
        then
A14:    f.i in rng f by A12,FUNCT_1:3;
A15:    rng f c= NAT by A10,VALUED_0:def 6;
        dom g = n by A11,PARTFUN1:def 2;
        then
A16:    g.i in rng g by A12,FUNCT_1:3;
A17:    rng g c= NAT by A11,VALUED_0:def 6;
        then reconsider xi, yi as Element of R
        by A12,A14,A15,A16,DICKSON:def 15,FUNCOP_1:7;
        take xi, yi;
        thus R = (n-->OrderedNAT).i & xi = f.i & yi = g.i;
        reconsider a99=a9, b99=b9 as bag of n by A7,A8;
A18:     xi in NAT & yi in NAT by A15,A17,A14,A16;
        a99 divides b99 by A2,Def11;
        then a99.i <= b99.i by PRE_POLY:def 11;
        then [xi, yi] in NATOrd by DICKSON:def 14,A18;
        hence xi <= yi by A13,DICKSON:def 15,ORDERS_2:def 5;
      end;
      then a9 <= b9 by A9,YELLOW_1:def 4;
      hence [a,b] in IP by ORDERS_2:def 5;
    end;
    assume
A19: [a,b] in IP;
    then
A20: a in dom IP by XTUPLE_0:def 12;
A21: b in rng IP by A19,XTUPLE_0:def 13;
A22: a in CP by A20;
A23: b in CP by A21;
A24: a in Bags n by A22,Th29;
    b in Bags n by A23,Th29;
    then reconsider a9=a, b9=b as bag of n by A24;
    reconsider a2=a9,b2=b9 as Element of CP by A20,A21;
    a2 in the carrier of product(n0-->OrderedNAT);
    then
A25: a2 in product Carrier(n-->OrderedNAT) by YELLOW_1:def 4;
    a2 <= b2 by A19,ORDERS_2:def 5;
    then consider f,g being Function such that
A26: f = a2 and
A27: g = b2 and
A28: for i being object
    st i in n ex R being RelStr, xi,yi being Element of R
    st R = (n-->OrderedNAT).i & xi = f.i & yi = g.i & xi <= yi
    by A25,YELLOW_1:def 4;
    now
      let k be object such that
A29:  k in n;
      consider R being RelStr, xi, yi being Element of R such that
A30:  R = (n-->OrderedNAT).k and
A31:  xi = f.k and
A32:  yi = g.k and
A33:  xi <= yi by A28,A29;
      R = OrderedNAT by A29,A30,FUNCOP_1:7;
      then [xi,yi] in NATOrd by A33,DICKSON:def 15,ORDERS_2:def 5;
      then consider xii, yii being Element of NAT such that
A34:  [xii,yii] = [xi,yi] and
A35:  xii <= yii by DICKSON:def 14;
      xii = xi by A34,XTUPLE_0:1;
      hence a9.k <= b9.k by A26,A27,A31,A32,A34,A35,XTUPLE_0:1;
    end;
    then a9 divides b9 by PRE_POLY:46;
    hence [a,b] in IROB by Def11;
  end;
  hence thesis by A1,RELAT_1:def 2;
end;
