reserve i,n,m for Nat,
  x,y,X,Y for set,
  r,s for Real;

theorem Th30:
  for M be Reflexive symmetric triangle non empty MetrStruct holds
  M is totally_bounded iff for r be Real,A be Subset of M st r>0 & for p,q be
  Point of M st p <> q & p in A & q in A holds dist(p,q) >= r holds A is finite
proof
  let M be Reflexive symmetric triangle non empty MetrStruct;
  thus M is totally_bounded implies for r be Real,A be Subset of M st r>0 &
for p,q be Point of M st p <> q & p in A & q in A holds dist(p,q) >= r holds A
  is finite
  proof
    assume
A1: M is totally_bounded;
    let r be Real,A be Subset of M such that
A2: r>0 and
A3: for p,q be Point of M st p <> q & p in A & q in A holds dist(p,q) >=r;
    r/2>0 by A2,XREAL_1:215;
    then consider G be Subset-Family of M such that
A4: G is finite and
A5: the carrier of M = union G and
A6: for C be Subset of M st C in G ex w be Point of M st C = Ball(w,r/
    2) by A1;
    defpred f[object,object] means
     ex D2 being set st D2 = $2 & $1 in D2 & $2 in G;
A7: for x being object st x in A
      ex y being object st y in bool(the carrier of M) & f[x,y]
    proof
      let x be object;
      assume x in A;
      then consider y such that
A8:   x in y and
A9:   y in G by A5,TARSKI:def 4;
      reconsider y as Subset of M by A9;
      take y;
      thus thesis by A8,A9;
    end;
    consider F be Function of A, bool the carrier of M such that
A10: for x being object st x in A holds f[x,F.x] from FUNCT_2:sch 1(A7);
    now
      let x1,x2 be object such that
A11:  x1 in A and
A12:  x2 in A and
A13:  F.x1 = F.x2;
      reconsider p1=x1,p2=x2 as Point of M by A11,A12;
A14:   f[x1,F.x1] by A10,A11;
      then F.x1 in G;
      then consider w be Point of M such that
A15:  F.x1 = Ball(w,r/2) by A6;
      p1 in Ball(w,r/2) by A15,A14;
      then
A16:  dist(p1,w)<r/2 by METRIC_1:11;
A17:  dist(p1,p2)<=dist(p1,w)+dist(w,p2) by METRIC_1:4;
      f[x2,F.x2] by A10,A12;
      then p2 in Ball(w,r/2) by A13,A15;
      then dist(w,p2)<r/2 by METRIC_1:11;
      then dist(p1,w)+dist(w,p2)<r/2+r/2 by A16,XREAL_1:8;
      then dist(p1,p2)<r/2+r/2 by A17,XXREAL_0:2;
      hence x1 = x2 by A3,A11,A12;
    end;
    then
A18: F is one-to-one by FUNCT_2:19;
A19: rng F c= G
    proof
      let x be object;
      assume x in rng F;
      then consider y being object such that
A20:     y in dom F & x=F.y by FUNCT_1:def 3;
       f[y,F.y] by A10,A20;
       then consider D2 being set such that
A21:      D2 = F.y & y in D2 & F.y in G;
      thus thesis by A20,A21;
    end;
    dom F=A by FUNCT_2:def 1;
    then A,rng F are_equipotent by A18,WELLORD2:def 4;
    hence thesis by A4,A19,CARD_1:38;
  end;
  assume
A22: for r be Real,A be Subset of M st r>0 & for p,q be Point of M st p
  <> q & p in A & q in A holds dist(p,q) >= r holds A is finite;
  let r such that
A23: r>0;
  reconsider r as Real;
  consider A be Subset of M such that
A24: for p,q be Point of M st p <> q & p in A & q in A holds dist(p,q) >= r and
A25: for p be Point of M ex q be Point of M st q in A& p in Ball(q,r) by A23
,Th29;
  deffunc B(Point of M)=Ball($1,r);
  set BA={B(p) where p is Point of M:p in A};
A26: A is finite by A22,A23,A24;
A27: BA is finite from FRAENKEL:sch 21(A26);
  BA c= bool the carrier of M
  proof
    let x be object;
    assume x in BA;
    then ex p be Point of M st x = B(p) & p in A;
    hence thesis;
  end;
  then reconsider BA as Subset-Family of M;
  take BA;
  the carrier of M c= union BA
  proof
    let x be object;
    assume x in the carrier of M;
    then reconsider p=x as Point of M;
    consider q be Point of M such that
A28: q in A and
A29: p in B(q) by A25;
    B(q) in BA by A28;
    hence thesis by A29,TARSKI:def 4;
  end;
  hence BA is finite & union BA = the carrier of M by A27,XBOOLE_0:def 10;
  let C be Subset of M;
  assume C in BA;
  then ex p be Point of M st C=B(p) & p in A;
  hence thesis;
end;
