reserve p,p1,p2,p3,p11,p22,q,q1,q2 for Point of TOP-REAL 2,
  f,h for FinSequence of TOP-REAL 2,
  r,r1,r2,s,s1,s2 for Real,
  u,u1,u2,u5 for Point of Euclid 2,
  n,m,i,j,k for Nat,
  N for Nat,
  x,y,z for set;
reserve lambda for Real;

theorem
  not p1 in Ball(u,r) & p in Ball(u,r) & |[q`1,p`2]| in Ball(u,r) & not
|[q`1,p`2]| in LSeg(p1,p) & p1`2 = p`2 & p`1<>q`1 & p`2<>q`2 implies (LSeg(p,|[
  q`1,p`2]|) \/ LSeg(|[q`1,p`2]|,q)) /\ LSeg(p1,p) = {p}
proof
  set v = |[q`1,p`2]|;
  assume that
A1: not p1 in Ball(u,r) and
A2: p in Ball(u,r) and
A3: v in Ball(u,r) and
A4: not v in LSeg(p1,p) and
A5: p1`2=p`2 and
A6: p`1<>q`1 and
A7: p`2<>q`2;
A8: LSeg(p,v) c= Ball(u,r) by A2,A3,Th21;
A9: p1=|[p1`1,p`2]| by A5,EUCLID:53;
  p in LSeg(p,v) by RLTOPSP1:68;
  then p in LSeg(p1,p) & p in LSeg(p,v) \/ LSeg(v,q) by RLTOPSP1:68
,XBOOLE_0:def 3;
  then p in (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) by XBOOLE_0:def 4;
  then
A10: {p} c= (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) by ZFMISC_1:31;
A11: (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) = LSeg(p,v) /\ LSeg(p1,p) \/
  LSeg(v,q) /\ LSeg(p1,p) by XBOOLE_1:23;
A12: q=|[q`1,q`2]| by EUCLID:53;
A13: p=|[p`1,p`2]| by EUCLID:53;
A14: v`2=p`2;
A15: v`1=q`1;
  per cases;
  suppose
    p1`1=p`1;
    hence thesis by A1,A2,A5,Th6;
  end;
  suppose
A16: p1`1<>p`1;
    now
      per cases by A16,XXREAL_0:1;
      suppose
A17:    p1`1>p`1;
        now
          per cases by A6,XXREAL_0:1;
          case
A18:        p`1>q`1;
            then
A19:        p`1>=v`1;
            now
              per cases by A7,XXREAL_0:1;
              suppose
A20:            p`2>q`2;
                (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) c= {p}
                proof
                  let x be object such that
A21:              x in (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p);
                  now
                    per cases by A11,A21,XBOOLE_0:def 3;
                    case
A22:                  x in LSeg(p,v) /\ LSeg(p1,p);
                      p in {q1: q1`2=p`2 & v`1<=q1`1 & q1`1<=p1`1} by A17,A19;
                      then p in LSeg(p1,v) by A9,A17,A18,Th10,XXREAL_0:2;
                      hence thesis by A22,TOPREAL1:8;
                    end;
                    case
A23:                  x in LSeg(v,q) /\ LSeg(p1,p);
                      then x in LSeg(q,v) by XBOOLE_0:def 4;
                      then
                      x in {p2: p2`1=q`1 & q`2<=p2`2 & p2`2<=p`2} by A12,A20
,Th9;
                      then
A24:                  ex p2 st p2=x & p2`1=q`1 & q`2<=p2`2 & p2`2<=p`2;
                      x in LSeg(p, p1) by A23,XBOOLE_0:def 4;
                      then
                      x in {q2: q2`2=p`2 & p`1<=q2`1 & q2`1<=p1`1} by A9,A13
,A17,Th10;
                      then ex q2 st q2=x & q2`2=p`2 & p`1 <=q2`1 & q2`1<=p1`1;
                      hence contradiction by A18,A24;
                    end;
                  end;
                  hence thesis;
                end;
                hence thesis by A10;
              end;
              suppose
A25:            p`2<q`2;
                (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) c= {p}
                proof
                  let x be object such that
A26:              x in (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p);
                  now
                    per cases by A11,A26,XBOOLE_0:def 3;
                    case
A27:                  x in LSeg(p,v) /\ LSeg(p1,p);
                      p in {q1: q1`2=p`2 & v`1<=q1`1 & q1`1<=p1`1} by A17,A19;
                      then p in LSeg(p1,v) by A9,A17,A18,Th10,XXREAL_0:2;
                      hence thesis by A27,TOPREAL1:8;
                    end;
                    case
A28:                  x in LSeg(v,q) /\ LSeg(p1,p);
                      then x in LSeg(p1, p) by XBOOLE_0:def 4;
                      then
                      x in {q2: q2`2=p`2 & p`1<=q2`1 & q2`1<=p1`1} by A9,A13
,A17,Th10;
                      then
A29:                  ex q2 st q2=x & q2`2=p`2 & p`1 <=q2`1 & q2`1<=p1`1;
                      x in LSeg(v,q) by A28,XBOOLE_0:def 4;
                      then
                      x in {p2: p2`1=q`1 & v`2<=p2`2 & p2`2<=q`2} by A12,A25,
