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

theorem Th19:
  for O being Ordinal, L being well-unital commutative associative non trivial
    doubleLoopStr, x being Function of O, L, b being bag of O
  for S being one-to-one FinSequence of O st
       rng S = support b
    ex y being FinSequence of L st
        len y = card support b &
        eval(b,x) = Product y &
    for i st 1 <= i & i <= len y holds
           y/.i = power(L).((x*S)/.i, (b*S)/.i)
proof
  let n be Ordinal, L be well-unital commutative associative non trivial
  doubleLoopStr, x be Function of n,L, b be bag of n;
  let S be one-to-one FinSequence of n such that
A1:rng S = support b;
  set SG=SgmX(RelIncl n, support b);
  consider y be FinSequence of L such that
A2: len y = len SG & eval(b,x) = Product y and
A3: for i being Element of NAT st 1 <= i & i <= len y holds
        y/.i = power(L).((x * SG)/.i,(b * SG)/.i) by POLYNOM2:def 2;
A4:RelIncl n linearly_orders support b by PRE_POLY:82;
A5:SG is one-to-one & len SG = card support b by PRE_POLY:10,11,82;
A6:rng SG = support b by A4,PRE_POLY:def 2;
  then consider H be Function such that
A7: dom H=dom S & rng H = dom SG & H is one-to-one & SG*H = S
  by A1,A5,RFINSEQ:26,CLASSES1:77;
A8:len S=len SG by A1,A5,A6,FINSEQ_1:48;
A9: dom y = dom SG = dom S by A2,A8,FINSEQ_3:29;
  then
A10: dom (y*H) = dom H & dom S = Seg len S
  by A7,RELAT_1:27,FINSEQ_1:def 3;
  then reconsider yH=y*H as FinSequence by A7,FINSEQ_1:def 2;
  reconsider H as Function of dom y,dom y by A7,A9,FUNCT_2:1;
  H is onto by A7,A2,FINSEQ_3:29;
  then reconsider H as Permutation of dom y by A7;
A11:rng y c= the carrier of L;
  rng yH c= rng y by RELAT_1:26;
  then rng yH c= the carrier of L by A11;
  then reconsider yH as FinSequence of L by FINSEQ_1:def 4;
  take yH;
  thus len yH = card support b by A7,A10,FINSEQ_3:29,A8,A5;
A12:   H is Permutation of dom y;
  thus eval(b,x) = (the multF of L)"**"  y by GROUP_4:def 2,A2
  .=(the multF of L)"**"  yH by FINSOP_1:7,A12
  .= Product yH by GROUP_4:def 2;
  let i be Nat such that
A13:1<=i & i <= len yH;set Hi=H/.i;
  i in dom yH by A13,FINSEQ_3:25;
  then
A14: yH/.i = yH.i & H.i = Hi & yH.i = y.(H.i) & H.i in rng H
  by A10,PARTFUN1:def 6,FUNCT_1:12,def 3;
  then
A15:1<= Hi <= len y & Hi in NAT & y.Hi = y/.Hi
  by FINSEQ_3:25,PARTFUN1:def 6;
  dom x = n by FUNCT_2:def 1;
  then rng SG c= dom x & rng S c= dom x;
  then
A16: dom (x * SG) = dom SG & dom (x * S) = dom S by RELAT_1:27;
  then
A17:(x * SG)/.Hi = (x * SG).Hi by A14,A7,PARTFUN1:def 6
  .= x.(SG.Hi) by A16,A14,A7,FUNCT_1:12
  .= x.((SG*H).i) by A14,A13,FINSEQ_3:25,A7,A10,FUNCT_1:12
  .= (x*S).i by A7,A16,A13,FINSEQ_3:25,A10,FUNCT_1:12
  .= (x*S)/.i by A7,A16,A13,FINSEQ_3:25,A10,PARTFUN1:def 6;
  dom b = n by PARTFUN1:def 2;
  then rng SG c= dom b & rng S c= dom b;
  then
A18: dom (b * SG) = dom SG & dom (b * S) = dom S by RELAT_1:27;
  then (b * SG)/.Hi = (b * SG).Hi by A14,A7,PARTFUN1:def 6
  .= b.(SG.Hi) by A18,A14,A7,FUNCT_1:12
  .= b.((SG*H).i) by A14,A13,FINSEQ_3:25,A7,A10,FUNCT_1:12
  .= (b*S).i by A7,A18,A13,FINSEQ_3:25,A10,FUNCT_1:12
  .= (b*S)/.i by A7,A18,A13,FINSEQ_3:25,A10,PARTFUN1:def 6;
  hence  yH/.i = power(L).((x * S)/.i,(b * S)/.i) by A3,A17,A14,A15;
end;
