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 Th19:
  x in Z_Lin{w1,w2} iff ex a,b be Integer st x = a * w1 + b * w2
proof
  thus x in Z_Lin{w1,w2} implies ex a,b be Integer
    st x = a * w1 + b * w2
  proof
    assume
A1: x in Z_Lin{w1,w2};
    now
      per cases;
      suppose
        w1 = w2;
        then {w1,w2} = {w1} by ENUMSET1:29;
        then consider a be Integer such that
A2:     x = a * w1 by A1,Th16;
        consider b be Integer such that
A3:     b = 0;
        x = a * w1 + 0.V by A2,RLVECT_1:4;
        then x = a * w1 + b * w2 by A3,RLVECT_1:10;
        hence thesis;
      end;
      suppose
A4:     w1 <> w2;
        consider l being Linear_Combination of {w1,w2} such that
A5:     x = Sum(l) & rng l c= INT by A1;
A6:     x = l.w1 * w1 + l.w2 * w2 by A4,A5,RLVECT_2:33;
        ex f being Function st l = f & dom f = the carrier of V
              & rng f c= REAL by FUNCT_2:def 2; then
        l.w1 in rng l & l.w2 in rng l by FUNCT_1:3;
        hence thesis by A5,A6;
      end;
    end;
    hence thesis;
  end;
  given a0,b0 be Integer such that
A7: x = a0 * w1 + b0 * w2;
  reconsider a=a0,b=b0 as Element of REAL by XREAL_0:def 1;
  now
    per cases;
    suppose
A8:   w1 = w2;
      then x = (a + b) * w1 by A7,RLVECT_1:def 6;
      then x in Z_Lin{w1} by Th16;
      hence thesis by A8,ENUMSET1:29;
    end;
    suppose
A9:   w1 <> w2;
      consider f being Function of the carrier of V, REAL such that
A10:   f.w1 = a & f.w2 = b and
A11:   for u st u <> w1 & u <> w2 holds f.u = H(u) from FUNCT_2:sch 7(A9);
      reconsider f as Element of Funcs(the carrier of V,REAL) by FUNCT_2:8;
A12:  now
        let u;
        assume not u in {w1,w2};
        then u <> w1 & u <> w2 by TARSKI:def 2;
        hence f.u = 0 by A11;
      end;
      then reconsider f as Linear_Combination of V by RLVECT_2:def 3;
      Carrier f c= {w1,w2}
      proof
        let x be object;
        assume that
A13:    x in Carrier f and
A14:    not x in {w1,w2};
        x <> w1 & x <> w2 by A14,TARSKI:def 2;
        then f.x = 0 by A11,A13;
        hence contradiction by A13,RLVECT_2:19;
      end;
      then reconsider f as Linear_Combination of {w1,w2} by RLVECT_2:def 6;
A15:  x = Sum(f) by A7,A9,A10,RLVECT_2:33;
      rng f c= INT
      proof
       let y be object;
       assume A16:y in rng f;
       consider x be object
         such that A17: x in the carrier of V & y=f.x by A16,FUNCT_2:11;
       reconsider v=x as VECTOR of V by A17;
       per cases;
         suppose not v in {w1,w2}; then
         f.v = 0 by A12;
         hence y in INT by A17,NUMBERS:17;
        end;
         suppose v in {w1,w2}; then
         f.v = a0 or f.v = b0 by A10,TARSKI:def 2;
         hence y in INT by A17,INT_1:def 2;
        end;
      end;
      hence thesis by A15;
    end;
  end;
  hence thesis;
end;
