reserve j for Nat;

theorem
  for P being non empty Subset of TOP-REAL 2, p1,p2,p being Point of
TOP-REAL 2,e being Real st P is_an_arc_of p1,p2 & p2`1>e & p in P & p`1=e holds
  p is_Lout P,p1,p2,e or p is_Rout P,p1,p2,e or p is_OSout P,p1,p2,e
proof
  let P be non empty Subset of TOP-REAL 2, p1,p2,p be Point of TOP-REAL 2,e be
  Real;
  assume that
A1: P is_an_arc_of p1,p2 and
A2: p2`1>e and
A3: p in P and
A4: p`1=e;
  now
    reconsider pr1a=proj1 as Function of TOP-REAL 2,R^1 by TOPMETR:17;
    reconsider pro1=pr1a|P as Function of (TOP-REAL 2)|P,R^1 by PRE_TOPC:9;
    consider f being Function of I[01], (TOP-REAL 2)|P such that
A5: f is being_homeomorphism and
A6: f.0 = p1 and
A7: f.1 = p2 by A1,TOPREAL1:def 1;
A8: f is continuous by A5,TOPS_2:def 5;
A9: rng f=[#]((TOP-REAL 2)|P) by A5,TOPS_2:def 5;
    then p in rng f by A3,PRE_TOPC:def 5;
    then consider xs being object such that
A10: xs in dom f and
A11: p=f.xs by FUNCT_1:def 3;
A12: dom f=[#](I[01]) by A5,TOPS_2:def 5;
    reconsider s2=xs as Real by A10;
A13: s2<=1 by A10,BORSUK_1:40,XXREAL_1:1;
    for q being Point of TOP-REAL 2 st q=f.1 holds q`1<>e by A2,A7;
    then
A14: 1 in {s where s is Real: 1>=s & s>=s2 & (for q being Point of
    TOP-REAL 2 st q=f.s holds q`1<>e)} by A13;
    {s where s is Real: 1>=s & s>=s2 &
   for q being Point of TOP-REAL 2 st q=f.s holds q`1<>e } c= REAL
    proof
      let x be object;
      assume x in {s where s is Real: 1>=s & s>=s2 &
       (for q being Point of TOP-REAL 2 st q=f.s holds q`1<>e)};
      then consider s being Real such that
A15:     s=x & 1>=s & s>=s2 &
      for q being Point of TOP-REAL 2 st q=f.s holds q`1<>e;
       s in REAL by XREAL_0:def 1;
      hence thesis by A15;
    end;
    then reconsider R={s where s is Real: 1>=s & s>=s2 &
    (for q being Point of
    TOP-REAL 2 st q=f.s holds q`1<>e)} as non empty Subset of REAL by A14;
    reconsider s0=lower_bound R as Real;
A16: for s being Real st s in R holds s > s2
    proof
      let s be Real;
      assume s in R;
      then
A17:  ex s3 being Real st s3=s & 1>=s3 & s3>=s2 & for q being Point of
      TOP-REAL 2 st q=f.s3 holds q`1<>e;
      then s<>s2 by A4,A11;
      hence thesis by A17,XXREAL_0:1;
    end;
    then for s being Real st s in R holds s >= s2;
    then
A18: s0 >= s2 by SEQ_4:43;
    for p7 being Point of (TOP-REAL 2)|P holds pro1.p7=proj1.p7
    proof
      let p7 be Point of (TOP-REAL 2)|P;
      the carrier of ((TOP-REAL 2)|P)=P by PRE_TOPC:8;
      hence thesis by FUNCT_1:49;
    end;
    then
A19: pro1 is continuous by JGRAPH_2:29;
    reconsider h=pro1*f as Function of I[01],R^1;
A20: dom h=[.0,1.] by BORSUK_1:40,FUNCT_2:def 1;
    for s being ExtReal st s in R holds s >= s2 by A16;
    then s2 is LowerBound of R by XXREAL_2:def 2;
    then
A21: R is bounded_below by XXREAL_2:def 9;
A22: 0<=s2 by A10,BORSUK_1:40,XXREAL_1:1;
    R c= [.0,1.]
    proof
      let x be object;
      assume x in R;
      then ex s being Real st s=x & 1>=s & s>=s2 &
       for q being Point of
      TOP-REAL 2 st q=f.s holds q`1<>e;
      hence thesis by A22,XXREAL_1:1;
    end;
    then
