(** We deduce the axioms of the area method. *)

Definition vect := (F * F)%type.Definition cross_product (u v : vect) : F :=
  fst u * snd v - snd u * fst v.Definition scalar_product (u v : vect) : F :=
  fst u * fst v + snd u * snd v.Definition ratio A B C D :=
  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
  let (Cc, _) := coordinates_of_point_F C in
  let (Cx, Cy) := Cc in
  let (Dc, _) := coordinates_of_point_F D in
  let (Dx, Dy) := Dc in
  let VAB := (Bx-Ax, By-Ay) in
  let VCD := (Dx-Cx, Dy-Cy) in
  scalar_product VAB VCD / scalar_product VCD VCD.Definition signed_area A B C :=
  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
  let (Cc, _) := coordinates_of_point_F C in
  let (Cx, Cy) := Cc in
  let VAB := (Bx-Ax, By-Ay) in
  let VAC := (Cx-Ax, Cy-Ay) in
  1 / 2 * cross_product VAB VAC.(** We introduce this definition to simplify the automatic proofs:*)

Definition twice_signed_area A B C :=
  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
  let (Cc, _) := coordinates_of_point_F C in
  let (Cx, Cy) := Cc in
  let VAB := (Bx-Ax, By-Ay) in
  let VAC := (Cx-Ax, Cy-Ay) in
  cross_product VAB VAC.

(* Specifications: *)
Lemma signed_area_cyclic : forall A B C, signed_area A B C =F= signed_area B C A.
Lemma signed_area_perm : forall A B C, signed_area A B C =F= - signed_area B A C.
Lemma signed_area_sum : forall A B C D, signed_area A B C =F= signed_area A B D + signed_area A D C + signed_area D B C.
Lemma co_side : forall A B C P, A <> C -> ~ twice_signed_area P A C =F= 0 -> twice_signed_area A B C =F= 0 -> ratio A B A C =F= twice_signed_area P A B / twice_signed_area P A C.