
theorem Th4:
  for L being Abelian add-associative non empty addLoopStr, a
being Element of L, p,q being FinSequence of the carrier of L st len p = len q
  & ex i being Element of NAT st i in dom p & q/.i = a + p/.i & for i9 being
  Element of NAT st i9 in dom p & i9 <> i holds q/.i9 = p/.i9 holds Sum q = a +
  Sum p
proof
  let L be Abelian add-associative non empty addLoopStr, a be Element of L,
  p,q be FinSequence of the carrier of L;
  assume that
A1: len p = len q and
A2: ex i being Element of NAT st i in dom p & q/.i = a + p/.i & for i9
  being Element of NAT st i9 in dom p & i9 <> i holds q/.i9 = p/.i9;
  consider i being Element of NAT such that
A3: i in dom p and
A4: q/.i = a + p/.i and
A5: for i9 being Element of NAT st i9 in dom p & i9 <> i holds q/.i9 = p
  /.i9 by A2;
  consider fq being sequence of the carrier of L such that
A6: Sum q = fq.(len q) and
A7: fq.0 = 0.L and
A8: for j being Nat, v being Element of L st j < len q & v =
  q.(j + 1) holds fq.(j + 1) = fq.j + v by RLVECT_1:def 12;
  consider l being Nat such that
A9: dom p = Seg l by FINSEQ_1:def 2;
  i in {z where z is Nat : 1 <= z & z <= l} by A3,A9,FINSEQ_1:def 1;
  then
A10: ex i9 being Nat st i9 = i & 1 <= i9 & i9 <= l;
  consider l9 being Nat such that
A11: dom q = Seg l9 by FINSEQ_1:def 2;
  reconsider l,l9 as Element of NAT by ORDINAL1:def 12;
  consider fp being sequence of the carrier of L such that
A12: Sum p = fp.(len p) and
A13: fp.0 = 0.L and
A14: for j being Nat, v being Element of L st j < len p & v =
  p.(j + 1) holds fp.(j + 1) = fp.j + v by RLVECT_1:def 12;
A15: len p = l by A9,FINSEQ_1:def 3;
  defpred P[Element of NAT] means ($1 < i & fp.($1) = fq.($1)) or (i <= $1 &
  fq.($1) = a + fp.($1));
A16: l = len p by A9,FINSEQ_1:def 3
    .= l9 by A1,A11,FINSEQ_1:def 3;
A17: for j being Element of NAT st 0 <= j & j < len p holds P[j] implies P[j
  +1]
  proof
    let j be Element of NAT;
    assume that
    0 <= j and
A18: j < len p;
    assume
A19: P[j];
    per cases;
    suppose
A20:  j < i;
        per cases;
        suppose
A21:      j + 1 = i;
          then
A22:      p.(j+1) = p/.(j+1) by A3,PARTFUN1:def 6;
          q.(j+1) = q/.(j+1) by A3,A9,A11,A16,A21,PARTFUN1:def 6;
          then fq.(j+1) = fq.j + (a + p/.(j+1)) by A1,A4,A8,A18,A21
            .= a + (fq.j + p/.(j+1)) by RLVECT_1:def 3
            .= a + fp.(j+1) by A14,A18,A19,A20,A22;
          hence thesis by A21;
        end;
        suppose
A23:      j + 1 <> i;
A24:      j + 1 < i
          proof
            assume i <= j + 1;
            then i < j + 1 by A23,XXREAL_0:1;
            hence thesis by A20,NAT_1:13;
          end;
          j + 1 <= i by A20,NAT_1:13;
          then
A25:      j + 1 <= l by A10,XXREAL_0:2;
          0 + 1 <= j + 1 by XREAL_1:6;
          then
A26:      j + 1 in Seg l by A25,FINSEQ_1:1;
          then
A27:      p.(j+1) = p/.(j+1) by A9,PARTFUN1:def 6;
          q.(j+1) = q/.(j+1) by A11,A16,A26,PARTFUN1:def 6;
          then fq.(j+1) = fq.j + q/.(j+1) by A1,A8,A18
            .= fp.(j+1) by A5,A14,A9,A18,A19,A20,A23,A26,A27;
          hence thesis by A24;
        end;
    end;
    suppose
A28:  i <= j;
      j < l by A9,A18,FINSEQ_1:def 3;
      then
A29:  j + 1 <= l by NAT_1:13;
      0 + 1 <= j + 1 by XREAL_1:6;
      then
A30:  j + 1 in dom p by A9,A29,FINSEQ_1:1;
      then
A31:  p.(j+1) = p/.(j+1) by PARTFUN1:def 6;
A32:  i < j + 1 by A28,NAT_1:13;
      q.(j+1) = q/.(j+1) by A9,A11,A16,A30,PARTFUN1:def 6;
      then fq.(j+1) = fq.j + q/.(j+1) by A1,A8,A18
        .= (a + fp.j) + p/.(j+1) by A5,A19,A28,A32,A30
        .= a + (fp.j + p/.(j+1)) by RLVECT_1:def 3
        .= a + fp.(j+1) by A14,A18,A31;
      hence thesis by A28,NAT_1:13;
    end;
  end;
A33: P[0] by A13,A7,A10;
  for j being Element of NAT st 0 <= j & j <= len p holds P[j] from
  INT_1:sch 7(A33,A17);
  hence thesis by A1,A12,A6,A10,A15;
end;
