reserve a, b, p, q for Real;

theorem Th10:
  for p be Real st 0 < p
for a,ap be Real_Sequence st a is
  convergent & (for n be Nat holds 0 <=a.n ) &
   (for n be Nat holds ap.n=(a.n) to_power p)
holds ap is convergent & lim ap = (lim a) to_power p
proof
  let p be Real such that
A1: 0 < p;
  let a,ap be Real_Sequence such that
A2: a is convergent and
A3: for n be Nat holds 0 <=a.n and
A4: for n be Nat holds ap.n=(a.n) to_power p;
  now
    per cases;
    case
A5:   lim a =0;
      now
        per cases;
        case
          ex n be Nat st for m be Nat st n<=m
          holds a.m=0;
          then consider N be Nat such that
A6:       for m be Nat st N<=m holds a.m=0;
A7:       for n be Nat holds (a^\N).n=0
          proof
            let n be Nat;
            a.(n+N)=0 by A6,NAT_1:12;
            hence thesis by NAT_1:def 3;
          end;
A8:       now
            let e be Real such that
A9:         e>0;
             reconsider n=0 as Nat;
            take n;
            let m be Nat such that
            n<=m;
A10:        (lim a) to_power p = 0 by A1,A5,POWER:def 2;
            (ap^\N).m= ap.(m+N) by NAT_1:def 3
              .= (a.(m+N)) to_power p by A4
              .= ((a^\N).m) to_power p by NAT_1:def 3
              .= 0 to_power p by A7
              .= 0 by A1,POWER:def 2;
            hence |.(ap^\N).m-((lim a) to_power p).| < e by A9,A10,ABSVALUE:2;
          end;
          then
A11:      (ap^\N) is convergent by SEQ_2:def 6;
          then ((lim a) to_power p) =lim(ap^\N) by A8,SEQ_2:def 7;
          hence thesis by A11,SEQ_4:20,21;
        end;
        case
A12:      for n be Nat ex m be Nat st n<=m & a. m<>0;
          defpred P[set] means a.$1 <> 0;
          ex m1 be Nat st 0<=m1 & a.m1 <>0 by A12;
          then
A13:      ex m be Nat st P[m];
          consider M be Nat such that
A14:      P[M] & for n be Nat st P[n] holds M<=n from NAT_1:sch 5(A13
          );
          defpred P[set,set,set] means for n,m be Nat st $2=n & $3=
m holds n<m & a.m <>0 & for k be Nat st n<k & a.k <>0 holds m<=k;
A15:      (lim a) to_power p =0 by A1,A5,POWER:def 2;
          reconsider M as Nat;
A16:      now
            let n be Nat;
            consider m be Nat such that
A17:        n+1<=m & a.m <>0 by A12;
            take m;
            thus n<m & a.m <>0 by A17,NAT_1:13;
          end;
A18:      for n being Nat, x being Element of NAT
            ex y being Element of NAT st P[n,x,y]
          proof
            let n be Nat, x be Element of NAT;
            defpred P[Nat] means x<$1 & a.$1 <>0;
            ex m be Nat st P[m] by A16;
            then
A19:        ex m be Nat st P[m];
            consider l be Nat such that
A20:        P[l] & for k be Nat st P[k] holds l<=k from NAT_1:sch 5(
            A19);
            take l;
            l in NAT by ORDINAL1:def 12;
            hence thesis by A20;
          end;
          reconsider zz=0 as Element of NAT;
          consider F be sequence of NAT such that
A21:      F.0=In(M,NAT) & for n be Nat holds P[n,F.n,F.(n+1)]
               from RECDEF_1:sch 2(A18);
      rng F c= NAT by RELAT_1:def 19;
          then
A22:      rng F c= REAL by NUMBERS:19;
      dom F=NAT by FUNCT_2:def 1;
          then reconsider F as Real_Sequence by A22,RELSET_1:4;
          for n being Nat holds F.n<F.(n+1) by A21;
          then reconsider F as increasing sequence of NAT by SEQM_3:def 6;
A23:      for n be Nat st a.n <> 0 ex m be Nat st F .m=n
          proof
            defpred P[set] means a.$1 <>0 & for m be Nat holds F.m
            <>$1;
            assume ex n be Nat st P[n];
            then
A24:        ex n be Nat st P[n];
            consider M1 be Nat such that
A25:        P[M1] & for n be Nat st P[n] holds M1<=n from NAT_1:sch 5
            (A24);
            defpred P[Nat] means $1<M1 & a.$1 <> 0 & ex m be Nat st
            F.m=$1;
A26:        ex n be Nat st P[n]
            proof
              take M;
              M<=M1 & M <> M1 by A14,A21,A25;
              hence M<M1 by XXREAL_0:1;
              thus a.M <>0 by A14;
              take 0;
              thus thesis by A21;
            end;
A27:        for n be Nat st P[n] holds n<=M1;
            consider MX be Nat such that
A28:        P[MX] & for n be Nat st P[n] holds n<=MX from NAT_1:sch 6
            (A27,A26);
A29:        for k be Nat st MX<k & k<M1 holds a.k=0
            proof
              given k be Nat such that
A30:          MX<k and
A31:          k<M1 & a.k <> 0;
              now
                per cases;
                case
                  ex m be Nat st F.m=k;
                  hence contradiction by A28,A30,A31;
                end;
                case
                  for m be Nat holds F.m<>k;
                  hence contradiction by A25,A31;
                end;
              end;
              hence contradiction;
            end;
            consider m be Nat such that
A32:        F.m=MX by A28;
A33:        MX<F.(m+1) & a.(F.(m+1))<>0 by A21,A32;
A34:        F.(m+1)<=M1 by A21,A25,A28,A32;
            now
              assume F.(m+1)<>M1;
              then F.(m+1)<M1 by A34,XXREAL_0:1;
              hence contradiction by A29,A33;
            end;
            hence contradiction by A25;
          end;
