reserve x,y for set;
reserve a,b for Real;
reserve i,j for Integer;
reserve V for RealLinearSpace;
reserve W1,W2,W3 for Subspace of V;
reserve v,v1,v2,v3,u,w,w1,w2,w3 for VECTOR of V;
reserve A,B,C for Subset of V;
reserve L,L1,L2 for Linear_Combination of V;
reserve l,l1,l2 for Linear_Combination of A;

theorem
  Z_Lin(A \/ B) = Z_Lin(A) + Z_Lin(B)
proof
  now
    let v be object;
    assume v in Z_Lin(A \/ B);
    then consider l being Linear_Combination of A \/ B such that
A1: v = Sum(l) & rng l c= INT;
    deffunc F(object)=l.$1;
    set D = Carrier(l) \ A;
    set C = Carrier(l) /\ A;
    defpred P[object] means $1 in C;
    defpred D[object] means $1 in D;
A2: for x being object st x in the carrier of V
holds (P[x] implies F(x) in REAL) & (
    not P[x ] implies H(x) in REAL) by XREAL_0:def 1;
    consider f being Function of the carrier of V, REAL such that
A3: for x being object st x in the carrier of V
   holds (P[x] implies f.x = F(x)) &
    (not P[x] implies f.x = H(x)) from FUNCT_2:sch 5 (A2);
    reconsider C as finite Subset of V;
    reconsider f as Element of Funcs(the carrier of V, REAL) by FUNCT_2:8;
    for u holds not u in C implies f.u = 0 by A3;
    then reconsider f as Linear_Combination of V by RLVECT_2:def 3;
A4: rng f c= INT
    proof
      let y be object;
      assume A5:y in rng f;
      consider x be object such that
A6:   x in the carrier of V & y=f.x by A5,FUNCT_2:11;
       reconsider z=x as VECTOR of V by A6;
       per cases;
         suppose not z in C; then
         f.z = 0 by A3;
         hence y in INT by A6,NUMBERS:17;
        end;
         suppose z in C; then
         f.z = l.z by A3; then
         f.z in rng l by FUNCT_2:4;
         hence y in INT by A6,A1;
        end;
      end;
A7: Carrier(f) c= C
    proof
      let x be object;
      assume x in Carrier(f); then
A8:   ex u st x = u & f.u <> 0;
      assume not x in C;
      hence thesis by A3,A8;
    end;
    C c= A by XBOOLE_1:17;
    then Carrier(f) c= A by A7;
    then reconsider f as Linear_Combination of A by RLVECT_2:def 6;
A9: for x being object st x in the carrier of V
holds (D[x] implies F(x) in REAL) & (
    not D[x] implies H(x) in REAL) by XREAL_0:def 1;
    consider g being Function of the carrier of V, REAL such that
A10: for x being object st x in the carrier of V
holds (D[x] implies g.x = F(x)) &
    (not D[x] implies g.x = H(x)) from FUNCT_2:sch 5(A9);
    reconsider D as finite Subset of V;
    reconsider g as Element of Funcs(the carrier of V, REAL) by FUNCT_2:8;
    for u holds not u in D implies g.u = 0 by A10;
    then reconsider g as Linear_Combination of V by RLVECT_2:def 3;
A11: rng g c= INT
   proof
       let y be object;
       assume A12:y in rng g;
       consider x be object
         such that A13: x in the carrier of V & y=g.x by A12,FUNCT_2:11;
       reconsider z=x as VECTOR of V by A13;
       per cases;
         suppose not z in D;
         then g.z = 0 by A10;
         hence y in INT by A13,NUMBERS:17;
        end;
         suppose z in D;
         then g.z = l.z by A10;
         then g.z in rng l by FUNCT_2:4;
         hence y in INT by A13,A1;
        end;
      end;
A14: D c= B
    proof
      let x be object;
      assume x in D; then
A15:   x in Carrier(l) & not x in A by XBOOLE_0:def 5;
      Carrier(l) c= A \/ B by RLVECT_2:def 6;
      hence thesis by A15,XBOOLE_0:def 3;
    end;
    Carrier(g) c= D
    proof
      let x be object;
      assume x in Carrier(g); then
A16:  ex u st x = u & g.u <> 0;
      assume not x in D;
      hence thesis by A10,A16;
    end;
    then Carrier(g) c= B by A14;
    then reconsider g as Linear_Combination of B by RLVECT_2:def 6;
    l = f + g
    proof
      let v;
      now
        per cases;
        suppose
A17:      v in C;
A18:      now
            assume v in D;
            then not v in A by XBOOLE_0:def 5;
            hence contradiction by A17,XBOOLE_0:def 4;
          end;
          thus (f + g).v = f.v + g.v by RLVECT_2:def 10
            .= l.v + g.v by A3,A17
            .= l.v + z0 by A10,A18
            .= l.v;
        end;
        suppose
A19:      not v in C;
          now
            per cases;
            suppose
A20:          v in Carrier(l);
A21:          now
                assume not v in D;
                then not v in Carrier(l) or v in A by XBOOLE_0:def 5;
                hence contradiction by A19,A20,XBOOLE_0:def 4;
              end;
              thus (f + g). v = f.v + g.v by RLVECT_2:def 10
                .= z0 + g.v by A3,A19
                .= l.v by A10,A21;
            end;
            suppose
A22:          not v in Carrier(l); then
A23:          not v in D by XBOOLE_0:def 5;
A24:          not v in C by A22,XBOOLE_0:def 4;
              thus (f + g).v = f.v + g.v by RLVECT_2:def 10
                .= z0 + g.v by A3,A24
                .= z0 + z0 by A10,A23
                .= l.v by A22;
            end;
          end;
          hence thesis;
        end;
      end;
      hence thesis;
    end;
    then
A25: v = Sum(f) + Sum(g) by A1,RLVECT_3:1;
    Sum(f) in Z_Lin(A) & Sum(g) in Z_Lin(B) by A4,A11;
    hence v in Z_Lin(A) + Z_Lin(B) by A25;
  end;
  then
A26: Z_Lin(A \/ B) c= Z_Lin(A) + Z_Lin(B);
A27: Z_Lin(A) c=Z_Lin(A \/ B) & Z_Lin(B) c= Z_Lin(A \/ B) by Th13,XBOOLE_1:7;
 now let x be object;
   assume x in Z_Lin(A) + Z_Lin(B); then
   consider u,v be Element of V such that
A28:x=u+v & u in Z_Lin(A) & v in Z_Lin(B);
    thus x in Z_Lin(A \/ B) by A28,A27,Th9;
 end; then
    Z_Lin(A) + Z_Lin(B) c= Z_Lin(A \/ B);
  hence thesis by A26,XBOOLE_0:def 10;
end;
