reserve i,j,k,n,m,l,s,t for Nat;
reserve a,b for Real;
reserve F for real-valued FinSequence;
reserve z for Complex;
reserve x,y for Complex;
reserve r,s,t for natural Number;

theorem
  for m,F st m <> 0 & len F = m & (for i,l st i in dom F & l = n+i-1
  holds F.i = l choose n) holds Sum F = (n+m) choose (n+1)
proof
  defpred P[Nat] means for F st $1 <> 0 & len F = $1 & (for i,l st i in dom F
  & l = n+i-1 holds F.i = l choose n) holds Sum F = (n+$1) choose (n+1);
A1: for m st P[m] holds P[m+1]
  proof
    let m;
    assume
A2: P[m];
    let F;
    assume that
    m+1 <> 0 and
A3: len F = m+1 and
A4: for i,l st i in dom F & l = n+i-1 holds F.i = l choose n;
    rng F c= REAL;
    then F is FinSequence of REAL by FINSEQ_1:def 4;
    then
    consider G be FinSequence of REAL,x being Element of REAL such that
A5: F = G^<*x*> by A3,FINSEQ_2:19;
A6: m+1 = len G +1 by A3,A5,FINSEQ_2:16;
    per cases;
    suppose
A7:   m = 0;
A8:   n = n+1-1;
      reconsider c = n choose n as Element of REAL by XREAL_0:def 1;
A9:   dom F = Seg 1 by A3,A7,FINSEQ_1:def 3;
      then 1 in dom F;
      then F.1 = n choose n by A4,A8;
      hence Sum F = Sum<*c*> by A9,FINSEQ_1:def 8
        .= n choose n by FINSOP_1:11
        .= 1 by Th21
        .= (n+(m+1)) choose (n+1) by A7,Th21;
    end;
    suppose
A10:  m <> 0;
A11:  n+m = n +(m+1)-1;
A12:  for i,l st i in dom G & l = n+i-1 holds G.i = l choose n
      proof
A13:    dom G c= dom F by A5,FINSEQ_1:26;
        let i,l;
        assume that
A14:    i in dom G and
A15:    l = n+i-1;
        G.i = F.i by A5,A14,FINSEQ_1:def 7;
        hence thesis by A4,A14,A15,A13;
      end;
      dom F = Seg (m+1) by A3,FINSEQ_1:def 3;
      then
A16:  (n+m) choose n = (G^<*x*>).(len G +1) by A4,A5,A6,A11,FINSEQ_1:4
        .= x by FINSEQ_1:42;
      thus Sum F = Sum G + x by A5,RVSUM_1:74
        .= (n+m) choose (n+1) + (n+m) choose n by A2,A6,A10,A12,A16
        .= (n+m+1) choose (n+1) by Th22
        .= (n+(m+1)) choose (n+1);
    end;
  end;
A17: P[0];
  thus for m holds P[m] from NAT_1:sch 2(A17,A1);
end;
