reserve x,y for set,
        r,s for Real,
        n for Nat,
        V for RealLinearSpace,
        v,u,w,p for VECTOR of V,
        A,B for Subset of V,
        Af for finite Subset of V,
        I for affinely-independent Subset of V,
        If for finite affinely-independent Subset of V,
        F for Subset-Family of V,
        L1,L2 for Linear_Combination of V;

theorem Th15:
  ex L be Linear_Combination of Af st Sum L = r*Sum Af & sum L = r * card Af &
                                      L = (ZeroLC V) +* (Af-->r)
  proof
    set cV=the carrier of V;
    set Ar=ZeroLC(V)+*(Af-->r);
    A1: dom(Af-->r)=Af;
    dom ZeroLC(V)=cV by FUNCT_2:def 1;
    then dom Ar=cV\/Af by A1,FUNCT_4:def 1;
    then rng Ar c=rng(Af-->r)\/rng ZeroLC(V) & dom Ar=cV
      by FUNCT_4:17,XBOOLE_1:12;
    then Ar is Function of the carrier of V,REAL by FUNCT_2:2;
    then reconsider Ar as Element of Funcs(the carrier of V,REAL)by FUNCT_2:8;
    now take Af;
      let v;
      assume not v in Af;
      hence Ar.v=ZeroLC(V).v by A1,FUNCT_4:11
      .=0 by RLVECT_2:20;
    end;
    then reconsider Ar as Linear_Combination of V by RLVECT_2:def 3;
    Carrier Ar c=Af
    proof
      let x be object;
      assume A2: x in Carrier Ar;
      then reconsider v=x as Element of V;
      assume not x in Af;
      then Ar.x=ZeroLC(V).v by A1,FUNCT_4:11
      .=0 by RLVECT_2:20;
      hence thesis by A2,RLVECT_2:19;
    end;
    then reconsider Ar=(ZeroLC V)+*(Af-->r) as Linear_Combination of Af
      by RLVECT_2:def 6;
    A3: Carrier Ar c=Af by RLVECT_2:def 6;
    per cases;
    suppose A4: r=0;
      Carrier Ar={}
      proof
        assume Carrier Ar<>{};
        then consider x being object such that
        A5: x in Carrier Ar by XBOOLE_0:def 1;
        Ar.x=(Af-->r).x & (Af-->r).x=0 by A1,A3,A4,A5,FUNCOP_1:7,FUNCT_4:13;
        hence contradiction by A5,RLVECT_2:19;
      end;
      then Ar=ZeroLC(V) by RLVECT_2:def 5;
      then A6: Sum Ar=0.V & sum Ar=0 by RLAFFIN1:31,RLVECT_2:30;
      r*Sum Af=0.V by A4,RLVECT_1:10;
      hence thesis by A4,A6;
    end;
    suppose A7: r<>0;
      consider F be FinSequence of V such that
      A8: F is one-to-one and
      A9: rng F=Carrier(Ar) and
      A10: Sum Ar=Sum(Ar(#)F) by RLVECT_2:def 8;
      reconsider r as Element of REAL by XREAL_0:def 1;
      Af c=Carrier Ar
      proof
        let x be object;
        assume A11: x in Af;
        then Ar.x=(Af-->r).x by A1,FUNCT_4:13;
        hence thesis by A7,A11;
      end;
      then A12: Af=Carrier Ar by A3;
      then dom F,Af are_equipotent by A8,A9,WELLORD2:def 4;
      then A13: card Af=card dom F by CARD_1:5
      .=card Seg len F by FINSEQ_1:def 3
      .=len F by FINSEQ_1:57;
      set L=len F|->r;
      A14: len(Ar*F)=len F by FINSEQ_2:33;
      then reconsider ArF=Ar*F as Element of len F-tuples_on REAL
        by FINSEQ_2:92;
      now let i be Nat;
        assume A15: i in Seg len F;
        then i in dom F by FINSEQ_1:def 3;
        then A16: F.i in rng F by FUNCT_1:def 3;
        then A17: (Af-->r).(F.i)=r by A3,A9,FUNCOP_1:7;
        i in dom ArF by A14,A15,FINSEQ_1:def 3;
        then ArF.i=Ar.(F.i) by FUNCT_1:12;
        then ArF.i=(Af-->r).(F.i) by A1,A3,A9,A16,FUNCT_4:13;
        hence ArF.i=L.i by A15,A17,FINSEQ_2:57;
      end;
      then ArF=L by FINSEQ_2:119;
      then A18: sum Ar=Sum L by A8,A9,RLAFFIN1:def 3
      .=(len F)*r by RVSUM_1:80;
      set AF=Ar(#)F;
      A19: len AF=len F by RLVECT_2:def 7;
      then A20: dom AF=dom F by FINSEQ_3:29;
      now let i be Nat;
        assume A21: i in dom F;
        then F/.i=F.i & F.i in rng F by FUNCT_1:def 3,PARTFUN1:def 6;
        then Ar.(F/.i)=(Af-->r).(F/.i) & (Af-->r).(F/.i)=r
          by A1,A3,A9,FUNCOP_1:7,FUNCT_4:13;
        hence AF.i=r*F/.i by A20,A21,RLVECT_2:def 7;
      end;
      then Sum Ar=r*Sum F by A10,A19,RLVECT_2:3
      .=r*Sum Af by A8,A9,A12,RLVECT_2:def 2;
      hence thesis by A13,A18;
    end;
  end;
