reserve V for non empty RLSStruct;
reserve x,y,y1 for set;
reserve v for VECTOR of V;
reserve a,b for Real;
reserve V for non empty addLoopStr;
reserve F for FinSequence-like PartFunc of NAT,V;
reserve f,f9,g for sequence of V;
reserve v,u for Element of V;
reserve j,k,n for Nat;

theorem Th38:
  for F,G being FinSequence of V holds
  len F = len G + 1 & G = F | (dom G) & v = F.(len F) implies
  Sum(F) = Sum(G) + v
proof
  let F,G be FinSequence of V;
  assume that
A1: len F = len G + 1 and
A2: G = F | (dom G) and
A3: v = F.(len F);
  consider g such that
A4: Sum(G) = g.(len G) and
A5: g.0 = 0.V and
A6: for j,v st j < len G & v = G.(j + 1) holds g.(j + 1) = g.j + v by Def12;
  consider f such that
A7: Sum(F) = f.(len F) and
A8: f.0 = 0.V and
A9: for j,v st j < len F & v = F.(j + 1) holds f.(j + 1) = f.j + v by Def12;
  defpred P[Nat] means
  for H being FinSequence of V holds len H = $1 & H = F | (Seg $1) &
  len H <= len G implies f.(len H) = g.(len H);
  now
    let k;
    assume
A10: for H be FinSequence of V st len H = k & H = F | (Seg k) & len H <= len G
     holds f.(len H) = g.(len H);
    let H be FinSequence of V;
    assume that
A11: len H = k + 1 and
A12: H = F | (Seg (k + 1)) and
A13: len H <= len G;
    1 <= k + 1 & k + 1 <= len F by A1,A11,A13,NAT_1:12;
    then k + 1 in dom F by FINSEQ_3:25;
    then reconsider v = F.(k + 1) as Element of V by FUNCT_1:102;
    1 <= k + 1 by NAT_1:12;
    then k + 1 in Seg(len G) by A11,A13,FINSEQ_1:1;
    then k + 1 in dom G by FINSEQ_1:def 3;
    then
A14: v = G.(k + 1) by A2,FUNCT_1:47;
    reconsider H1 = H as FinSequence of V;
    reconsider p = H1 | (Seg k) as FinSequence of V by FINSEQ_1:18;
A15: k <= len H by A11,NAT_1:12;
    then Seg k c= Seg(k + 1) by A11,FINSEQ_1:5;
    then
A16: p = F | (Seg k) by A12,FUNCT_1:51;
    k < k + 1 by XREAL_1:29;
    then k < len G by A11,A13,XXREAL_0:2;
    then
A17: g.(k + 1) = g.k + v by A6,A14;
A18: len G < len F by A1,XREAL_1:29;
    k <= len G by A13,A15,XXREAL_0:2;
    then k < len F by A18,XXREAL_0:2;
    then
A19: f.(k + 1) = f.k + v by A9;
    len p = k by A15,FINSEQ_1:17;
    hence f.(len H) = g.(len H) by A10,A11,A13,A15,A16,A19,A17,XXREAL_0:2;
  end;
  then
A20: for k st P[k] holds P[k+1];
A21: dom G = Seg len G by FINSEQ_1:def 3;
A22: P[0] by A8,A5;
  for k holds P[k] from NAT_1:sch 2(A22,A20);
  then f.(len G) = g.(len G) by A2,A21;
  hence thesis by A1,A3,A7,A9,A4,XREAL_1:29;
end;
