Definition square_dist A B :=
let (Ac, _) := coordinates_of_point_F A in
let (Ax, Ay) := Ac in
let (Bc, _) := coordinates_of_point_F B in
let (Bx, By) := Bc in
(Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By).
Definition twice_signed_area4 A B C D :=
twice_signed_area A B C + twice_signed_area A C D.
Definition Py A B C := square_dist A B + square_dist B C - square_dist A C.
Definition Py4 A B C D := Py A B D - Py C B D.
Definition AM_Cong A B C D := Py A B A =F= Py C D C.
Definition AM_Col A B C := twice_signed_area A B C =F= 0.
Definition AM_Per A B C := Py A B C =F= 0.
Definition AM_Perp A B C D := Py4 A C B D =F= 0.
Definition AM_Par A B C D := twice_signed_area4 A C B D =F= 0.
Definition AM_on_foot Y P U V := AM_Perp Y P U V /\ AM_Col Y U V /\ U <> V.

Lemma perp_triangle_area : forall A B C, A<>C -> AM_Per A B C ->
twice_signed_area A B C * twice_signed_area A B C =F= square_dist A B * square_dist B C.