
theorem Th19:
  for L be Abelian add-associative right_zeroed
right_complementable unital left-distributive non empty doubleLoopStr for p,q
be Polynomial of L for x be Element of L holds eval(p+q,x) = eval(p,x) + eval(q
  ,x)
proof
  let L be Abelian add-associative right_zeroed right_complementable unital
  left-distributive non empty doubleLoopStr;
  let p,q be Polynomial of L;
  let x be Element of L;
  reconsider k = max(len p,len q) as Element of NAT by ORDINAL1:def 12;
A1: k - len p >= 0 by XREAL_1:48,XXREAL_0:25;
  consider F1 be FinSequence of the carrier of L such that
A2: eval(p,x) = Sum F1 and
A3: len F1 = len p and
A4: for n be Element of NAT st n in dom F1 holds F1.n = p.(n-'1) * (
  power L).(x,n-'1) by Def2;
A5: len (F1 ^ ((k-'(len F1)) |-> 0.L)) = len p + len ((k-'(len p)) |-> 0.L)
  by A3,FINSEQ_1:22
    .= len p + (k-'(len p)) by CARD_1:def 7
    .= len p + (k-(len p)) by A1,XREAL_0:def 2
    .= k;
A6: k - len q >= 0 by XREAL_1:48,XXREAL_0:25;
  k >= len p & k >= len q by XXREAL_0:25;
  then
A7: k - len (p+q) >= 0 by Th6,XREAL_1:48;
  consider F3 be FinSequence of the carrier of L such that
A8: eval(p+q,x) = Sum F3 and
A9: len F3 = len (p+q) and
A10: for n be Element of NAT st n in dom F3 holds F3.n = (p+q).(n-'1) * (
  power L).(x,n-'1) by Def2;
A11: len (F3 ^ ((k-'(len F3)) |-> 0.L)) = len (p+q) + len ((k-'(len (p+q)))
  |-> 0.L) by A9,FINSEQ_1:22
    .= len (p+q) + (k-'(len (p+q))) by CARD_1:def 7
    .= len (p+q) + (k-(len (p+q))) by A7,XREAL_0:def 2
    .= k;
  consider F2 be FinSequence of the carrier of L such that
A12: eval(q,x) = Sum F2 and
A13: len F2 = len q and
A14: for n be Element of NAT st n in dom F2 holds F2.n = q.(n-'1) * (
  power L).(x,n-'1) by Def2;
  len (F2 ^ ((k-'(len F2)) |-> 0.L)) = len q + len ((k-'(len q)) |-> 0.L)
  by A13,FINSEQ_1:22
    .= len q + (k-'(len q)) by CARD_1:def 7
    .= len q + (k-(len q)) by A6,XREAL_0:def 2
    .= k;
  then reconsider
  G1 = F1 ^ ((k-'(len F1)) |-> 0.L), G2 = F2 ^ ((k-'(len F2)) |->
  0.L), G3 = F3 ^ ((k-'(len F3)) |-> 0.L) as Element of k-tuples_on the carrier
  of L by A5,A11,FINSEQ_2:92;
  now
    let n be Nat;
    assume
A15: n in Seg k;
    then
A16: 0+1 <= n by FINSEQ_1:1;
A17: n <= k by A15,FINSEQ_1:1;
    per cases by XXREAL_0:1;
    suppose
A18:  len p > len q;
      then
A19:  k = len p by XXREAL_0:def 10;
      then len(p+q) = len p by A18,Th7;
      then
A20:  n in dom F3 by A9,A15,A19,FINSEQ_1:def 3;
A21:  len G2 = k by CARD_1:def 7;
      then
A22:  n in dom G2 by A15,FINSEQ_1:def 3;
      then
A23:  G2/.n = G2.n by PARTFUN1:def 6;
      len G1 = k by CARD_1:def 7;
      then
A24:  n in dom G1 by A15,FINSEQ_1:def 3;
      then
A25:  G1/.n = G1.n by PARTFUN1:def 6;
A26:  n in dom F1 by A3,A15,A19,FINSEQ_1:def 3;
A27:  G1/.n = G1.n by A24,PARTFUN1:def 6
        .= F1.n by A26,FINSEQ_1:def 7
        .= F1/.n by A26,PARTFUN1:def 6;
A28:  F1.n = p.(n-'1)*(power L).(x,n-'1) by A4,A26;
      now
        per cases;
        suppose
          n <= len q;
          then n in Seg len q by A16,FINSEQ_1:1;
          then
A29:      n in dom F2 by A13,FINSEQ_1:def 3;
          then
A30:      F2.n = q.(n-'1)*(power L).(x,n-'1) by A14;
A31:      G2/.n = G2.n by A22,PARTFUN1:def 6
            .= F2.n by A29,FINSEQ_1:def 7
            .= F2/.n by A29,PARTFUN1:def 6;
          thus G3.n = F3.n by A20,FINSEQ_1:def 7
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A10,A20
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= p.(n-'1)*(power L).(x,n-'1) + q.(n-'1)*(power L).(x,n-'1) by
VECTSP_1:def 3
            .= p.(n-'1)*(power L).(x,n-'1) + F2/.n by A29,A30,PARTFUN1:def 6
            .= F1/.n + F2/.n by A26,A28,PARTFUN1:def 6
            .= (G1 + G2).n by A15,A25,A23,A27,A31,FVSUM_1:18;
        end;
        suppose
A32:      n > len q;
          then
A33:      n >= len q+1 by NAT_1:13;
          then n-1 >= len q by XREAL_1:19;
          then
A34:      n-'1 >= len q by XREAL_0:def 2;
          n-len F2 <= k-len F2 by A17,XREAL_1:9;
          then
A35:      n-len F2 <= k-'len F2 by XREAL_0:def 2;
A36:      n-len F2 >= 1 by A13,A33,XREAL_1:19;
          then n-len F2 = n-'len F2 by XREAL_0:def 2;
          then
A37:      n-len F2 in Seg (k-'len F2) by A36,A35,FINSEQ_1:1;
          n <= len G2 by A15,A21,FINSEQ_1:1;
          then
A38:      G2/.n = ((k-'(len F2))|->0.L).(n-len F2) by A13,A23,A32,FINSEQ_1:24
            .= 0.L by A37,FUNCOP_1:7;
          thus G3.n = F3.n by A20,FINSEQ_1:def 7
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A10,A20
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= (p.(n-'1) + 0.L) * (power L).(x,n-'1) by A34,ALGSEQ_1:8
            .= (p.(n-'1)) * (power L).(x,n-'1) by RLVECT_1:4
            .= F1.n by A4,A26
            .= G1/.n by A26,A27,PARTFUN1:def 6
            .= G1/.n + 0.L by RLVECT_1:4
            .= (G1 + G2).n by A15,A25,A23,A38,FVSUM_1:18;
        end;
      end;
      hence G3.n = (G1 + G2).n;
    end;
    suppose
A39:  len p < len q;
      then
A40:  k = len q by XXREAL_0:def 10;
      then len(p+q) = len q by A39,Th7;
      then
A41:  n in dom F3 by A9,A15,A40,FINSEQ_1:def 3;
A42:  len G1 = k by CARD_1:def 7;
      then
A43:  n in dom G1 by A15,FINSEQ_1:def 3;
      then
A44:  G1/.n = G1.n by PARTFUN1:def 6;
      len G2 = k by CARD_1:def 7;
      then
A45:  n in dom G2 by A15,FINSEQ_1:def 3;
      then
A46:  G2/.n = G2.n by PARTFUN1:def 6;
A47:  n in dom F2 by A13,A15,A40,FINSEQ_1:def 3;
A48:  G2/.n = G2.n by A45,PARTFUN1:def 6
        .= F2.n by A47,FINSEQ_1:def 7
        .= F2/.n by A47,PARTFUN1:def 6;
A49:  F2.n = q.(n-'1)*(power L).(x,n-'1) by A14,A47;
      now
        per cases;
        suppose
          n <= len p;
          then n in Seg len p by A16,FINSEQ_1:1;
          then
A50:      n in dom F1 by A3,FINSEQ_1:def 3;
          then
A51:      F1.n = p.(n-'1)*(power L).(x,n-'1) by A4;
A52:      G1/.n = G1.n by A43,PARTFUN1:def 6
            .= F1.n by A50,FINSEQ_1:def 7
            .= F1/.n by A50,PARTFUN1:def 6;
          thus G3.n = F3.n by A41,FINSEQ_1:def 7
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A10,A41
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= p.(n-'1)*(power L).(x,n-'1) + q.(n-'1)*(power L).(x,n-'1) by
VECTSP_1:def 3
            .= F1/.n + q.(n-'1)*(power L).(x,n-'1) by A50,A51,PARTFUN1:def 6
            .= F1/.n + F2/.n by A47,A49,PARTFUN1:def 6
            .= (G1 + G2).n by A15,A44,A46,A48,A52,FVSUM_1:18;
        end;
        suppose
A53:      n > len p;
          then
A54:      n >= len p+1 by NAT_1:13;
          then n-1 >= len p by XREAL_1:19;
          then
A55:      n-'1 >= len p by XREAL_0:def 2;
          n-len F1 <= k-len F1 by A17,XREAL_1:9;
          then
A56:      n-len F1 <= k-'len F1 by XREAL_0:def 2;
A57:      n-len F1 >= 1 by A3,A54,XREAL_1:19;
          then n-len F1 = n-'len F1 by XREAL_0:def 2;
          then
A58:      n-len F1 in Seg (k-'len F1) by A57,A56,FINSEQ_1:1;
          n <= len G1 by A15,A42,FINSEQ_1:1;
          then
A59:      G1/.n = ((k-'(len F1))|->0.L).(n-len F1) by A3,A44,A53,FINSEQ_1:24
            .= 0.L by A58,FUNCOP_1:7;
          thus G3.n = F3.n by A41,FINSEQ_1:def 7
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A10,A41
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= (0.L + q.(n-'1)) * (power L).(x,n-'1) by A55,ALGSEQ_1:8
            .= (q.(n-'1)) * (power L).(x,n-'1) by RLVECT_1:4
            .= F2.n by A14,A47
            .= G2/.n by A47,A48,PARTFUN1:def 6
            .= 0.L + G2/.n by RLVECT_1:4
            .= (G1 + G2).n by A15,A44,A46,A59,FVSUM_1:18;
        end;
      end;
      hence G3.n = (G1 + G2).n;
    end;
    suppose
A60:  len p = len q;
      len G2 = k by CARD_1:def 7;
      then
A61:  n in dom G2 by A15,FINSEQ_1:def 3;
      then
A62:  G2/.n = G2.n by PARTFUN1:def 6;
      len G1 = k by CARD_1:def 7;
      then
A63:  n in dom G1 by A15,FINSEQ_1:def 3;
      then
A64:  G1/.n = G1.n by PARTFUN1:def 6;
A65:  len G3 = k by CARD_1:def 7;
A66:  n in dom F2 by A13,A15,A60,FINSEQ_1:def 3;
A67:  n in dom F1 by A3,A15,A60,FINSEQ_1:def 3;
      then
A68:  F1.n = p.(n-'1)*(power L).(x,n-'1) by A4;
A69:  G1/.n = G1.n by A63,PARTFUN1:def 6
        .= F1.n by A67,FINSEQ_1:def 7
        .= F1/.n by A67,PARTFUN1:def 6;
      now
        per cases;
        suppose
A70:      n <= len (p+q);
A71:      n in dom F2 by A13,A15,A60,FINSEQ_1:def 3;
          then
A72:      F2.n = q.(n-'1)*(power L).(x,n-'1) by A14;
A73:      G2/.n = G2.n by A61,PARTFUN1:def 6
            .= F2.n by A71,FINSEQ_1:def 7
            .= F2/.n by A71,PARTFUN1:def 6;
          n in Seg len (p+q) by A16,A70,FINSEQ_1:1;
          then
A74:      n in dom F3 by A9,FINSEQ_1:def 3;
          hence G3.n = F3.n by FINSEQ_1:def 7
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A10,A74
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= p.(n-'1)*(power L).(x,n-'1) + q.(n-'1)*(power L).(x,n-'1) by
VECTSP_1:def 3
            .= p.(n-'1)*(power L).(x,n-'1) + F2/.n by A71,A72,PARTFUN1:def 6
            .= F1/.n + F2/.n by A67,A68,PARTFUN1:def 6
            .= (G1 + G2).n by A15,A64,A62,A69,A73,FVSUM_1:18;
        end;
        suppose
A75:      n > len (p+q);
          then
A76:      n >= len (p+q)+1 by NAT_1:13;
          then n-1 >= len (p+q)+1-1 by XREAL_1:9;
          then
A77:      n-'1 >= len (p+q) by XREAL_0:def 2;
          n-len F3 <= k-len F3 by A17,XREAL_1:9;
          then
A78:      n-len F3 <= k-'len F3 by XREAL_0:def 2;
A79:      G2.n = F2.n by A66,FINSEQ_1:def 7
            .= (q.(n-'1))*(power L).(x,n-'1) by A14,A66;
A80:      G1.n = F1.n by A67,FINSEQ_1:def 7
            .= (p.(n-'1))*(power L).(x,n-'1) by A4,A67;
A81:      n-len F3 >= 1 by A9,A76,XREAL_1:19;
          then n-len F3 = n-'len F3 by XREAL_0:def 2;
          then
A82:      n-len F3 in Seg (k-'len F3) by A81,A78,FINSEQ_1:1;
          n <= len G3 by A15,A65,FINSEQ_1:1;
          hence G3.n = ((k-'(len F3))|->0.L).(n-len F3) by A9,A75,FINSEQ_1:24
            .= 0.L by A82,FUNCOP_1:7
            .= 0.L * (power L).(x,n-'1)
            .= (p+q).(n-'1) * (power L).(x,n-'1) by A77,ALGSEQ_1:8
            .= (p.(n-'1) + q.(n-'1)) * (power L).(x,n-'1) by NORMSP_1:def 2
            .= (p.(n-'1))*(power L).(x,n-'1) + (q.(n-'1))*(power L).(x,n-'1)
          by VECTSP_1:def 3
            .= (G1 + G2).n by A15,A80,A79,FVSUM_1:18;
        end;
      end;
      hence G3.n = (G1 + G2).n;
    end;
  end;
  then
A83: G3 = G1 + G2 by FINSEQ_2:119;
A84: Sum G3 = Sum F3 + Sum ((k-'(len F3)) |-> 0.L) by RLVECT_1:41
    .= Sum F3 + 0.L by MATRIX_3:11
    .= Sum F3 by RLVECT_1:def 4;
A85: Sum G2 = Sum F2 + Sum ((k-'(len F2)) |-> 0.L) by RLVECT_1:41
    .= Sum F2 + 0.L by MATRIX_3:11
    .= Sum F2 by RLVECT_1:def 4;
  Sum G1 = Sum F1 + Sum ((k-'(len F1)) |-> 0.L) by RLVECT_1:41
    .= Sum F1 + 0.L by MATRIX_3:11
    .= Sum F1 by RLVECT_1:def 4;
  hence thesis by A2,A12,A8,A85,A84,A83,FVSUM_1:76;
end;
