Grace/Cumulus/Geometry/Construction/Points.g17

Open in Workbench Download source

Imports

Grace.Cumulus.Geometry.Construction.Intersections · Grace.Cumulus.Geometry.Construction.Impossibility

Declarations

Source

1-- Constructible points of the plane: the least set containing (0, 0) and2-- (1, 0) and closed under the three intersections. Their coordinates are3-- constructible numbers, so no constructible point has abscissa ∛2 and no4-- constructible point of the unit circle trisects the angle of sixty5-- degrees.6-- Part of Cumulus, the Grace17 mathematics library.7-- Copyright (c) 2026 Grant Passmore.8-- Released under the Apache License 2.0. See LICENSE in the repository root.9-- Authors: Grant Passmore1011module Grace.Cumulus.Geometry.Construction.Points12import Grace.Cumulus.Geometry.Construction.Intersections13import Grace.Cumulus.Geometry.Construction.Impossibility1415-- The definitions1617-- A set of points closed under ruler and compass: it holds the two base18-- points and every intersection of two nonparallel lines, of a line and a19-- circle, and of two circles with distinct centers, each determined by20-- points of the set.21predicate ConstructionClosed (P : Set) :=22  P ⊆ ℝ × ℝ ∧ ((0:R), (0:R)) ∈ P ∧ ((1:R), (0:R)) ∈ P ∧23  (∀ a b c d ∈ P, ∀ p ∈ ℝ × ℝ, ∀ t u ∈ ℝ,24    directionCross(a, b, c, d) ≠ (0:R) → OnLine(p, a, b, t) →25    OnLine(p, c, d, u) → p ∈ P) ∧26  (∀ a b c w ∈ P, ∀ p ∈ ℝ × ℝ, ∀ t ∈ ℝ,27    a ≠ b → OnLine(p, a, b, t) → OnCircle(p, c, w) → p ∈ P) ∧28  (∀ c w e v ∈ P, ∀ p ∈ ℝ × ℝ,29    c ≠ e → OnCircle(p, c, w) → OnCircle(p, e, v) → p ∈ P)3031def constructiblePoints : Set :=32  { p ∈ ℝ × ℝ | ∀ P, ConstructionClosed(P) → p ∈ P }3334-- Membership3536theorem constructiblePoints.mem_iff (p : Set)37  shows p ∈ constructiblePoints ↔38    p ∈ ℝ × ℝ ∧ (∀ P, ConstructionClosed(P) → p ∈ P)39proof40  simp4142theorem constructiblePoints.least (P : Set)43  requires closed : ConstructionClosed(P)44  shows constructiblePoints ⊆ P45proof46  intros p hp47  have data := constructiblePoints.mem_iff.forward with hp48  exact data.right with P, closed4950theorem constructiblePoints.point (p : Set)51  requires constructible : p ∈ constructiblePoints52  shows Point(p)53proof54  have data := constructiblePoints.mem_iff.forward with constructible55  exact point.of_product with data.left5657theorem constructiblePoints.origin58  shows ((0:R), (0:R)) ∈ constructiblePoints59proof60  apply constructiblePoints.mem_iff.backward61  have pairIn : ((0:R), (0:R)) ∈ ℝ × ℝ :=62    product.pair with realZero.real, realZero.real63  refine ⟨pairIn, ?_⟩64  intros P closed65  obtain ⟨_, originIn, _⟩ := closed66  exact originIn6768theorem constructiblePoints.unit69  shows ((1:R), (0:R)) ∈ constructiblePoints70proof71  apply constructiblePoints.mem_iff.backward72  have pairIn : ((1:R), (0:R)) ∈ ℝ × ℝ :=73    product.pair with realOne.real, realZero.real74  refine ⟨pairIn, ?_⟩75  intros P closed76  obtain ⟨_, _, unitIn, _⟩ := closed77  exact unitIn7879-- The points with constructible coordinates8081def coordinatePoints : Set :=82  { p ∈ ℝ × ℝ | x(p) ∈ constructibles ∧ y(p) ∈ constructibles }8384theorem coordinatePoints.mem_iff (p : Set)85  shows p ∈ coordinatePoints ↔86    p ∈ ℝ × ℝ ∧ (x(p) ∈ constructibles ∧ y(p) ∈ constructibles)87proof88  simp8990theorem coordinatePoints.unpack (p : Set)91  requires pIn : p ∈ coordinatePoints92  shows Point(p) ∧ (x(p) ∈ constructibles ∧ y(p) ∈ constructibles)93proof94  have data := coordinatePoints.mem_iff.forward with pIn95  have point := point.of_product with data.left96  exact ⟨point, data.right⟩9798theorem coordinatePoints.intro (p : Point)99  requires coordinates : x(p) ∈ constructibles ∧ y(p) ∈ constructibles100  shows p ∈ coordinatePoints101proof102  have pIn := point.product_mem at p with *103  apply coordinatePoints.mem_iff.backward104  exact ⟨pIn, coordinates⟩105106-- They form a construction-closed set, by the three intersection lemmas107-- at S = constructibles.108theorem coordinatePoints.closed109  shows ConstructionClosed(coordinatePoints)110proof111  have closed := constructibles.closed112  have field := constructibles.subfield113  have bounded : coordinatePoints ⊆ ℝ × ℝ114    intros p hp115    have data := coordinatePoints.mem_iff.forward with hp116    exact data.left117  have zeroIn := RealSubfield.zero_mem with field118  have oneIn := RealSubfield.one_mem with field119  have originIn : ((0:R), (0:R)) ∈ coordinatePoints120    have pairX := x.pair at (0:R), (0:R) with *121    have pairY := y.pair at (0:R), (0:R) with *122    apply coordinatePoints.intro123    rw [pairX, pairY]124    exact ⟨zeroIn, zeroIn⟩125  have unitIn : ((1:R), (0:R)) ∈ coordinatePoints126    have pairX := x.pair at (1:R), (0:R) with *127    have pairY := y.pair at (1:R), (0:R) with *128    apply coordinatePoints.intro129    rw [pairX, pairY]130    exact ⟨oneIn, zeroIn⟩131  have lines : ∀ a b c d ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ,132      ∀ t u ∈ ℝ, directionCross(a, b, c, d) ≠ (0:R) →133      OnLine(p, a, b, t) → OnLine(p, c, d, u) → p ∈ coordinatePoints134    intros a ha b hb c hc d hd p hp t ht u hu notParallel onFirst onSecond135    obtain ⟨aPoint, aIn⟩ := coordinatePoints.unpack with ha136    obtain ⟨bPoint, bIn⟩ := coordinatePoints.unpack with hb137    obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc138    obtain ⟨dPoint, dIn⟩ := coordinatePoints.unpack with hd139    have coordinates := lineLine.coordinates_closed140      with closed, aIn, bIn, cIn, dIn, notParallel, onFirst, onSecond141    exact coordinatePoints.intro with coordinates142  have lineCircles : ∀ a b c w ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ,143      ∀ t ∈ ℝ, a ≠ b → OnLine(p, a, b, t) → OnCircle(p, c, w) →144      p ∈ coordinatePoints145    intros a ha b hb c hc w hw p hp t ht distinct onLine onCircle146    obtain ⟨aPoint, aIn⟩ := coordinatePoints.unpack with ha147    obtain ⟨bPoint, bIn⟩ := coordinatePoints.unpack with hb148    obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc149    obtain ⟨wPoint, wIn⟩ := coordinatePoints.unpack with hw150    have coordinates := lineCircle.coordinates_closed151      with closed, aIn, bIn, cIn, wIn, distinct, onLine, onCircle152    exact coordinatePoints.intro with coordinates153  have circles : ∀ c w e v ∈ coordinatePoints, ∀ p ∈ ℝ × ℝ,154      c ≠ e → OnCircle(p, c, w) → OnCircle(p, e, v) →155      p ∈ coordinatePoints156    intros c hc w hw e he v hv p hp centers onFirst onSecond157    obtain ⟨cPoint, cIn⟩ := coordinatePoints.unpack with hc158    obtain ⟨wPoint, wIn⟩ := coordinatePoints.unpack with hw159    obtain ⟨ePoint, eIn⟩ := coordinatePoints.unpack with he160    obtain ⟨vPoint, vIn⟩ := coordinatePoints.unpack with hv161    have coordinates := circleCircle.coordinates_closed162      with closed, cIn, wIn, eIn, vIn, centers, onFirst, onSecond163    exact coordinatePoints.intro with coordinates164  unfold ConstructionClosed165  exact ⟨bounded, originIn, unitIn, lines, lineCircles, circles⟩166167-- The main theorems168169theorem constructiblePoints.coordinates (p : Point)170  requires constructible : p ∈ constructiblePoints171  shows Constructible(x(p)) ∧ Constructible(y(p))172proof173  have closed := coordinatePoints.closed174  have included := constructiblePoints.least with closed175  have pIn := included with p, constructible176  obtain ⟨_, xIn, yIn⟩ := coordinatePoints.unpack with pIn177  exact ⟨xIn, yIn⟩178179theorem doublingTheCube.no_point (p : Point)180  requires constructible : p ∈ constructiblePoints181  shows x(p) * x(p) * x(p) ≠ (2:R)182proof183  intro cube184  have coordinates := constructiblePoints.coordinates with constructible185  have notConstructible := cubeRootTwo.not_constructible with cube186  exact notConstructible with coordinates.left187188-- On the unit circle x² + y² = 1, the real part x³ − 3xy² of the cube of189-- the point is 4x³ − 3x, the cosine of three times its angle; the angle190-- of sixty degrees has cosine 1/2.191theorem trisection.no_point192  shows ¬(∃ p ∈ constructiblePoints,193    x(p) * x(p) + y(p) * y(p) = (1:R) ∧194    x(p) * x(p) * x(p) - (3:R) * x(p) * (y(p) * y(p)) = (1:R) / (2:R))195proof196  intro trisected197  obtain ⟨p, pIn, circle, cube⟩ := trisected198  have coordinates := constructiblePoints.coordinates with pIn199  -- The real part of the cube on the unit circle: y² = 1 − x².200  have tripled : (4:R) * (x(p) * x(p) * x(p)) - (3:R) * x(p) = (1:R) / (2:R)201    linear_combination cube + (3:R) * x(p) * circle202  apply trisection.impossible203  exact ⟨x(p), coordinates.left, tripled⟩204