reserve x,y,z for Real,
  a,b,c,d,e,f,g,h for Nat,
  k,l,m,n,m1,n1,m2,n2 for Integer,
  q for Rational;
reserve fs,fs1,fs2,fs3 for FinSequence;
reserve D for non empty set,
  v,v1,v2,v3 for object,
  fp for FinSequence of NAT,
  fr,fr1,fr2 for FinSequence of INT,
  ft for FinSequence of REAL;

theorem
  a in dom ft implies Sum Del(ft,a)+(ft.a)=Sum(ft)
proof
  defpred P[Nat] means $1 in dom ft implies (ft.$1)+Sum Del(ft,$1)=Sum(ft);
A1: for a st P[a] holds P[a+1]
  proof
    let a such that
    P[a];
    now
      per cases;
      suppose
A2:     a=0;
        thus P[a+1]
        proof
          reconsider ft1 = ft.1 as Element of REAL by XREAL_0:def 1;
          assume a+1 in dom ft;
          then a+1<=len ft by FINSEQ_3:25;
          then <*ft.1*>^Del(ft,1)=ft by A2,Lm15;
          then Sum(ft)=Sum(<*ft1*>)+Sum Del(ft,1) by RVSUM_1:75
            .=(ft.1)+Sum Del(ft,1) by FINSOP_1:11;
          hence thesis by A2;
        end;
      end;
      suppose
        a>0 & a<len ft;
        then a+1>=1 & a+1<=len ft by NAT_1:11,13;
        then
A3:     (a+1) in dom ft by FINSEQ_3:25;
        then consider fs1,fs2 such that
A4:     ft=fs1^<*ft.(a+1)*>^fs2 and
A5:     len fs1=(a+1)-1 and
        len fs2=len ft-(a+1) by Lm10;
          reconsider fta1 = ft.(a+1) as Element of REAL by XREAL_0:def 1;
A6:     Del(ft,a+1)=fs1^fs2 by A3,A4,A5,Lm11;
        reconsider fs2 as FinSequence of REAL by A4,FINSEQ_1:36;
        reconsider fs1 as FinSequence of REAL by A6,FINSEQ_1:36;
        Sum(ft)=Sum(fs1^<*ft.(a+1)*>)+Sum(fs2) by A4,RVSUM_1:75
          .=Sum(fs1)+Sum(<*fta1*>)+Sum(fs2) by RVSUM_1:75
          .=fta1+Sum(fs1)+Sum(fs2) by FINSOP_1:11
          .=(ft.(a+1))+(Sum(fs1)+Sum(fs2));
        hence thesis by A6,RVSUM_1:75;
      end;
      suppose
        a>=len ft;
        then a+1 > len ft by NAT_1:13;
        hence thesis by FINSEQ_3:25;
      end;
    end;
    hence thesis;
  end;
A7: P[0] by FINSEQ_3:25;
  for a holds P[a] from NAT_1:sch 2(A7,A1);
  hence thesis;
end;
