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

theorem Th9:
  p in LSeg(p2,p3) & p<>p2 implies angle(p3,p2,p1)=angle(p,p2,p1)
proof
  set c = euc2cpx(p-p2);
  set c1 = euc2cpx(p1-p2);
  set c3 = euc2cpx(p3-p2);
  assume p in LSeg(p2,p3);
  then consider l be Real such that
A1: p=(1-l)*p2+l*p3 and
A2: 0<=l and
  l<=1;
  reconsider l as Real;
A3: p - p2 = (1+(-l))*p2 +l*p3 -p2 by A1
    .= (1)*p2+(-l)*p2 +l*p3 -p2 by RLVECT_1:def 6
    .= p2 +(-l)*p2 +l*p3 -p2 by RLVECT_1:def 8
    .= (p2 +(-l)*p2)+ (l*p3 + -p2) by RLVECT_1:def 3
    .= p2 +((-l)*p2 +(l*p3 + -p2)) by RLVECT_1:def 3
    .= p2 +(-p2 + ((-l)*p2 + l*p3)) by RLVECT_1:def 3
    .= (p2 + -p2) + ((-l)*p2 + l*p3) by RLVECT_1:def 3
    .= 0.TOP-REAL 2 + ((-l)*p2 + l*p3) by RLVECT_1:5
    .= (l*(-1))*p2 + l*p3 by RLVECT_1:4
    .= l*((-1)*p2) + l*p3 by RLVECT_1:def 7
    .= l*(-p2) + l*p3
    .= l*(p3-p2) by RLVECT_1:def 5;
  assume
A4: p<>p2;
A5: l <> 0
  proof
    assume l=0;
    then p = 1*p2+0.TOP-REAL 2 by A1,RLVECT_1:10
      .= 1*p2 by RLVECT_1:4
      .= p2 by RLVECT_1:def 8;
    hence contradiction by A4;
  end;
  cpx2euc(c3 * l) = l*cpx2euc(c3) by EUCLID_3:19
    .= l*(p3-p2) by EUCLID_3:2
    .= cpx2euc(c) by A3,EUCLID_3:2;
  then c = c3 * l by EUCLID_3:3;
  then
A6: Arg c = Arg c3 by A2,A5,COMPLEX2:27;
  angle(c3,c1) = angle(c,c1)
  proof
    per cases;
    suppose
A7:   Arg c3 = 0 or c1 <> 0;
      then angle(c3,c1)=Arg(Rotate(c1, -Arg c3)) by COMPLEX2:def 3
        .= angle(c,c1) by A6,A7,COMPLEX2:def 3;
      hence thesis;
    end;
    suppose
A8:   not (Arg c3 = 0 or c1 <> 0);
      then angle(c3,c1)=2*PI - Arg c3 by COMPLEX2:def 3
        .= angle(c,c1) by A6,A8,COMPLEX2:def 3;
      hence thesis;
    end;
  end;
  hence angle(p3,p2,p1) = angle(c,c1) by Lm7
    .= angle(p,p2,p1) by Lm7;
end;
