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 Th3:
  for L be Linear_Combination of Af st Af c=conv If & sum L=1 holds
     Sum L in Affin If
   & for x be Element of V
       ex F be FinSequence of REAL,G be FinSequence of V st
          (Sum L|--If).x = Sum F & len G = len F & G is one-to-one &
          rng G = Carrier L &
          for n st n in dom F holds F.n = L.(G.n)*(G.n|--If).x
  proof
    defpred P[Nat] means
    for B be finite Subset of V st card B=$1 & B c=conv If for L be
    Linear_Combination of B st Carrier L=B & sum L=1 holds Sum L in Affin If &
    for x be Element of V
    ex F be FinSequence of REAL,G be FinSequence of V st
      (Sum L|--If).x=Sum F & len G=len F & G is one-to-one & rng G=Carrier L &
      for n st n in dom F holds F.n=L.(G.n)*(G.n|--If).x;
    A1: for m be Nat st P[m] holds P[m+1]
    proof
      let m be Nat such that
      A2: P[m];
      let B be finite Subset of V such that
      A3: card B=m+1 and
      A4: B c=conv If;
      conv If c=Affin If by RLAFFIN1:65;
      then A5: B c=Affin If by A4;
      then A6: Affin B c=Affin If by RLAFFIN1:51;
      let L be Linear_Combination of B such that
      A7: Carrier L=B and
      A8: sum L=1;
      Sum L in {Sum K where K is Linear_Combination of B:sum K=1} by A8;
      then Sum L in Affin B by RLAFFIN1:59;
      hence Sum L in Affin If by A6;
      per cases;
      suppose A9: m=0;
        let x be Element of V;
        consider b be object such that
        A10: B={b} by A3,A9,CARD_2:42;
        b in B by A10,TARSKI:def 1;
        then reconsider b as Element of V;
        A11: sum L=L.b by A7,A10,RLAFFIN1:32;
        set F=<*(b|--If).x*>,G=<*b*>;
        take F,G;
        Sum L=L.b*b by A10,RLVECT_2:32;
        then len G=1 & Sum L=b by A8,A11,FINSEQ_1:39,RLVECT_1:def 8;
        hence (Sum L|--If).x=Sum F & len G=len F & G is one-to-one & rng G=
        Carrier L by A7,A10,FINSEQ_1:39,FINSEQ_3:93,RVSUM_1:73;
        let n;
        assume n in dom F;
        then n in Seg 1 by FINSEQ_1:38;
        then A12: n=1 by FINSEQ_1:2,TARSKI:def 1;
        then G.n=b by FINSEQ_1:40;
        hence thesis by A8,A11,A12,FINSEQ_1:40;
      end;
      suppose A13: m>0;
        ex v be Element of V st L.v<>1 & v in Carrier L
        proof
          consider F be FinSequence of V such that
          A14: F is one-to-one and
          A15: rng F=Carrier L and
          A16: 1=Sum(L*F) by A8,RLAFFIN1:def 3;
          dom F,B are_equipotent by A7,A14,A15,WELLORD2:def 4;
          then A17: card B=card dom F by CARD_1:5
          .=card Seg len F by FINSEQ_1:def 3
          .=len F by FINSEQ_1:57;
          A18: len F=len(L*F) & len(len F|->1)=len F
            by CARD_1:def 7,FINSEQ_2:33;
          Sum(len F|->1)=len F*1 by RVSUM_1:80;
          then len F|->1<>L*F by A3,A13,A16,A17;
          then consider k be Nat such that
          A19: 1<=k & k<=len F and
          A20: (len F|->1).k<>(L*F).k by A18,FINSEQ_1:14;
          A21: k in Seg len F by A19,FINSEQ_1:1;
          A22: k in dom F by A19,FINSEQ_3:25;
          then A23: F.k in Carrier L by A15,FUNCT_1:def 3;
          L.(F.k)=(L*F).k by A22,FUNCT_1:13;
          then L.(F.k)<>1 by A20,A21,FINSEQ_2:57;
          hence thesis by A23;
        end;
        then consider v be Element of V such that
        A24: L.v<>1 and
        A25: v in Carrier L;
        set 1Lv=1-L.v;
        consider K be Linear_Combination of{v} such that
        A26: K.v=L.v by RLVECT_4:37;
        set LK=L-K;
        A27: 1Lv<>0 by A24;
        set 1LK=1/1Lv*LK;
        A28: Carrier K c={v} by RLVECT_2:def 6;
        then sum K=K.v by RLAFFIN1:32;
        then sum LK=1Lv by A8,A26,RLAFFIN1:36;
        then A29: sum 1LK=1/1Lv*1Lv by RLAFFIN1:35;
        LK.v=L.v-K.v by RLVECT_2:54;
        then A30: not v in Carrier LK by A26,RLVECT_2:19;
        A31: card(B\{v})=m by A3,A7,A25,STIRL2_1:55;
        A32: Sum K=L.v*v by A26,RLVECT_2:32;
        B\{v}c=B by XBOOLE_1:36;
        then A33: B\{v}c=conv If by A4;
        L.v<>0 by A25,RLVECT_2:19;
        then v in Carrier K by A26;
        then A34: Carrier K={v} by A28,ZFMISC_1:33;
        A35: B\{v}c=Carrier LK
        proof
          let x be object;
          assume A36: x in B\{v};
          then reconsider u=x as Element of V;
          u in B by A36,ZFMISC_1:56;
          then A37: L.u<>0 by A7,RLVECT_2:19;
          LK.u=L.u-K.u & not u in {v} by A36,RLVECT_2:54,XBOOLE_0:def 5;
          then LK.u<>0 by A34,A37;
          hence thesis;
        end;
        let x be Element of V;
        A38: 1/1Lv*1Lv=(1*1Lv)/1Lv by XCMPLX_1:74
        .=1 by A27,XCMPLX_1:60;
        Sum 1LK=1/1Lv*Sum LK by RLVECT_3:2;
        then 1Lv*Sum 1LK=(1Lv*(1/1Lv))*Sum LK by RLVECT_1:def 7
        .=Sum LK by A38,RLVECT_1:def 8;
        then A39: 1Lv*Sum 1LK+L.v*v=Sum L-L.v*v+L.v*v by A32,RLVECT_3:4
        .=Sum L by RLVECT_4:1;
        B\/{v}=B by A7,A25,ZFMISC_1:40;
        then Carrier LK c=B\{v} by A7,A34,A30,RLVECT_2:55,ZFMISC_1:34;
        then B\{v}=Carrier LK by A35;
        then A40: Carrier 1LK=B\{v} by A27,RLVECT_2:42;
        then A41: 1LK is Linear_Combination of B\{v} by RLVECT_2:def 6;
        then consider F be FinSequence of REAL,
                      G be FinSequence of V such that
        A42: (Sum 1LK|--If).x=Sum F and
        A43: len G=len F and
        A44: G is one-to-one and
        A45: rng G=Carrier 1LK and
        A46: for n st n in dom F holds F.n=1LK.(G.n)*(G.n|--If).x
          by A2,A29,A38,A31,A33,A40;
        Sum 1LK in Affin If by A2,A29,A38,A31,A33,A40,A41;
        then A47: Sum L|--If=1Lv*(Sum 1LK|--If)+L.v*(v|--If)
          by A5,A7,A25,A39,RLAFFIN1:70;
        take F1=(1Lv*F)^<*L.v*(v|--If).x*>,G1=G^<*v*>;
        thus Sum F1=Sum(1Lv*F)+L.v*(v|--If).x by RVSUM_1:74
        .=1Lv*(Sum 1LK|--If).x+L.v*(v|--If).x by A42,RVSUM_1:87
        .=(1Lv*(Sum 1LK|--If)).x+L.v*(v|--If).x by RLVECT_2:def 11
        .=(1Lv*(Sum 1LK|--If)).x+(L.v*(v|--If)).x by RLVECT_2:def 11
        .=(Sum L|--If).x by A47,RLVECT_2:def 10;
        reconsider f=F as Element of len F-tuples_on REAL by FINSEQ_2:92;
        A48: len F=len(1Lv*f) by CARD_1:def 7;
        then A49: len F1=len F+1 by FINSEQ_2:16;
        hence len F1=len G1 by A43,FINSEQ_2:16;
        A50: rng<*v*>={v} by FINSEQ_1:38;
        then <*v*> is one-to-one & rng G misses rng<*v*>
          by A40,A45,FINSEQ_3:93,XBOOLE_1:79;
        hence G1 is one-to-one by A44,FINSEQ_3:91;
        thus rng G1=B\{v}\/{v} by A40,A45,A50,FINSEQ_1:31
        .=Carrier L by A7,A25,ZFMISC_1:116;
        let n;
        assume A51: n in dom F1;
        then A52: n<=len F1 by FINSEQ_3:25;
        per cases by A49,A51,A52,FINSEQ_3:25,NAT_1:8;
        suppose A53: 1<=n & n<=len F;
          then n in dom F by FINSEQ_3:25;
          then A54: (1Lv*f).n=1Lv*f.n & F.n=1LK.(G.n)*(G.n|--If).x
            by A46,RVSUM_1:45;
          A55: n in dom G by A43,A53,FINSEQ_3:25;
          then A56: G1.n=G.n by FINSEQ_1:def 7;
          A57: G.n in B\{v} by A40,A45,A55,FUNCT_1:def 3;
          then not G.n in {v} by XBOOLE_0:def 5;
          then K.(G.n)=0 by A34,A57;
          then LK.(G.n)=L.(G.n)-0 by A57,RLVECT_2:54;
          then 1LK.(G.n)=(1/1Lv)*(L.(G.n)) by A57,RLVECT_2:def 11;
          then 1Lv*1LK.(G1.n)=1Lv*(1/1Lv)*(L.(G.n)) by A56;
          then A58: 1Lv*1LK.(G1.n)=L.(G.n) by A38;
          n in dom(1Lv*F) by A48,A53,FINSEQ_3:25;
          hence thesis by A54,A56,A58,FINSEQ_1:def 7;
        end;
        suppose A59: n=len F+1;
          then G1.n=v by A43,FINSEQ_1:42;
          hence thesis by A48,A59,FINSEQ_1:42;
        end;
      end;
    end;
    let L be Linear_Combination of Af such that
    A60: Af c=conv If and
    A61: sum L=1;
    set C=Carrier L;
    C c=Af by RLVECT_2:def 6;
    then A62: C c=conv If by A60;
    reconsider L1=L as Linear_Combination of C by RLVECT_2:def 6;
    A63: P[0 qua Nat]
    proof
      let B be finite Subset of V such that
      A64: card B=0 and
      B c=conv If;
      let L be Linear_Combination of B such that
      Carrier L=B and
      A65: sum L=1;
      B={}the carrier of V by A64;
      then L=ZeroLC(V) by RLVECT_2:23;
      hence thesis by A65,RLAFFIN1:31;
    end;
    for m be Nat holds P[m] from NAT_1:sch 2(A63,A1);
    then sum L=sum L1 & P[card C];
    hence thesis by A61,A62;
  end;
