(* ========================================================================= *)
(* Thales's theorem. *)
(* ========================================================================= *)
needs "Multivariate/convex.ml";;
prioritize_real();;
(* ------------------------------------------------------------------------- *)
(* Geometric concepts. *)
(* ------------------------------------------------------------------------- *)
let BETWEEN_THM = prove
(`between x (a,b) <=>
?u. &0 <= u /\ u <= &1 /\ x = u % a + (&1 - u) % b`,
let length_def = new_definition
`length(A:real^2,B:real^2) = norm(B - A)`;;
(* ------------------------------------------------------------------------- *)
(* This formulation works. *)
(* ------------------------------------------------------------------------- *)
let THALES = prove
(`!centre radius a b c.
length(a,centre) = radius /\
length(b,centre) = radius /\
length(c,centre) = radius /\
is_midpoint centre (a,b)
==> orthogonal (c - a) (c - b)`,
(* ------------------------------------------------------------------------- *)
(* But for another natural version, we need to use the reals. *)
(* ------------------------------------------------------------------------- *)
needs "Examples/sos.ml";;
(* ------------------------------------------------------------------------- *)
(* The following, which we need as a lemma, needs the reals specifically. *)
(* ------------------------------------------------------------------------- *)
(* ------------------------------------------------------------------------- *)
(* Now we get a more natural formulation of Thales's theorem. *)
(* ------------------------------------------------------------------------- *)
let THALES = prove
(`!centre radius a b c:real^2.
length(a,centre) = radius /\
length(b,centre) = radius /\
length(c,centre) = radius /\
between centre (a,b)
==> orthogonal (c - a) (c - b)`,