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.

(* Specifications: *)
Lemma Cong_AM_Cong: forall A B C D, AM_Cong A B C D <-> Cong A B C D.
Lemma Col_AM_Col : forall A B C, AM_Col A B C <-> Col A B C.
Lemma Per_AM_Per : forall A B C, AM_Per A B C <-> Per A B C.
Lemma Perp_AM_Perp : forall A B C D,
(AM_Perp A B C D /\ A <> B /\ C <> D) <-> Perp A B C D.
Lemma AM_Par_ratio_AM_Par :
forall P Q C D,
AM_Par P Q C D -> ratio P Q C D =F= 1 -> C<>D -> AM_Par D Q P C.
Lemma Par_AM_Par : forall A B C D,
(A <> B /\ C <> D /\ AM_Par A B C D) <-> Par A B C D.
Lemma AM_lower_dim :
exists A B C, ~ AM_Col A B C.
Lemma signed_area_AAB : forall A B, signed_area A A B =F= 0.
Lemma signed_area_ABA : forall A B, signed_area A B A =F= 0.
Lemma signed_area_ABB : forall A B, signed_area A B B =F= 0.
Lemma twice_signed_area_AAB : forall A B, twice_signed_area A A B =F= 0.
Lemma twice_signed_area_ABA : forall A B, twice_signed_area A B A =F= 0.
Lemma twice_signed_area_ABB : forall A B, twice_signed_area A B B =F= 0.
Lemma twice_signed_area_cyclic :
forall A B C, twice_signed_area A B C =F= twice_signed_area B C A.
Lemma twice_signed_area_perm :
forall A B C, twice_signed_area A B C =F= - twice_signed_area B A C.
Lemma AM_Perp_AM_Perp_AM_Par : forall A B C D U V,
C<>D ->
AM_Perp A B C D -> AM_Perp U V C D -> AM_Par A B U V.
Lemma Py_triv_ABB : forall A B, Py A B B  =F= 0.
Lemma AM_Perp_triv1 : forall A B C, AM_Perp A B C C.
Lemma AM_Perp_triv2 : forall A B C, AM_Perp A A B C.
Lemma AM_perp_AM_Par_AM_perp : forall A B C D U V,
A<>B ->
AM_Perp A B C D -> AM_Par A B U V -> AM_Perp U V C D.
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.
Lemma triangle_area : forall A B C H,
AM_on_foot H A B C ->
twice_signed_area A B C * twice_signed_area A B C =F= square_dist A H * square_dist B C.