reserve a,b,c,d,m,x,n,j,k,l for Nat,
  t,u,v,z for Integer,
  f,F for FinSequence of NAT;
reserve p,q,r,s for real number;
reserve a,b,c,d,m,x,n,k,l for Nat,
  t,z for Integer,
  f,F,G for FinSequence of REAL;
reserve q,r,s for real number;
reserve D for set;

theorem Th17:
  for n be positive Nat st n+1 = len f holds
    Sum f = Sum((f|n)/^1) + f.1 + f.(n+1)
  proof
    let n be positive Nat such that
    A0: n+1 = len f;
    A2: f =(f|n)^<*f.(n+1)*> by A0,RFINSEQ:7;
    n >= 1 & len f >= n by A0,NAT_1:13,14; then
    A2a: n in dom f by FINSEQ_3:25;
    n+1 > n+0 by XREAL_1:6; then
    A3: len (f|n) > 0 by A0,FINSEQ_1:59;
    <*f.(n+1)*> is FinSequence of REAL by RVSUM_1:145; then
    Sum f = Sum (f|n) + Sum <*f.(n+1)*> by Th14,A2
    .= Sum (f|n) + f.(n+1) by RVSUM_1:73
    .= ((f|n).1 + Sum((f|n)/^1)) + f.(n+1) by A3,IRRAT_1:17;
    hence thesis by A2a,Th9;
  end;
