reserve x1, x2, x3, x4, x5, x6, x7 for set;

theorem Th30:
  for A being Subset of R^1, a, b being Real st a < b & A =
  RAT (a, b) holds Cl A = [. a, b .]
proof
  let A be Subset of R^1, a, b be Real;
  assume that
A1: a < b and
A2: A = RAT (a, b);
  reconsider ab = ]. a, b .[, RT = RAT as Subset of R^1 by NUMBERS:12
,TOPMETR:17;
  reconsider RR = RAT /\ ]. a, b .[ as Subset of R^1 by TOPMETR:17;
A3: (the carrier of R^1) /\ Cl ab = Cl ab by XBOOLE_1:28;
A4: Cl RR c= (Cl RT) /\ Cl ab by PRE_TOPC:21;
  thus Cl A c= [. a, b .]
  proof
    let x be object;
    assume x in Cl A;
    then x in (Cl RT) /\ Cl ab by A2,A4;
    then x in (the carrier of R^1) /\ Cl ab by Th14;
    hence thesis by A1,A3,Th15;
  end;
  thus [. a, b .] c= Cl A
  proof
    let x be object;
    assume
A5: x in [. a, b .];
    then reconsider p = x as Element of RealSpace by METRIC_1:def 13;
A6: a <= p by A5,XXREAL_1:1;
A7: p <= b by A5,XXREAL_1:1;
    per cases by A7,XXREAL_0:1;
    suppose
A8:   p < b;
      now
        let r be Real;
        reconsider pp = p + r as Element of RealSpace by METRIC_1:def 13
,XREAL_0:def 1;
        set pr = min (pp, (p + b)/2);
A9:     pr <= (p + b)/2 by XXREAL_0:17;
        assume
A10:    r > 0;
        p < pr
        proof
          per cases by XXREAL_0:15;
          suppose
            pr = pp;
            hence thesis by A10,XREAL_1:29;
          end;
          suppose
            pr = (p + b)/2;
            hence thesis by A8,XREAL_1:226;
          end;
        end;
        then consider Q being Rational such that
A11:    p < Q and
A12:    Q < pr by RAT_1:7;
        (p + b)/2 < b by A8,XREAL_1:226;
        then pr < b by A9,XXREAL_0:2;
        then
A13:    Q < b by A12,XXREAL_0:2;
        pr <= pp by XXREAL_0:17;
        then
A14:    pr - p <= pp - p by XREAL_1:9;
        reconsider P = Q as Element of RealSpace by METRIC_1:def 13
,XREAL_0:def 1;
        P - p < pr - p by A12,XREAL_1:9;
        then P - p < r by A14,XXREAL_0:2;
        then dist (p, P) < r by A11,Th13;
        then
A15:    P in Ball (p, r) by METRIC_1:11;
        a < Q by A6,A11,XXREAL_0:2;
        then
A16:    Q in ]. a, b .[ by A13,XXREAL_1:4;
        Q in RAT by RAT_1:def 2;
        then Q in A by A2,A16,XBOOLE_0:def 4;
        hence Ball (p, r) meets A by A15,XBOOLE_0:3;
      end;
      hence thesis by GOBOARD6:92,TOPMETR:def 6;
    end;
    suppose
      p = b;
      hence thesis by A1,A2,Lm2;
    end;
  end;
end;
