
theorem Th10:
  for F,G be FinSequence of ExtREAL, a be R_eal st (a is real or (
for i be Nat st i in dom F holds F.i < 0.) or
for i be Nat st i in dom F holds 0. < F.i )
& dom F = dom G & for i be Nat st i in dom G holds G.i=a*F.i holds
  Sum(G)=a*Sum(F)
proof
  let F,G be FinSequence of ExtREAL;
  let a be R_eal;
  assume that
A1: a is real or (for i be Nat st i in dom F holds F.i < 0.) or for i be
  Nat st i in dom F holds 0. < F.i and
A2: dom F = dom G and
A3: for i be Nat st i in dom G holds G.i=a*F.i;
  consider g be sequence of ExtREAL such that
A4: Sum(G) = g.(len G) and
A5: g.0 = 0. and
A6: for i being Nat st i < len G holds g.(i+1)=g.i+G.(i+1) by
EXTREAL1:def 2;
  consider f be sequence of ExtREAL such that
A7: Sum(F) = f.(len F) and
A8: f.0 = 0. and
A9: for i being Nat st i < len F holds f.(i+1)=f.i+F.(i+1) by
EXTREAL1:def 2;
  defpred P[Nat] means $1 <= len G implies g.$1 = a*f.$1;
A10: for i be Nat st P[i] holds P[i+1]
  proof
    let i be Nat;
    assume
A11: P[i];
    assume
A12: i+1 <= len G;
    reconsider i as Element of NAT by ORDINAL1:def 12;
    1 <= i+1 by NAT_1:11;
    then
A13: i+1 in dom G by A12,FINSEQ_3:25;
    then i+1 in Seg len F by A2,FINSEQ_1:def 3;
    then i+1 <= len F by FINSEQ_1:1;
    then
A14: i < len F by NAT_1:13;
    i < len G by A12,NAT_1:13;
    then
A15: g.(i+1) = g.i + G.(i+1) by A6
      .= a*f.i + a*F.(i+1) by A3,A11,A12,A13,NAT_1:13;
    now
      per cases by A1;
      case
        a is real;
        then g.(i+1) = a*(f.i + F.(i+1)) by A15,XXREAL_3:95;
        hence thesis by A9,A14;
      end;
      case
A16:    for i be Nat st i in dom F holds F.i < 0.;
        defpred P1[Nat] means $1 < len F implies f.$1 <= 0.;
A17:    for i be Nat st P1[i] holds P1[i+1]
        proof
          let i be Nat;
          assume
A18:      P1[i];
          assume
A19:      i+1 < len F;
          reconsider i as Element of NAT by ORDINAL1:def 12;
          1 <= i+1 by NAT_1:12;
          then i+1 in dom F by A19,FINSEQ_3:25;
          then
A20:      F.(i+1) < 0. by A16;
          i < len F by A19,NAT_1:13;
          then f.(i+1) = f.i + F.(i+1) by A9;
          hence thesis by A18,A19,A20,NAT_1:13;
        end;
A21:    P1[0] by A8;
        for i be Nat holds P1[i] from NAT_1:sch 2(A21,A17);
        then
A22:    f.i < 0. or f.i = 0. by A14;
        F.(i+1) < 0. by A2,A13,A16;
        then g.(i+1) = a*(f.i + F.(i+1)) by A15,A22,XXREAL_3:97;
        hence thesis by A9,A14;
      end;
      case
A23:    for i be Nat st i in dom F holds 0. < F.i;
        defpred P2[Nat] means $1 < len F implies 0. <= f.$1;
A24:    for i be Nat st P2[i] holds P2[i+1]
        proof
          let i be Nat;
          assume
A25:      P2[i];
          assume
A26:      i+1 < len F;
          reconsider i as Element of NAT by ORDINAL1:def 12;
          1 <= i+1 by NAT_1:12;
          then i+1 in dom F by A26,FINSEQ_3:25;
          then
A27:      0. < F.(i+1) by A23;
          i < len F by A26,NAT_1:13;
          then f.(i+1) = f.i + F.(i+1) by A9;
          hence thesis by A25,A26,A27,NAT_1:13;
        end;
A28:    P2[0] by A8;
        for i be Nat holds P2[i] from NAT_1:sch 2(A28,A24);
        then
A29:    0. < f.i or f.i = 0. by A14;
        0. < F.(i+1) by A2,A13,A23;
        then g.(i+1) = a*(f.i + F.(i+1)) by A15,A29,XXREAL_3:96;
        hence thesis by A9,A14;
      end;
    end;
    hence thesis;
  end;
A30: P[0] by A8,A5;
A31: for i be Nat holds P[i] from NAT_1:sch 2(A30,A10);
  Seg len F = dom G by A2,FINSEQ_1:def 3
    .= Seg len G by FINSEQ_1:def 3;
  then a*Sum(F) = a*f.(len G) by A7,FINSEQ_1:6
    .= g.(len G) by A31;
  hence thesis by A4;
end;
