reserve n,m,k for Nat;
reserve a,p,r for Real;
reserve s,s1,s2,s3 for Real_Sequence;

theorem Th28:
  (for n holds s.n>=0 & s1.n = n-root (s.n)) & s1 is convergent &
  lim s1 < 1 implies s is summable
proof
  assume that
A1: for n holds s.n>=0 & s1.n = n-root (s.n) and
A2: s1 is convergent and
A3: lim s1 < 1;
A4: now
    let n;
A5: (s1^\1).n = s1.(n+1) by NAT_1:def 3
      .= (n+1)-root (s.(n+1)) by A1;
    s.(n+1) >= 0 by A1;
    hence (s1^\1).n >= 0 by A5,NAT_1:11,POWER:7;
  end;
  set r = (1 - lim s1)/2;
  0 + lim s1 < 1 by A3;
  then 0 < 1 - lim s1 by XREAL_1:20;
  then r > 0;
  then consider m such that
A6: for n st m <= n holds |.s1.n - lim s1.| < r by A2,SEQ_2:def 7;
  lim (s1^\1) = lim s1 by A2,SEQ_4:20;
  then
A7: lim s1 >= 0 by A2,A4,PREPOWER:1;
  then 1 + -lim s1 < 1 + 1 by XREAL_1:6;
  then (1 - lim s1)/2 < 2/2 by XREAL_1:74;
  then
A8: 1 - r > 0 by XREAL_1:50;
  set s2 = (1-r) GeoSeq;
A9: r + lim s1 = 1 - r;
A10: for n st m+1<=n holds s.n <= (1-r) to_power n
  proof
    let n;
    assume
A11: m+1<=n;
    1<=m+1 by NAT_1:11;
    then
A12: 1 <= n by A11,XXREAL_0:2;
A13: s.n >= 0 by A1;
    m<=n by A11,NAT_1:13;
    then |.s1.n - lim s1.| < r by A6;
    then s1.n - lim s1 < r by SEQ_2:1;
    then s1.n < 1 - r by A9,XREAL_1:19;
    then
A14: n-root (s.n) < 1 - r by A1;
    now
      per cases;
      suppose
        s.n = 0;
        hence s.n < (1 - r) to_power n by A8,POWER:34;
      end;
      suppose
        s.n <> 0;
        then n -Root (s.n) > 0 by A12,A13,PREPOWER:def 2;
        then n-root (s.n) > 0 by A12,A13,POWER:def 1;
        then (n-root (s.n)) to_power n < (1-r) to_power n by A11,A14,POWER:37;
        hence s.n < (1-r) to_power n by A12,A13,POWER:4;
      end;
    end;
    hence thesis;
  end;
A15: for n st m+1 <= n holds s.n <= s2.n
  proof
    let n;
    s2.n = (1-r) to_power n by PREPOWER:def 1;
    hence thesis by A10;
  end;
  1 - lim s1 <= 1 - 0 by A7,XREAL_1:6;
  then 1 - lim s1 < 2 * 2 by XXREAL_0:2;
  then r < 2 * 2 / 2 by XREAL_1:74;
  then r < 1 + 1;
  then r - 1 < 1 by XREAL_1:19;
  then
A16: - (r - 1) > - 1 by XREAL_1:24;
  1 - lim s1 > 0 by A3,XREAL_1:50;
  then r > 0;
  then 1 - r < 1 - 0 by XREAL_1:10;
  then |.1-r.| < 1 by A16,SEQ_2:1;
  then s2 is summable by Th24;
  hence thesis by A1,A15,Th19;
end;
