
theorem Th29:
  for R being right_zeroed add-associative right_complementable
well-unital distributive non trivial doubleLoopStr, n being Nat,
   b being bag of n, p1 being Polynomial of n, R, F being FinSequence of
  the carrier of Polynom-Ring (n,R) st p1 = Sum F ex g being Function of the
carrier of Polynom-Ring (n, R), the carrier of R st (for p being Polynomial of
  n, R holds g.p = p.b) & p1.b = Sum (g*F)
proof
  let R be right_zeroed add-associative right_complementable well-unital
  distributive non trivial doubleLoopStr, n be Nat, b be
  bag of n,p1 be Polynomial of n, R, F be FinSequence of the carrier of
  Polynom-Ring (n,R);
  assume
A1: p1 = Sum F;
  set CR = the carrier of R;
  set PNR = Polynom-Ring (n,R);
  set CPNR = the carrier of PNR;
  defpred P1[Element of CPNR, Element of CR] means for p being Polynomial of n
  , R st p = $1 holds $2 = p.b;
A2: now
    let x be Element of CPNR;
    reconsider x9=x as Polynomial of n, R by POLYNOM1:def 11;
    P1[x,x9.b];
    hence ex y being Element of CR st P1[x,y];
  end;
  consider g be Function of CPNR,CR such that
A3: for x being Element of CPNR holds P1[x,g.x] from FUNCT_2:sch 3(A2);
  take g;
  now
    let p be Polynomial of n,R;
    reconsider p9=p as Element of CPNR by POLYNOM1:def 11;
    P1[p9,g.p9] by A3;
    hence g.p = p.b;
  end;
  hence for p being Polynomial of n, R holds g.p = p.b;
  defpred P2[Nat] means for F9 being FinSequence of CPNR, p19 being Polynomial
  of n, R st len F9 <= $1 & p19 = Sum F9 holds p19.b = Sum (g * F9);
A4: for k being Nat st P2[k] holds P2[k+1]
  proof
    let k be Nat;
    assume
A5: P2[k];
    now
      let F9 be FinSequence of CPNR, p19 be Polynomial of n, R;
      assume that
A6:   len F9 <= k+1 and
A7:   p19 = Sum F9;
      per cases;
      suppose
        len F9 < k+1;
        then len F9 <= k by NAT_1:13;
        hence p19.b = Sum (g * F9) by A5,A7;
      end;
      suppose
        len F9 >= k+1;
        then len F9 = k+1 by A6,XXREAL_0:1;
        then consider p,q being FinSequence such that
A8:     len p = k and
A9:     len q = 1 and
A10:    F9 = p^q by FINSEQ_2:22;
        rng q c= rng F9 by A10,FINSEQ_1:30;
        then rng q c= CPNR by XBOOLE_1:1;
        then reconsider q as FinSequence of CPNR by FINSEQ_1:def 4;
        rng p c= rng F9 by A10,FINSEQ_1:29;
        then rng p c= CPNR by XBOOLE_1:1;
        then reconsider p as FinSequence of CPNR by FINSEQ_1:def 4;
A11:    Sum F9 = Sum p + Sum q by A10,RLVECT_1:41;
        reconsider p9 = Sum p as Polynomial of n, R by POLYNOM1:def 11;
A12:    g * F9 = (g * p)^(g* q) by A10,FINSEQOP:9;
        1 in dom q by A9,FINSEQ_3:25;
        then q.1 in rng q by FUNCT_1:def 3;
        then reconsider q9=q.1 as Element of CPNR;
        reconsider q99=q9 as Polynomial of n, R by POLYNOM1:def 11;
A13:    q = <* q9 *> by A9,FINSEQ_1:40;
        then g * q = <* g.q9 *> by FINSEQ_2:35
          .= <* q99.b *> by A3;
        then
A14:    Sum (g * q) = q99.b by RLVECT_1:44;
        q9 = Sum q by A13,RLVECT_1:44;
        then
A15:    p19 = p9 + q99 by A7,A11,POLYNOM1:def 11;
        p9.b = Sum (g * p) by A5,A8;
        hence p19.b = Sum (g * p) + Sum (g * q) by A14,A15,POLYNOM1:15
          .= Sum (g * F9) by A12,RLVECT_1:41;
      end;
    end;
    hence thesis;
  end;
A16: P2[ 0 ]
  proof
    let F9 being FinSequence of CPNR, p19 be Polynomial of n, R;
    assume that
A17: len F9 <= 0 and
A18: p19 = Sum F9;
A19: F9 = <*> (CPNR) by A17;
    then g * F9 = <*> (CR);
    then
A20: Sum (g * F9) = 0.R by RLVECT_1:43;
    p19 = 0.PNR by A18,A19,RLVECT_1:43
      .= 0_(n, R) by POLYNOM1:def 11;
    hence thesis by A20,POLYNOM1:22;
  end;
  for k being Nat holds P2[k] from NAT_1:sch 2(A16,A4);
  then P2[len F];
  hence thesis by A1;
end;
