
theorem Th5:
  for R being right_zeroed left_add-cancelable left-distributive
  non empty doubleLoopStr, a being Element of R, p being FinSequence of the
  carrier of R holds Sum(p * a) = Sum p * a
proof
  let R be right_zeroed left_add-cancelable left-distributive non empty
  doubleLoopStr, a be Element of R, p be FinSequence of the carrier of R;
  consider f being sequence of the carrier of R such that
A1: Sum p = f.(len p) and
A2: f.0 = 0.R and
A3: for j being Nat, v being Element of R st j < len p & v =
  p.(j + 1) holds f.(j + 1) = f.j + v by RLVECT_1:def 12;
  consider fa being sequence of the carrier of R such that
A4: Sum(p * a) = fa.(len(p * a)) and
A5: fa.0 = 0.R and
A6: for j being Nat, v being Element of R st j < len(p * a) &
  v = (p * a).(j + 1) holds fa.(j + 1) = fa.j + v by RLVECT_1:def 12;
  defpred P[Nat] means f.$1 * a = fa.$1;
A7: Seg(len(p * a)) = dom(p * a) by FINSEQ_1:def 3
    .= dom p by POLYNOM1:def 2
    .= Seg(len p) by FINSEQ_1:def 3;
A8: now
    let j be Element of NAT;
    assume that
    0 <= j and
A9: j < len p;
    thus P[j] implies P[j+1]
    proof
A10:  j < len(p * a) by A7,A9,FINSEQ_1:6;
      then
A11:  j + 1 <= len(p * a) by NAT_1:13;
A12:  0 + 1 <= j + 1 by XREAL_1:6;
      then j + 1 in Seg len(p * a) by A11,FINSEQ_1:1;
      then j + 1 in dom(p * a) by FINSEQ_1:def 3;
      then
A13:  (p * a)/.(j + 1) = (p * a).(j + 1) by PARTFUN1:def 6;
      j + 1 in Seg len p by A7,A11,A12,FINSEQ_1:1;
      then
A14:  j + 1 in dom p by FINSEQ_1:def 3;
      then
A15:  p/.(j + 1) = p.(j + 1) by PARTFUN1:def 6;
      assume f.j * a = fa.j;
      hence fa.(j+1) = f.j * a + (p * a)/.(j + 1) by A6,A10,A13
        .= f.j * a + p/.(j + 1) * a by A14,POLYNOM1:def 2
        .= (f.j + p/.(j + 1)) * a by VECTSP_1:def 3
        .= f.(j+1) * a by A3,A9,A15;
    end;
  end;
A16: P[0] by A2,A5,Th1;
A17: for i being Element of NAT st 0 <= i & i <= len p holds P[i] from
  INT_1:sch 7(A16,A8);
  thus Sum(p * a) = fa.(len p) by A4,A7,FINSEQ_1:6
    .= Sum p * a by A1,A17;
end;