A23: 1 >= s0 by A14,BORSUK_1:40,BORSUK_4:26;
    then s0 in dom f by A12,A22,A18,BORSUK_1:40,XXREAL_1:1;
    then f.s0 in rng f by FUNCT_1:def 3;
    then f.s0 in P by A9,PRE_TOPC:def 5;
    then reconsider p9=f.s0 as Point of TOP-REAL 2;
A24: LE p,p9,P,p1,p2 by A1,A5,A6,A7,A11,A22,A13,A23,A18,JORDAN5C:8;
A25: rng f=P by A9,PRE_TOPC:def 5;
A26: for p8 being Point of TOP-REAL 2 st LE p8,p9,P,p1,p2 & LE p,p8,P,p1,
    p2 holds p8`1=e
    proof
      let p8 be Point of TOP-REAL 2;
      assume that
A27:  LE p8,p9,P,p1,p2 and
A28:  LE p,p8,P,p1,p2;
A29:  p8 in P by A27,JORDAN5C:def 3;
      then consider x8 being object such that
A30:  x8 in dom f and
A31:  p8=f.x8 by A25,FUNCT_1:def 3;
      reconsider s8=x8 as Element of REAL by A12,A30,BORSUK_1:40;
A32:  s8<=1 by A30,BORSUK_1:40,XXREAL_1:1;
      0<=s8 by A30,BORSUK_1:40,XXREAL_1:1;
      then
A33:  s8>=s2 by A5,A6,A7,A11,A13,A28,A31,A32,JORDAN5C:def 3;
A34:  s0>=s8 by A5,A6,A7,A22,A23,A18,A27,A31,A32,JORDAN5C:def 3;
      now
        reconsider s8n=s8 as Point of RealSpace by METRIC_1:def 13;
        reconsider s8m=s8 as Point of Closed-Interval-MSpace(0,1) by A30,
BORSUK_1:40,TOPMETR:10;
        reconsider ee=|.p8`1-e.|/2 as Real;
        reconsider w=p8`1 as Element of RealSpace
            by METRIC_1:def 13,XREAL_0:def 1;
        reconsider B=Ball(w,ee) as Subset of R^1 by METRIC_1:def 13,TOPMETR:17;
A35:    B={s7 where s7 is Real:p8`1-ee<s7 & s7<p8`1+ee} by JORDAN2B:17
          .= ].p8`1-ee,p8`1+ee.[ by RCOMP_1:def 2;
        assume
A36:    p8`1<>e;
        then p8`1-e<>0;
        then |.p8`1-e.|>0 by COMPLEX1:47;
        then
A37:    w in Ball(w,ee) by GOBOARD6:1,XREAL_1:139;
A38:    h"B is open & I[01]=TopSpaceMetr(Closed-Interval-MSpace(0,1)) by A8,A19
,TOPMETR:20,def 6,def 7,UNIFORM1:2;
        h.s8=pro1.(f.s8) by A20,A30,BORSUK_1:40,FUNCT_1:12
          .=proj1.p8 by A29,A31,FUNCT_1:49
          .=p8`1 by PSCOMP_1:def 5;
        then s8 in h"B by A20,A30,A37,BORSUK_1:40,FUNCT_1:def 7;
        then consider r0 being Real such that
A39:    r0>0 and
A40:    Ball(s8m,r0) c= h"B by A38,TOPMETR:15;
        reconsider r0 as Real;
        reconsider r01=min(s8-s2,r0) as Real;
        the carrier of Closed-Interval-MSpace(0,1)=[.0,1.] & Ball(s8n,r01
        )= (].s8- r01,s8+r01 .[) by FRECHET:7,TOPMETR:10;
        then
A41:    Ball(s8m,r01)= (].s8-r01,s8+r01 .[) /\ [.0,1.] by TOPMETR:9;
        s8>s2 by A4,A11,A31,A33,A36,XXREAL_0:1;
        then s8-s2>0 by XREAL_1:50;
        then
A42:    r01>0 by A39,XXREAL_0:21;
        then
A43:    r01-r01/2+r01/2>0+r01/2 by XREAL_1:6;
        then
A44:    s8-r01<s8-r01/2 by XREAL_1:10;
A45:    r01/2>0 by A42,XREAL_1:139;
        then
A46:    s8+-(r01/2)<s8+r01/2 by XREAL_1:8;
        s8+r01/2<s8+r01 by A43,XREAL_1:8;
        then s8-r01/2<s8+r01 by A46,XXREAL_0:2;
        then
A47:    s8-r01/2 in ].s8-r01,s8+r01 .[ by A44,XXREAL_1:4;
A48:    s8-r01/2>s8-r01 by A43,XREAL_1:10;
        Ball(s8m,r01) c= Ball(s8m,r0) by PCOMPS_1:1,XXREAL_0:17;
        then
A49:    (].s8-r01,s8+r01 .[)/\ [.0,1.] c= h"B by A40,A41;
        reconsider s70=s8-r01/2 as Real;
        s8-s2>=r01 by XXREAL_0:17;
        then -(s8-s2)<= -r01 by XREAL_1:24;
        then
A50:    s2-s8+s8<= -r01+s8 by XREAL_1:7;
        --(r01/2)> 0 by A42,XREAL_1:139;
        then -(r01/2) < 0;
        then
A51:    s8+0>s8+-r01/2 by XREAL_1:8;
        then
A52:    1>=s70 by A32,XXREAL_0:2;
        1-0>s8-r01/2 by A32,A45,XREAL_1:15;
        then s8-r01/2 in [.0,1.] by A22,A50,A48,XXREAL_1:1;
        then
A53:    s8-r01/2 in (].s8-r01,s8+r01 .[)/\ [.0,1.] by A47,XBOOLE_0:def 4;
        then
A54:    h.(s8-r01/2) in B by A49,FUNCT_1:def 7;
A55:    s8-r01/2 in dom h by A49,A53,FUNCT_1:def 7;
A56:    for p7 being Point of TOP-REAL 2 st p7=f.s70 holds p7`1<>e
        proof
          let p7 be Point of TOP-REAL 2;
          assume
