
theorem ThSumScDM1:
  for L being Z_Lattice, l being Linear_Combination of DivisibleMod(L),
      v being Vector of DivisibleMod(L) holds
  (ScProductDM(L)).(v, Sum(l)) = SumSc(v, l)
  proof
    defpred P[Nat] means
    for L being Z_Lattice, l being Linear_Combination of DivisibleMod(L),
        v being Vector of DivisibleMod(L) st card(Carrier l) = $1 holds
    (ScProductDM(L)).(v, Sum(l)) = SumSc(v, l);
    A1: P[0]
    proof
      let L be Z_Lattice, l be Linear_Combination of DivisibleMod(L),
          v be Vector of DivisibleMod(L) such that
      B1: card(Carrier l) = 0;
      B2: Carrier l = {} by B1;
      then Sum(l) = 0.DivisibleMod(L) by VECTSP_6:19;
      then (ScProductDM(L)).(v, Sum(l)) = 0.F_Real by ZMODLAT2:14;
      hence thesis by B2,LmSumScDM13;
    end;
    A2: for n being Nat st P[n] holds P[n+1]
    proof
      let n be Nat such that
      B1: P[n];
      let L be Z_Lattice, l be Linear_Combination of DivisibleMod(L),
      v be Vector of DivisibleMod(L) such that
      B2: card(Carrier l) = n+1;
      Carrier l <> {} by B2;
      then consider u be object such that
      B3: u in Carrier l by XBOOLE_0:def 1;
      reconsider u as Element of DivisibleMod(L) by B3;
      B4: card(Carrier(l) \ {u}) = card(Carrier l) - card{u}
        by B3,CARD_2:44,ZFMISC_1:31
      .= n+1 - 1 by B2,CARD_2:42
      .= n;
      B5: Carrier(l) = (Carrier(l) \ {u}) \/ {u}
        by B3,XBOOLE_1:45,ZFMISC_1:31;
      B6: (Carrier(l) \ {u}) /\ {u} = {} by XBOOLE_0:def 7,XBOOLE_1:79;
      l is Linear_Combination of Carrier(l) by VECTSP_6:7;
      then consider l1 be Linear_Combination of (Carrier (l) \ {u}),
      l2 be Linear_Combination of {u} such that
      B7: l = l1 + l2 by B5,B6,ZMODUL04:26;
      Sum(l) = Sum(l1) + Sum(l2) by B7,ZMODUL02:52;
      then B8: (ScProductDM(L)).(v, Sum(l))
      = (ScProductDM(L)).(v, Sum(l1)) + (ScProductDM(L)).(v, Sum(l2))
        by ZMODLAT2:12;
      for x being Vector of DivisibleMod(L) st x in (Carrier(l) \ {u})
      holds x in Carrier(l1)
      proof
        let x be Vector of DivisibleMod(L) such that
        C1: x in (Carrier(l) \ {u});
        x in Carrier(l) by C1,XBOOLE_0:def 5;
        then C2: l.x <> 0.INT.Ring by VECTSP_6:2;
        C3: Carrier(l2) c= {u} by VECTSP_6:def 4;
        C4: l.x = l1.x + l2.x by B7,VECTSP_6:22;
        not x in Carrier(l2) by C1,C3,XBOOLE_0:def 5;
        then l1.x <> 0.INT.Ring by C2,C4;
        hence thesis;
      end;
      then (Carrier(l) \ {u}) c= Carrier(l1);
      then Carrier(l1) = (Carrier(l) \ {u}) by VECTSP_6:def 4;
      then B10: (ScProductDM(L)).(v, Sum(l1)) = SumSc(v, l1) by B1,B4;
      SumSc(v, l2) = (ScProductDM(L)).(v, l2.u * u) by LmSumScDM14
      .= (ScProductDM(L)).(v, Sum(l2)) by VECTSP_6:17;
      hence thesis by B7,B8,B10,LmSumScDM1X;
    end;
    A3: for n being Nat holds P[n] from NAT_1:sch 2(A1,A2);
    let L be Z_Lattice, l be Linear_Combination of DivisibleMod(L),
        v be Vector of DivisibleMod(L);
    reconsider n = card (Carrier l) as Nat;
    P[n] by A3;
    hence thesis;
  end;
