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

theorem Th24:
  for O being Ordinal,
      L being Abelian right_zeroed add-associative right_complementable
      well-unital distributive non trivial doubleLoopStr,
    p being Polynomial of O,L,
    x being Function of O, L
  for S being one-to-one FinSequence of Bags O st
       rng S = Support p
    ex y being FinSequence of L st
        len y = card Support p &
        eval(p,x) = Sum y &
        for i being Nat st 1 <= i & i <= len y holds
           y/.i = (p * S)/.i * eval(S/.i,x)
proof
  let n be Ordinal, L be Abelian right_zeroed add-associative
    right_complementable well-unital distributive non trivial doubleLoopStr,
    p be Polynomial of n,L,x be Function of n, L;
  let S be one-to-one FinSequence of Bags n such that
A1:rng S = Support p;
  set SG=SgmX(BagOrder n, Support p);
  consider y be FinSequence of L such that
A2: len y = len SG & eval(p,x) = Sum y and
A3: for i be Element of NAT st 1 <= i & i <= len y
    holds y/.i = (p * SG)/.i * eval((SG/.i),x) by POLYNOM2:def 4;
A4:BagOrder n linearly_orders Support p by POLYNOM2:18;
A5:SG is one-to-one & len SG = card Support p
    by POLYNOM2:18,PRE_POLY:10,11;
A6:rng SG = Support p 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;
  reconsider yH as FinSequence of L;
  take yH;
  thus len yH = card Support p by A7,A10,FINSEQ_3:29,A8,A5;
A12: len y = len yH by A2,A8,A7,A10,FINSEQ_3:29;
  for i be Nat st i in dom yH holds yH.i = y.(H.i) by FUNCT_1:12;
  hence eval(p,x) = Sum yH by A2,A12,RLVECT_2:6;
  let i be Nat such that
A13:1<=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 p = Bags n by FUNCT_2:def 1;
  then rng SG c= dom p & rng S c= dom p;
  then
A16: dom (p * SG) = dom SG & dom (p * S) = dom S by RELAT_1:27;
  then
A17:(p * SG)/.Hi = (p * SG).Hi by A14,A7,PARTFUN1:def 6
  .= p.(SG.Hi) by A16,A14,A7,FUNCT_1:12
  .= p.((SG*H).i) by A14,A13,FINSEQ_3:25,A7,A10,FUNCT_1:12
  .= (p*S).i by A7,A16,A13,FINSEQ_3:25,A10,FUNCT_1:12
  .= (p*S)/.i by A7,A16,A13,FINSEQ_3:25,A10,PARTFUN1:def 6;
  SG/.Hi = SG.(H.i) by A14,A7,PARTFUN1:def 6
  .= (SG*H).i by A13,FINSEQ_3:25,A7,A10,FUNCT_1:12
  .= S/.i by A13,FINSEQ_3:25,A7,A10,PARTFUN1:def 6;
  hence yH/.i = (p * S)/.i * eval(S/.i,x) by A3,A17,A14,A15;
end;
