
theorem
  for L being add-associative right_zeroed right_complementable non
  empty addLoopStr, p being FinSequence of L, n being Element of NAT st for k
being Element of NAT st k in dom p & k > n holds p.k = 0.L holds Sum p = Sum(p|
  n)
proof
  let L be add-associative right_zeroed right_complementable non empty
  addLoopStr, p be FinSequence of L, n be Element of NAT;
  defpred P[Nat] means for p being FinSequence of L, n being
Element of NAT st len p = $1 & for k being Element of NAT st k in dom p & k > n
  holds p.k = 0.L holds Sum p = Sum(p|n);
A1: now
    let k be Nat;
    assume
A2: P[k];
    now
      let p be FinSequence of L, n be Element of NAT;
      assume that
A3:   len p = k+1 and
A4:   for l being Element of NAT st l in dom p & l > n holds p.l = 0.L;
A5:   dom p = Seg(k+1) by A3,FINSEQ_1:def 3;
      set q = p|(Seg k);
      reconsider q as FinSequence of L by FINSEQ_1:18;
A6:   k <= len p by A3,NAT_1:11;
      then
A7:   len q = k by FINSEQ_1:17;
      k <= k + 1 & dom q = Seg(k) by A6,FINSEQ_1:17,NAT_1:11;
      then
A8:   dom q c= dom p by A5,FINSEQ_1:5;
A9:   q = p|k by FINSEQ_1:def 16;
A10:  q^<*p/.(k+1)*> = q^<*p.(k+1)*> by A5,FINSEQ_1:4,PARTFUN1:def 6
        .= p by A3,FINSEQ_3:55;
      now
        per cases;
        case
A11:      k < n;
A12:      dom(p|n) = dom(p|(Seg n)) by FINSEQ_1:def 16;
A13:      k + 1 <= n by A11,NAT_1:13;
A14:      now
            let u be object;
            assume
A15:        u in dom p;
            then reconsider u9 = u as Element of NAT;
A16:        u in Seg(k+1) by A3,A15,FINSEQ_1:def 3;
            then u9 <= k + 1 by FINSEQ_1:1;
            then
A17:        u9 <= n by A13,XXREAL_0:2;
            1 <= u9 by A16,FINSEQ_1:1;
            then u9 in Seg n by A17,FINSEQ_1:1;
            then u9 in dom(p) /\ (Seg n) by A15,XBOOLE_0:def 4;
            hence u in dom(p|n) by A12,RELAT_1:61;
          end;
A18:      for x being object st x in dom(p|(Seg n)) holds (p|(Seg n)).x = p.
          x by FUNCT_1:47;
          now
            let u be object;
            assume u in dom(p|n);
            then
A19:        u in dom(p|(Seg n)) by FINSEQ_1:def 16;
            dom(p|(Seg n)) c= dom p by RELAT_1:60;
            hence u in dom p by A19;
          end;
          then dom(p|n) = dom p by A14,TARSKI:2;
          then p|(Seg n) = p by A12,A18,FUNCT_1:2;
          hence Sum(p|n) = Sum p by FINSEQ_1:def 16;
        end;
        case
A20:      n <= k;
A21:      now
            let l be Element of NAT;
            assume that
A22:        l in dom q and
A23:        l > n;
A24:        p.l = 0.L by A4,A8,A22,A23;
            thus q.l = q/.l by A22,PARTFUN1:def 6
              .= p/.l by A9,A22,FINSEQ_4:70
              .= 0.L by A8,A22,A24,PARTFUN1:def 6;
          end;
          k + 1 > n by A20,NAT_1:13;
          then
A25:      0.L = p.(k+1) by A4,A5,FINSEQ_1:4
            .= p/.(k+1) by A5,FINSEQ_1:4,PARTFUN1:def 6;
          thus Sum p = Sum q + Sum(<*p/.(k+1)*>) by A10,RLVECT_1:41
            .= Sum q + p/.(k+1) by RLVECT_1:44
            .= Sum q by A25,RLVECT_1:def 4
            .= Sum(q|n) by A2,A7,A21
            .= Sum(p|n) by A9,A20,FINSEQ_1:82;
        end;
      end;
      hence Sum p = Sum(p|n);
    end;
    hence P[k+1];
  end;
A26: P[ 0 ] by FINSEQ_1:58;
A27: for k being Nat holds P[k] from NAT_1:sch 2(A26,A1);
A28: ex k being Element of NAT st len p = k;
  assume for k being Element of NAT st k in dom p & k > n holds p.k = 0.L;
  hence thesis by A27,A28;
end;
