 reserve x,X for set,
         n, m, i for Nat,
         p, q for Point of TOP-REAL n,
         A, B for Subset of TOP-REAL n,
         r, s for Real;
reserve N for non zero Nat,
        u,t for Point of TOP-REAL(N+1);

theorem Th9:
  for p st p in Fr A & A is closed
    for r st r>0
    ex U be open Subset of (TOP-REAL n) |A st
        p in U & U c= Ball(p,r) &
        for f be Function of (TOP-REAL n) | (A\U),Tunit_circle(n) st
          f is continuous
        ex h be Function of (TOP-REAL n) |A,Tunit_circle(n) st
          h is continuous & h| (A\U) = f
proof
  set TR=TOP-REAL n;
  let p;
  assume that
A1:   p in Fr A
    and
A2:   A is closed;
  A3:Fr A c= A by TOPS_1:35, A2;
  n>0
  proof
    assume n<=0;
    then n=0;
    then
A4:   the carrier of TR = {0.TR} by EUCLID:77,22;
    [#]TR is open;
    hence thesis by A4, A1,ZFMISC_1:33;
  end;
  then reconsider n1=n-1 as Element of NAT by NAT_1:20;
  set TU=Tunit_circle(n);
A5: p is Element of REAL n by EUCLID:22;
  let r;
  assume
A6: r>0;
  set r3=r/3,r2=2*r3;
  set B=Ball(p,r3);
  p is Element of REAL n by EUCLID:22;
  then |. p-p .|=0;
  then p in B by A6;
  then A` meets B by A1,TOPS_1:28;
  then consider x be object such that
A7:   x in A`
    and
A8:   x in B by XBOOLE_0:3;
  reconsider x as Element of TR by A7;
  set u=Ball(x,r2), clU=cl_Ball(x,r2);
A9:n in NAT by ORDINAL1:def 12;
A10:u c= clU by TOPREAL9:16;
A11:[#](TR|A)=A by PRE_TOPC:def 5;
  then reconsider U=u/\A as Subset of TR|A by XBOOLE_1:17;
  u in the topology of TR by PRE_TOPC:def 2;
  then U in the topology of TR|A by PRE_TOPC:def 4,A11;
  then reconsider U as open Subset of TR|A by PRE_TOPC:def 2;
  take U;
  x is Element of REAL n by EUCLID:22;
  then
A12: |.x-p.| =|.p-x.| by EUCLID:18, A5;
  |.x-p.|+r2 < r3+r2 by A8,TOPREAL9:7,XREAL_1:6;
  then
A13: u c= Ball(p,r) by Th5;
  r2 > r3 by A6,XREAL_1:155;
  then |.x-p.| < r2 by A8,TOPREAL9:7,XXREAL_0:2;
  then
A14: p in u by A12;
  hence p in U by A3, A1,XBOOLE_0:def 4;
  U c= u by XBOOLE_1:17;
  hence U c= Ball(p,r) by A13;
  let f be Function of TR | (A\U),TU such that
A15: f is continuous;
  per cases;
    suppose
A16:    A\U is empty;
      set h = the continuous Function of TR |A,Tunit_circle(n1+1);
      reconsider H=h as Function of (TOP-REAL n) |A,TU;
      take H;
      f={} by A16;
      hence thesis by A16;
    end;
    suppose
A17:    A\U is non empty;
      set S = Sphere(x,r2);
      reconsider AUS=(A\U)\/S as non empty Subset of TR by A17;
A18:  TR|AUS is metrizable & TR|AUS is finite-ind second-countable
      proof
        reconsider aus=AUS as Subset of the TopStruct of TR;
A19:    the TopStruct of TR = TopSpaceMetr Euclid n by EUCLID:def 8;
        TR|AUS = (the TopStruct of TR) |aus by PRE_TOPC:36;
        hence thesis by A19;
      end;
A20:  [#] (TR|AUS) = AUS by PRE_TOPC:def 5;
      then reconsider AU=A\U,SS=S as Subset of TR|AUS by XBOOLE_1:7;
      AU` = (AUS)\AU by SUBSET_1:def 4,A20
         .= S\AU by XBOOLE_1:40;
      then
A21:    AU` c= SS by XBOOLE_1:36;
      ind S = n1 by A6,Th7;
      then ind SS =n1 by TOPDIM_1:21;
      then
A22:    ind (AU`) <= n1 by TOPDIM_1:19,A21;
A23:  TR| (A\U) = TR|AUS| (AU) by A20,PRE_TOPC:7;
      then reconsider F=f as Function of TR |AUS| AU,TU;
      A\U = A\u by XBOOLE_1:47;
      then
A24:    A\U is closed by A2,YELLOW_8:20;
      then AU is closed by TSEP_1:8;
      then consider g be continuous Function of TR |AUS, Tunit_circle(n1+1)
          such that
A25:    g|AU=F by Th3, A23,A15, A18,A22;
A26:  [#](TR|A) = A by PRE_TOPC:def 5;
      then reconsider AclU=A/\clU, au=A\U as Subset of TR|A by XBOOLE_1:17,36;
      set T3=TR |A | AclU, T4=TR |A | au;
A27:  (A/\U) \/ au = A by XBOOLE_1:51;
      A`= ([#]TR)\A by SUBSET_1:def 4;
      then not x in A by A7,XBOOLE_0:def 5;
      then consider h be Function of TR |A,TR |S such that
A28:      h is continuous
        and
A29:      h|S = id (A/\S) by A6,Th4;
A30:  n1+1 = n;
      then
A31:    dom h = the carrier of (TR|A) by A6,FUNCT_2:def 1;
A32:  [#](TR|S)=S by PRE_TOPC:def 5;
      then rng h c= the carrier of TR by XBOOLE_1:1;
      then reconsider h1=h as Function of TR|A,TR by A31,FUNCT_2:2;
A33: S c= AUS by XBOOLE_1:7;
      rng h c= [#](TR|S);
      then reconsider h2=h1 as Function of TR|A,TR|AUS
        by A33,A32,XBOOLE_1:1,A31,FUNCT_2:2,A20;
      h1 is continuous by A28,PRE_TOPC:26;
      then
A34:    h2 is continuous by PRE_TOPC:27;
      set T2=TR |AUS|AU;
A35:  TR |AUS | AU = TR| (A\U) by PRE_TOPC:7, XBOOLE_1:7;
A36:  clU\u = S by JORDAN:19,A9;
A37:  (A/\A)/\u = A/\(A/\u) by XBOOLE_1: 16;
A38:  g|T2 = g|the carrier of T2 by TMAP_1:def 4;
      TR |A | au = TR| (A\U) by XBOOLE_1:36,PRE_TOPC:7;
      then reconsider gT2=g|T2 as continuous Function of T4,Tunit_circle(n1+1)
        by A35,A17;
A39:  [#]T3 =AclU by PRE_TOPC:def 5;
      AclU is non empty by A10,A14, A3, A1,XBOOLE_0:def 4;
      then reconsider gh2T3=g*(h2|T3) as continuous
        Function of T3,Tunit_circle(n1+1) by A34;
A40:  [#]T4 = au by PRE_TOPC:def 5;
A41:  h2|T3 = h2|the carrier of T3 by A3, A1, TMAP_1:def 4;
A42:  now
        let x be object such that
A43:      x in dom gh2T3 /\ dom gT2;
A44:    not x in U by A43,A40,XBOOLE_0:def 5;
        x in A by A43,A40,XBOOLE_0:def 5;
        then
A45:      not x in u by A44,XBOOLE_0:def 4;
A46:    x in dom gh2T3 by A43,XBOOLE_0:def 4;
        then x in clU by A39,XBOOLE_0:def 4;
        then
A47:      x in S by A45,A36,XBOOLE_0:def 5;
A48:    x in dom gT2 by A43,XBOOLE_0:def 4;
        x in A by A46,A39,XBOOLE_0:def 4;
        then
A49:      x in A/\S by A47,XBOOLE_0:def 4;
        x in dom (h2|T3) by A46,FUNCT_1:11;
        then (h2|T3).x = h2.x by A41,FUNCT_1:47
                      .= (h|S).x by A47,FUNCT_1:49
                      .= x by A29,A49,FUNCT_1:17;
        hence gh2T3.x = g.x by A46,FUNCT_1:12
                     .= gT2.x by A38,A48,FUNCT_1:47;
      end;
      A50: AclU is closed by A2,TSEP_1:8;
      au is closed by A24,TSEP_1:8;
      then reconsider G=gh2T3+* gT2 as continuous
        Function of TR|A| ( AclU\/au),Tunit_circle(n1+1)
        by A50,A42,PARTFUN1:def 4,TOPGEN_5:10;
      W: A/\u c= AclU by TOPREAL9:16,XBOOLE_1:26;
      A = AclU\/au by A26,W,A27,A37,XBOOLE_1:9;
      then
A51:    TR|A| (AclU\/au) = TR|A by A26,TSEP_1:93;
      then reconsider GG=G as Function of TR|A, TU;
      take GG;
      thus GG is continuous by A51;
A52:  [#](TR| (A\U)) = A\U by PRE_TOPC:def 5;
A53:  dom gT2 =the carrier of T4 by FUNCT_2:def 1;
A54:  now let x;
        assume
A55:      x in dom f;
        hence (GG| (A\U)).x = GG.x by A52,FUNCT_1:49
                           .= gT2.x by FUNCT_4:13, A55,A52,A40,A53
                           .= g.x by A38,A40,A52,A53,A55,FUNCT_1:47
                           .= f.x by A25, A55,A52,FUNCT_1:49;
      end;
      dom GG = A by A26,FUNCT_2:def 1;
      then
A56:    dom (GG| (A\U)) = A /\ ( A\U) by RELAT_1:61
                       .= A\U by XBOOLE_1:36,XBOOLE_1:28;
      dom f = A\U by A30,A52,FUNCT_2:def 1;
      hence thesis by A54,A56;
    end;
end;
