reserve c, c1, c2, d, d1, d2, e, y for Real,
  k, n, m, N, n1, N0, N1, N2, N3, M for Element of NAT,
  x for set;

theorem
  for f being Real_Sequence, k being Element of NAT st (for n holds f.n
  = Sum(seq_n^(k), n)) holds f in Big_Theta(seq_n^(k+1))
proof
  let f be Real_Sequence, k be Element of NAT such that
A1: for n holds f.n = Sum(seq_n^(k), n);
  set g = seq_n^(k+1);
A2: f is Element of Funcs(NAT, REAL) by FUNCT_2:8;
A3: now
    set p = seq_n^(k);
    let n;
    set n1 = [/n/2\];
    ex s being Real_Sequence st s.0 = 0 & for m st m > 0 holds s.m = ((n/
    2) to_power k)
    proof
      defpred P[Element of NAT,Real] means ($1 = 0 implies $2 = 0) & ($1 > 0
      implies $2 = ((n/2) to_power k));
A4:   for x being Element of NAT ex y being Element of REAL st P[x,y]
      proof
        let x be Element of NAT;
        per cases;
        suppose
          x = zz;
          hence thesis;
        end;
        suppose
A5:       x > 0;
           reconsider y = (n/2) to_power k as Element of REAL by XREAL_0:def 1;
          take y;
          thus thesis by A5;
        end;
      end;
      consider h being sequence of REAL such that
A6:   for x being Element of NAT holds P[x,h.x] from FUNCT_2:sch 3(
      A4);
      take h;
      thus h.0 = 0 by A6;
      let n;
      thus thesis by A6;
    end;
    then consider q being Real_Sequence such that
A7: q.0 = 0 and
A8: for m st m > 0 holds q.m = (n/2) to_power k;
A9: [/n/2\] >= n/2 by INT_1:def 7;
    then reconsider n1 as Element of NAT by INT_1:3;
    set n2 = n1-1;
    assume
A10: n >= 1;
    then
A11: n*2" > 0*2" by XREAL_1:68;
    then
A12: ((n/2) to_power k) > 0 by POWER:34;
    now
      assume n2 < 0;
      then (n1-1)+1 <= -1+1;
      hence contradiction by A11,INT_1:def 7;
    end;
    then reconsider n2 as Element of NAT by INT_1:3;
A13: now
      [/n/2\] < n/2 + 1 by INT_1:def 7;
      then n2 < n/2 by XREAL_1:19;
      then
A14:  n/2 + n2 < n/2 + n/2 by XREAL_1:6;
      assume n-n2 < n/2;
      hence contradiction by A14,XREAL_1:19;
    end;
    Sum(q,n,n2) = (n-n2)*((n/2) to_power k) by A7,A8,Lm18;
    then Sum(q,n,n2) >= (n/2) * ((n/2) to_power k) by A13,A12,XREAL_1:64;
    then Sum(q,n,n2) >= ((n/2) to_power 1) * ((n/2) to_power k) by POWER:25;
    then Sum(q,n,n2) >= ((n/2) to_power (k+1)) by A11,POWER:27;
    then
A15: Sum(q,n,n2) >= (n to_power (k+1))/(2 to_power (k+1)) by A10,POWER:31;
A16: f.n = Sum(p, n) by A1;
A17: now
      let m;
      assume m <= n;
      per cases;
      suppose
        m = 0;
        hence p.m >= 0 by Def3;
      end;
      suppose
        m > 0;
        then p.m = m to_power k by Def3;
        hence p.m >= 0;
      end;
    end;
    now
      let m;
      n1 <= n1+1 by NAT_1:11;
      then
A18:  n2 <= n1 by XREAL_1:20;
A19:  n1 <= n by Lm17;
      assume m <= n2;
      then m <= n1 by A18,XXREAL_0:2;
      then m <= n by A19,XXREAL_0:2;
      hence p.m >= 0 by A17;
    end;
    then Sum(p,n2) >= 0 by Lm12;
    then
