Grace/Cumulus/Geometry/Construction/Tower.g17
Imports
Grace.Cumulus.Algebra.Field.QuadraticTower · Grace.Cumulus.Geometry.Construction.Numbers
Declarations
- towerReals def
- towerReals.mem_iff theorem derivation
- towerReals.subset_reals theorem derivation
- towerReals.of_tower theorem derivation
- towerReals.common_tower theorem derivation
- towerReals.closed theorem derivation
- Constructible.in_tower theorem derivation
- towerField.constructible theorem derivation
- constructibles.eq_tower theorem derivation
Source
1-- Every constructible number lies in the field of a quadratic tower: the2-- union of the tower fields is constructibly closed, so it contains the3-- least closed set, and it is contained in it.4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.Geometry.Construction.Tower10import Grace.Cumulus.Algebra.Field.QuadraticTower11import Grace.Cumulus.Geometry.Construction.Numbers1213-- The tower numbers1415-- The reals reached by some quadratic tower.16def towerReals : Set :=17 { x ∈ ℝ | ∃ ds, List(ℝ, ds) ∧ QuadraticTower(ds) ∧ x ∈ towerField(ds) }1819theorem towerReals.mem_iff (x : Set)20 shows x ∈ towerReals ↔21 x ∈ ℝ ∧ (∃ ds, List(ℝ, ds) ∧ QuadraticTower(ds) ∧ x ∈ towerField(ds))22proof23 simp2425theorem towerReals.subset_reals26 shows towerReals ⊆ ℝ27proof28 simp2930theorem towerReals.of_tower (ds : List(ℝ)) (x : Set)31 requires tower : QuadraticTower(ds)32 requires xIn : x ∈ towerField(ds)33 shows x ∈ towerReals34proof35 have bounded := towerField.subset_reals at ds36 have xReal := bounded with x, xIn37 have dsList : List(ℝ, ds) by typecheck38 apply towerReals.mem_iff.backward39 exact ⟨xReal, ds, dsList, tower, xIn⟩4041-- Two tower numbers share a tower: the stack of their two towers.42theorem towerReals.common_tower (x y : Set)43 requires xIn : x ∈ towerReals44 requires yIn : y ∈ towerReals45 shows ∃ ds, List(ℝ, ds) ∧ QuadraticTower(ds) ∧46 x ∈ towerField(ds) ∧ y ∈ towerField(ds)47proof48 have first := towerReals.mem_iff.forward with xIn49 have second := towerReals.mem_iff.forward with yIn50 obtain ⟨ds, dsList, towerD, xInD⟩ := first.right51 obtain ⟨es, esList, towerE, yInE⟩ := second.right52 have joined : List(ℝ, append(ds, es)) by typecheck53 have tower := QuadraticTower.append with towerD, towerE54 have left := towerField.subset_append with towerD, towerE55 have right := towerField.subset_append_right at ds, es with towerD56 have xUp := left with x, xInD57 have yUp := right with y, yInE58 exact ⟨append(ds, es), joined, tower, xUp, yUp⟩5960-- The tower numbers are constructibly closed6162-- 0 and 1 by the empty tower; a sum or product by the common tower of its63-- terms; a negation or inverse by the same tower; √x by x :: ds.64theorem towerReals.closed65 shows ConstructiblyClosed(towerReals)66proof67 have bounded := towerReals.subset_reals68 have nilTower := QuadraticTower.nil69 have zeroMember : (0:R) ∈ towerReals70 have zeroIn : (0:R) ∈ towerField([])71 rw towerField.nil72 exact rationalReals.zero_mem73 exact towerReals.of_tower with nilTower, zeroIn74 have oneMember : (1:R) ∈ towerReals75 have oneIn : (1:R) ∈ towerField([])76 rw towerField.nil77 exact rationalReals.one_mem78 exact towerReals.of_tower with nilTower, oneIn79 have negatives : ∀ x ∈ towerReals, -(x:R) ∈ towerReals80 intros x hx81 have data := towerReals.mem_iff.forward with hx82 obtain ⟨ds, dsList, tower, xIn⟩ := data.right83 have field := towerField.subfield with tower84 have negIn := RealSubfield.neg_mem with field, xIn85 exact towerReals.of_tower with tower, negIn86 have sums : ∀ x y ∈ towerReals, (x:R) + (y:R) ∈ towerReals87 intros x hx y hy88 have xReal : Real(x) := bounded with x, hx89 have yReal : Real(y) := bounded with y, hy90 obtain ⟨ds, dsList, tower, xIn, yIn⟩ := towerReals.common_tower with hx, hy91 have field := towerField.subfield with tower92 have sumIn := RealSubfield.add_mem with field, xIn, yIn93 exact towerReals.of_tower with tower, sumIn94 have products : ∀ x y ∈ towerReals, (x:R) * (y:R) ∈ towerReals95 intros x hx y hy96 have xReal : Real(x) := bounded with x, hx97 have yReal : Real(y) := bounded with y, hy98 obtain ⟨ds, dsList, tower, xIn, yIn⟩ := towerReals.common_tower with hx, hy99 have field := towerField.subfield with tower100 have productIn := RealSubfield.mul_mem with field, xIn, yIn101 exact towerReals.of_tower with tower, productIn102 have inverses : ∀ x ∈ towerReals,103 x ≠ (0:R) → realInvValue(x) ∈ towerReals104 intros x hx nonzero105 have data := towerReals.mem_iff.forward with hx106 obtain ⟨ds, dsList, tower, xIn⟩ := data.right107 have field := towerField.subfield with tower108 have inverseIn := RealSubfield.inv_mem with field, xIn, nonzero109 exact towerReals.of_tower with tower, inverseIn110 have roots : ∀ x ∈ towerReals,111 (0:R) ≤ (x:R) → realSqrt(x) ∈ towerReals112 intros x hx nonneg113 have data := towerReals.mem_iff.forward with hx114 obtain ⟨ds, dsList, tower, xIn⟩ := data.right115 have field := towerField.subfield with tower116 have taller := QuadraticTower.cons with tower, xIn, nonneg117 have rootIn : realSqrt(x) ∈ towerField(x :: ds)118 rw towerField.cons119 have member := adjoinSqrt.sqrt_mem with field, nonneg120 unfold sqrt at member121 exact member122 exact towerReals.of_tower with taller, rootIn123 have field := RealSubfield.mk with124 bounded, zeroMember, oneMember, negatives, sums, products, inverses125 unfold ConstructiblyClosed126 exact ⟨field, roots⟩127128-- The constructibles are the tower numbers129130theorem Constructible.in_tower (x : Real)131 requires constructible : Constructible(x)132 shows ∃ ds, List(ℝ, ds) ∧ QuadraticTower(ds) ∧ x ∈ towerField(ds)133proof134 have closed := towerReals.closed135 have least := constructibles.least with closed136 have member := least with x, constructible137 have data := towerReals.mem_iff.forward with member138 exact data.right139140-- Induction on ds: the rationals are constructible, and the constructibles141-- contain a + b√d once they contain a, b, and d ≥ 0.142theorem towerField.constructible (ds : List(ℝ))143 requires tower : QuadraticTower(ds)144 shows towerField(ds) ⊆ constructibles145proof146 induction ds147 | List.nil =>148 intro tower149 rw towerField.nil150 have field := constructibles.subfield151 exact RealSubfield.rationals_subset with field152 | List.cons(d, tail) using ih =>153 intro tower154 have below := QuadraticTower.tail with tower155 obtain ⟨dIn, dNonneg⟩ := QuadraticTower.head with tower156 have inner := ih with below157 have closedField := constructibles.subfield158 have closed := constructibles.closed159 have dC := inner with d, dIn160 have rootC := closed.right with d, dC, dNonneg161 rw towerField.cons162 intros z hz163 obtain ⟨a, aIn, b, bIn, same⟩ := adjoinSqrt.cases with dNonneg, hz164 have aC := inner with a, aIn165 have bC := inner with b, bIn166 have productC := RealSubfield.mul_mem with closedField, bC, rootC167 have sumC := RealSubfield.add_mem with closedField, aC, productC168 rw same169 unfold sqrt170 exact sumC171172theorem constructibles.eq_tower173 shows constructibles = towerReals174proof175 have closed := towerReals.closed176 have least := constructibles.least with closed177 have back : towerReals ⊆ constructibles178 intros x hx179 have data := towerReals.mem_iff.forward with hx180 obtain ⟨ds, dsList, tower, xIn⟩ := data.right181 have included := towerField.constructible with tower182 exact included with x, xIn183 exact Subset.antisymmetric with least, back184