
theorem Th22:
  for X be RealNormSpace, w be Point of X, e be Real,
      l be Linear_Combination of {w} st 0 < e holds
  ex m be Linear_Combination of {w}
  st Carrier m = Carrier l & rng m c= RAT & ||. Sum l - Sum m .|| < e
  proof
    let X be RealNormSpace, w be Point of  X, e be Real,
        l be Linear_Combination of {w};
    assume
    A1: 0 < e;
    A2: Carrier l c= {w} by RLVECT_2:def 6;
    per cases;
    suppose
      A3: not w in Carrier l;
      set m = l;
      take m;
      thus Carrier m = Carrier l;
      for y be object st y in rng m holds y in RAT
      proof
        let y be object;
        assume y in rng m; then
        consider x be object such that
        A4: x in dom m & y = m.x by FUNCT_1:def 3;
        reconsider x as Point of X by A4;
        not x in Carrier l by A2,A3,TARSKI:def 1; then
        y is integer by A4;
        hence y in RAT by NUMBERS:14;
      end;
      hence rng m c= RAT;
      Sum l - Sum m = 0.X by RLVECT_1:15;
      hence ||. Sum l - Sum m .|| < e by A1;
    end;
    suppose
      A5: w in Carrier l; then
      A6: Carrier l = {w} & l.w <> 0 by RLVECT_2:19,def 6,ZFMISC_1:31;
      per cases;
      suppose
        A7: w = 0.X;
        A8: Sum l = (l.w * w) by RLVECT_2:32;
        set m = (1/(l.w)) * l;
        Carrier m = Carrier l by A6,RLVECT_2:42; then
        reconsider m as Linear_Combination of {w} by RLVECT_2:def 6;
        take m;
        thus Carrier m = Carrier l by A6,RLVECT_2:42;
        for y be object st y in rng m holds y in RAT
        proof
          let y be object;
          assume y in rng m; then
          consider x be object such that
          A9: x in dom m & y = m.x by FUNCT_1:def 3;
          reconsider x as Point of X by A9;
          per cases;
          suppose
            not x in Carrier l; then
            A10: l.x = 0;
            y = (1/(l.w)) * l.x by A9,RLVECT_2:def 11; then
            y is integer by A10;
            hence y in RAT by NUMBERS:14;
          end;
          suppose
            x in Carrier l; then
            x = w by A6,TARSKI:def 1; then
            y = (1/(l.w)) * l.w by A9,RLVECT_2:def 11; then
            y is integer by A5,RLVECT_2:19,XCMPLX_1:87;
            hence y in RAT by NUMBERS:14;
          end;
        end;
        hence rng m c= RAT;
        Sum m = (1/(l.w)) * Sum(l) by RLVECT_3:2;
        hence ||. Sum l - Sum m .|| < e by A1,A7,A8;
      end;
      suppose
        A11: w <> 0.X; then
        A12: ||.w.|| <> 0 by NORMSP_0:def 5; then
        consider q be Element of RAT such that
        A13: q <> 0 & |. l.w - q .| < e / ||.w.|| by A1,Th21;
        set m = (q/(l.w)) * l;
        Carrier m = Carrier l by A6,A13,RLVECT_2:42; then
        reconsider m as Linear_Combination of {w} by RLVECT_2:def 6;
        take m;
        thus Carrier m = Carrier l by A6,A13,RLVECT_2:42;
        for y be object st y in rng m holds y in RAT
        proof
          let y be object;
          assume y in rng m; then
          consider x be object such that
          A14: x in dom m & y = m.x  by FUNCT_1:def 3;
          reconsider x as Point of X by A14;
          per cases;
          suppose
            not x in Carrier l; then
            A15: l.x = 0;
            y = (q/(l.w)) * l.x by A14,RLVECT_2:def 11; then
            y is integer by A15;
            hence y in RAT by NUMBERS:14;
          end;
          suppose
            x in Carrier l; then
            x = w by A6,TARSKI:def 1; then
            y = (q/(l.w)) * l.w by A14,RLVECT_2:def 11; then
            y = q by A5,RLVECT_2:19,XCMPLX_1:87;
            hence y in RAT;
          end;
        end;
        hence rng m c= RAT;
        A16: Sum (m) = (q/(l.w)) * Sum(l) by RLVECT_3:2
                    .= (q/(l.w)) * (l.w * w) by RLVECT_2:32
                    .= ((q/(l.w)) * l.w) * w by RLVECT_1:def 7
                    .= q * w by A5,RLVECT_2:19,XCMPLX_1:87;
        Sum l - Sum m = (l.w * w) - Sum m by RLVECT_2:32
                     .= (l.w - q) * w by A16,RLVECT_1:35; then
        A17: ||. Sum l - Sum m .|| = |. l.w - q .| * ||.w.|| by NORMSP_1:def 1;
        |. l.w - q .| * ||.w.|| < e / ||.w.|| * ||.w.|| by A12,A13,XREAL_1:68;
        hence ||. Sum l - Sum m .|| < e by A11,A17,NORMSP_0:def 5,XCMPLX_1:87;
      end;
    end;
  end;