A20: Sum(p,n) + Sum(p,n2) >= Sum(p,n) + 0 by XREAL_1:7;
A21: for N0 st n1 <= N0 & N0 <= n holds q.N0 <= p.N0
    proof
      let N0;
      assume that
A22:  n1 <= N0 and
      N0 <= n;
A23:  N0 >= n/2 by A9,A22,XXREAL_0:2;
A24:  p.N0 = N0 to_power k by A11,A9,A22,Def3;
      q.N0 = (n/2) to_power k by A8,A11,A9,A22;
      hence thesis by A11,A24,A23,Lm6;
    end;
    n >= n2 + 1 by Lm17;
    then Sum(p,n,n2) >= Sum(q,n,n2) by A21,Lm16;
    then
A25: Sum(p,n,n2) >= (n to_power (k+1))*(2 to_power (k+1))" by A15,XXREAL_0:2;
    Sum(p,n,n2) = Sum(p,n) - Sum(p,n2) by SERIES_1:def 6;
    then
A26: Sum(p,n) >= Sum(p,n,n2) by A20,XREAL_1:20;
    g.n = n to_power (k+1) by A10,Def3;
    hence (2 to_power (k+1))"*g.n <= f.n by A16,A26,A25,XXREAL_0:2;
    Sum(p,n) >= 0 by A17,Lm12;
    hence f.n >= 0 by A1;
  end;
  now
    set p = seq_n^(k);
    let n;
    assume
A27: n >= 1;
    ex s being Real_Sequence st s.0 = 0 & for m st m > 0 holds s.m = (n
    to_power k)
    proof
      defpred P[Element of NAT,Real] means ($1 = 0 implies $2 = 0) & ($1 > 0
      implies $2 = n to_power k);
A28:  for x being Element of NAT ex y being Element of REAL st P[x,y]
      proof
        let x be Element of NAT;
        per cases;
        suppose
          x = zz;
          hence thesis;
        end;
        suppose
A29:        x > 0;
           reconsider y = n to_power k as Element of REAL by XREAL_0:def 1;
          take y;

          thus thesis by A29;
        end;
      end;
      consider h being sequence of REAL such that
A30:  for x being Element of NAT holds P[x,h.x] from FUNCT_2:sch 3(
      A28
      );
      take h;
      thus h.0 = 0 by A30;
      let n;
      thus thesis by A30;
    end;
    then consider q being Real_Sequence such that
A31: q.0 = 0 and
A32: for m st m > 0 holds q.m = n to_power k;
    now
      let m;
      assume
A33:  m <= n;
      per cases;
      suppose
        m = 0;
        hence p.m <= q.m by A31,Def3;
      end;
      suppose
A34:    m > 0;
        then
A35:    q.m = n to_power k by A32;
        p.m = m to_power k by A34,Def3;
        hence p.m <= q.m by A33,A34,A35,Lm6;
      end;
    end;
    then
A36: Sum(p, n) <= Sum(q, n) by Lm13;
    Sum(q, n) = (n to_power k)*n by A31,A32,Lm14
      .= (n to_power k)*(n to_power 1) by POWER:25
      .= n to_power (k+1) by A27,POWER:27
      .= g.n by A27,Def3;
    hence f.n <= 1*g.n by A1,A36;
A37: now
      let m;
      assume m <= n;
      per cases;
      suppose
        m = 0;
        hence p.m >= 0 by Def3;
      end;
      suppose
        m > 0;
        then p.m = m to_power k by Def3;
        hence p.m >= 0;
      end;
    end;
    f.n = Sum(p, n) by A1;
    hence f.n >= 0 by A37,Lm12;
  end;
  then
A38: f in Big_Oh(g) by A2;
  2 to_power (k+1) > 0 by POWER:34;
  then f in Big_Omega(g) by A2,A3;
  hence thesis by A38,XBOOLE_0:def 4;
end;
