Ptolemy's theorem
ProvedFamousTheorems.ptolemyPtolemy's theorem.
If lie on a common sphere and the segments and cross at a point — so that is a cyclic quadrilateral in that cyclic order — then
the product of the diagonals equals the sum of the products of the two pairs of opposite sides.
For a general quadrilateral the left side is strictly larger (Ptolemy's inequality); equality characterises concyclicity. Applied to a rectangle it collapses to the Pythagorean theorem, and applied to a cyclic quadrilateral with one side a diameter it yields the addition formulas for sine and cosine — which is exactly how Ptolemy used it.
It appears in Book I of the Almagest (c. 150 AD), where it is the engine for computing the table of chords, the trigonometric table on which fourteen centuries of positional astronomy rested. Before the sine function existed, this identity was trigonometry.
Formalization note. Cospherical asserts the four points are equidistant from some centre;
says lies strictly between and , which encodes that the diagonals cross.
The result is Mathlib's EuclideanGeometry.mul_dist_add_mul_dist_eq_mul_dist_of_cospherical.
import Mathlib
namespace FamousTheorems
open scoped EuclideanGeometry Real
theorem ptolemy
{V : Type*} {P : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
[MetricSpace P] [NormedAddTorsor V P]
{a b c d p : P} (h : EuclideanGeometry.Cospherical ({a, b, c, d} : Set P))
(hapc : ∠ a p c = π) (hbpd : ∠ b p d = π) :
dist a b * dist c d + dist b c * dist d a = dist a c * dist b d := by sorry
end FamousTheorems