A57:      p7=f.s70;
          s70 in [.0,1.] by A22,A50,A44,A52,XXREAL_1:1;
          then
A58:      p7 in rng f by A12,A57,BORSUK_1:40,FUNCT_1:def 3;
A59:      rng f=[#]((TOP-REAL 2)|P) by A5,TOPS_2:def 5
            .=P by PRE_TOPC:def 5;
A60:      h.s70=pro1.(f.s70) by A55,FUNCT_1:12
            .=pr1a.(p7) by A57,A58,A59,FUNCT_1:49
            .=p7`1 by PSCOMP_1:def 5;
          then
A61:      p7`1<p8`1+ee by A35,A54,XXREAL_1:4;
A62:      p8`1-ee<p7`1 by A35,A54,A60,XXREAL_1:4;
          now
            assume
A63:        p7`1=e;
            now
              per cases;
              case
A64:            p8`1-e>=0;
                then p8`1-(p8`1-e)/2<e by A62,A63,ABSVALUE:def 1;
                then p8`1/2+e/2<e/2+e/2;
                then p8`1/2<e/2 by XREAL_1:7;
                then
A65:            p8`1/2-e/2<e/2-e/2 by XREAL_1:14;
                (p8`1-e)/2>=0/2 by A64;
                hence contradiction by A65;
              end;
              case
A66:            p8`1-e<0;
                then e< p8`1+(-(p8`1-e))/2 by A61,A63,ABSVALUE:def 1;
                then p8`1/2+e/2>e/2+e/2;
                then p8`1/2>e/2 by XREAL_1:7;
                then
A67:            p8`1/2-e/2>e/2-e/2 by XREAL_1:14;
                (p8`1-e)/2<=0/2 by A66;
                hence contradiction by A67;
              end;
            end;
            hence contradiction;
          end;
          hence thesis;
        end;
        s70>=s2 by A50,A44,XXREAL_0:2;
        then consider s7 being Real such that
A68:    s8>s7 and
A69:    1>=s7 & s7>=s2 & for p7 being Point of TOP-REAL 2 st p7=f.s7
        holds p7`1 <>e by A51,A52,A56;
        s7 in R by A69;
        then s7 >=s0 by A21,SEQ_4:def 2;
        hence contradiction by A34,A68,XXREAL_0:2;
      end;
      hence thesis;
    end;
    assume not p is_OSout P,p1,p2,e;
    then consider p4 being Point of TOP-REAL 2 such that
A70: LE p9,p4,P,p1,p2 and
A71: p4<>p9 and
A72: (for p5 being Point of TOP-REAL 2 st LE p5,p4,P,p1,p2 & LE p9,p5
, P,p1,p2 holds p5`1<=e)or for p6 being Point of TOP-REAL 2 st LE p6,p4,P,p1,p2
    & LE p9,p6,P,p1,p2 holds p6`1>=e by A1,A3,A4,A24,A26;
A73: p9 in P by A70,JORDAN5C:def 3;
    now
      per cases by A72;
      case
A74:    for p5 being Point of TOP-REAL 2 st LE p5,p4,P,p1,p2 & LE p9
        ,p5,P,p1,p2 holds p5`1<=e;
