reserve x,y,y1,y2 for set,
  p for FinSequence,
  i,k,l,n for Nat,
  V for RealLinearSpace,
  u,v,v1,v2,v3,w for VECTOR of V,
  a,b for Real,
  F,G,H1,H2 for FinSequence of V,
  A,B for Subset of V,
  f for Function of the carrier of V, REAL;
reserve K,L,L1,L2,L3 for Linear_Combination of V;
reserve l,l1,l2 for Linear_Combination of A;

theorem
  A <> {} & A is linearly-closed iff for l holds Sum(l) in A
proof
  thus A <> {} & A is linearly-closed implies for l holds Sum(l) in A
  proof
    defpred P[Nat] means
   for l st card(Carrier(l)) = $1 holds Sum (l) in A;
    assume that
A1: A <> {} and
A2: A is linearly-closed;
    now
      let l;
      assume card(Carrier(l)) = 0;
      then Carrier(l) = {};
      then l = ZeroLC(V) by Def5;
      then Sum(l) = 0.V by Lm2;
      hence Sum(l) in A by A1,A2,RLSUB_1:1;
    end;
    then
A3: P[0];
    now
      let k;
      assume
A4:   for l st card(Carrier(l)) = k holds Sum(l) in A;
      let l;
      deffunc F(Element of V)= l.$1;
      consider F such that
