reserve n for Nat,
        p,q,u,w for Point of TOP-REAL n,
        S for Subset of TOP-REAL n,
        A, B for convex Subset of TOP-REAL n,
        r for Real;

theorem Th4:
  for A st A is closed & p in Int A & p <> q & A/\halfline(p,q) is bounded
  ex u st(Fr A)/\halfline(p,q)={u}
 proof
   set TRn=TOP-REAL n;
   set En=Euclid n;
   let A be convex Subset of TOP-REAL n such that
A1:  A is closed and
A2:  p in Int A and
A3:  p<>q and
A4:  A/\halfline(p,q) is bounded;
   reconsider P=p,Q=q as Point of En by EUCLID:67;
A5:  the TopStruct of TRn=TopSpaceMetr Euclid n by EUCLID:def 8;
   then reconsider I=Int A as Subset of TopSpaceMetr En;
   Int A in the topology of TopSpaceMetr En by A5,PRE_TOPC:def 2;
   then I is open by PRE_TOPC:def 2;
   then consider r be Real such that
A6:  r>0 and
A7:  Ball(P,r)c=I by A2,TOPMETR:15;
   dist(P,P)<r by A6,METRIC_1:1;
   then
A8:  P in Ball(P,r) by METRIC_1:11;
   set H=halfline(p,q);
   reconsider AH=A/\H as bounded Subset of En by A4,JORDAN2C:11;
A9: Int A c=A by TOPS_1:16;
   then consider W be Point of En such that
A10: W in (Fr A)/\H and
A11: for u,P be Point of Euclid n st P=p & u in AH holds
       dist(P,u)<=dist(P,W) and
    for r be Real st r>0 ex u be Point of En st u in AH & dist(W,u)<r
      by A2,A3,A4,Lm3;
   reconsider w=W as Point of TRn by EUCLID:67;
A12: W in Fr A by A10,XBOOLE_0:def 4;
   W in H by A10,XBOOLE_0:def 4;
   then consider Wr be Real such that
A13: W=(1-Wr)*p+Wr*q and
A14: Wr>=0;
A15: Fr A c=A by A1,TOPS_1:35;
A16: Fr A misses Ball(P,r) by A7,TOPS_1:39,XBOOLE_1:63;
   (Fr A)/\H={W}
     proof
       assume(Fr A)/\H<>{W};
       then consider u be object such that
A17:     u in (Fr A)/\H and
A18:     u<>W by A10,ZFMISC_1:35;
       reconsider u as Point of TRn by A17;
A19:     u in H by A17,XBOOLE_0:def 4;
       then consider Ur be Real such that
A20:     u=(1-Ur)*p+Ur*q and
A21:     Ur>=0;
A22:   |.Ur.|=Ur by A21,ABSVALUE:def 1;
       reconsider U=u as Element of En by EUCLID:67;
       (1-Ur)*p+Ur*q-p=Ur*(q-p) by Lm1;
       then
A23:     dist(U,P) = |.Ur*(q-p).| by A20,SPPOL_1:39
                  .= Ur*|.q-p.| by A22,TOPRNS_1:7;
       set R=r*(Wr-Ur)/Wr;
       reconsider b=Ball(U,R) as Subset of TopSpaceMetr En by A5,EUCLID:67;
       set x=(Wr-Ur)/Wr;
       b is open by TOPMETR:14;
       then b in the topology of TRn by A5,PRE_TOPC:def 2;
       then reconsider B=b as open Subset of TRn by PRE_TOPC:def 2;
A24:     |.Wr.|=Wr by A14,ABSVALUE:def 1;
       (1-Wr)*p+Wr*q-p=Wr*(q-p) by Lm1;
       then
A25:     dist(W,P) = |.Wr*(q-p).| by A13,SPPOL_1:39
                  .= Wr*|.q-p.| by A24,TOPRNS_1:7;
A26:   u in Fr A by A17,XBOOLE_0:def 4;
       then
A27:     u in AH by A15,A19,XBOOLE_0:def 4;
       P<>W by A16,A8,A12,XBOOLE_0:3;
       then
A28:     Wr>0 by A25,METRIC_1:7;
       then
A29:     1-x = Wr/Wr-x by XCMPLX_1:60
            .= Ur/Wr;
       P<>u by A16,A8,A26,XBOOLE_0:3;
       then Ur>0 by A23,METRIC_1:7;
       then 1-x>=x-x by A28,A29;
       then
A30:     x in REAL & x<=1 by XREAL_0:def 1,XREAL_1:6;
A31:   (1-Wr)*p+Wr*q=Wr*(q-p)+p by Th1;
A32:   (1-Ur)*p+Ur*q=p+Ur*(q-p) by Th1;
       then (1-Wr)*p+Wr*q-((1-Ur)*p+Ur*q)
            = (p+Wr*(q-p)-p)-Ur*(q-p) by A31,RLVECT_1:27
           .= Wr*(q-p)+(p-p)-Ur*(q-p) by RLVECT_1:def 3
           .= Wr*(q-p)+0.TRn-Ur*(q-p) by RLVECT_1:5
           .= Wr*(q-p)-Ur*(q-p)
           .= (Wr-Ur)*(q-p) by RLVECT_1:35;
       then