A35:      a*F is convergent & lim (a*F)=0 by A2,A5,SEQ_4:16,17;
A36:      now
            let e be Real;
            assume
A37:        0<e;
            then 0 < (e to_power (1/p) ) by POWER:34;
            then consider n be Nat such that
A38:        for m be Nat st n<=m holds |.(a*F).m-0.| < (e
            to_power (1/p) ) by A35,SEQ_2:def 7;
            reconsider k=F.n as Nat;
            take k;
            let m be Nat such that
A39:        k<=m;
            now
              per cases;
              case
                a.m=0;
                then ap.m= 0 to_power p by A4
                  .= 0 by A1,POWER:def 2;
                hence |.ap.m-((lim a) to_power p).|<e by A15,A37,ABSVALUE:2;
              end;
              case
A40:            a.m<>0;
                then consider l be Nat such that
A41:            m=F.l by A23;
A42:      l in NAT by ORDINAL1:def 12;
                n<=l by A39,A41,SEQM_3:1;
                then |.(a*F).l-0.|< (e to_power (1/p) ) by A38;
                then
A43:            |.a.(F.l).|< (e to_power (1/p) ) by FUNCT_2:15,A42;
A44:            (a.m) to_power p = ap.m by A4;
A45:            a.m > 0 by A3,A40;
                then
A46:            0 < ap.m by A44,POWER:34;
                |.a.m.| > 0 by A40,COMPLEX1:47;
                then |.a.m.| to_power p < (e to_power (1/p) ) to_power p by A1
,A41,A43,POWER:37;
                then |.a.m.| to_power p < e to_power ( (1/p) *p ) by A37,
POWER:33;
                then |.a.m.| to_power p < e to_power 1 by A1,XCMPLX_1:106;
                then |.a.m.| to_power p < e by POWER:25;
                then ap.m < e by A45,A44,ABSVALUE:def 1;
                hence |.ap.m -((lim a) to_power p).| < e by A15,A46,
ABSVALUE:def 1;
              end;
            end;
            hence |.ap.m -((lim a) to_power p).| < e;
          end;
          hence ap is convergent by SEQ_2:def 6;
          hence lim ap = (lim a) to_power p by A36,SEQ_2:def 7;
        end;
      end;
      hence thesis;
    end;
    case
A47:  lim a <>0;
A48:  0 <= lim a by A2,A3,SEQ_2:17;
      ex k be Nat st rng (a^\k) c= dom ( #R p)
      proof
        set e0=(lim a );
A49:    e0/2 > 0 by A47,A48,XREAL_1:215;
        then consider k be Nat such that
A50:    for m be Nat st k<=m holds |.a.m-e0.|<e0/2 by A2,
SEQ_2:def 7;
        take k;
A51:    now
          let m be Nat;
          |.a.(k+m)-e0.|<e0/2 by A50,NAT_1:12;
          then -(e0/2) <= a.(k+m)-e0 by ABSVALUE:5;
          then -(e0/2)+e0 <= a.(k+m)-e0+e0 by XREAL_1:7;
          hence 0 < (a^\k).m by A49,NAT_1:def 3;
        end;
          let x be object;
          assume x in rng (a^\k);
          then consider n be Element of NAT such that
A52:      x = (a^\k).n by FUNCT_2:113;
          0 < (a^\k).n by A51;
          then (a^\k).n in {g where g is Real: 0<g};
          then (a^\k).n in right_open_halfline(0) by XXREAL_1:230;
          hence x in dom ( #R p) by A52,TAYLOR_1:def 4;
      end;
      then consider k be Nat such that
A53:  rng (a^\k) c= dom ( #R p);
      now
        let x be object;
        assume x in NAT;
        then reconsider n=x as Element of NAT;
        (a^\k).n in rng (a^\k) by VALUED_0:28;
        then (a^\k).n in dom ( #R p) by A53;
        then
A54:    (a^\k).n in right_open_halfline(0) by TAYLOR_1:def 4;
        then a.(k+n) in right_open_halfline(0) by NAT_1:def 3;
        then a.(k+n) in {g where g is Real: 0<g} by XXREAL_1:230;
        then
A55:    ex g be Real st a.(k+n) = g & g > 0;
        thus (( #R p)/*(a^\k)).x = ( #R p).((a^\k).n) by A53,FUNCT_2:108
          .=((a^\k).n) #R p by A54,TAYLOR_1:def 4
          .=(a.(k+n)) #R p by NAT_1:def 3
          .=(a.(k+n)) to_power p by A55,POWER:def 2
          .=ap.(k+n) by A4
          .=(ap^\k).x by NAT_1:def 3;
      end;
      then
A56:  ( #R p)/*(a^\k) = ap^\k by FUNCT_2:12;
A57:  lim (a^\k) = lim a by A2,SEQ_4:20;
      lim a > 0 by A2,A3,A47,SEQ_2:17;
      then ( #R p) is_continuous_in lim (a^\k) by A57,FDIFF_1:24,TAYLOR_1:21;
      then
A58:  ( #R p)/*(a^\k) is convergent & ( #R p).(lim (a^\k)) = lim (( #R p
      )/*(a^\k)) by A2,A53,FCONT_1:def 1;
      lim a in {g where g is Real: 0<g} by A47,A48;
      then lim a in right_open_halfline(0) by XXREAL_1:230;
      then ( #R p).(lim (a^\k)) =(lim a) #R p by A57,TAYLOR_1:def 4
        .=(lim a) to_power p by A47,A48,POWER:def 2;
      hence thesis by A58,A56,SEQ_4:21,22;
    end;
  end;
  hence thesis;
end;
