Definition sqrt3 := PythF 1 (PythF 1 1).

(* Specifications: *)
Lemma sqrt3_square : sqrt3* sqrt3 =F= 1+2.
Lemma characterization_of_congruence_F : forall A B C D,
Cong 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
(Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By) -
((Cx - Dx) * (Cx - Dx) + (Cy - Dy) * (Cy - Dy)) =F= 0.
Lemma characterization_of_betweenness_F : forall A B C,
Bet 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
exists T, 0 <= T /\ T <= 1 /\
T * (Cx - Ax) =F= Bx - Ax /\ T * (Cy - Ay) =F= By - Ay.
Lemma characterization_of_collinearity_F : forall A B C,
Col 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
(Ax - Bx) * (By - Cy) - (Ay - By) * (Bx - Cx) =F= 0.
Lemma characterization_of_equality_F : forall A B,
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 =F= Bx /\ Ay =F= By.
Lemma characterization_of_neq_F_bis : forall A B,
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 =F= Bx) \/ ~ (Ay =F= By).
Lemma characterization_of_equality_F_aux : forall Ax Ay Bx By,
Ax =F= Bx /\ Ay =F= By <->
(Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By) =F= OF.
Lemma characterization_of_equality_F_bis : forall A B,
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) =F= OF.
Lemma characterization_of_neq_F : forall A B,
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) =F= OF).
Lemma characterization_of_midpoint_F : forall A B I,
Midpoint I 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
let (Ic, _) := coordinates_of_point_F I in
let (Ix, Iy) := Ic in
Ix * 2 - (Ax + Bx) =F= 0 /\ Iy * 2 - (Ay + By) =F= 0.
Lemma characterization_of_right_triangle_F : forall A B C,
Per 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
(Ax - Bx) * (Bx - Cx) + (Ay - By) * (By - Cy) =F= 0.
Lemma characterization_of_parallelism_F_aux : forall A B C D,
Par A B C D <->
A <> B /\ C <> D /\
exists P, Midpoint C A P /\ exists Q, Midpoint Q B P /\ Col C D Q.
Lemma characterization_of_parallelism_F_bis : forall A B C D,
Par 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
(Ax - Bx) * (Cy - Dy) - (Ay - By) * (Cx - Dx) =F= 0 /\
(~ (Ax =F= Bx) \/ ~ (Ay =F= By)) /\ (~ (Cx =F= Dx) \/ ~ (Cy =F= Dy)).
Lemma characterization_of_parallelism_F : forall A B C D,
Par 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
(Ax - Bx) * (Cy - Dy) - (Ay - By) * (Cx - Dx) =F= 0 /\
~ ((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By) =F= OF) /\
~ ((Cx - Dx) * (Cx - Dx) + (Cy - Dy) * (Cy - Dy) =F= OF).
Lemma characterization_of_perpendicularity_F_bis : forall A B C D,
Perp 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
(Ax - Bx) * (Cx - Dx) + (Ay - By) * (Cy - Dy) =F= OF /\
(~ (Ax =F= Bx) \/ ~ (Ay =F= By)) /\ (~ (Cx =F= Dx) \/ ~ (Cy =F= Dy)).
Lemma characterization_of_perpendicularity_F : forall A B C D,
Perp 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
(Ax - Bx) * (Cx - Dx) + (Ay - By) * (Cy - Dy) =F= OF /\
~ ((Ax - Bx) * (Ax - Bx) + (Ay - By) * (Ay - By) =F= OF) /\
~ ((Cx - Dx) * (Cx - Dx) + (Cy - Dy) * (Cy - Dy) =F= OF).
Lemma field_prop: forall a b c d: F,
~ b=F=0 -> ~ d =F= 0 -> a*d =F= b*c -> a/b =F= c/d.
Lemma field_prop_zero : forall a b, ~ b =F= 0 -> a/b =F= 0 -> a=F=0.
Lemma field_prop_1 : forall a b c, ~ b =F= 0 -> a/b =F= c -> a=F=c*b.
Ltac decompose_coordinates :=
repeat
match goal with
H: _ |- context[ (coordinates_of_point_F ?X) ] =>
let fx := fresh X "x" in
let fy := fresh X "y" in
destruct (coordinates_of_point_F X) as [[fx fy] _]
end.