Th9;
                      then ex p2 st p2=x & p2`1=q`1 & v`2<=p2`2 & p2`2<=q`2;
                      hence contradiction by A18,A29;
                    end;
                  end;
                  hence thesis;
                end;
                hence thesis by A10;
              end;
            end;
            hence thesis;
          end;
          case
A30:        p`1<q`1;
            now
              per cases by XXREAL_0:1;
              suppose
A31:            q`1>p1`1;
                then p1 in {q2: q2`2=p`2 & p`1<=q2`1 & q2`1<=v`1} by A5,A17
;
                then p1 in LSeg(p,v) by A13,A17,A31,Th10,XXREAL_0:2;
                hence contradiction by A1,A8;
              end;
              suppose
                q`1=p1`1;
                hence contradiction by A1,A3,A5,EUCLID:53;
              end;
              suppose
                q`1<p1`1;
                then
                v in {p2: p2`2=p`2 & p`1<=p2`1 & p2`1<=p1`1} by A15,A14,A30;
                hence contradiction by A4,A9,A13,A17,Th10;
              end;
            end;
            hence contradiction;
          end;
        end;
        hence thesis;
      end;
      suppose
A32:    p1`1<p`1;
        now
          per cases by A6,XXREAL_0:1;
          case
A33:        p`1>q`1;
            now
              per cases by XXREAL_0:1;
              suppose
                q`1>p1`1;
                then
                v in {q2: q2`2=p`2 & p1`1<=q2`1 & q2`1<=p`1} by A15,A14,A33;
                hence contradiction by A4,A9,A13,A32,Th10;
              end;
              suppose
                q`1=p1`1;
                hence contradiction by A1,A3,A5,EUCLID:53;
              end;
              suppose
A34:            q`1<p1`1;
                then p1 in {p2: p2`2=p`2 & v`1<=p2`1 & p2`1<=p`1} by A5,A32
;
                then p1 in LSeg(p,v) by A13,A32,A34,Th10,XXREAL_0:2;
                hence contradiction by A1,A8;
              end;
            end;
            hence contradiction;
          end;
          case
A35:        p`1<q`1;
            then
A36:        p`1<=v`1;
            now
              per cases by A7,XXREAL_0:1;
              suppose
A37:            p`2>q`2;
                (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) c= {p}
                proof
                  let x be object such that
A38:              x in (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p);
                  now
                    per cases by A11,A38,XBOOLE_0:def 3;
                    case
A39:                  x in LSeg(p,v) /\ LSeg(p1,p);
                      p in {q1: q1`2=p`2 & p1`1<=q1`1 & q1`1<=v`1} by A32,A36;
                      then p in LSeg(p1,v) by A9,A32,A35,Th10,XXREAL_0:2;
                      hence thesis by A39,TOPREAL1:8;
                    end;
                    case
A40:                  x in LSeg(v,q) /\ LSeg(p1,p);
                      then x in LSeg(v,q) by XBOOLE_0:def 4;
                      then
                      x in {p2: p2`1=q`1 & q`2<=p2`2 & p2`2<=p`2} by A12,A37
,Th9;
                      then
A41:                  ex p2 st p2=x & p2`1=q`1 & q`2<=p2`2 & p2`2<=p`2;
                      x in LSeg(p1, p) by A40,XBOOLE_0:def 4;
                      then
                      x in {q2: q2`2=p`2 & p1`1<=q2`1 & q2`1<=p`1} by A9,A13
,A32,Th10;
                      then ex q2 st q2=x & q2`2=p`2 & p1 `1<=q2`1 & q2`1<=p`1;
                      hence contradiction by A35,A41;
                    end;
                  end;
                  hence thesis;
                end;
                hence thesis by A10;
              end;
              suppose
A42:            p`2<q`2;
                (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p) c= {p}
                proof
                  let x be object such that
A43:              x in (LSeg(p,v) \/ LSeg(v,q)) /\ LSeg(p1,p);
                  now
                    per cases by A11,A43,XBOOLE_0:def 3;
                    case
A44:                  x in LSeg(p,v) /\ LSeg(p1,p);
                      p in {q1: q1`2=p`2 & p1`1<=q1`1 & q1`1<=v`1} by A32,A36;
                      then p in LSeg(p1,v) by A9,A32,A35,Th10,XXREAL_0:2;
                      hence thesis by A44,TOPREAL1:8;
                    end;
                    case
A45:                  x in LSeg(v,q) /\ LSeg(p1,p);
                      then x in LSeg(p1, p) by XBOOLE_0:def 4;
                      then x in {q2: q2`2=p`2 & p1`1<=q2`1 & q2`1<=p`1} by A9
,A13,A32,Th10;
                      then
A46:                  ex q2 st q2=x & q2`2=p`2 & p1 `1<=q2`1 & q2`1<=p`1;
                      x in LSeg(v,q) by A45,XBOOLE_0:def 4;
                      then x in {p2: p2`1=q`1 & v`2<=p2`2 & p2`2<=q`2} by A12
,A42,Th9;
                      then ex p2 st p2=x & p2`1=q`1 & v`2<=p2`2 & p2`2<=q`2;
                      hence contradiction by A35,A46;
                    end;
                  end;
                  hence thesis;
                end;
                hence thesis by A10;
              end;
            end;
            hence thesis;
          end;
        end;
        hence thesis;
      end;
    end;
    hence thesis;
  end;
end;
