
theorem Th27:
  for M being non empty MetrSpace holds for X being Subset of
  TopSpaceMetr(M) st X <> {} & X is compact holds dist_min(X) is continuous
proof
  let M be non empty MetrSpace;
  let X be Subset of TopSpaceMetr(M);
  assume
A1: X <> {} & X is compact;
  for P being Subset of R^1 st P is open holds (dist_min(X))"P is open
  proof
    let P be Subset of R^1;
    assume
A2: P is open;
    for p being Point of M st p in (dist_min(X))"P ex r being Real
    st r>0 & Ball(p,r) c= (dist_min(X))"P
    proof
      let p be Point of M;
      assume
A3:   p in (dist_min(X))"P;
      ex r being Real st r>0 & Ball(p,r) c= (dist_min(X))"P
      proof
A4:     (dist_min(X)).p in P by A3,FUNCT_1:def 7;
        reconsider P as Subset of TopSpaceMetr(RealSpace) by TOPMETR:def 6;
        set y = lower_bound((dist(p)).:(X));
        y in REAL by XREAL_0:def 1;
        then reconsider y as Point of RealSpace by METRIC_1:def 13;
        y in P by A4,Def6;
        then consider r being Real such that
A5:     r>0 and
A6:     Ball(y,r) c= P by A2,TOPMETR:15,def 6;
        reconsider r as Real;
        take r;
        Ball(p,r) c= (dist_min(X))"P
        proof
          let z be object;
          assume
A7:       z in Ball(p,r);
          then reconsider z as Point of M;
          set q = lower_bound((dist(z)).:(X));
          q in REAL by XREAL_0:def 1;
          then reconsider q as Point of RealSpace by METRIC_1:def 13;
          dist(p,z) < r by A7,METRIC_1:11;
          then
          |.lower_bound((dist(p)).:(X)) - lower_bound((dist(z)).:(X)).|+
          dist(p,z) < r+dist(p,z) by A1,Th22,XREAL_1:8;
          then |.lower_bound((dist(p)).:(X)) - lower_bound((dist(z)).:(X)).|
          < r by XREAL_1:6;
          then dist(y,q) < r by TOPMETR:11;
          then
A8:      q in Ball(y,r) by METRIC_1:11;
          dom (dist_min(X)) = the carrier of TopSpaceMetr(M) by FUNCT_2:def 1;
          then
A9:      dom (dist_min(X)) = the carrier of M by TOPMETR:12;
          q = (dist_min(X)).z by Def6;
          hence thesis by A6,A8,A9,FUNCT_1:def 7;
        end;
        hence thesis by A5;
      end;
      hence thesis;
    end;
    hence (dist_min(X))"P is open by TOPMETR:15;
  end;
  hence thesis by Lm2,TOPS_2:43;
end;
