Grace/Cumulus/AlgebraicGeometry/Coordinates/Elimination.g17

Open in Workbench Download source

Imports

Grace.Cumulus.AlgebraicGeometry.Coordinates.Ambient · Grace.Cumulus.AlgebraicGeometry.Coordinates.Plane · Grace.Cumulus.AlgebraicGeometry.Coordinates.Lifting

Declarations

Source

1-- Elimination: the fibre algebra D = ℂ[h, u, v, w] ⧸ (F) is the lifted2-- algebra L = B[U, V, W] ⧸ (relX, relY, relS) over the plane presentation3-- B = ℂ[h, x, y, s] ⧸ (relH, relCusp), as ℂ-algebras: h, x, y, s go to the4-- classes of h, u³ + hv, −u² + hw, S(h, u, v, w), and U, V, W to u, v, w.5-- Part of Cumulus, the Grace17 mathematics library.6-- Copyright (c) 2026 Grant Passmore.7-- Released under the Apache License 2.0. See LICENSE in the repository root.8-- Authors: Grant Passmore910module Grace.Cumulus.AlgebraicGeometry.Coordinates.Elimination11import Grace.Cumulus.AlgebraicGeometry.Coordinates.Ambient12import Grace.Cumulus.AlgebraicGeometry.Coordinates.Plane13import Grace.Cumulus.AlgebraicGeometry.Coordinates.Lifting1415-- The fibre algebra D = ℂ[4] ⧸ (F) and its projection.16def fibreIdeal : Set :=17  generatedIdeal(polynomialRing(complexRing, 4), {ambientF})1819def fibreAlgebra : Set := quotientAlgebra(ambientAlgebra, fibreIdeal)2021def fibreProjection : Set := algebraProjection(ambientAlgebra, fibreIdeal)2223-- The plane presentation over ℂ as the base B, with its classes h, x, y, s.24def baseAlgebra : Set := planeAlgebra(complexRing)2526def baseRing : Set := Algebra.ring(baseAlgebra)2728def baseH : Set := planeVariable(complexRing, 0)2930def baseX : Set := planeVariable(complexRing, 1)3132def baseY : Set := planeVariable(complexRing, 2)3334def baseS : Set := planeVariable(complexRing, 3)3536-- The lifted algebra L over B, as an algebra over ℂ.37def liftedAlgebra : Set :=38  restrictScalars(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS),39    complexRing, Algebra.map(baseAlgebra))4041def liftedConstant : Set :=42  Algebra.map(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS))4344def liftedVariable (i : Set) : Set :=45  liftingVariable(baseRing, baseH, baseX, baseY, baseS, i)4647-- B → D: h, x, y, s to the classes of h, x, y, s in D.48def auxValues : Set :=49  quadrupleMap(algebraCarrier(fibreAlgebra),50    fibreProjection(X(complexRing, 4, 0)), fibreProjection(ambientX),51    fibreProjection(ambientY), fibreProjection(ambientS))5253def auxEval : Set :=54  evaluationHom(complexRing, Algebra.ring(fibreAlgebra), 4,55    Algebra.map(fibreAlgebra), auxValues)5657def auxToD : Set :=58  algebraLift(auxEval, ambientAlgebra, fibreAlgebra, planeIdeal(complexRing))5960-- B[U, V, W] → D: constants by auxToD, and U, V, W to the classes of u, v, w.61def liftValues : Set :=62  tripleMap(algebraCarrier(fibreAlgebra), fibreProjection(X(complexRing, 4, 1)),63    fibreProjection(X(complexRing, 4, 2)),64    fibreProjection(X(complexRing, 4, 3)))6566def liftEval : Set :=67  evaluationHom(baseRing, Algebra.ring(fibreAlgebra), 3, auxToD, liftValues)6869def toOriginal : Set :=70  quotientMap(liftEval, Ring.carrier(polynomialRing(baseRing, 3)),71    algebraCarrier(fibreAlgebra),72    quotientRelation(polynomialRing(baseRing, 3),73      liftingIdeal(baseRing, baseH, baseX, baseY, baseS)))7475-- ℂ[h, u, v, w] → L: h to the constant h, and u, v, w to U, V, W.76def originalValues : Set :=77  quadrupleMap(algebraCarrier(liftedAlgebra), liftedConstant(baseH),78    liftedVariable(0), liftedVariable(1), liftedVariable(2))7980def originalEval : Set :=81  evaluationHom(complexRing, Algebra.ring(liftedAlgebra), 4,82    Algebra.map(liftedAlgebra), originalValues)8384def fromOriginal : Set :=85  algebraLift(originalEval, ambientAlgebra, liftedAlgebra, fibreIdeal)8687-- The ambient algebra ℂ[h, u, v, w] and the fibre algebra D: their rings88-- and structure maps, and the projection onto D, which kills F.8990theorem ambientAlgebra.algebra91  shows Algebra(ambientAlgebra)92proof93  unfold ambientAlgebra94  exact polynomialAlgebra.algebra at complexRing, 4 with *9596theorem ambientAlgebra.ring97  shows Algebra.ring(ambientAlgebra) = polynomialRing(complexRing, 4)98proof99  unfold ambientAlgebra100  exact polynomialAlgebra.ring101102theorem fibreIdeal.ideal103  shows Ideal(Algebra.ring(ambientAlgebra), fibreIdeal)104proof105  rw ambientAlgebra.ring106  unfold fibreIdeal107  exact generatedIdeal.ideal at polynomialRing(complexRing, 4), {ambientF}108    with *109110theorem fibreAlgebra.algebra111  shows Algebra(fibreAlgebra)112proof113  have ambient := ambientAlgebra.algebra114  have ideal := fibreIdeal.ideal115  unfold fibreAlgebra116  exact quotientAlgebra.algebra with ambient, ideal117118theorem fibreAlgebra.base119  shows Algebra.base(fibreAlgebra) = complexRing120proof121  unfold fibreAlgebra122  rw quotientAlgebra.baseOf123  unfold ambientAlgebra124  exact polynomialAlgebra.base125126theorem fibreAlgebra.ring127  shows Algebra.ring(fibreAlgebra) =128    quotientRing(polynomialRing(complexRing, 4), fibreIdeal)129proof130  unfold fibreAlgebra131  rw quotientAlgebra.ringOf132  unfold ambientAlgebra133  rw polynomialAlgebra.ring134135instance fibreRing.comm_ring136  shows CommRing(Algebra.ring(fibreAlgebra))137proof138  have fibre := fibreAlgebra.algebra139  exact Algebra.comm_ring with fibre140141theorem fibreAlgebra.structure_map142  shows Algebra.map(fibreAlgebra) : complexRing →+* Algebra.ring(fibreAlgebra)143proof144  have fibre := fibreAlgebra.algebra145  have map := fibre.right.right.right146  rw fibreAlgebra.base at map147  exact map148149theorem fibreProjection.ring_hom150  shows fibreProjection :151    polynomialRing(complexRing, 4) →+* Algebra.ring(fibreAlgebra)152proof153  have ambient := ambientAlgebra.algebra154  have ideal := fibreIdeal.ideal155  have projection := algebraProjection.ring_hom with ambient, ideal156  rw fibreAlgebra.ring157  unfold fibreProjection158  rw ambientAlgebra.ring at projection159  exact projection160161theorem fibreProjection.algebra_hom162  shows fibreProjection : ambientAlgebra →ₐ fibreAlgebra163proof164  have ambient := ambientAlgebra.algebra165  have ideal := fibreIdeal.ideal166  unfold fibreProjection167  unfold fibreAlgebra168  exact algebraProjection.hom with ambient, ideal169170instance fibreProjection.mem (p : Set)171  requires member : p ∈ Ring.carrier(polynomialRing(complexRing, 4))172  shows fibreProjection(p) ∈ Ring.carrier(Algebra.ring(fibreAlgebra))173proof174  have projection := fibreProjection.ring_hom175  exact RingHom.map_mem with projection, member176177theorem fibreGenerators.subset178  shows {ambientF} ⊆ algebraCarrier(ambientAlgebra)179proof180  unfold algebraCarrier181  rw ambientAlgebra.ring182  intros g hg183  rw singleton.membership at hg184  rw hg185  exact ambientF.mem with *186187theorem fibreProjection.F188  shows fibreProjection(ambientF) = Ring.zero(Algebra.ring(fibreAlgebra))189proof190  have ambient := ambientAlgebra.algebra191  have generators := fibreGenerators.subset192  have member : ambientF ∈ {ambientF} := singleton.self193  have killed := algebraProjection.kills_generator194    with ambient, generators, member195  rw fibreAlgebra.ring196  unfold fibreProjection197  unfold fibreIdeal198  rw ambientAlgebra.ring at killed199  unfold ambientAlgebra at killed200  unfold ambientAlgebra201  exact killed202203-- Every element of D is the class of a polynomial.204theorem fibreAlgebra.representative (d : Set)205  requires member : d ∈ algebraCarrier(fibreAlgebra)206  shows ∃ x ∈ Ring.carrier(polynomialRing(complexRing, 4)),207    d = fibreProjection(x)208proof209  have ambient := ambientAlgebra.algebra210  have ideal := fibreIdeal.ideal211  have ambientRing := Algebra.comm_ring with ambient212  unfold fibreAlgebra at member213  rw quotientAlgebra.carrierOf at member214  obtain ⟨x, hx, shape⟩ :=215    quotientRing.representative with ambientRing, ideal, member216  have inAmbient : x ∈ algebraCarrier(ambientAlgebra)217    unfold algebraCarrier218    exact hx219  have projected := algebraProjection.value with ambient, ideal, inAmbient220  rw ambientAlgebra.ring at hx221  refine ⟨x, hx, ?_⟩222  unfold fibreProjection223  rw projected224  unfold algebraCarrier225  exact shape226227-- The base B = ℂ[h, x, y, s] ⧸ (relH, relCusp): its ring and structure map,228-- the classes h, x, y, s, and the three relations among them that the229-- lifting needs.230231theorem baseAlgebra.algebra232  shows Algebra(baseAlgebra)233proof234  unfold baseAlgebra235  exact planeAlgebra.algebra at complexRing with *236237theorem baseAlgebra.base238  shows Algebra.base(baseAlgebra) = complexRing239proof240  unfold baseAlgebra241  unfold planeAlgebra242  rw quotientAlgebra.baseOf243  exact polynomialAlgebra.base244245instance baseRing.comm_ring246  shows CommRing(baseRing)247proof248  have base := baseAlgebra.algebra249  unfold baseRing250  exact Algebra.comm_ring with base251252theorem baseAlgebra.structure_map253  shows Algebra.map(baseAlgebra) : complexRing →+* baseRing254proof255  have base := baseAlgebra.algebra256  have map := base.right.right.right257  rw baseAlgebra.base at map258  unfold baseRing259  exact map260261instance baseH.mem262  shows baseH ∈ Ring.carrier(baseRing)263proof264  unfold baseH265  unfold baseRing266  unfold baseAlgebra267  exact planeH.class_mem at complexRing with *268269instance baseX.mem270  shows baseX ∈ Ring.carrier(baseRing)271proof272  unfold baseX273  unfold baseRing274  unfold baseAlgebra275  exact planeX.class_mem at complexRing with *276277instance baseY.mem278  shows baseY ∈ Ring.carrier(baseRing)279proof280  unfold baseY281  unfold baseRing282  unfold baseAlgebra283  exact planeY.class_mem at complexRing with *284285instance baseS.mem286  shows baseS ∈ Ring.carrier(baseRing)287proof288  unfold baseS289  unfold baseRing290  unfold baseAlgebra291  exact planeS.class_mem at complexRing with *292293-- The relation h = 1 + P(x, y, s) in B.294theorem baseAlgebra.relation_h295  shows baseH = Ring.one(baseRing) + shiftP(baseRing, baseX, baseY, baseS)296proof297  have complexes := complexRing.comm_ring298  have quotient := planeAlgebra.comm_ring at complexRing with complexes299  have plane := polynomialRing.comm_ring at complexRing, 2 with complexes300  unfold baseH301  unfold baseX302  unfold baseY303  unfold baseS304  unfold baseRing305  unfold baseAlgebra306  exact planeAlgebra.relation_h at complexRing with complexes, quotient, plane307308-- The cusp relation x² + y³ = hs in B.309theorem baseAlgebra.relation_cusp310  shows baseX^2 + baseY^3 = baseH * baseS311proof312  have complexes := complexRing.comm_ring313  have quotient := planeAlgebra.comm_ring at complexRing with complexes314  have plane := polynomialRing.comm_ring at complexRing, 2 with complexes315  unfold baseH316  unfold baseX317  unfold baseY318  unfold baseS319  unfold baseRing320  unfold baseAlgebra321  exact planeAlgebra.relation_cusp at complexRing322    with complexes, quotient, plane323324-- The Bézout relation αh + βy = 1 in B.325theorem baseAlgebra.bezout326  shows bezoutAlpha(baseRing, baseX, baseS) * baseH +327    bezoutBeta(baseRing, baseX, baseY, baseS) * baseY = baseRing[1]328proof329  have complexes := complexRing.comm_ring330  have quotient := planeAlgebra.comm_ring at complexRing with complexes331  have plane := polynomialRing.comm_ring at complexRing, 2 with complexes332  unfold baseH333  unfold baseX334  unfold baseY335  unfold baseS336  unfold baseRing337  unfold baseAlgebra338  exact planeAlgebra.bezout at complexRing with complexes, quotient, plane339340-- The lifted algebra L = B[U, V, W] ⧸ (relX, relY, relS): over B, and over341-- ℂ by restriction of scalars; its ring, constants, variables, and the342-- relations among them.343344theorem liftingAlgebra.over_base345  shows Algebra(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS))346proof347  exact liftingAlgebra.algebra at baseRing, baseH, baseX, baseY, baseS with *348349theorem liftingAlgebra.base_of350  shows Algebra.base(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS)) =351    baseRing352proof353  unfold liftingAlgebra354  rw quotientAlgebra.baseOf355  exact polynomialAlgebra.base356357theorem liftedAlgebra.algebra358  shows Algebra(liftedAlgebra)359proof360  have complexes := complexRing.comm_ring361  have lifting := liftingAlgebra.over_base362  have scalars := baseAlgebra.structure_map363  rw ← liftingAlgebra.base_of at scalars364  unfold liftedAlgebra365  exact restrictScalars.algebra with lifting, complexes, scalars366367theorem liftedAlgebra.base368  shows Algebra.base(liftedAlgebra) = complexRing369proof370  unfold liftedAlgebra371  exact restrictScalars.base372373theorem liftedAlgebra.ring374  shows Algebra.ring(liftedAlgebra) =375    Algebra.ring(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS))376proof377  unfold liftedAlgebra378  exact restrictScalars.ring379380instance liftedRing.comm_ring381  shows CommRing(Algebra.ring(liftedAlgebra))382proof383  rw liftedAlgebra.ring384  exact liftingAlgebra.comm_ring at baseRing, baseH, baseX, baseY, baseS385    with *386387theorem liftedConstant.ring_hom388  shows liftedConstant : baseRing →+* Algebra.ring(liftedAlgebra)389proof390  rw liftedAlgebra.ring391  unfold liftedConstant392  exact liftingAlgebra.structure_hom at baseRing, baseH, baseX, baseY, baseS393    with *394395instance liftedConstant.mem (a : Set)396  requires member : a ∈ Ring.carrier(baseRing)397  shows liftedConstant(a) ∈ Ring.carrier(Algebra.ring(liftedAlgebra))398proof399  have hom := liftedConstant.ring_hom400  exact RingHom.map_mem with hom, member401402instance liftedU.mem403  shows liftedVariable(0) ∈ Ring.carrier(Algebra.ring(liftedAlgebra))404proof405  rw liftedAlgebra.ring406  unfold liftedVariable407  exact liftingU.mem at baseRing, baseH, baseX, baseY, baseS with *408409instance liftedV.mem410  shows liftedVariable(1) ∈ Ring.carrier(Algebra.ring(liftedAlgebra))411proof412  rw liftedAlgebra.ring413  unfold liftedVariable414  exact liftingV.mem at baseRing, baseH, baseX, baseY, baseS with *415416instance liftedW.mem417  shows liftedVariable(2) ∈ Ring.carrier(Algebra.ring(liftedAlgebra))418proof419  rw liftedAlgebra.ring420  unfold liftedVariable421  exact liftingW.mem at baseRing, baseH, baseX, baseY, baseS with *422423-- The structure map of L over ℂ factors through the constants of B.424theorem liftedAlgebra.map_value (a : Set)425  requires member : a ∈ Ring.carrier(complexRing)426  shows Algebra.map(liftedAlgebra)(a) =427    liftedConstant(Algebra.map(baseAlgebra)(a))428proof429  have structureMap := baseAlgebra.structure_map430  have constantHom := liftedConstant.ring_hom431  have iota := structureMap.right.right.left432  have inner : Algebra.map(liftingAlgebra(baseRing, baseH, baseX, baseY,433      baseS)) : Ring.carrier(baseRing) →434        algebraCarrier(liftingAlgebra(baseRing, baseH, baseX, baseY, baseS))435    unfold algebraCarrier436    rw ← liftedAlgebra.ring437    unfold liftedConstant at constantHom438    exact constantHom.right.right.left439  unfold liftedAlgebra440  rw restrictScalars.map441  rw liftingAlgebra.base_of442  rw compose.apply with iota, inner, member443  unfold liftedConstant444  rfl445446-- The constants B → L as a ℂ-algebra homomorphism.447theorem liftedConstant.hom448  shows liftedConstant : baseAlgebra →ₐ liftedAlgebra449proof450  have base := baseAlgebra.algebra451  have lifted := liftedAlgebra.algebra452  have ringHom := liftedConstant.ring_hom453  unfold baseRing at ringHom454  unfold AlgebraHom455  refine ⟨base, lifted, ?_, ringHom, ?_⟩456  . rw [baseAlgebra.base, liftedAlgebra.base]457  . intros a aIn458    rw baseAlgebra.base at aIn459    symm460    exact liftedAlgebra.map_value with aIn461462-- The relations of L, with the plane relations of B supplied.463theorem liftedAlgebra.relations464  shows liftedVariable(0)^3 + liftedConstant(baseH) * liftedVariable(1) =465      liftedConstant(baseX) ∧466    -liftedVariable(0)^2 + liftedConstant(baseH) * liftedVariable(2) =467      liftedConstant(baseY) ∧468    cuspS(Algebra.ring(liftedAlgebra), liftedConstant(baseH),469      liftedVariable(0), liftedVariable(1), liftedVariable(2)) =470      liftedConstant(baseS)471proof472  have αIn : bezoutAlpha(baseRing, baseX, baseS) ∈ Ring.carrier(baseRing)473    by typecheck474  have βIn : bezoutBeta(baseRing, baseX, baseY, baseS) ∈ Ring.carrier(baseRing)475    by typecheck476  have cusp := baseAlgebra.relation_cusp477  have bezout := baseAlgebra.bezout478  have quotient := liftedRing.comm_ring479  rw liftedAlgebra.ring at quotient480  have relations := liftingAlgebra.relations481    at baseRing, baseH, baseX, baseY, baseS,482      bezoutAlpha(baseRing, baseX, baseS),483      bezoutBeta(baseRing, baseX, baseY, baseS)484    with *485  rw liftedAlgebra.ring486  unfold liftedVariable487  unfold liftedConstant488  exact relations489490-- The relation h = 1 + P(x, y, s) of B, read in L through the constants.491theorem liftedConstant.relation_h492  shows liftedConstant(baseH) = Ring.one(Algebra.ring(liftedAlgebra)) +493    shiftP(Algebra.ring(liftedAlgebra), liftedConstant(baseX),494      liftedConstant(baseY), liftedConstant(baseS))495proof496  have constantHom := liftedConstant.ring_hom497  have relation := baseAlgebra.relation_h498  have shiftIn : shiftP(baseRing, baseX, baseY, baseS) ∈ Ring.carrier(baseRing)499    by typecheck500  have add := RingHom.map_add at liftedConstant, baseRing,501    Algebra.ring(liftedAlgebra), Ring.one(baseRing),502    shiftP(baseRing, baseX, baseY, baseS) with *503  have one := RingHom.map_one at liftedConstant, baseRing,504    Algebra.ring(liftedAlgebra) with *505  have shift := RingHom.map_shiftP at baseRing, Algebra.ring(liftedAlgebra),506    liftedConstant, baseX, baseY, baseS with *507  rw [relation, add, one, shift]508509-- Every element of L is the class of a polynomial over B.510theorem liftedAlgebra.representative (l : Set)511  requires member : l ∈ algebraCarrier(liftedAlgebra)512  shows ∃ q ∈ Ring.carrier(polynomialRing(baseRing, 3)),513    l = algebraProjection(polynomialAlgebra(baseRing, 3),514      liftingIdeal(baseRing, baseH, baseX, baseY, baseS))(q)515proof516  have polynomial := polynomialAlgebra.algebra at baseRing, 3 with *517  have ideal := liftingIdeal.ideal at baseRing, baseH, baseX, baseY, baseS518    with *519  have polynomials := Algebra.comm_ring with polynomial520  unfold algebraCarrier at member521  rw liftedAlgebra.ring at member522  unfold liftingAlgebra at member523  rw quotientAlgebra.ringOf at member524  obtain ⟨q, hq, shape⟩ :=525    quotientRing.representative with polynomials, ideal, member526  have inPolynomial : q ∈ algebraCarrier(polynomialAlgebra(baseRing, 3))527    unfold algebraCarrier528    exact hq529  have projected := algebraProjection.value with polynomial, ideal, inPolynomial530  rw polynomialAlgebra.ring at hq531  refine ⟨q, hq, ?_⟩532  rw projected533  unfold algebraCarrier534  exact shape535536-- The ambient elements x, y, s, F under a ring homomorphism out of537-- ℂ[h, u, v, w]: their shapes in terms of the images of the variables.538section AmbientTransport539variable (S f : Set)540hypothesis target : CommRing(S)541hypothesis hom : f : polynomialRing(complexRing, 4) →+* S542543theorem ambientX.map544  shows f(ambientX) = f(X(complexRing, 4, 1))^3 +545    f(X(complexRing, 4, 0)) * f(X(complexRing, 4, 2))546proof547  unfold ambientX548  simp [RingHom.map_add, RingHom.map_mul, RingHom.map_pow]549550theorem ambientY.map551  shows f(ambientY) = -f(X(complexRing, 4, 1))^2 +552    f(X(complexRing, 4, 0)) * f(X(complexRing, 4, 3))553proof554  unfold ambientY555  simp [RingHom.map_add, RingHom.map_mul, RingHom.map_neg, RingHom.map_pow]556557theorem ambientS.map558  shows f(ambientS) = cuspS(S, f(X(complexRing, 4, 0)), f(X(complexRing, 4, 1)),559    f(X(complexRing, 4, 2)), f(X(complexRing, 4, 3)))560proof561  unfold ambientS562  exact cuspS.map with *563564theorem ambientF.map565  shows f(ambientF) = f(X(complexRing, 4, 0)) -566    shiftP(S, f(ambientX), f(ambientY), f(ambientS)) - Ring.one(S)567proof568  have shift := RingHom.map_shiftP at polynomialRing(complexRing, 4), S, f,569    ambientX, ambientY, ambientS with *570  unfold ambientF571  unfold ambientP572  simp [RingHom.map_sub, RingHom.map_one, shift]573574end AmbientTransport575576-- The lifting relations of B[U, V, W] under a ring homomorphism out of it.577section LiftingTransport578variable (B S f : Set)579hypothesis base : CommRing(B)580hypothesis target : CommRing(S)581hypothesis hom : f : polynomialRing(B, 3) →+* S582583theorem relX.map (h x : B)584  shows f(relX(B, h, x)) =585    f(X(B, 3, 0))^3 + f(polynomialConstant(B, 3)(h)) * f(X(B, 3, 1)) -586      f(polynomialConstant(B, 3)(x))587proof588  unfold relX589  simp [RingHom.map_add, RingHom.map_sub, RingHom.map_mul, RingHom.map_pow]590591theorem relY.map (h y : B)592  shows f(relY(B, h, y)) =593    -f(X(B, 3, 0))^2 + f(polynomialConstant(B, 3)(h)) * f(X(B, 3, 2)) -594      f(polynomialConstant(B, 3)(y))595proof596  unfold relY597  simp [RingHom.map_add, RingHom.map_sub, RingHom.map_mul, RingHom.map_neg,598    RingHom.map_pow]599600theorem relS.map (h s : B)601  shows f(relS(B, h, s)) =602    cuspS(S, f(polynomialConstant(B, 3)(h)), f(X(B, 3, 0)), f(X(B, 3, 1)),603      f(X(B, 3, 2))) - f(polynomialConstant(B, 3)(s))604proof605  have image := cuspS.map at polynomialRing(B, 3), S, f,606    polynomialConstant(B, 3)(h), X(B, 3, 0), X(B, 3, 1), X(B, 3, 2) with *607  unfold relS608  simp [RingHom.map_sub, image]609610end LiftingTransport611612-- B → D. The evaluation auxEval : ℂ[h, x, y, s] → D sends the variables to613-- the classes of h, x, y, s; the plane relations hold among those classes,614-- so auxEval descends to auxToD : B → D.615616theorem auxValues.function617  shows auxValues : 4 → algebraCarrier(fibreAlgebra)618proof619  unfold auxValues620  unfold algebraCarrier621  exact quadrupleMap.function with *622623theorem auxValues.values624  shows auxValues(0) = fibreProjection(X(complexRing, 4, 0)) ∧625    auxValues(1) = fibreProjection(ambientX) ∧626    auxValues(2) = fibreProjection(ambientY) ∧627    auxValues(3) = fibreProjection(ambientS)628proof629  unfold auxValues630  unfold algebraCarrier631  refine ⟨?_, ?_, ?_, ?_⟩632  . exact quadrupleMap.zero with *633  . exact quadrupleMap.one with *634  . exact quadrupleMap.two with *635  . exact quadrupleMap.three with *636637theorem auxEval.algebra_hom638  shows auxEval : ambientAlgebra →ₐ fibreAlgebra639proof640  have complexes := complexRing.comm_ring641  have fibre := fibreAlgebra.algebra642  have over := fibreAlgebra.base643  have values := auxValues.function644  unfold auxEval645  unfold ambientAlgebra646  exact evaluationHom.algebra_hom at complexRing, 4, fibreAlgebra, auxValues647    with complexes, fibre, over, values648649theorem auxEval.hom650  shows auxEval : polynomialRing(complexRing, 4) →+* Algebra.ring(fibreAlgebra)651proof652  have hom := auxEval.algebra_hom653  have ringHom := AlgebraHom.ring_hom with hom654  rw ambientAlgebra.ring at ringHom655  exact ringHom656657theorem auxEval.variable (i : Set)658  requires index : i ∈ 4659  shows auxEval(X(complexRing, 4, i)) = auxValues(i)660proof661  have complexes := complexRing.comm_ring662  have fibre := fibreAlgebra.algebra663  have over := fibreAlgebra.base664  have values := auxValues.function665  unfold auxEval666  exact evaluationHom.algebra_X at complexRing, 4, fibreAlgebra, auxValues, i667    with complexes, fibre, over, values, index668669theorem auxEval.H670  shows auxEval(X(complexRing, 4, 0)) = fibreProjection(X(complexRing, 4, 0))671proof672  have zero : 0 ∈ 4 by simp [membership.four]673  have values := auxValues.values674  rw auxEval.variable with zero675  exact values.left676677theorem auxEval.X678  shows auxEval(X(complexRing, 4, 1)) = fibreProjection(ambientX)679proof680  have one : 1 ∈ 4 by simp [membership.four]681  have values := auxValues.values682  rw auxEval.variable with one683  exact values.right.left684685theorem auxEval.Y686  shows auxEval(X(complexRing, 4, 2)) = fibreProjection(ambientY)687proof688  have two : 2 ∈ 4 by simp [membership.four]689  have values := auxValues.values690  rw auxEval.variable with two691  exact values.right.right.left692693theorem auxEval.S694  shows auxEval(X(complexRing, 4, 3)) = fibreProjection(ambientS)695proof696  have three : 3 ∈ 4 by simp [membership.four]697  have values := auxValues.values698  rw auxEval.variable with three699  exact values.right.right.right700701-- The relation h = 1 + P(x, y, s) among the classes in D, from F = 0.702theorem fibreProjection.relation703  shows fibreProjection(X(complexRing, 4, 0)) =704    Ring.one(Algebra.ring(fibreAlgebra)) +705    shiftP(Algebra.ring(fibreAlgebra), fibreProjection(ambientX),706      fibreProjection(ambientY), fibreProjection(ambientS))707proof708  have fibre := fibreRing.comm_ring709  have projection := fibreProjection.ring_hom710  have vanish := fibreProjection.F711  have mapped := ambientF.map with fibre, projection712  rw mapped at vanish713  linear_combination vanish714715-- The cusp relation among the classes in D, from the cusp identity.716theorem fibreProjection.cusp717  shows fibreProjection(ambientX)^2 + fibreProjection(ambientY)^3 =718    fibreProjection(X(complexRing, 4, 0)) * fibreProjection(ambientS)719proof720  have ambient := polynomialRing.comm_ring at complexRing, 4 with *721  have projection := fibreProjection.ring_hom722  have mapped : fibreProjection(ambientX^2 + ambientY^3) =723      fibreProjection(X(complexRing, 4, 0) * ambientS)724    have cusp := ambient.cusp with *725    rw cusp726  simp [RingHom.map_add, RingHom.map_mul, RingHom.map_pow] at mapped727  exact mapped728729theorem auxEval.relH730  shows auxEval(relH(complexRing)) = Ring.zero(Algebra.ring(fibreAlgebra))731proof732  have complexes := complexRing.comm_ring733  have fibre := fibreRing.comm_ring734  have hom := auxEval.hom735  have relation := fibreProjection.relation736  have mapped := RingHom.map_relH with complexes, fibre, hom737  rw [mapped, auxEval.H, auxEval.X, auxEval.Y, auxEval.S]738  linear_combination relation739740theorem auxEval.relCusp741  shows auxEval(relCusp(complexRing)) = Ring.zero(Algebra.ring(fibreAlgebra))742proof743  have complexes := complexRing.comm_ring744  have fibre := fibreRing.comm_ring745  have hom := auxEval.hom746  have cusp := fibreProjection.cusp747  have mapped := RingHom.map_relCusp with complexes, fibre, hom748  rw [mapped, auxEval.H, auxEval.X, auxEval.Y, auxEval.S]749  linear_combination cusp750751theorem planeRelations.generators752  shows planeRelations(complexRing) ⊆ algebraCarrier(ambientAlgebra)753proof754  unfold algebraCarrier755  rw ambientAlgebra.ring756  intros g hg757  unfold planeRelations at hg758  simp [pair.membership] at hg759  rcases hg with rfl | rfl760  . unfold relH761    typecheck762  . unfold relCusp763    typecheck764765theorem auxEval.kills766  shows ∀ g ∈ planeRelations(complexRing),767    auxEval(g) = Ring.zero(Algebra.ring(fibreAlgebra))768proof769  intros g hg770  unfold planeRelations at hg771  simp [pair.membership] at hg772  rcases hg with rfl | rfl773  . exact auxEval.relH774  . exact auxEval.relCusp775776theorem auxToD.hom777  shows auxToD : baseAlgebra →ₐ fibreAlgebra778proof779  have ambient := ambientAlgebra.algebra780  have generators := planeRelations.generators781  have hom := auxEval.algebra_hom782  have killed := auxEval.kills783  have lifted := AlgebraHom.lift_generated784    at ambientAlgebra, planeRelations(complexRing), auxEval, fibreAlgebra785    with ambient, generators, hom, killed786  rw ambientAlgebra.ring at lifted787  unfold ambientAlgebra at lifted788  unfold auxToD789  unfold baseAlgebra790  unfold planeAlgebra791  unfold planeIdeal792  unfold ambientAlgebra793  exact lifted794795theorem auxToD.ring_hom796  shows auxToD : baseRing →+* Algebra.ring(fibreAlgebra)797proof798  have hom := auxToD.hom799  unfold baseRing800  exact AlgebraHom.ring_hom with hom801802-- auxToD on the classes of h, x, y, s.803theorem auxToD.variable (i : Set)804  requires index : i ∈ 4805  shows auxToD(planeVariable(complexRing, i)) = auxEval(X(complexRing, 4, i))806proof807  have ambient := ambientAlgebra.algebra808  have generators := planeRelations.generators809  have hom := auxEval.algebra_hom810  have killed := auxEval.kills811  have member : X(complexRing, 4, i) ∈ algebraCarrier(ambientAlgebra)812    unfold algebraCarrier813    rw ambientAlgebra.ring814    exact X.mem at complexRing, 4, i with *815  have factors := AlgebraHom.lift_generated_factors816    at ambientAlgebra, planeRelations(complexRing), auxEval, fibreAlgebra,817      X(complexRing, 4, i)818    with ambient, generators, hom, killed, member819  rw ambientAlgebra.ring at factors820  unfold ambientAlgebra at factors821  unfold auxToD822  unfold planeVariable823  unfold planeIdeal824  unfold ambientAlgebra825  exact factors826827theorem auxToD.H828  shows auxToD(baseH) = fibreProjection(X(complexRing, 4, 0))829proof830  have zero : 0 ∈ 4 by simp [membership.four]831  unfold baseH832  rw auxToD.variable with zero833  exact auxEval.H834835theorem auxToD.X836  shows auxToD(baseX) = fibreProjection(ambientX)837proof838  have one : 1 ∈ 4 by simp [membership.four]839  unfold baseX840  rw auxToD.variable with one841  exact auxEval.X842843theorem auxToD.Y844  shows auxToD(baseY) = fibreProjection(ambientY)845proof846  have two : 2 ∈ 4 by simp [membership.four]847  unfold baseY848  rw auxToD.variable with two849  exact auxEval.Y850851theorem auxToD.S852  shows auxToD(baseS) = fibreProjection(ambientS)853proof854  have three : 3 ∈ 4 by simp [membership.four]855  unfold baseS856  rw auxToD.variable with three857  exact auxEval.S858859-- B[U, V, W] → D. The evaluation liftEval over auxToD sends U, V, W to the860-- classes of u, v, w; the lifting relations hold among those classes, so861-- liftEval descends to toOriginal : L → D, first over B and then over ℂ.862863theorem liftValues.function864  shows liftValues : 3 → Ring.carrier(Algebra.ring(fibreAlgebra))865proof866  unfold liftValues867  unfold algebraCarrier868  exact tripleMap.function with *869870theorem liftValues.values871  shows liftValues(0) = fibreProjection(X(complexRing, 4, 1)) ∧872    liftValues(1) = fibreProjection(X(complexRing, 4, 2)) ∧873    liftValues(2) = fibreProjection(X(complexRing, 4, 3))874proof875  unfold liftValues876  unfold algebraCarrier877  exact tripleMap.value with *878879theorem liftEval.hom880  shows liftEval : polynomialRing(baseRing, 3) →+* Algebra.ring(fibreAlgebra)881proof882  have baseRing := baseRing.comm_ring883  have fibre := fibreRing.comm_ring884  have hom := auxToD.ring_hom885  have values := liftValues.function886  unfold liftEval887  exact evaluationHom.hom888    at baseRing, Algebra.ring(fibreAlgebra), 3, auxToD, liftValues889    with baseRing, fibre, hom, values890891theorem liftEval.variable (j : Set)892  requires index : j ∈ 3893  shows liftEval(X(baseRing, 3, j)) = liftValues(j)894proof895  have baseRing := baseRing.comm_ring896  have fibre := fibreRing.comm_ring897  have hom := auxToD.ring_hom898  have values := liftValues.function899  unfold liftEval900  exact evaluationHom.map_X901    at baseRing, Algebra.ring(fibreAlgebra), 3, auxToD, liftValues, j902    with baseRing, fibre, hom, values, index903904theorem liftEval.constant (a : Set)905  requires member : a ∈ Ring.carrier(baseRing)906  shows liftEval(polynomialConstant(baseRing, 3)(a)) = auxToD(a)907proof908  have baseRing := baseRing.comm_ring909  have fibre := fibreRing.comm_ring910  have hom := auxToD.ring_hom911  have values := liftValues.function912  unfold liftEval913  exact evaluationHom.map_constant914    at baseRing, Algebra.ring(fibreAlgebra), 3, auxToD, liftValues, a915    with baseRing, fibre, hom, values916917theorem liftEval.U918  shows liftEval(X(baseRing, 3, 0)) = fibreProjection(X(complexRing, 4, 1))919proof920  have zero : 0 ∈ 3 by simp [membership.three]921  have values := liftValues.values922  rw liftEval.variable with zero923  exact values.left924925theorem liftEval.V926  shows liftEval(X(baseRing, 3, 1)) = fibreProjection(X(complexRing, 4, 2))927proof928  have one : 1 ∈ 3 by simp [membership.three]929  have values := liftValues.values930  rw liftEval.variable with one931  exact values.right.left932933theorem liftEval.W934  shows liftEval(X(baseRing, 3, 2)) = fibreProjection(X(complexRing, 4, 3))935proof936  have two : 2 ∈ 3 by simp [membership.three]937  have values := liftValues.values938  rw liftEval.variable with two939  exact values.right.right940941-- The lifting relations hold among the classes of u, v, w in D: each is942-- the image under the projection of a definition in ℂ[h, u, v, w].943theorem liftEval.relX944  shows liftEval(relX(baseRing, baseH, baseX)) =945    Ring.zero(Algebra.ring(fibreAlgebra))946proof947  have fibre := fibreRing.comm_ring948  have hom := liftEval.hom949  have projection := fibreProjection.ring_hom950  have mapped := relX.map951    at baseRing, Algebra.ring(fibreAlgebra), liftEval, baseH, baseX with *952  have h := liftEval.constant at baseH with *953  have x := liftEval.constant at baseX with *954  have image := ambientX.map with fibre, projection955  rw [mapped, h, x, liftEval.U, liftEval.V, auxToD.H, auxToD.X, image]956  ring957958theorem liftEval.relY959  shows liftEval(relY(baseRing, baseH, baseY)) =960    Ring.zero(Algebra.ring(fibreAlgebra))961proof962  have fibre := fibreRing.comm_ring963  have hom := liftEval.hom964  have projection := fibreProjection.ring_hom965  have mapped := relY.map966    at baseRing, Algebra.ring(fibreAlgebra), liftEval, baseH, baseY with *967  have h := liftEval.constant at baseH with *968  have y := liftEval.constant at baseY with *969  have image := ambientY.map with fibre, projection970  rw [mapped, h, y, liftEval.U, liftEval.W, auxToD.H, auxToD.Y, image]971  ring972973theorem liftEval.relS974  shows liftEval(relS(baseRing, baseH, baseS)) =975    Ring.zero(Algebra.ring(fibreAlgebra))976proof977  have fibre := fibreRing.comm_ring978  have hom := liftEval.hom979  have projection := fibreProjection.ring_hom980  have mapped := relS.map981    at baseRing, Algebra.ring(fibreAlgebra), liftEval, baseH, baseS with *982  have h := liftEval.constant at baseH with *983  have s := liftEval.constant at baseS with *984  have image := ambientS.map with fibre, projection985  rw [mapped, h, s, liftEval.U, liftEval.V, liftEval.W, auxToD.H, auxToD.S,986    image]987  unfold cuspS988  ring989990-- D as an algebra over B through auxToD; liftEval is the evaluation over991-- B, and toOriginal its lift to L over B.992def fibreOverBase : Set :=993  Algebra.mk(baseRing, Algebra.ring(fibreAlgebra), auxToD)994995theorem fibreOverBase.base996  shows Algebra.base(fibreOverBase) = baseRing997proof998  unfold fibreOverBase999  rw Algebra.mk.base10001001theorem fibreOverBase.ring1002  shows Algebra.ring(fibreOverBase) = Algebra.ring(fibreAlgebra)1003proof1004  unfold fibreOverBase1005  rw Algebra.mk.ring10061007theorem fibreOverBase.map1008  shows Algebra.map(fibreOverBase) = auxToD1009proof1010  unfold fibreOverBase1011  rw Algebra.mk.map10121013theorem fibreOverBase.carrier1014  shows algebraCarrier(fibreOverBase) = algebraCarrier(fibreAlgebra)1015proof1016  unfold algebraCarrier1017  rw fibreOverBase.ring10181019theorem fibreOverBase.algebra1020  shows Algebra(fibreOverBase)1021proof1022  have baseRing := baseRing.comm_ring1023  have fibre := fibreRing.comm_ring1024  have hom := auxToD.ring_hom1025  unfold fibreOverBase1026  exact Algebra.intro with baseRing, fibre, hom10271028theorem liftEval.algebra_hom1029  shows liftEval : polynomialAlgebra(baseRing, 3) →ₐ fibreOverBase1030proof1031  have baseRing := baseRing.comm_ring1032  have algebra := fibreOverBase.algebra1033  have over := fibreOverBase.base1034  have values : liftValues : 3 → algebraCarrier(fibreOverBase)1035    rw fibreOverBase.carrier1036    unfold algebraCarrier1037    exact liftValues.function1038  have hom := evaluationHom.algebra_hom1039    at baseRing, 3, fibreOverBase, liftValues1040    with baseRing, algebra, over, values1041  rw [fibreOverBase.ring, fibreOverBase.map] at hom1042  unfold liftEval1043  exact hom10441045theorem liftingRelations.generators1046  shows liftingRelations(baseRing, baseH, baseX, baseY, baseS) ⊆1047    algebraCarrier(polynomialAlgebra(baseRing, 3))1048proof1049  unfold algebraCarrier1050  rw polynomialAlgebra.ring1051  intros g hg1052  unfold liftingRelations at hg1053  simp [pair.membership] at hg1054  rcases hg with rfl | rfl | rfl1055  . unfold relX1056    typecheck1057  . unfold relY1058    typecheck1059  . unfold relS1060    typecheck10611062theorem liftEval.kills1063  shows ∀ g ∈ liftingRelations(baseRing, baseH, baseX, baseY, baseS),1064    liftEval(g) = Ring.zero(Algebra.ring(fibreOverBase))1065proof1066  rw fibreOverBase.ring1067  intros g hg1068  unfold liftingRelations at hg1069  simp [pair.membership] at hg1070  rcases hg with rfl | rfl | rfl1071  . exact liftEval.relX1072  . exact liftEval.relY1073  . exact liftEval.relS10741075theorem toOriginal.over_base1076  shows toOriginal :1077    liftingAlgebra(baseRing, baseH, baseX, baseY, baseS) →ₐ fibreOverBase1078proof1079  have polynomial := polynomialAlgebra.algebra at baseRing, 3 with *1080  have generators := liftingRelations.generators1081  have hom := liftEval.algebra_hom1082  have killed := liftEval.kills1083  have lifted := AlgebraHom.lift_generated1084    at polynomialAlgebra(baseRing, 3),1085      liftingRelations(baseRing, baseH, baseX, baseY, baseS), liftEval,1086      fibreOverBase1087    with polynomial, generators, hom, killed1088  rw polynomialAlgebra.ring at lifted1089  unfold algebraLift at lifted1090  rw fibreOverBase.carrier at lifted1091  unfold algebraCarrier at lifted1092  rw polynomialAlgebra.ring at lifted1093  unfold toOriginal1094  unfold algebraCarrier1095  unfold liftingAlgebra1096  unfold liftingIdeal1097  exact lifted10981099theorem toOriginal.hom1100  shows toOriginal : liftedAlgebra →ₐ fibreAlgebra1101proof1102  have complexes := complexRing.comm_ring1103  have over := toOriginal.over_base1104  have scalars := baseAlgebra.structure_map1105  rw ← liftingAlgebra.base_of at scalars1106  have restricted := AlgebraHom.restrict with over, complexes, scalars1107  have fibre := fibreAlgebra.algebra1108  have base : Algebra.base(restrictScalars(fibreOverBase, complexRing,1109      Algebra.map(baseAlgebra))) = Algebra.base(fibreAlgebra)1110    rw [restrictScalars.base, fibreAlgebra.base]1111  have ring : Algebra.ring(restrictScalars(fibreOverBase, complexRing,1112      Algebra.map(baseAlgebra))) = Algebra.ring(fibreAlgebra)1113    rw [restrictScalars.ring, fibreOverBase.ring]1114  have map : ∀ a ∈ Ring.carrier(Algebra.base(fibreAlgebra)),1115      Algebra.map(restrictScalars(fibreOverBase, complexRing,1116        Algebra.map(baseAlgebra)))(a) = Algebra.map(fibreAlgebra)(a)1117    intros a aIn1118    rw fibreAlgebra.base at aIn1119    have structureMap := baseAlgebra.structure_map1120    have iota := structureMap.right.right.left1121    have auxRingHom := auxToD.ring_hom1122    have inner : Algebra.map(fibreOverBase) : Ring.carrier(baseRing) →1123        algebraCarrier(fibreOverBase)1124      rw [fibreOverBase.carrier, fibreOverBase.map]1125      unfold algebraCarrier1126      exact auxRingHom.right.right.left1127    rw restrictScalars.map1128    rw fibreOverBase.base1129    rw compose.apply with iota, inner, aIn1130    rw fibreOverBase.map1131    have auxHom := auxToD.hom1132    have member : a ∈ Ring.carrier(Algebra.base(baseAlgebra))1133      rw baseAlgebra.base1134      exact aIn1135    exact AlgebraHom.map_base with auxHom, member1136  unfold liftedAlgebra1137  exact AlgebraHom.transfer with restricted, fibre, base, ring, map11381139-- toOriginal on the classes of L: the variables and the constants.1140theorem toOriginal.class (q : Set)1141  requires member : q ∈ Ring.carrier(polynomialRing(baseRing, 3))1142  shows toOriginal(algebraProjection(polynomialAlgebra(baseRing, 3),1143    liftingIdeal(baseRing, baseH, baseX, baseY, baseS))(q)) = liftEval(q)1144proof1145  have polynomial := polynomialAlgebra.algebra at baseRing, 3 with *1146  have generators := liftingRelations.generators1147  have hom := liftEval.algebra_hom1148  have killed := liftEval.kills1149  have inPolynomial : q ∈ algebraCarrier(polynomialAlgebra(baseRing, 3))1150    unfold algebraCarrier1151    rw polynomialAlgebra.ring1152    exact member1153  have factors := AlgebraHom.lift_generated_factors1154    at polynomialAlgebra(baseRing, 3),1155      liftingRelations(baseRing, baseH, baseX, baseY, baseS), liftEval,1156      fibreOverBase, q1157    with polynomial, generators, hom, killed, inPolynomial1158  rw polynomialAlgebra.ring at factors1159  unfold algebraLift at factors1160  rw fibreOverBase.carrier at factors1161  unfold algebraCarrier at factors1162  rw polynomialAlgebra.ring at factors1163  unfold toOriginal1164  unfold algebraCarrier1165  unfold liftingIdeal1166  exact factors11671168theorem toOriginal.U1169  shows toOriginal(liftedVariable(0)) = fibreProjection(X(complexRing, 4, 1))1170proof1171  have member := X.mem at baseRing, 3, 0 with *1172  unfold liftedVariable1173  unfold liftingVariable1174  rw toOriginal.class with member1175  exact liftEval.U11761177theorem toOriginal.V1178  shows toOriginal(liftedVariable(1)) = fibreProjection(X(complexRing, 4, 2))1179proof1180  have member := X.mem at baseRing, 3, 1 with *1181  unfold liftedVariable1182  unfold liftingVariable1183  rw toOriginal.class with member1184  exact liftEval.V11851186theorem toOriginal.W1187  shows toOriginal(liftedVariable(2)) = fibreProjection(X(complexRing, 4, 3))1188proof1189  have member := X.mem at baseRing, 3, 2 with *1190  unfold liftedVariable1191  unfold liftingVariable1192  rw toOriginal.class with member1193  exact liftEval.W11941195theorem toOriginal.constant (b : Set)1196  requires member : b ∈ Ring.carrier(baseRing)1197  shows toOriginal(liftedConstant(b)) = auxToD(b)1198proof1199  have constant := liftingProjection.constant1200    at baseRing, baseH, baseX, baseY, baseS, b with *1201  have inPolynomial := polynomialConstant.mem at baseRing, 3, b with *1202  unfold liftedConstant1203  rw ← constant1204  rw toOriginal.class with inPolynomial1205  exact liftEval.constant with member12061207-- ℂ[h, u, v, w] → L. The evaluation originalEval sends h to the constant h1208-- and u, v, w to U, V, W; it kills F, so it descends to1209-- fromOriginal : D → L.12101211theorem originalValues.function1212  shows originalValues : 4 → algebraCarrier(liftedAlgebra)1213proof1214  unfold originalValues1215  unfold algebraCarrier1216  exact quadrupleMap.function with *12171218theorem originalValues.values1219  shows originalValues(0) = liftedConstant(baseH) ∧1220    originalValues(1) = liftedVariable(0) ∧1221    originalValues(2) = liftedVariable(1) ∧1222    originalValues(3) = liftedVariable(2)1223proof1224  unfold originalValues1225  unfold algebraCarrier1226  refine ⟨?_, ?_, ?_, ?_⟩1227  . exact quadrupleMap.zero with *1228  . exact quadrupleMap.one with *1229  . exact quadrupleMap.two with *1230  . exact quadrupleMap.three with *12311232theorem originalEval.algebra_hom1233  shows originalEval : ambientAlgebra →ₐ liftedAlgebra1234proof1235  have complexes := complexRing.comm_ring1236  have lifted := liftedAlgebra.algebra1237  have over := liftedAlgebra.base1238  have values := originalValues.function1239  unfold originalEval1240  unfold ambientAlgebra1241  exact evaluationHom.algebra_hom1242    at complexRing, 4, liftedAlgebra, originalValues1243    with complexes, lifted, over, values12441245theorem originalEval.hom1246  shows originalEval :1247    polynomialRing(complexRing, 4) →+* Algebra.ring(liftedAlgebra)1248proof1249  have hom := originalEval.algebra_hom1250  have ringHom := AlgebraHom.ring_hom with hom1251  rw ambientAlgebra.ring at ringHom1252  exact ringHom12531254theorem originalEval.variable (i : Set)1255  requires index : i ∈ 41256  shows originalEval(X(complexRing, 4, i)) = originalValues(i)1257proof1258  have complexes := complexRing.comm_ring1259  have lifted := liftedAlgebra.algebra1260  have over := liftedAlgebra.base1261  have values := originalValues.function1262  unfold originalEval1263  exact evaluationHom.algebra_X1264    at complexRing, 4, liftedAlgebra, originalValues, i1265    with complexes, lifted, over, values, index12661267theorem originalEval.H1268  shows originalEval(X(complexRing, 4, 0)) = liftedConstant(baseH)1269proof1270  have zero : 0 ∈ 4 by simp [membership.four]1271  have values := originalValues.values1272  rw originalEval.variable with zero1273  exact values.left12741275theorem originalEval.U1276  shows originalEval(X(complexRing, 4, 1)) = liftedVariable(0)1277proof1278  have one : 1 ∈ 4 by simp [membership.four]1279  have values := originalValues.values1280  rw originalEval.variable with one1281  exact values.right.left12821283theorem originalEval.V1284  shows originalEval(X(complexRing, 4, 2)) = liftedVariable(1)1285proof1286  have two : 2 ∈ 4 by simp [membership.four]1287  have values := originalValues.values1288  rw originalEval.variable with two1289  exact values.right.right.left12901291theorem originalEval.W1292  shows originalEval(X(complexRing, 4, 3)) = liftedVariable(2)1293proof1294  have three : 3 ∈ 4 by simp [membership.four]1295  have values := originalValues.values1296  rw originalEval.variable with three1297  exact values.right.right.right12981299-- The elements x, y, s of ℂ[h, u, v, w] go to the constants x, y, s of L,1300-- by the relations of L.1301theorem originalEval.ambientX1302  shows originalEval(ambientX) = liftedConstant(baseX)1303proof1304  have lifted := liftedRing.comm_ring1305  have hom := originalEval.hom1306  have relations := liftedAlgebra.relations1307  have mapped := ambientX.map with lifted, hom1308  rw [mapped, originalEval.H, originalEval.U, originalEval.V]1309  exact relations.left13101311theorem originalEval.ambientY1312  shows originalEval(ambientY) = liftedConstant(baseY)1313proof1314  have lifted := liftedRing.comm_ring1315  have hom := originalEval.hom1316  have relations := liftedAlgebra.relations1317  have mapped := ambientY.map with lifted, hom1318  rw [mapped, originalEval.H, originalEval.U, originalEval.W]1319  exact relations.right.left13201321theorem originalEval.ambientS1322  shows originalEval(ambientS) = liftedConstant(baseS)1323proof1324  have lifted := liftedRing.comm_ring1325  have hom := originalEval.hom1326  have relations := liftedAlgebra.relations1327  have mapped := ambientS.map with lifted, hom1328  rw [mapped, originalEval.H, originalEval.U, originalEval.V, originalEval.W]1329  exact relations.right.right13301331-- F vanishes under h ↦ h, u ↦ U, v ↦ V, w ↦ W in L.1332theorem originalEval.F1333  shows originalEval(ambientF) = Ring.zero(Algebra.ring(liftedAlgebra))1334proof1335  have lifted := liftedRing.comm_ring1336  have hom := originalEval.hom1337  have mapped := ambientF.map with lifted, hom1338  have relation := liftedConstant.relation_h1339  rw [mapped, originalEval.ambientX, originalEval.ambientY,1340    originalEval.ambientS, originalEval.H, relation]1341  ring13421343theorem originalEval.kills1344  shows ∀ g ∈ {ambientF},1345    originalEval(g) = Ring.zero(Algebra.ring(liftedAlgebra))1346proof1347  intros g hg1348  rw singleton.membership at hg1349  rw hg1350  exact originalEval.F13511352theorem fromOriginal.hom1353  shows fromOriginal : fibreAlgebra →ₐ liftedAlgebra1354proof1355  have ambient := ambientAlgebra.algebra1356  have generators := fibreGenerators.subset1357  have hom := originalEval.algebra_hom1358  have killed := originalEval.kills1359  have lifted := AlgebraHom.lift_generated1360    at ambientAlgebra, {ambientF}, originalEval, liftedAlgebra1361    with ambient, generators, hom, killed1362  rw ambientAlgebra.ring at lifted1363  unfold fromOriginal1364  unfold fibreAlgebra1365  unfold fibreIdeal1366  exact lifted13671368theorem fromOriginal.ring_hom1369  shows fromOriginal :1370    Algebra.ring(fibreAlgebra) →+* Algebra.ring(liftedAlgebra)1371proof1372  have hom := fromOriginal.hom1373  exact AlgebraHom.ring_hom with hom13741375theorem fromOriginal.class (x : Set)1376  requires member : x ∈ Ring.carrier(polynomialRing(complexRing, 4))1377  shows fromOriginal(fibreProjection(x)) = originalEval(x)1378proof1379  have ambient := ambientAlgebra.algebra1380  have generators := fibreGenerators.subset1381  have hom := originalEval.algebra_hom1382  have killed := originalEval.kills1383  have inAmbient : x ∈ algebraCarrier(ambientAlgebra)1384    unfold algebraCarrier1385    rw ambientAlgebra.ring1386    exact member1387  have factors := AlgebraHom.lift_generated_factors1388    at ambientAlgebra, {ambientF}, originalEval, liftedAlgebra, x1389    with ambient, generators, hom, killed, inAmbient1390  rw ambientAlgebra.ring at factors1391  unfold fromOriginal1392  unfold fibreProjection1393  unfold fibreIdeal1394  exact factors13951396-- The two composites are the identities. Each is checked on generators:1397-- toOriginal ∘ originalEval is the projection onto D, and1398-- fromOriginal ∘ liftEval is the projection onto L.13991400theorem toOriginal.after_original (x : Set)1401  requires member : x ∈ Ring.carrier(polynomialRing(complexRing, 4))1402  shows toOriginal(originalEval(x)) = fibreProjection(x)1403proof1404  have complexes := complexRing.comm_ring1405  have hIn := baseH.mem1406  have originalHom := originalEval.algebra_hom1407  have toHom := toOriginal.hom1408  have first := AlgebraHom.compose with originalHom, toHom1409  have second := fibreProjection.algebra_hom1410  have originalFunction := AlgebraHom.function with originalHom1411  have toFunction := AlgebraHom.function with toHom1412  unfold ambientAlgebra at first1413  unfold ambientAlgebra at second1414  unfold ambientAlgebra at originalFunction1415  have agree : ∀ j ∈ 4, compose(toOriginal, originalEval,1416      algebraCarrier(polynomialAlgebra(complexRing, 4)),1417      algebraCarrier(liftedAlgebra), algebraCarrier(fibreAlgebra))(1418      X(complexRing, 4, j)) = fibreProjection(X(complexRing, 4, j))1419    intros j hj1420    have inPolynomial :1421        X(complexRing, 4, j) ∈ algebraCarrier(polynomialAlgebra(complexRing, 4))1422      rw polynomialAlgebra.carrierOf1423      exact X.mem at complexRing, 4, j with complexes1424    rw compose.apply with originalFunction, toFunction, inPolynomial1425    have index := membership.four.forward with hj1426    rcases index with rfl | rfl | rfl | rfl1427    . rw [originalEval.H, toOriginal.constant with hIn, auxToD.H]1428    . rw [originalEval.U, toOriginal.U]1429    . rw [originalEval.V, toOriginal.V]1430    . rw [originalEval.W, toOriginal.W]1431  have equal := AlgebraHom.polynomial_ext at complexRing, 4, fibreAlgebra,1432    compose(toOriginal, originalEval,1433      algebraCarrier(polynomialAlgebra(complexRing, 4)),1434      algebraCarrier(liftedAlgebra), algebraCarrier(fibreAlgebra)),1435    fibreProjection1436    with complexes, first, second, agree1437  have inPolynomial : x ∈ algebraCarrier(polynomialAlgebra(complexRing, 4))1438    rw polynomialAlgebra.carrierOf1439    exact member1440  rw ← equal1441  rw compose.apply with originalFunction, toFunction, inPolynomial14421443theorem toOriginal.after_from (d : Set)1444  requires member : d ∈ algebraCarrier(fibreAlgebra)1445  shows toOriginal(fromOriginal(d)) = d1446proof1447  obtain ⟨x, hx, shape⟩ := fibreAlgebra.representative with member1448  rw shape1449  rw fromOriginal.class with hx1450  exact toOriginal.after_original with hx14511452-- fromOriginal after auxToD is the constants map B → L.1453theorem fromOriginal.after_aux (b : Set)1454  requires member : b ∈ Ring.carrier(baseRing)1455  shows fromOriginal(auxToD(b)) = liftedConstant(b)1456proof1457  have complexes := complexRing.comm_ring1458  have auxHom := auxToD.hom1459  have fromHom := fromOriginal.hom1460  have first := AlgebraHom.compose with auxHom, fromHom1461  have second := liftedConstant.hom1462  have auxFunction := AlgebraHom.function with auxHom1463  have fromFunction := AlgebraHom.function with fromHom1464  unfold baseAlgebra at first1465  unfold baseAlgebra at second1466  unfold baseAlgebra at auxFunction1467  have agree : ∀ i ∈ 4, compose(fromOriginal, auxToD,1468      algebraCarrier(planeAlgebra(complexRing)), algebraCarrier(fibreAlgebra),1469      algebraCarrier(liftedAlgebra))(planeVariable(complexRing, i)) =1470      liftedConstant(planeVariable(complexRing, i))1471    intros i hi1472    have inBase : planeVariable(complexRing, i) ∈1473        algebraCarrier(planeAlgebra(complexRing))1474      unfold algebraCarrier1475      exact planeVariable.mem at complexRing, i with complexes, hi1476    rw compose.apply with auxFunction, fromFunction, inBase1477    have index := membership.four.forward with hi1478    rcases index with rfl | rfl | rfl | rfl1479    . have value := auxToD.H1480      have result := originalEval.H1481      unfold baseH at value1482      unfold baseH at result1483      rw value1484      rw fromOriginal.class with *1485      exact result1486    . have value := auxToD.X1487      have result := originalEval.ambientX1488      unfold baseX at value1489      unfold baseX at result1490      rw value1491      rw fromOriginal.class with *1492      exact result1493    . have value := auxToD.Y1494      have result := originalEval.ambientY1495      unfold baseY at value1496      unfold baseY at result1497      rw value1498      rw fromOriginal.class with *1499      exact result1500    . have value := auxToD.S1501      have result := originalEval.ambientS1502      unfold baseS at value1503      unfold baseS at result1504      rw value1505      rw fromOriginal.class with *1506      exact result1507  have equal := planeAlgebra.hom_ext at complexRing,1508    compose(fromOriginal, auxToD, algebraCarrier(planeAlgebra(complexRing)),1509      algebraCarrier(fibreAlgebra), algebraCarrier(liftedAlgebra)),1510    liftedConstant, liftedAlgebra1511    with complexes, first, second, agree1512  have inBase : b ∈ algebraCarrier(planeAlgebra(complexRing))1513    unfold algebraCarrier1514    unfold baseRing at member1515    unfold baseAlgebra at member1516    exact member1517  rw ← equal1518  rw compose.apply with auxFunction, fromFunction, inBase15191520-- fromOriginal after liftEval is the projection onto L.1521theorem fromOriginal.after_lift (q : Set)1522  requires member : q ∈ Ring.carrier(polynomialRing(baseRing, 3))1523  shows fromOriginal(liftEval(q)) =1524    algebraProjection(polynomialAlgebra(baseRing, 3),1525      liftingIdeal(baseRing, baseH, baseX, baseY, baseS))(q)1526proof1527  have baseRing := baseRing.comm_ring1528  have polynomials := polynomialRing.comm_ring at baseRing, 3 with *1529  have liftHom := liftEval.hom1530  have fromHom := fromOriginal.ring_hom1531  have first := RingHom.comp with polynomials, liftHom, fromHom1532  have second := liftingProjection.ring_hom1533    at baseRing, baseH, baseX, baseY, baseS with *1534  rw ← liftedAlgebra.ring at second1535  have liftFunction := liftHom.right.right.left1536  have fromFunction := fromHom.right.right.left1537  have constants : ∀ b ∈ Ring.carrier(baseRing), compose(fromOriginal, liftEval,1538      Ring.carrier(polynomialRing(baseRing, 3)),1539      Ring.carrier(Algebra.ring(fibreAlgebra)),1540      Ring.carrier(Algebra.ring(liftedAlgebra)))(1541      polynomialConstant(baseRing, 3)(b)) =1542      algebraProjection(polynomialAlgebra(baseRing, 3),1543        liftingIdeal(baseRing, baseH, baseX, baseY, baseS))(1544        polynomialConstant(baseRing, 3)(b))1545    intros b bIn1546    have inPolynomial := polynomialConstant.mem at baseRing, 3, b with *1547    have constant := liftingProjection.constant1548      at baseRing, baseH, baseX, baseY, baseS, b with *1549    rw compose.apply with liftFunction, fromFunction, inPolynomial1550    rw liftEval.constant with bIn1551    rw fromOriginal.after_aux with bIn1552    rw constant1553    unfold liftedConstant1554    rfl1555  have variables : ∀ j ∈ 3, compose(fromOriginal, liftEval,1556      Ring.carrier(polynomialRing(baseRing, 3)),1557      Ring.carrier(Algebra.ring(fibreAlgebra)),1558      Ring.carrier(Algebra.ring(liftedAlgebra)))(X(baseRing, 3, j)) =1559      algebraProjection(polynomialAlgebra(baseRing, 3),1560        liftingIdeal(baseRing, baseH, baseX, baseY, baseS))(X(baseRing, 3, j))1561    intros j hj1562    have inPolynomial := X.mem at baseRing, 3, j with *1563    rw compose.apply with liftFunction, fromFunction, inPolynomial1564    rw liftingProjection.variable1565    have index := membership.three.forward with hj1566    rcases index with rfl | rfl | rfl1567    . have result := originalEval.U1568      unfold liftedVariable at result1569      rw liftEval.U1570      rw fromOriginal.class with *1571      exact result1572    . have result := originalEval.V1573      unfold liftedVariable at result1574      rw liftEval.V1575      rw fromOriginal.class with *1576      exact result1577    . have result := originalEval.W1578      unfold liftedVariable at result1579      rw liftEval.W1580      rw fromOriginal.class with *1581      exact result1582  have equal := polynomialRing.hom_ext1583    at baseRing, 3, Algebra.ring(liftedAlgebra),1584    compose(fromOriginal, liftEval, Ring.carrier(polynomialRing(baseRing, 3)),1585      Ring.carrier(Algebra.ring(fibreAlgebra)),1586      Ring.carrier(Algebra.ring(liftedAlgebra))),1587    algebraProjection(polynomialAlgebra(baseRing, 3),1588      liftingIdeal(baseRing, baseH, baseX, baseY, baseS))1589    with baseRing, first, second, constants, variables1590  rw ← equal1591  rw compose.apply with liftFunction, fromFunction, member15921593theorem fromOriginal.after_to (l : Set)1594  requires member : l ∈ algebraCarrier(liftedAlgebra)1595  shows fromOriginal(toOriginal(l)) = l1596proof1597  obtain ⟨q, hq, shape⟩ := liftedAlgebra.representative with member1598  rw shape1599  rw toOriginal.class with hq1600  exact fromOriginal.after_lift with hq16011602-- The main theorem: L ≅ D as ℂ-algebras, by toOriginal and fromOriginal.1603theorem elimination_equivalence1604  shows toOriginal : liftedAlgebra ≃ₐ fibreAlgebra1605proof1606  have forward := toOriginal.hom1607  have backward := fromOriginal.hom1608  have left : ∀ l ∈ algebraCarrier(liftedAlgebra),1609      fromOriginal(toOriginal(l)) = l1610    intros l hl1611    exact fromOriginal.after_to with hl1612  have right : ∀ d ∈ algebraCarrier(fibreAlgebra),1613      toOriginal(fromOriginal(d)) = d1614    intros d hd1615    exact toOriginal.after_from with hd1616  exact AlgebraIso.of_inverse with forward, backward, left, right1617