A33:     dist(U,W) = |.(Wr-Ur)*(q-p).| by A13,A20,SPPOL_1:39
                  .= |.Wr-Ur.|*|.q-p.| by TOPRNS_1:7;
       dist(U,W)>0 by A18,METRIC_1:7;
       then |.q-p.|>0 by A33,XREAL_1:134;
       then Ur<=Wr by A11,A23,A25,A27,XREAL_1:68;
       then Wr-Ur>=0 by XREAL_1:48;
       then
A34:     |.Wr-Ur.|=Wr-Ur by ABSVALUE:def 1;
       then
A35:     Wr-Ur>0 by A18,A33,METRIC_1:7;
       dist(U,U)=0 by METRIC_1:1;
       then U in B by A6,A28,A35,METRIC_1:11;
       then B\A<>{} by A26,TOPGEN_1:9;
       then consider t be object such that
A36:     t in B\A by XBOOLE_0:def 1;
A37:     t in B by A36,XBOOLE_0:def 5;
       reconsider t as Point of TRn by A36;
       set z=p+Wr/(Wr-Ur)*(t-u);
       reconsider Z=z as Point of En by EUCLID:67;
       reconsider T=t as Point of En by EUCLID:67;
A38:   dist(U,T)=|.u-t.| by SPPOL_1:39;
A39:   Wr/(Wr-Ur)*R = Wr/Wr*(Wr-Ur)/(Wr-Ur)*r
                   .= (Wr-Ur)/(Wr-Ur)*r by A28,XCMPLX_1:88
                   .= r by A35,XCMPLX_1:88;
       |.-Wr.|=--Wr by A28,ABSVALUE:def 1;
       then
A40:     (-Wr)/(Wr-Ur) in REAL & |.(-Wr)/(Wr-Ur).|=Wr/(Wr-Ur)
         by A34,COMPLEX1:67,XREAL_0:def 1;
A41:  (Ur/Wr)*(Wr*(q-p)) = (Ur/Wr*Wr)*(q-p) by RLVECT_1:def 7
                        .= (Wr/Wr*Ur)*(q-p)
                        .= Ur*(q-p) by A28,XCMPLX_1:88;
       p-z =(p-p)-Wr/(Wr-Ur)*(t-u) by RLVECT_1:27
          .= 0.TRn-Wr/(Wr-Ur)*(t-u) by RLVECT_1:15
          .= -Wr/(Wr-Ur)*(t-u)
          .= (-1)*(Wr/(Wr-Ur)*(t-u)) by RLVECT_1:16
          .= ((-1)*(Wr/(Wr-Ur)))*(t-u) by RLVECT_1:def 7
          .= (-Wr)/(Wr-Ur)*(t-u);
       then
A42:     dist(P,Z) = |.((-Wr)/(Wr-Ur))*(t-u).| by SPPOL_1:39
                  .= Wr/(Wr-Ur)*|.t-u.| by A40,TOPRNS_1:7;
       dist(U,T)<R by A37,METRIC_1:11;
       then Wr/(Wr-Ur)*|.u-t.|<r by A28,A35,A38,A39,XREAL_1:68;
       then dist(P,Z)<r by A38,A42,SPPOL_1:39;
       then Z in Ball(P,r) by METRIC_1:11;
       then
A43:     Z in I by A7;
       x*(Wr/(Wr-Ur)*(t-u)) = x*(Wr/(Wr-Ur))*(t-u) by RLVECT_1:def 7
                           .= (Wr-Ur)/(Wr-Ur)*Wr/Wr*(t-u)
                           .= Wr/Wr*(t-u) by A35,XCMPLX_1:88
                           .= 1 *(t-u) by A28,XCMPLX_1:60
                           .= t-u by RLVECT_1:def 8;
       then x*z=x*p+(t-u) by RLVECT_1:def 5;
       then x*z+(1-x)*w
          = t-u+x*p+((1-x)*p+Ur*(q-p))  by A13,A29,A31,A41,RLVECT_1:def 5
         .= t-u+x*p+(1-x)*p+Ur*(q-p) by RLVECT_1:def 3
         .= t-u+(x*p+(1-x)*p)+Ur*(q-p) by RLVECT_1:def 3
         .= t-u+(x+(1-x))*p+Ur*(q-p) by RLVECT_1:def 6
         .= t-u+p+Ur*(q-p) by RLVECT_1:def 8
         .= t-u+u by A20,A32,RLVECT_1:def 3
         .= t-(u-u) by RLVECT_1:29
         .= t-0.TRn by RLVECT_1:15
         .= t;
       then t in A by A15,A9,A12,A28,A30,A35,A43,RLTOPSP1:def 1;
       hence contradiction by A36,XBOOLE_0:def 5;
    end;
  hence thesis by A10;
end;
