-- Constructible points of the plane: the least set containing (0, 0) and -- (1, 0) and closed under the three intersections. Their coordinates are -- constructible numbers, so no constructible point has abscissa ∛2 and no -- constructible point of the unit circle trisects the angle of sixty -- degrees. -- Part of Cumulus, the Grace17 mathematics library. -- Copyright (c) 2026 Grant Passmore. -- Released under the Apache License 2.0. See LICENSE in the repository root. -- Authors: Grant Passmore module Grace.Cumulus.Geometry.Construction.Points import Grace.Cumulus.Geometry.Construction.Intersections import Grace.Cumulus.Geometry.Construction.Impossibility -- The definitions -- A set of points closed under ruler and compass: it holds the two base -- points and every intersection of two nonparallel lines, of a line and a -- circle, and of two circles with distinct centers, each determined by -- points of the set. predicate ConstructionClosed (P : Set) := P ⊆ ℝ × ℝ ∧ ((0:R), (0:R)) ∈ P ∧ ((1:R), (0:R)) ∈ P ∧ (∀ a b c d ∈ P, ∀ p ∈ ℝ × ℝ, ∀ t u ∈ ℝ, directionCross(a, b, c, d) ≠ (0:R) → OnLine(p, a, b, t) → OnLine(p, c, d, u) → p ∈ P) ∧ (∀ a b c w ∈ P, ∀ p ∈ ℝ × ℝ, ∀ t ∈ ℝ, a ≠ b → OnLine(p, a, b, t) → OnCircle(p, c, w) → p ∈ P) ∧ (∀ c w e v ∈ P, ∀ p ∈ ℝ × ℝ, c ≠ e → OnCircle(p, c, w) → OnCircle(p, e, v) → p ∈ P) def constructiblePoints : Set := { p ∈ ℝ × ℝ | ∀ P, ConstructionClosed(P) → p ∈ P } -- Membership theorem constructiblePoints.mem_iff (p : Set) shows p ∈ constructiblePoints ↔ p ∈ ℝ × ℝ ∧ (∀ P, ConstructionClosed(P) → p ∈ P) proof simp theorem constructiblePoints.least (P : Set) requires closed : ConstructionClosed(P) shows constructiblePoints ⊆ P proof intros p hp have data := constructiblePoints.mem_iff.forward with hp exact data.right with P, closed theorem constructiblePoints.point (p : Set) requires constructible : p ∈ constructiblePoints shows Point(p) proof have data := constructiblePoints.mem_iff.forward with constructible exact point.of_product with data.left theorem constructiblePoints.origin shows ((0:R), (0:R)) ∈ constructiblePoints proof apply constructiblePoints.mem_iff.backward have pairIn : ((0:R), (0:R)) ∈ ℝ × ℝ := product.pair with realZero.real, realZero.real refine ⟨pairIn, ?_⟩ intros P closed obtain ⟨_, originIn, _⟩ := closed exact originIn theorem constructiblePoints.unit shows ((1:R), (0:R)) ∈ constructiblePoints proof apply constructiblePoints.mem_iff.backward have pairIn : ((1:R), (0:R)) ∈ ℝ × ℝ := product.pair with realOne.real, realZero.real refine ⟨pairIn, ?_⟩ intros P closed obtain ⟨_, _, unitIn, _⟩ := closed exact unitIn -- The points with constructible coordinates def coordinatePoints : Set := { p ∈ ℝ × ℝ | x(p) ∈ constructibles ∧ y(p) ∈ constructibles } theorem coordinatePoints.mem_iff (p : Set) shows p ∈ coordinatePoints ↔ p ∈ ℝ × ℝ ∧ (x(p) ∈ constructibles ∧ y(p) ∈ constructibles) proof simp theorem coordinatePoints.unpack (p : Set) requires pIn : p ∈ coordinatePoints shows Point(p) ∧ (x(p) ∈ constructibles ∧ y(p) ∈ constructibles) proof have data := coordinatePoints.mem_iff.forward with pIn have point := point.of_product with data.left exact ⟨point, data.right⟩ theorem coordinatePoints.intro (p : Point) requires coordinates : x(p) ∈ constructibles ∧ y(p) ∈ constructibles shows p ∈ coordinatePoints proof have pIn := point.product_mem at p with * apply coordinatePoints.mem_iff.backward exact ⟨pIn, coordinates⟩ -- They form a construction-closed set, by the three intersection lemmas -- at S = constructibles. theorem coordinatePoints.closed shows ConstructionClosed(coordinatePoints) proof have closed := constructibles.closed have field := constructibles.subfield have bounded : coordinatePoints ⊆ ℝ × ℝ intros p hp have data := coordinatePoints.mem_iff.forward with hp exact data.left have zeroIn := RealSubfield.zero_mem with field have oneIn := RealSubfield.one_mem with field have originIn : ((0:R), (0:R)) ∈ coordinatePoints have pairX := x.pair at (0:R), (0:R) with * have pairY := y.pair at (0:R), (0:R) with * apply coordinatePoints.intro rw [pairX, pairY] exact ⟨zeroIn, zeroIn⟩ have unitIn : ((1:R), (0:R)) ∈ coordinatePoints have pairX := x.pair at (1:R), (0:R) with * have pairY := y.pair at (1:R), (0:R) with * apply coordinatePoints.intro rw [pairX, pairY] exact ⟨oneIn, zeroIn⟩ have lines : ∀ a b c d ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ, ∀ t u ∈ ℝ, directionCross(a, b, c, d) ≠ (0:R) → OnLine(p, a, b, t) → OnLine(p, c, d, u) → p ∈ coordinatePoints intros a ha b hb c hc d hd p hp t ht u hu notParallel onFirst onSecond obtain ⟨aPoint, aIn⟩ := coordinatePoints.unpack with ha obtain ⟨bPoint, bIn⟩ := coordinatePoints.unpack with hb obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc obtain ⟨dPoint, dIn⟩ := coordinatePoints.unpack with hd have coordinates := lineLine.coordinates_closed with closed, aIn, bIn, cIn, dIn, notParallel, onFirst, onSecond exact coordinatePoints.intro with coordinates have lineCircles : ∀ a b c w ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ, ∀ t ∈ ℝ, a ≠ b → OnLine(p, a, b, t) → OnCircle(p, c, w) → p ∈ coordinatePoints intros a ha b hb c hc w hw p hp t ht distinct onLine onCircle obtain ⟨aPoint, aIn⟩ := coordinatePoints.unpack with ha obtain ⟨bPoint, bIn⟩ := coordinatePoints.unpack with hb obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc obtain ⟨wPoint, wIn⟩ := coordinatePoints.unpack with hw have coordinates := lineCircle.coordinates_closed with closed, aIn, bIn, cIn, wIn, distinct, onLine, onCircle exact coordinatePoints.intro with coordinates have circles : ∀ c w e v ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ, c ≠ e → OnCircle(p, c, w) → OnCircle(p, e, v) → p ∈ coordinatePoints intros c hc w hw e he v hv p hp centers onFirst onSecond obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc obtain ⟨wPoint, wIn⟩ := coordinatePoints.unpack with hw obtain ⟨ePoint, eIn⟩ := coordinatePoints.unpack with he obtain ⟨vPoint, vIn⟩ := coordinatePoints.unpack with hv have coordinates := circleCircle.coordinates_closed with closed, cIn, wIn, eIn, vIn, centers, onFirst, onSecond exact coordinatePoints.intro with coordinates unfold ConstructionClosed exact ⟨bounded, originIn, unitIn, lines, lineCircles, circles⟩ -- The main theorems theorem constructiblePoints.coordinates (p : Point) requires constructible : p ∈ constructiblePoints shows Constructible(x(p)) ∧ Constructible(y(p)) proof have closed := coordinatePoints.closed have included := constructiblePoints.least with closed have pIn := included with p, constructible obtain ⟨_, xIn, yIn⟩ := coordinatePoints.unpack with pIn exact ⟨xIn, yIn⟩ theorem doublingTheCube.no_point (p : Point) requires constructible : p ∈ constructiblePoints shows x(p) * x(p) * x(p) ≠ (2:R) proof intro cube have coordinates := constructiblePoints.coordinates with constructible have notConstructible := cubeRootTwo.not_constructible with cube exact notConstructible with coordinates.left -- On the unit circle x² + y² = 1, the real part x³ − 3xy² of the cube of -- the point is 4x³ − 3x, the cosine of three times its angle; the angle -- of sixty degrees has cosine 1/2. theorem trisection.no_point shows ¬(∃ p ∈ constructiblePoints, x(p) * x(p) + y(p) * y(p) = (1:R) ∧ x(p) * x(p) * x(p) - (3:R) * x(p) * (y(p) * y(p)) = (1:R) / (2:R)) proof intro trisected obtain ⟨p, pIn, circle, cube⟩ := trisected have coordinates := constructiblePoints.coordinates with pIn -- The real part of the cube on the unit circle: y² = 1 − x². have tripled : (4:R) * (x(p) * x(p) * x(p)) - (3:R) * x(p) = (1:R) / (2:R) linear_combination cube + (3:R) * x(p) * circle apply trisection.impossible exact ⟨x(p), coordinates.left, tripled⟩