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

theorem Th5:
  the_area_of_polygon3(p1,p2,p3) = |.p1-p2.|*|.p3-p2.|*sin angle(p3 ,p2,p1) / 2
proof
  per cases;
  suppose
A1: p1=p2;
    then |.p1-p2.| = |.0.TOP-REAL 2.| by RLVECT_1:5
      .= 0 by EUCLID_2:39;
    hence thesis by A1;
  end;
  suppose
A2: p1<>p2;
    per cases;
    suppose
A3:   p2=p3;
      then |.p3-p2.| = |.0.TOP-REAL 2.| by RLVECT_1:5
        .= 0 by EUCLID_2:39;
      hence thesis by A3;
    end;
    suppose
A4:   p2<>p3;
      set b = euc2cpx(p3-p2);
      set a = euc2cpx(p1-p2);
A5:   now
        assume
A6:     a=0 or b=0;
        per cases by A6;
        suppose
          a=0;
          hence contradiction by A2,EUCLID_3:18,RLVECT_1:21;
        end;
        suppose
          b=0;
          hence contradiction by A4,EUCLID_3:18,RLVECT_1:21;
        end;
      end;
A7:   now
        assume
A8:     |.a.|*|.b.|=0;
        per cases by A8;
        suppose
          |.a.|=0;
          hence contradiction by A5,COMPLEX1:45;
        end;
        suppose
          |.b.|=0;
          hence contradiction by A5,COMPLEX1:45;
        end;
      end;
      |.p1-p2.|*|.p3-p2.|*sin angle(p3,p2,p1) / 2 = |.p1-p2.|*|.p3-p2.|*(
      -sin angle(p1,p2,p3)) / 2 by Th2
        .= |.p1-p2.|*|.p3-p2.|*(- sin angle(a,b)) / 2 by Lm7
        .= |.p1-p2.|*|.p3-p2.|*(-(-Im(a.|.b)/(|.a.|*|.b.|)))/2 by A5,
COMPLEX2:69
        .= |.a.|*|.p3-p2.|*(Im (a.|.b)/(|.a.|*|.b.|))/2 by Lm16
        .= |.a.|*|.b.|*(Im (a.|.b)/(|.a.|*|.b.|))/2 by Lm16
        .= (Im (a.|.b)/((|.a.|*|.b.|)/(|.a.|*|.b.|))/2) by XCMPLX_1:81
        .= (Im (a.|.b)/1/2) by A7,XCMPLX_1:60
        .= (-(p1`1 - p2`1)*(p3`2 - p2`2)+(p1`2 - p2`2)*(p3`1 - p2`1))/2 by Lm16
        .= ((p1`1*p2`2 - p2`1*p1`2) + (p2`1*p3`2 - p3`1*p2`2) + (p3`1*p1`2 -
      p1`1*p3`2)) / 2;
      hence thesis;
    end;
  end;
end;
