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

theorem
  a <> 1 & (for n holds s.(n+1) = a * s.n) implies for n holds
  Partial_Sums(s).n = s.0 * (1 - a to_power (n+1))/(1-a)
proof
  assume that
A1: a <> 1 and
A2: for n holds s.(n+1) = a * s.n;
  defpred X[Nat] means s.$1 = s.0 * a GeoSeq.$1;
A3: for n st X[n] holds X[n+1]
  proof
    let n;
    assume s.n = s.0 * a GeoSeq.n;
    then s.(n+1) = a * (s.0 * a GeoSeq.n) by A2
      .= s.0 * (a GeoSeq.n * a)
      .= s.0 * a GeoSeq.(n+1) by PREPOWER:3;
    hence thesis;
  end;
  a GeoSeq.0 = 1 by PREPOWER:3;
  then
A4: X[0];
  for n holds X[n] from NAT_1:sch 2(A4,A3);
  then s = s.0 (#) a GeoSeq by SEQ_1:9;
  then
A5: Partial_Sums(s) = s.0 (#) Partial_Sums(a GeoSeq) by Th9;
  now
    let n;
    thus Partial_Sums(s).n = s.0 * Partial_Sums(a GeoSeq).n by A5,SEQ_1:9
      .= s.0 * ((1 - a to_power (n+1))/(1-a)) by A1,Th22
      .= s.0 * (1 - a to_power (n+1))/(1-a);
  end;
  hence thesis;
end;
