reserve i,j,k,n,m for Nat,
        X for set,
        b,s for bag of X,
        x for object;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
          right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;
reserve O for Ordinal,
        R for right_zeroed add-associative right_complementable
             right_unital distributive non trivial doubleLoopStr,
        p for Polynomial of O, R;

theorem Th66:
  for m be non trivial Nat
    for p be Jpolynom of m,F_Complex
      for f be FinSequence of REAL
        for xf,cxf be Function of m,F_Complex st
      xf = FS2XFS f & cxf = FS2XFS _sqrt(f) holds
  eval(p,cxf) = eval(JsqrtSeries p,xf)
proof
  let m be non trivial Nat;
  let p be Jpolynom of m,F_Complex;
  reconsider L=F_Complex as Field;
  let f be FinSequence of REAL;
  let xf,cxf be Function of m,F_Complex such that
A1:  xf = FS2XFS f &cxf = FS2XFS _sqrt(f);
  reconsider xfL=xf,cxfL=cxf  as Function of m,L;
  m>1 by NEWTON03:def 1;
  then
A2:for b be bag of m,n st b in Support p holds b.n is even by Def10;
  set c = JsqrtSeries p;
  reconsider P=p,C=c as Polynomial of m,L;
  set CS = SgmX(BagOrder m, Support C);
  consider Cy be FinSequence of L such that
A3: len Cy = len CS & eval(C,xfL) = Sum Cy and
A4: for i be Element of NAT st 1 <= i & i <= len Cy holds
  Cy/.i = (C * CS)/.i * eval((CS/.i),xfL) by POLYNOM2:def 4;
  BagOrder m linearly_orders  Support C by POLYNOM2:18;
  then
A5: rng CS = Support C & CS is one-to-one by PRE_POLY:def 2,10;
  then consider S be one-to-one FinSequence of Bags m such that
