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

theorem
  for M be non empty MetrSpace holds M is complete iff for F be
Subset-Family of TopSpaceMetr M st F is closed & F is centered &
 for r be Real
  st r > 0 ex A be Subset of M st A in F & A is bounded & diameter A < r holds
  meet F is non empty
proof
  let M be non empty MetrSpace;
  set T=TopSpaceMetr(M);
  thus M is complete implies for F be Subset-Family of T st F is closed & F is
centered & for r st r>0 ex A be Subset of M st A in F & A is bounded & diameter
  A < r holds meet F is non empty
  proof
    reconsider NULL=0 as Real;
    deffunc F(Nat)=1/(1+$1);
    assume
A1: M is complete;
    consider seq be Real_Sequence such that
A2: for n be Nat holds seq.n=F(n) from SEQ_1:sch 1;
    set Ns=NULL(#)seq;
    let F be Subset-Family of T such that
A3: F is closed and
A4: F is centered and
A5: for r st r>0 ex A be Subset of M st A in F & A is bounded & diameter A<r;
A6: for n be Nat holds seq.n=1/(n+1) by A2;
    then
A7: Ns is convergent by SEQ_2:7,SEQ_4:31;
    defpred P[object,object] means
for i st i=$1 for A be Subset of M st A=$2 holds
    A in F & A is bounded & diameter A <1/(i+1);
A8: for x being object st x in NAT
ex y being object st y in bool(the carrier of M) & P[x,y]
    proof
      let x be object;
      assume x in NAT;
      then reconsider i=x as Nat;
      consider A be Subset of M such that
A9:   A in F and
A10:  A is bounded and
A11:  diameter A < 1/(i+1) by A5,XREAL_1:139;
      take A;
      thus thesis by A9,A10,A11;
    end;
    consider f be SetSequence of M such that
A12: for x being object st x in NAT holds P[x,f.x] from FUNCT_2:sch 1(A8);
    rng f c= F
    proof
      let x be object;
      assume x in rng f;
      then consider y being object such that
A13:  y in dom f and
A14:  f.y=x by FUNCT_1:def 3;
      reconsider y as Element of NAT by A13;
      f.y in F by A12;
      hence thesis by A14;
    end;
    then consider R be SetSequence of T such that
A15: R is non-ascending and
A16: F is centered implies R is non-empty and
    F is open implies R is open and
A17: F is closed implies R is closed and
A18: for i holds R.i = meet {f.j where j is Element of NAT: j<=i} by Th13;
    reconsider R9=R as non-empty SetSequence of M by A4,A16;
    now
      let i;
      f.0 in {f.j where j is Element of NAT: j <= i};
      then meet {f.j where j is Element of NAT: j <= i} c= f.0 by SETFAM_1:3;
      then R.i c= f.0 by A18;
      hence R9.i is bounded by A12,TBSP_1:14;
    end;
    then reconsider R9 as non-empty pointwise_bounded SetSequence of M by Def1;
    set dR=diameter R9;
A19: now
      let n be Nat;
A20:    n in NAT by ORDINAL1:def 12;
      set Sn={f.j where j is Element of NAT:j<=n};
A21:  f.n in Sn by A20;
      R.n=meet Sn by A18;
      then
A22:  R.n c= f.n by A21,SETFAM_1:3;
      then diameter R9.n <= diameter f.n by A12,TBSP_1:24,A20;
      then
A23:  diameter R9.n <= F(n) by A12,XXREAL_0:2,A20;
      f.n is bounded by A12,A20;
      then
A24:  0<= diameter R9.n by A22,TBSP_1:14,21;
A25:  Ns.n=NULL*seq.n by SEQ_1:9;
      F(n)=seq.n by A2;
      hence Ns.n <= dR.n & dR.n<=seq.n by A24,A23,A25,Def2;
    end;
A26: lim seq=0 by A6,SEQ_4:31;
    then
A27: lim Ns=NULL*0 by A6,SEQ_2:8,SEQ_4:31;
A28: seq is convergent by A6,SEQ_4:31;
    then
A29: lim dR=0 by A26,A7,A27,A19,SEQ_2:20;
A30: R9 is closed by A3,A17,Th7;
    then meet R9<>{} by A1,A15,A29,Th10;
    then consider x0 be object such that
A31: x0 in meet R9 by XBOOLE_0:def 1;
    reconsider x0 as Point of M by A31;
A32: dR is convergent by A28,A26,A7,A27,A19,SEQ_2:19;
A33: now
      let y;
      assume
A34:  y in F;
      then reconsider Y=y as Subset of T;
      defpred P9[object,object] means
       for i st i=$1 holds $2=R.i/\Y;
A35:  for x being object st x in NAT
ex z be object st z in bool(the carrier of M) & P9[x ,z]
      proof
        let x be object;
        assume x in NAT;
        then reconsider i=x as Nat;
        take R.i/\Y;
        thus thesis;
      end;
      consider f9 be SetSequence of M such that
A36:  for x being object st x in NAT holds P9[x,f9.x] from FUNCT_2:sch 1(A35);
A37:  now
        deffunc F(object)=f.$1;
        let x be object;
        assume x in dom f9;
        then reconsider i=x as Element of NAT;
        set SS={f.j where j is Element of NAT:j<=i};
A38:    f.i in SS;
A39:    SS c= {F(j) where j is Element of NAT:j in i+1}
        proof
          let x be object;
          assume x in SS;
          then consider j be Element of NAT such that
A40:      x=f.j and
A41:      j<=i;
          j<i+1 by A41,NAT_1:13;
          then j in Segm(i+1) by NAT_1:44;
          hence thesis by A40;
        end;
A42:    {Y}\/SS c= F
        proof
          let z be object such that
A43:      z in {Y}\/SS;
          per cases by A43,XBOOLE_0:def 3;
          suppose
            z in {Y};
            hence thesis by A34,TARSKI:def 1;
          end;
          suppose
            z in SS;
            then ex j be Element of NAT st z=f.j & j<=i;
            hence thesis by A12;
          end;
        end;
A44:    i+1 is finite;
        {F(j)where j is Element of NAT:j in i+1} is finite from FRAENKEL:
        sch 21(A44);
        then meet({Y}\/SS)<>{} by A4,A42,A39,FINSET_1:def 3;
        then meet {Y} /\ meet SS <> {} by A38,SETFAM_1:9;
        then Y /\meet SS<>{} by SETFAM_1:10;
        then Y/\R.i<>{} by A18;
        hence f9.x is non empty by A36;
      end;
A45:  now
        let i;
        reconsider Ri=R.i as Subset of T;
        i in NAT by ORDINAL1:def 12;
        then
A46:    f9.i=Ri/\Y by A36;
        R9.i is closed by A30;
        then
A47:    Ri is closed by Th6;
        Y is closed by A3,A34;
        hence f9.i is closed by A47,A46,Th6;
      end;
      now
        let i;
        i in NAT by ORDINAL1:def 12;
        then
A48:    f9.i=R9.i /\ Y by A36;
        R9.i is bounded by Def1;
        hence f9.i is bounded by A48,TBSP_1:14,XBOOLE_1:17;
      end;
      then reconsider f9 as non-empty pointwise_bounded closed SetSequence of M
      by A37,A45,Def1,Def8,FUNCT_1:def 9;
A49:  f9.0=R.0/\Y by A36;
      set df=diameter f9;
      now
        reconsider Y9=Y as Subset of M;
        let n be Nat;
A50:    Ns.n=NULL*seq.n by SEQ_1:9;
        n in NAT by ORDINAL1:def 12;
        then
A51:    R.n/\Y9=f9.n by A36;
A52:    R9.n is bounded by Def1;
        then diameter f9.n <= diameter R9.n by A51,TBSP_1:24,XBOOLE_1:17;
        then
A53:    diameter f9.n <= dR.n by Def2;
        R.n/\Y c= R.n by XBOOLE_1:17;
        then 0<=diameter f9.n by A52,A51,TBSP_1:14,21;
        hence Ns.n <= df.n & df.n<=dR.n by A53,A50,Def2;
      end;
      then
A54:  lim df=0 by A7,A27,A32,A29,SEQ_2:20;
      now
        let i be Nat;
     i in NAT by ORDINAL1:def 12;
        then
A55:    f9.i = R.i/\Y by A36;
A56:    R.(i+1) c= R.i by A15,KURATO_0:def 3;
        f9.(i+1) =R.(i+1)/\Y by A36;
        hence f9.(i+1) c= f9.i by A55,A56,XBOOLE_1:26;
      end;
      then f9 is non-ascending by KURATO_0:def 3;
      then meet f9<>{} by A1,A54,Th10;
      then consider z be object such that
A57:  z in meet f9 by XBOOLE_0:def 1;
      reconsider z as Point of M by A57;
A58:  x0 = z
      proof
        assume x0<>z;
        then dist(x0,z)<>0 by METRIC_1:2;
        then dist(x0,z)>0 by METRIC_1:5;
        then consider i be Nat such that
A59:    for j be Nat st i<=j holds |.dR.j-0.|<dist(x0,z)
        by A32,A29,SEQ_2:def 7;
A60:     i in NAT by ORDINAL1:def 12;
A61:    f9.i=R.i/\Y by A36,A60;
        z in f9.i by A57,KURATO_0:3;
        then
A62:    z in R.i by A61,XBOOLE_0:def 4;
A63:    R9.i is bounded by Def1;
        then
A64:    0<=diameter (R9.i) by TBSP_1:21;
        x0 in R.i by A31,KURATO_0:3;
        then dist(x0,z)<=diameter (R9.i) by A62,A63,TBSP_1:def 8;
        then
A65:    |.diameter (R9.i).|>=dist(x0,z) by A64,ABSVALUE:def 1;
        |.dR.i-0.|<dist(x0,z) by A59;
        hence thesis by A65,Def2;
      end;
      z in f9.0 by A57,KURATO_0:3;
      hence x0 in y by A58,A49,XBOOLE_0:def 4;
    end;
    F<>{} by A4,FINSET_1:def 3;
    hence thesis by A33,SETFAM_1:def 1;
  end;
  assume
A66: for F be Subset-Family of T st F is closed & F is centered & for r
st r > 0 ex A be Subset of M st A in F & A is bounded&diameter A<r holds meet F
  is non empty;
  now
    let S be non-empty pointwise_bounded closed SetSequence of M such that
A67: S is non-ascending and
A68: lim diameter S = 0;
    reconsider RS=rng S as Subset-Family of T;
A69: now
      set d=diameter S;
A70:  dom S=NAT by FUNCT_2:def 1;
A71:  d is bounded_below by Th1;
A72:  d is non-increasing by A67,Th2;
      let r;
      assume r > 0;
      then consider n be Nat such that
A73:  for m be Nat st n<=m holds |.d.m-0 .|<r by A68,A71,A72,
SEQ_2:def 7;
       reconsider nn=n as Element of NAT by ORDINAL1:def 12;
      take Sn=S.nn;
A74:  d.n=diameter Sn by Def2;
      Sn is bounded by Def1;
      then
A75:  diameter Sn>=0 by TBSP_1:21;
      |.d.n-0 .|<r by A73;
      hence Sn in RS & Sn is bounded & diameter Sn <r by A74,A75,A70,Def1,
ABSVALUE:def 1,FUNCT_1:def 3;
    end;
    RS is closed by Th12;
    then meet RS is non empty by A66,A67,A69,Th11;
    then consider x being object such that
A76: x in meet RS by XBOOLE_0:def 1;
    now
      let i be Nat;
A77:     i in NAT by ORDINAL1:def 12;
      dom S=NAT by FUNCT_2:def 1;
      then S.i in RS by FUNCT_1:def 3,A77;
      hence x in S.i by A76,SETFAM_1:def 1;
    end;
    hence meet S is non empty by KURATO_0:3;
  end;
  hence thesis by Th10;
end;