A75:    now
          p4 in P by A70,JORDAN5C:def 3;
          then p4 in rng f by A9,PRE_TOPC:def 5;
          then consider xs4 being object such that
A76:      xs4 in dom f and
A77:      p4=f.xs4 by FUNCT_1:def 3;
          reconsider s4=xs4 as Real by A76;
A78:      s4<=1 by A76,BORSUK_1:40,XXREAL_1:1;
          assume
A79:      not ex p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2
          & LE p9,p51,P,p1,p2 & p51`1<e;
A80:      for p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2 & LE p9
          ,p51,P,p1,p2 holds p51`1=e
          proof
            let p51 be Point of TOP-REAL 2;
            assume LE p51,p4,P,p1,p2 & LE p9,p51,P,p1,p2;
            then p51`1>=e & p51`1<=e by A74,A79;
            hence thesis by XXREAL_0:1;
          end;
A81:      now
            assume s4>s0;
            then --(s4-s0)>0 by XREAL_1:50;
            then -(s4-s0)<0;
            then
A82:        (s0-s4)/2<0 by XREAL_1:141;
            then -((s0-s4)/2)>0 by XREAL_1:58;
            then consider r being Real such that
A83:        r in R and
A84:        r<s0+(-((s0-s4)/2)) by A21,SEQ_4:def 2;
            reconsider rss=r as Real;
A85:        ex s7 being Real st s7=r & 1>=s7 & s7>=s2 &
              for q being Point
            of TOP-REAL 2 st q=f.s7 holds q`1<>e by A83;
            then r in [.0,1.] by A22,XXREAL_1:1;
            then f.rss in rng f by A12,BORSUK_1:40,FUNCT_1:def 3;
            then f.rss in P by A9,PRE_TOPC:def 5;
            then reconsider pss=f.rss as Point of TOP-REAL 2;
            s4+0>s4+(s0-s4)/2 by A82,XREAL_1:8;
            then
A86:        s4>r by A84,XXREAL_0:2;
            then
A87:        1>r by A78,XXREAL_0:2;
A88:        r>=s0 by A21,A83,SEQ_4:def 2;
            then
A89:        LE p9,pss,P,p1,p2 by A1,A5,A6,A7,A22,A23,A18,A87,JORDAN5C:8;
            LE pss,p4,P,p1,p2 by A1,A5,A6,A7,A22,A18,A77,A78,A88,A86,A87,
JORDAN5C:8;
            then pss`1=e by A80,A89;
            hence contradiction by A85;
          end;
          0<=s4 by A76,BORSUK_1:40,XXREAL_1:1;
          then s4>=s0 by A5,A6,A7,A23,A70,A77,A78,JORDAN5C:def 3;
          hence contradiction by A71,A77,A81,XXREAL_0:1;
        end;
        now
          assume ex p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2 & LE
          p9,p51,P,p1,p2 & p51`1<e;
          then consider p51 being Point of TOP-REAL 2 such that
A90:      LE p51,p4,P,p1,p2 and
A91:      LE p9,p51,P,p1,p2 and
A92:      p51`1<e;
A93:      for p5 being Point of TOP-REAL 2 st LE p5,p51,P,p1,p2 & LE p,
          p5,P,p1,p2 holds p5`1<=e
          proof
            let p5 be Point of TOP-REAL 2;
            assume that
A94:        LE p5,p51,P,p1,p2 and
A95:        LE p,p5,P,p1,p2;
A96:        LE p5,p4,P,p1,p2 by A90,A94,JORDAN5C:13;
A97:        p5 in P by A94,JORDAN5C:def 3;
            then
A98:        p5=p9 implies LE p9,p5,P,p1,p2 by JORDAN5C:9;
            now
              per cases by A1,A73,A97,A98,JORDAN5C:14;
              case
                LE p5,p9,P,p1,p2;
                hence thesis by A26,A95;
              end;
              case
                LE p9,p5,P,p1,p2;
                hence thesis by A74,A96;
              end;
            end;
            hence thesis;
          end;
          LE p,p51,P,p1,p2 by A24,A91,JORDAN5C:13;
          hence p is_Lout P,p1,p2,e by A1,A3,A4,A92,A93;
        end;
        hence p is_Lout P,p1,p2,e or p is_Rout P,p1,p2,e by A75;
      end;
      case
A99:    for p6 being Point of TOP-REAL 2 st LE p6,p4,P,p1,p2 & LE p9
        ,p6,P,p1,p2 holds p6`1>=e;
