reserve X for set,
  Y for non empty set;
reserve n for Nat;
reserve r for Real,
  M for non empty MetrSpace;
reserve n for Nat,
  p,q,q1,q2 for Point of TOP-REAL 2,
  r,s1,s2,t1,t2 for Real,
  x,y for Point of Euclid 2;

theorem
  for A being compact non empty Subset of TOP-REAL 2, B being open
  Subset of TOP-REAL 2 st A c= B for p being Point of TOP-REAL 2 st not p in B
  holds dist(p,B) < dist(p,A)
proof
  let A be compact non empty Subset of TOP-REAL 2, B being open Subset of
  TOP-REAL 2 such that
A1: A c= B;
  the TopStruct of TOP-REAL 2 = TopSpaceMetr Euclid 2 by EUCLID:def 8;
  then reconsider P = B as open Subset of TopSpaceMetr Euclid 2 by PRE_TOPC:30;
  let p be Point of TOP-REAL 2 such that
A2: not p in B;
  assume
A3: dist(p,B) >= dist(p,A);
  dist(p,B) <= dist(p,A) by A1,Th41;
  then
A4: dist(p,B) = dist(p,A) by A3,XXREAL_0:1;
  consider q being Point of TOP-REAL 2 such that
A5: q in A and
A6: dist(p,A) = dist(p,q) by Th46;
  reconsider a = q as Point of Euclid 2 by TOPREAL3:8;
  consider r being Real such that
A7: r>0 and
A8: Ball(a,r) c= P by A1,A5,TOPMETR:15;
  reconsider r as Element of REAL by XREAL_0:def 1;
  set s = r/(2*dist(p,q)), q9 = (1-s)*q + s*p;
  a in P by A1,A5;
  then
A9: dist(p,q) > 0 by A2,Th22;
  then
A10: 2*dist(p,q) > 0 by XREAL_1:129;
  then 0 < s by A7,XREAL_1:139;
  then
A11: 1-s < 1-0 by XREAL_1:10;
A12: ex p1, q1 being Point of Euclid 2 st p1 = q & q1 = q9 & dist(q,q9) =
  dist(p1,q1) by TOPREAL6:def 1;
  dist(q,q9) = 1 *r/(2*dist(p,q))*dist(p,q) by A7,A9,Th28
    .= r/2/(dist(p,q)/1)*dist(p,q) by XCMPLX_1:84
    .= r/2 by A9,XCMPLX_1:87;
  then dist(q,q9) < r/1 by A7,XREAL_1:76;
  then
A13: q9 in Ball(a,r) by A12,METRIC_1:11;
  now
A14: ex p1, q1 being Point of Euclid 2 st p1 = p & q1 = q & dist(p,q) =
    dist(p1,q1) by TOPREAL6:def 1;
    assume r > dist(p,q);
    then p in Ball(a,r) by A14,METRIC_1:11;
    hence contradiction by A2,A8;
  end;
  then 1 *r < 2*dist(p,q) by A7,XREAL_1:98;
  then s < 1 by A10,XREAL_1:191;
  then dist(p,q9) = (1-s)*dist(p,q) by Th27;
  hence contradiction by A4,A6,A8,A9,A13,A11,Th50,XREAL_1:157;
end;
