reserve x,y for set;
reserve a,b for Real;
reserve i,j for Integer;
reserve V for RealLinearSpace;
reserve W1,W2,W3 for Subspace of V;
reserve v,v1,v2,v3,u,w,w1,w2,w3 for VECTOR of V;
reserve A,B,C for Subset of V;
reserve L,L1,L2 for Linear_Combination of V;
reserve l,l1,l2 for Linear_Combination of A;

theorem Th29:
for RS be RealLinearSpace,
      f be FinSequence of RS,
      v be Element of RS ,i be Nat st i in Seg (len f)
    & f = ( (Seg (len f)) --> 0.RS) +* ( {i} --> v)
holds Sum(f)=v
proof
  let RS be RealLinearSpace, f be FinSequence of RS;
  let v be Element of RS, i be Nat;
  defpred P[Nat] means for g be FinSequence of RS
   st len g = $1 & i in Seg (len g) &
   g = ( (Seg (len g)) --> 0.RS) +* ( {i} --> v) holds Sum(g)=v;
A1: P[0];
A2: now let n be Nat;
    assume A3: P[n];
     now let f be FinSequence of RS;
     assume A4: len f = n+1 & i in Seg (len f) &
     f = ((Seg len f) --> 0.RS) +* ( {i} --> v);
     reconsider g = f|n as FinSequence of RS;
     n+1 in Seg (n+1) by FINSEQ_1:4; then
     A5: n+1 in dom f by A4,FINSEQ_1:def 3;
     A6: len g = n by A4,FINSEQ_1:59,NAT_1:11;
     f = (f|n) ^<*f.(n+1)*> by A4,FINSEQ_3:55
          .=g ^<*f/.(n+1)*> by A5,PARTFUN1:def 6;
    then
    A7: Sum(f)=Sum(g)+Sum(<*f/.(n+1)*>) by RLVECT_1:41;
    A8: dom ( {i} --> v) = {i} by FUNCOP_1:13;
    let f1 be Function such that A9: f1 = (( Seg (len f)) --> 0.RS);
    let f2 be Function such that A10: f2 = ( {i} --> v);
    per cases;
    suppose A11: i = n+1;
      then dom f2 = {n+1} by A10,FUNCOP_1:13;
      then g = f1|Seg(n) by A4,A9,A10,FINSEQ_3:14,FUNCT_4:72
      .= ( ( Seg(len f) /\ Seg(n)) --> 0.RS) by A9,FUNCOP_1:12;
      then A12: g = ( ( Seg (n)) --> 0.RS) by A4,FINSEQ_1:7,NAT_1:11;
      A13: n+1 in {n+1} by ZFMISC_1:31;
      then n+1 in dom f2 by A10,A11,FUNCOP_1:13;
      then f.(n+1) = f2.(n+1) by A4,A10,FUNCT_4:13
      .= v by A10,A11,A13,FUNCOP_1:7;
      then A14: f/.(n+1) = v by A5,PARTFUN1:def 6;
      Sum(g) = 0.RS by A6,A12,Th28;
      hence Sum(f) = 0.RS + v by A7,A14,RLVECT_1:44
             .= v by RLVECT_1:4;
     end;
    suppose A15: i <> n+1;
     then i < n+1 or i > n+1 by XXREAL_0:1;
     then 1 <= i & i <= n by A4,FINSEQ_1:1,NAT_1:13; then
     A16: i in Seg (len g) by A6;
     g = f1|Seg(n) +* f2|Seg(n) by A4,A9,A10,FUNCT_4:71
     .= ( ( Seg(len f) /\ Seg(n)) --> 0.RS) +* f2|Seg(n) by A9,FUNCOP_1:12
     .= ( ( Seg len g) --> 0.RS) +* f2|Seg(n) by A4,A6,FINSEQ_1:7,NAT_1:11
     .= ( ( Seg len g) --> 0.RS) +*
({i} /\ Seg (n) --> v) by A10,FUNCOP_1:12; then
     A17: g = ( (Seg (len g)) --> 0.RS)
+* ( {i} --> v) by A6,A16,ZFMISC_1:46;
     not {n+1} c= dom f2 by A8,A10,A15,ZFMISC_1:3;
     then not n+1 in dom f2 by ZFMISC_1:31;
     then f.(n+1) = f1.(n+1) by A4,A9,A10,FUNCT_4:11
     .= 0.RS by A4,A9,FINSEQ_1:4,FUNCOP_1:7;
     then A18: f/.(n+1) = 0.RS by A5,PARTFUN1:def 6;
     Sum(g) = v by A16,A17,A6,A3;
     hence Sum(f) = v + 0.RS by A7,A18,RLVECT_1:44
             .= v by RLVECT_1:4;
    end;
end;
hence P[n+1];
end;
for n be Nat holds P[n] from NAT_1:sch 2(A1,A2);
hence thesis;
end;