A100:    now
          p4 in P by A70,JORDAN5C:def 3;
          then p4 in rng f by A9,PRE_TOPC:def 5;
          then consider xs4 being object such that
A101:     xs4 in dom f and
A102:     p4=f.xs4 by FUNCT_1:def 3;
          reconsider s4=xs4 as Real by A101;
A103:     s4<=1 by A101,BORSUK_1:40,XXREAL_1:1;
          assume
A104:     not ex p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2
          & LE p9,p51,P,p1,p2 & p51`1>e;
A105:     for p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2 & LE p9
          ,p51,P,p1,p2 holds p51`1=e
          proof
            let p51 be Point of TOP-REAL 2;
            assume LE p51,p4,P,p1,p2 & LE p9,p51,P,p1,p2;
            then p51`1<=e & p51`1>=e by A99,A104;
            hence thesis by XXREAL_0:1;
          end;
A106:     now
            assume s4>s0;
            then --(s4-s0)>0 by XREAL_1:50;
            then -(s4-s0)<0;
            then
A107:       (s0-s4)/2<0 by XREAL_1:141;
            then -((s0-s4)/2)>0 by XREAL_1:58;
            then consider r being Real such that
A108:       r in R and
A109:       r<s0+(-((s0-s4)/2)) by A21,SEQ_4:def 2;
            reconsider rss=r as Real;
A110:       ex s7 being Real st s7=r & 1>=s7 & s7>=s2 &
     for q being Point
            of TOP-REAL 2 st q=f.s7 holds q`1<>e by A108;
            then r in [.0,1.] by A22,XXREAL_1:1;
            then f.rss in rng f by A12,BORSUK_1:40,FUNCT_1:def 3;
            then f.rss in P by A9,PRE_TOPC:def 5;
            then reconsider pss=f.rss as Point of TOP-REAL 2;
            s4+0>s4+(s0-s4)/2 by A107,XREAL_1:8;
            then
A111:       s4>r by A109,XXREAL_0:2;
            then
A112:       1>r by A103,XXREAL_0:2;
A113:       r>=s0 by A21,A108,SEQ_4:def 2;
            then
A114:       LE p9,pss,P,p1,p2 by A1,A5,A6,A7,A22,A23,A18,A112,JORDAN5C:8;
            LE pss,p4,P,p1,p2 by A1,A5,A6,A7,A22,A18,A102,A103,A113,A111,A112,
JORDAN5C:8;
            then pss`1=e by A105,A114;
            hence contradiction by A110;
          end;
          0<=s4 by A101,BORSUK_1:40,XXREAL_1:1;
          then s4>=s0 by A5,A6,A7,A23,A70,A102,A103,JORDAN5C:def 3;
          hence contradiction by A71,A102,A106,XXREAL_0:1;
        end;
        now
          assume ex p51 being Point of TOP-REAL 2 st LE p51,p4,P,p1,p2 & LE
          p9,p51,P,p1,p2 & p51`1>e;
          then consider p51 being Point of TOP-REAL 2 such that
A115:     LE p51,p4,P,p1,p2 and
A116:     LE p9,p51,P,p1,p2 and
A117:     p51`1>e;
A118:     for p5 being Point of TOP-REAL 2 st LE p5,p51,P,p1,p2 & LE p,
          p5,P,p1,p2 holds p5`1>=e
          proof
            let p5 be Point of TOP-REAL 2;
            assume that
A119:       LE p5,p51,P,p1,p2 and
A120:       LE p,p5,P,p1,p2;
A121:       LE p5,p4,P,p1,p2 by A115,A119,JORDAN5C:13;
A122:       p5 in P by A119,JORDAN5C:def 3;
            then
A123:       p5=p9 implies LE p9,p5,P,p1,p2 by JORDAN5C:9;
            now
              per cases by A1,A73,A122,A123,JORDAN5C:14;
              case
                LE p9,p5,P,p1,p2;
                hence thesis by A99,A121;
              end;
              case
                LE p5,p9,P,p1,p2;
                hence thesis by A26,A120;
              end;
            end;
            hence thesis;
          end;
          LE p,p51,P,p1,p2 by A24,A116,JORDAN5C:13;
          hence p is_Rout P,p1,p2,e by A1,A3,A4,A117,A118;
        end;
        hence p is_Lout P,p1,p2,e or p is_Rout P,p1,p2,e by A100;
      end;
    end;
    hence p is_Lout P,p1,p2,e or p is_Rout P,p1,p2,e;
  end;
  hence thesis;
end;
