reserve T,T1,T2,S for non empty TopSpace;
reserve p,q for Point of TOP-REAL 2;

theorem Th39:
  for B0 being Subset of TOP-REAL 2,K0 being Subset of (TOP-REAL 2
)|B0,f being Function of ((TOP-REAL 2)|B0)|K0,((TOP-REAL 2)|B0) st f=Out_In_Sq|
K0 & B0=NonZero TOP-REAL 2 & K0={p:(p`1<=p`2 & -p`2<=p`1 or p`1>=p`2 & p`1<=-p
  `2) & p<>0.TOP-REAL 2} holds f is continuous & K0 is closed
proof
  reconsider K5={p7 where p7 is Point of TOP-REAL 2: p7`1<=-p7`2 } as closed
  Subset of TOP-REAL 2 by Lm20;
  reconsider K4={p7 where p7 is Point of TOP-REAL 2: p7`2<=p7`1 } as closed
  Subset of TOP-REAL 2 by Lm8;
  reconsider K3={p7 where p7 is Point of TOP-REAL 2: -p7`2<=p7`1 } as closed
  Subset of TOP-REAL 2 by Lm17;
  reconsider K2={p7 where p7 is Point of TOP-REAL 2: p7`1<=p7`2 } as closed
  Subset of TOP-REAL 2 by Lm5;
  let B0 be Subset of TOP-REAL 2,K0 be Subset of (TOP-REAL 2)|B0,f being
  Function of ((TOP-REAL 2)|B0)|K0,((TOP-REAL 2)|B0);
  defpred P[Point of TOP-REAL 2] means ($1`1<=$1`2 & -$1`2<=$1`1 or $1`1>=$1`2
  & $1`1<=-$1`2);
  the carrier of (TOP-REAL 2)|B0=[#]((TOP-REAL 2)|B0) .= B0 by PRE_TOPC:def 5;
  then reconsider K1=K0 as Subset of TOP-REAL 2 by XBOOLE_1:1;
  assume
A1: f=Out_In_Sq|K0 & B0=NonZero TOP-REAL 2 & K0={p:(p`1<=p`2 & -p`2<=p`1
  or p`1>=p`2 & p`1<=-p`2) & p<>0.TOP-REAL 2};
  K0 c= B0
  proof
    let x be object;
    assume x in K0;
    then
A2: ex p8 being Point of TOP-REAL 2 st x=p8 &( p8`1<=p8`2 & - p8`2<=p8`1 or
    p8`1>=p8`2 & p8`1<=-p8`2)& p8<>0.TOP-REAL 2 by A1;
    then not x in {0.TOP-REAL 2} by TARSKI:def 1;
    hence thesis by A1,A2,XBOOLE_0:def 5;
  end;
  then
A3: ((TOP-REAL 2)|B0)|K0=(TOP-REAL 2)|K1 by PRE_TOPC:7;
  reconsider K1={p7 where p7 is Point of TOP-REAL 2: P[p7]} as Subset of
  TOP-REAL 2 from TopSubset;
A4: K1 /\ B0 c= K0
  proof
    let x be object;
    assume
A5: x in K1 /\ B0;
    then x in B0 by XBOOLE_0:def 4;
    then not x in {0.TOP-REAL 2} by A1,XBOOLE_0:def 5;
    then
A6: not x=0.TOP-REAL 2 by TARSKI:def 1;
    x in K1 by A5,XBOOLE_0:def 4;
    then ex p7 being Point of TOP-REAL 2 st p7=x &( p7`1<=(p7`2) & -(p7`2)<=p7
    `1 or p7`1>=(p7`2) & p7`1<=-(p7`2));
    hence thesis by A1,A6;
  end;
A7: K2 /\ K3 \/ K4 /\ K5 c= K1
  proof
    let x be object;
    assume
A8: x in K2 /\ K3 \/ K4 /\ K5;
    now
      per cases by A8,XBOOLE_0:def 3;
      case
A9:    x in K2 /\ K3;
        then x in K3 by XBOOLE_0:def 4;
        then
A10:    ex p8 being Point of TOP-REAL 2 st p8=x & -p8`2<=p8`1;
        x in K2 by A9,XBOOLE_0:def 4;
        then ex p7 being Point of TOP-REAL 2 st p7=x & p7`1<=(p7`2);
        hence thesis by A10;
      end;
      case
A11:    x in K4 /\ K5;
        then x in K5 by XBOOLE_0:def 4;
        then
A12:    ex p8 being Point of TOP-REAL 2 st p8=x & p8`1<= -p8`2;
        x in K4 by A11,XBOOLE_0:def 4;
        then ex p7 being Point of TOP-REAL 2 st p7=x & p7`1>=(p7`2);
        hence thesis by A12;
      end;
    end;
    hence thesis;
  end;
  K1 c= K2 /\ K3 \/ K4 /\ K5
  proof
    let x be object;
    assume x in K1;
    then ex p being Point of TOP-REAL 2 st p=x &( p`1<=p`2 & -p`2 <=p`1 or p`1
    >=p`2 & p`1<=-p`2);
    then x in K2 & x in K3 or x in K4 & x in K5;
    then x in K2 /\ K3 or x in K4 /\ K5 by XBOOLE_0:def 4;
    hence thesis by XBOOLE_0:def 3;
  end;
  then K1=K2 /\ K3 \/ K4 /\ K5 by A7;
  then
A13: K1 is closed;
  K0 c= K1 /\ B0
  proof
    let x be object;
    assume x in K0;
    then
A14: ex p being Point of TOP-REAL 2 st x=p &( p`1<=p`2 & -p`2 <=p`1 or p`1
    >=p`2 & p`1<=-p`2)& p<>0.TOP-REAL 2 by A1;
    then not x in {0.TOP-REAL 2} by TARSKI:def 1;
    then
A15: x in B0 by A1,A14,XBOOLE_0:def 5;
    x in K1 by A14;
    hence thesis by A15,XBOOLE_0:def 4;
  end;
  then K0=K1 /\ B0 by A4
    .=K1 /\ [#]((TOP-REAL 2)|B0) by PRE_TOPC:def 5;
  hence thesis by A1,A3,A13,Th37,PRE_TOPC:13;
end;