A6:len S = len CS & rng S = Support p and
A7:for i st i in dom S holds S.i = 2(#)(CS/.i) +* (0,(CS/.i.0)) by A2,Th65;
  consider y being FinSequence of L such that
A8: len y = card Support p & eval(P,cxfL) = Sum y and
A9: for i being Nat st 1 <= i & i <= len y holds
      y/.i = (P * S)/.i * eval(S/.i,cxfL) by A6,HILB10_2:24;
A10: card Support p = len S by A6,FINSEQ_4:62;
  for i st 1 <= i & i <= len y holds y.i = Cy.i
  proof
    let i such that
A11:1 <= i & i <= len y;
A12:i in NAT by ORDINAL1:def 12;
    rng CS c= Bags m = dom C by A5,FUNCT_2:def 1;
    then
A13: dom (C*CS) = dom CS by RELAT_1:27;
    rng S c= Bags m = dom P by A6,FUNCT_2:def 1;
    then
A14: dom (P*S) = dom S by RELAT_1:27;
A15: i in dom CS & i in dom S & i in dom y & i in dom Cy
    by A11,A10,A3,A6,A8,FINSEQ_3:25;
A16: (P * S)/.i = (P*S).i = P.(S.i) & S.i = S/.i
    by A14,A11,A10,A8,FINSEQ_3:25,PARTFUN1:def 6,FUNCT_1:12;
A17: (C * CS)/.i = (C*CS).i = C.(CS.i) & CS.i = CS/.i
    by A13,A11,A10,A6,A8,FINSEQ_3:25,PARTFUN1:def 6,FUNCT_1:12;
A18: S.i = 2(#)(CS/.i) +* (0,(CS/.i.0))
    by A11,A10,A8,FINSEQ_3:25,A7;
    then
A19:(C * CS)/.i = (P * S)/.i by A16,A17,Def12;
A20:Cy/.i = (C * CS)/.i * eval((CS/.i),xfL) by A12,A4,A11,A10,A3,A6,A8;
A21: y/.i = (P * S)/.i * eval(S/.i,cxfL) by A9,A11;
    set Si =SgmX(RelIncl m, support (S/.i));
    consider a be FinSequence of the carrier of L such that
A22: len a = len Si & eval(S/.i,cxfL) = Product a and
A23: for j being Element of NAT st 1 <= j & j <= len a holds
    a/.j = power(L).((cxfL * Si)/.j,
    ((S/.i) * Si)/.j) by POLYNOM2:def 2;
    support (S/.i) = support (CS/.i) by A16,A18,Th21;
    then consider Ca be FinSequence of the carrier of L such that
A24: len Ca = len Si & eval(CS/.i,xfL) = Product Ca and
A25: for j being Element of NAT st 1 <= j & j <= len Ca holds
    Ca/.j = power(L).((xfL * Si)/.j,
    ((CS/.i) * Si)/.j) by POLYNOM2:def 2;
    RelIncl m linearly_orders support (S/.i) by PRE_POLY:82;
    then
A26: rng Si = support (S/.i) by PRE_POLY:def 2;
    rng Si c= m = dom (S/.i) & m = dom (CS/.i) by A26,PARTFUN1:def 2;
    then
A27: dom ((CS/.i) * Si) = dom Si = dom ((S/.i) * Si) by RELAT_1:27;
    dom xfL = m = dom cxfL by FUNCT_2:def 1;
    then
A28: dom (xfL * Si) = dom Si = dom (cxfL * Si) by A26,RELAT_1:27;
    for j st 1<=j<= len a holds a.j = Ca.j
    proof
      let j such that
A29:  1<=j<= len a;
A30:  j in NAT by ORDINAL1:def 12;
A31:  j in dom Si & j in dom a & j in dom Ca by A29,A22,A24,FINSEQ_3:25;
      then
A32:  a.j = a/.j & Ca.j = Ca/.j by PARTFUN1:def 6;
A33: (cxfL * Si)/.j =(cxfL * Si).j = cxfL .(Si.j) & Si.j=Si/.j
      by A29,A22,FINSEQ_3:25,A28,PARTFUN1:def 6,FUNCT_1:12;
A34: ((S/.i) * Si)/.j = ((S/.i) * Si).j = (S/.i).( Si.j)
      by A27,A29,A22,FINSEQ_3:25,PARTFUN1:def 6,FUNCT_1:12;
A35:  (xfL * Si)/.j =(xfL * Si).j = xfL .(Si.j)
      by A28,A29,A22,FINSEQ_3:25,PARTFUN1:def 6,FUNCT_1:12;
A36:  ((CS/.i) * Si)/.j = ((CS/.i) * Si).j = (CS/.i).( Si.j)
      by A27,A29,A22,FINSEQ_3:25,PARTFUN1:def 6,FUNCT_1:12;
A37:  Si.j in rng Si by A31,FUNCT_1:def 3;
      then
A38:  Si.j in m=Segm m by A26;
      then reconsider Sij=Si.j as Nat;
A39:  Sij < m by A38,NAT_1:44;
A40:  len f = len (FS2XFS f) = m = len (FS2XFS (_sqrt f)) = len _sqrt(f)
      by A1,AFINSQ_1:def 8,FUNCT_2:def 1;
A41:  xfL .Sij = f.(Sij+1) by A1,A40,A38,NAT_1:44,AFINSQ_1:def 8;
A42:  cxfL .Sij = (_sqrt f).(Sij+1) by A1,A40,A38,NAT_1:44,AFINSQ_1:def 8;
A43:  Ca/.j = power(L).((xfL * Si)/.j,
      ((CS/.i) * Si)/.j) by A30,A22,A24,A25,A29;
A44:  dom (2(#)(CS/.i))=m by PARTFUN1:def 2;
      1<= Sij+1 <= m by A39,NAT_1:11,13;
      then
A45:  Sij+1 in dom f by A40,FINSEQ_3:25;
      per cases;
      suppose
A46:    Sij =0;
        then
A47:    (cxfL * Si)/.j = (xfL * Si)/.j by A41,A42,A33,A35,Def11;
        ((S/.i) * Si)/.j=
        (2(#)(CS/.i) +* (0,(CS/.i.0))).Sij
        by A14,A11,A10,A8,FINSEQ_3:25,PARTFUN1:def 6,A18,A34
        .= ((CS/.i) * Si)/.j by A36,A46,A37,A26,A44,FUNCT_7:31;
        hence thesis by A47,A32,A30,A23,A29,A43;
      end;
      suppose
A48:    Sij<>0;
        then Sij+1<>1;
        then ((_sqrt f).(Sij+1))*((_sqrt f).(Sij+1))=
           ((_sqrt f).(Sij+1))^2 = f.(Sij+1) by A45,Def11,SQUARE_1:def 1;
        then
A49:    multcomplex.(((_sqrt f).(Sij+1)),
        ((_sqrt f).(Sij+1))) = f.(Sij+1) by BINOP_2:def 5;
        ((S/.i) * Si)/.j= (2(#)(CS/.i) +* (0,(CS/.i.0))).Sij
        by A14,A11,A10,A8,FINSEQ_3:25,PARTFUN1:def 6,A18,A34
        .= (2(#)(CS/.i)).Sij by A48,FUNCT_7:32
        .= 2*((CS/.i) * Si)/.j by A36,VALUED_1:6;
        hence a.j = power(L).((cxfL * Si)/.j,
        ((CS/.i) * Si)/.j+((CS/.i) * Si)/.j) by A32,A30,A23,A29
        .= power(L).((cxfL * Si)/.j,((CS/.i) * Si)/.j)
        * power(L).((cxfL * Si)/.j,((CS/.i) * Si)/.j) by HURWITZ:3
        .= power(L).((cxfL * Si)/.j * (cxfL * Si)/.j,((CS/.i) * Si)/.j)
        by GROUP_1:52
        .= power(L).((xfL * Si)/.j,((CS/.i) * Si)/.j)
        by A49,A41,A42,A33,A35,COMPLFLD:def 1
        .= Ca.j by A32,A30,A22,A24,A25,A29;
      end;
    end;
    then Cy/.i = y/.i=y.i by A19,A20,A21,A15,PARTFUN1:def 6,
    A22,A24,FINSEQ_1:14;
    hence thesis by A15,PARTFUN1:def 6;
  end;
  hence thesis by A8,A3,A6,FINSEQ_4:62,FINSEQ_1:14;
end;
