reserve p1,p2,p3,p4,p5,p6,p,pc for Point of TOP-REAL 2;
reserve a,b,c,r,s for Real;

theorem Th18:
  |.p1-p3.|=|.p2-p3.| & p in LSeg(p1,p2) & p<>p3 & p<>p1 & (angle(
  p3,p,p1)=PI/2 or angle(p3,p,p1)=3/2*PI) implies angle(p1,p3,p)=angle(p,p3,p2)
proof
  assume
A1: |.p1-p3.|=|.p2-p3.|;
  then
A2: |.p3-p1.|=|.p2-p3.| by Lm2;
  assume
A3: p in LSeg(p1,p2);
  assume that
A4: p<>p3 and
A5: p<>p1;
  assume
A6: angle(p3,p,p1)=PI/2 or angle(p3,p,p1)=3/2*PI;
  per cases;
  suppose
A7: p1=p2;
    then LSeg(p1,p2) = {p1} by RLTOPSP1:70;
    then p=p1 by A3,TARSKI:def 1;
    hence thesis by A7;
  end;
  suppose
A8: p1<>p2;
    per cases;
    suppose
A9:   p<>p2;
      p2<>p3
      proof
        assume
A10:    p2=p3;
        then |.p3-p1.|=0 by A2,Lm1;
        hence contradiction by A8,A10,Lm1;
      end;
      then
A11:  euc2cpx(p2)<> euc2cpx(p3) by EUCLID_3:4;
      p1<>p3
      proof
        assume
A12:    p1=p3;
        then |.p2-p3.|=0 by A1,Lm1;
        hence contradiction by A8,A12,Lm1;
      end;
      then
A13:  euc2cpx(p1)<> euc2cpx(p3) by EUCLID_3:4;
A14:  euc2cpx(p)<> euc2cpx(p1) & euc2cpx(p)<> euc2cpx(p3) by A4,A5,EUCLID_3:4;
A15:  angle(p1,p,p3) = angle(p3,p,p2) & euc2cpx(p)<> euc2cpx(p2) by A3,A5,A6,A9
,Th14,EUCLID_3:4;
A16:  angle(p3,p1,p) = angle(p3,p1,p2) by A3,A5,Th10
        .= angle(p1,p2,p3) by A2,A8,Th16
        .= angle(p,p2,p3) by A3,A9,Th9;
A17:  angle(p,p3,p1)=angle(p2,p3,p)
      proof
        per cases by A16,A14,A13,A11,A15,COMPLEX2:88;
        suppose
          angle(p,p2,p3)+angle(p,p3,p1)+angle(p3,p,p2) = PI & angle(p
,p2,p3)+angle(p2,p3,p)+angle(p3,p,p2) = PI or angle(p,p2,p3)+angle(p,p3,p1)+
angle(p3,p,p2) = 5*PI & angle(p,p2,p3)+angle(p2,p3,p)+angle(p3,p,p2) = 5*PI;
          hence thesis;
        end;
        suppose
A18:      angle(p,p2,p3)+angle(p,p3,p1)+angle(p3,p,p2) = PI & angle(p
          ,p2,p3)+angle(p2,p3,p)+angle(p3,p,p2) = 5*PI;
          angle(p2,p3,p)<2*PI & angle(p,p3,p1)>=0 by COMPLEX2:70;
          then
A19:      angle(p2,p3,p)-angle(p,p3,p1) < 2*PI-0 by XREAL_1:14;
          angle(p2,p3,p)-angle(p,p3,p1) = 4*PI by A18;
          hence thesis by A19,XREAL_1:64;
        end;
        suppose
A20:      angle(p,p2,p3)+angle(p,p3,p1)+angle(p3,p,p2) = 5*PI & angle
          (p,p2,p3)+angle(p2,p3,p)+angle(p3,p,p2) = PI;
          angle(p,p3,p1)<2*PI & angle(p2,p3,p)>=0 by COMPLEX2:70;
          then
A21:      angle(p,p3,p1)-angle(p2,p3,p) < 2*PI-0 by XREAL_1:14;
          angle(p,p3,p1)-angle(p2,p3,p) = 4*PI by A20;
          hence thesis by A21,XREAL_1:64;
        end;
      end;
      per cases;
      suppose
A22:    angle(p,p3,p1)=0;
        then angle(p1,p3,p)=0 by EUCLID_3:36;
        hence thesis by A17,A22,EUCLID_3:36;
      end;
      suppose
A23:    angle(p,p3,p1)<>0;
        then angle(p1,p3,p)=2*PI-angle(p,p3,p1) by EUCLID_3:37;
        hence thesis by A17,A23,EUCLID_3:37;
      end;
    end;
    suppose
A24:  p=p2;
      then |.p3-p1.|=|.p-p3.| by A1,Lm2
        .= |.p3-p.| by Lm2;
      then |.p3-p1.|^2+|.p1-p.|^2=|.p3-p1.|^2 by A4,A5,A6,EUCLID_3:46;
      then |.p1-p.|=0;
      hence thesis by A24,Lm1;
    end;
  end;
end;