A5:   F is one-to-one and
A6:   rng F = Carrier(l) and
A7:   Sum(l) = Sum(l (#) F) by Def8;
      reconsider G = F | Seg k as FinSequence of the carrier of V by
FINSEQ_1:18;
      assume
A8:   card(Carrier(l)) = k + 1;
      then
A9:   len F = k + 1 by A5,A6,FINSEQ_4:62;
      then
A10:  len(l (#) F) = k + 1 by Def7;
A11:  k + 1 in Seg(k + 1) by FINSEQ_1:4;
      then
A12:  k + 1 in dom F by A9,FINSEQ_1:def 3;
      k+1 in dom F by A9,A11,FINSEQ_1:def 3;
      then reconsider v = F.(k + 1) as VECTOR of V by FUNCT_1:102;
      consider f being Function of the carrier of V, REAL such that
A13:  f.v = In(0,REAL) and
A14:  for u being Element of V st u <> v holds f.u = F(u) from
      FUNCT_2:sch 6;
      reconsider f as Element of Funcs(the carrier of V, REAL) by FUNCT_2:8;
A15:  v in Carrier(l) by A6,A12,FUNCT_1:def 3;
      now
        let u;
        assume
A16:    not u in Carrier(l);
        hence f.u = l.u by A15,A14
          .= 0 by A16;
      end;
      then reconsider f as Linear_Combination of V by Def3;
A17:  A \ {v} c= A by XBOOLE_1:36;
A18:  Carrier(l) c= A by Def6;
      then
A19:  l.v * v in A by A2,A15;
A20:  Carrier(f) = Carrier(l) \ {v}
      proof
        thus Carrier(f) c= Carrier(l) \ {v}
        proof
          let x be object;
          assume x in Carrier(f);
          then consider u such that
A21:      u = x and
A22:      f.u <> 0;
          f.u = l.u by A13,A14,A22;
          then
A23:      x in Carrier(l) by A21,A22;
          not x in {v} by A13,A21,A22,TARSKI:def 1;
          hence thesis by A23,XBOOLE_0:def 5;
        end;
        let x be object;
        assume
A24:    x in Carrier(l) \ {v};
        then x in Carrier(l) by XBOOLE_0:def 5;
        then consider u such that
A25:    x = u and
A26:    l.u <> 0;
        not x in {v} by A24,XBOOLE_0:def 5;
        then x <> v by TARSKI:def 1;
        then l.u = f.u by A14,A25;
        hence thesis by A25,A26;
      end;
      then Carrier(f) c= A \ {v} by A18,XBOOLE_1:33;
      then Carrier(f) c= A by A17;
      then reconsider f as Linear_Combination of A by Def6;
A27:  len G = k by A9,FINSEQ_3:53;
      then
A28:  len (f (#) G) = k by Def7;
A29:  rng G = Carrier(f)
      proof
        thus rng G c= Carrier(f)
        proof
          let x be object;
          assume x in rng G;
          then consider y being object such that
A30:      y in dom G and
A31:      G.y = x by FUNCT_1:def 3;
          reconsider y as Element of NAT by A30;
A32:      dom G c= dom F & G.y = F.y by A30,FUNCT_1:47,RELAT_1:60;
          now
            assume x = v;
            then
A33:        k + 1 = y by A5,A12,A30,A31,A32;
            y <= k by A27,A30,FINSEQ_3:25;
            hence contradiction by A33,XREAL_1:29;
          end;
          then
A34:      not x in {v} by TARSKI:def 1;
          x in rng F by A30,A31,A32,FUNCT_1:def 3;
          hence thesis by A6,A20,A34,XBOOLE_0:def 5;
        end;
        let x be object;
        assume
A35:    x in Carrier(f);
        then x in rng F by A6,A20,XBOOLE_0:def 5;
        then consider y being object such that
A36:    y in dom F and
A37:    F.y = x by FUNCT_1:def 3;
        reconsider y as Element of NAT by A36;
        now
          assume not y in Seg k;
          then y in dom F \ Seg k by A36,XBOOLE_0:def 5;
          then y in Seg(k + 1) \ Seg k by A9,FINSEQ_1:def 3;
          then y in {k + 1} by FINSEQ_3:15;
          then y = k + 1 by TARSKI:def 1;
          then not v in {v} by A20,A35,A37,XBOOLE_0:def 5;
          hence contradiction by TARSKI:def 1;
        end;
        then y in dom F /\ Seg k by A36,XBOOLE_0:def 4;
        then
A38:    y in dom G by RELAT_1:61;
        then G.y = F.y by FUNCT_1:47;
        hence thesis by A37,A38,FUNCT_1:def 3;
      end;
      Seg(k + 1) /\ Seg k = Seg k by FINSEQ_1:7,NAT_1:12
        .= dom(f (#) G) by A28,FINSEQ_1:def 3;
      then
A39:  dom(f (#) G) = dom(l (#) F) /\ Seg k by A10,FINSEQ_1:def 3;
      now
        let x be object;
        assume
A40:    x in dom(f (#) G);
        then reconsider n = x as Element of NAT;
        n in dom(l (#) F) by A39,A40,XBOOLE_0:def 4;
        then
A41:    n in dom F by A9,A10,FINSEQ_3:29;
        then F.n in rng F by FUNCT_1:def 3;
        then reconsider w = F.n as VECTOR of V;
A42:    n in dom G by A27,A28,A40,FINSEQ_3:29;
        then
A43:    G.n in rng G by FUNCT_1:def 3;
        then reconsider u = G.n as VECTOR of V;
        not u in {v} by A20,A29,A43,XBOOLE_0:def 5;
        then
A44:    u <> v by TARSKI:def 1;
A45:    (f (#) G).n = f.u * u by A42,Th24
          .= l.u * u by A14,A44;
        w = u by A42,FUNCT_1:47;
        hence (f (#) G).x = (l (#) F).x by A45,A41,Th24;
      end;
      then
A46:  f (#) G = (l (#) F) | Seg k by A39,FUNCT_1:46;
      v in rng F by A12,FUNCT_1:def 3;
      then {v} c= Carrier(l) by A6,ZFMISC_1:31;
      then card(Carrier(f)) = k + 1 - card{v} by A8,A20,CARD_2:44
        .= k + 1 - 1 by CARD_1:30
        .= k;
      then
A47:  Sum(f) in A by A4;
      G is one-to-one by A5,FUNCT_1:52;
      then
A48:  Sum(f (#) G) = Sum(f) by A29,Def8;
      dom(f (#) G) = Seg len (f (#) G) & (l (#) F).(len F) = l.v * v by A9,A12
,Th24,FINSEQ_1:def 3;
      then Sum(l (#) F) = Sum (f (#) G) + l.v * v by A9,A10,A28,A46,RLVECT_1:38
;
      hence Sum(l) in A by A2,A7,A19,A48,A47;
    end;
    then
A49: for k st P[k] holds P[k+1];
    let l;
A50: card(Carrier(l)) = card(Carrier(l));
    for k holds P[k] from NAT_1:sch 2(A3,A49);
    hence thesis by A50;
  end;
  assume
A51: for l holds Sum(l) in A;
  hence A <> {};
  ZeroLC(V) is Linear_Combination of A & Sum(ZeroLC(V)) = 0.V by Lm2,Th22;
  then
A52: 0.V in A by A51;
A53: for a,v st v in A holds a * v in A
  proof
    let a,v;
    assume
A54: v in A;
    now
      per cases;
      suppose
        a = 0;
        hence thesis by A52,RLVECT_1:10;
      end;
      suppose
A55:    a <> 0;
        deffunc F(Element of V) = zz;
        reconsider aa=a as Element of REAL by XREAL_0:def 1;
        consider f such that
A56:    f.v = aa and
A57:    for u being Element of V st u <> v holds f.u = F(u) from
        FUNCT_2:sch 6;
        reconsider f as Element of Funcs(the carrier of V, REAL) by FUNCT_2:8;
        now
          let u;
          assume not u in {v};
          then u <> v by TARSKI:def 1;
          hence f.u = 0 by A57;
        end;
        then reconsider f as Linear_Combination of V by Def3;
A58:    Carrier(f) = {v}
        proof
          thus Carrier(f) c= {v}
          proof
            let x be object;
            assume x in Carrier(f);
            then consider u such that
A59:        x = u and
A60:        f.u <> 0;
            u = v by A57,A60;
            hence thesis by A59,TARSKI:def 1;
          end;
          let x be object;
          assume x in {v};
          then x = v by TARSKI:def 1;
          hence thesis by A55,A56;
        end;
        {v} c= A by A54,ZFMISC_1:31;
        then reconsider f as Linear_Combination of A by A58,Def6;
        consider F such that
A61:    F is one-to-one & rng F = Carrier(f) and
A62:    Sum(f (#) F) = Sum(f) by Def8;
        F = <* v *> by A58,A61,FINSEQ_3:97;
        then f (#) F = <* f.v * v *> by Th26;
        then Sum(f) = a * v by A56,A62,RLVECT_1:44;
        hence thesis by A51;
      end;
    end;
    hence thesis;
  end;
  thus for v,u st v in A & u in A holds v + u in A
  proof
    let v,u;
    assume that
A63: v in A and
A64: u in A;
    now
      per cases;
      suppose
        u = v;
        then v + u = 1 * v + v by RLVECT_1:def 8
          .= 1 * v + 1 * v by RLVECT_1:def 8
          .= (1 + 1) * v by RLVECT_1:def 6
          .= 2 * v;
        hence thesis by A53,A63;
      end;
      suppose
A65:    v <> u;
        deffunc F(Element of V)=zz;
        reconsider jj=1 as Element of REAL by XREAL_0:def 1;
        consider f such that
A66:    f.v = jj & f.u = jj and
A67:    for w being Element of V st w <> v & w <> u holds f.w = F(w)
        from FUNCT_2:sch 7(A65);
        reconsider f as Element of Funcs(the carrier of V, REAL) by FUNCT_2:8;
        now
          let w;
          assume not w in {v,u};
          then w <> v & w <> u by TARSKI:def 2;
          hence f.w = 0 by A67;
        end;
        then reconsider f as Linear_Combination of V by Def3;
A68:    Carrier(f) = {v,u}
        proof
          thus Carrier(f) c= {v,u}
          proof
            let x be object;
            assume x in Carrier(f);
            then ex w st x = w & f.w <> 0;
            then x = v or x = u by A67;
            hence thesis by TARSKI:def 2;
          end;
          let x be object;
          assume x in {v,u};
          then x = v or x = u by TARSKI:def 2;
          hence thesis by A66;
        end;
        then
A69:    Carrier(f) c= A by A63,A64,ZFMISC_1:32;
A70:    1 * u = u & 1 * v = v by RLVECT_1:def 8;
        reconsider f as Linear_Combination of A by A69,Def6;
        consider F such that
A71:    F is one-to-one & rng F = Carrier(f) and
A72:    Sum(f (#) F) = Sum(f) by Def8;
        F = <* v,u *> or F = <* u,v *> by A65,A68,A71,FINSEQ_3:99;
        then f (#) F = <* 1 * v, 1 * u *> or f (#) F = <* 1 * u, 1* v *> by A66
,Th27;
        then Sum(f) = v + u by A72,A70,RLVECT_1:45;
        hence thesis by A51;
      end;
    end;
    hence thesis;
  end;
  thus thesis by A53;
end;
