-- The lifting lemma: over a commutative ring B with elements h, x, y, s -- satisfying the cusp relation x² + y³ = hs and Bézout coefficients -- αh + βy = 1, the algebra B[U, V, W] ⧸ (U³ + hV − x, −U² + hW − y, -- S(h, U, V, W) − s) is a polynomial algebra in one variable T over B, by -- T = αU + β(V + UW) and the inverse formulas. -- 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.AlgebraicGeometry.Coordinates.Lifting import Grace.Cumulus.AlgebraicGeometry.Coordinates.LiftingIdentities import Grace.Cumulus.Algebra.Algebras import Grace.Cumulus.Set.Function.Quadruples -- The relations. section Relations variable (B : Set) hypothesis base : CommRing(B) hypothesis polynomials : CommRing(polynomialRing(B, 3)) -- The three relations in B[U, V, W], with U, V, W the variables 0, 1, 2. def relX (h x : Set) : Set := X(B, 3, 0)^3 + polynomialConstant(B, 3)(h)*X(B, 3, 1) - polynomialConstant(B, 3)(x) def relY (h y : Set) : Set := -X(B, 3, 0)^2 + polynomialConstant(B, 3)(h)*X(B, 3, 2) - polynomialConstant(B, 3)(y) def relS (h s : Set) : Set := Ring.sub(polynomialRing(B, 3), cuspS(polynomialRing(B, 3), polynomialConstant(B, 3)(h), X(B, 3, 0), X(B, 3, 1), X(B, 3, 2)), polynomialConstant(B, 3)(s)) -- The relations are members of B[U, V, W]. instance relX.mem (h x : Set) requires hIn : h ∈ Ring.carrier(B) requires xIn : x ∈ Ring.carrier(B) shows relX(B, h, x) ∈ Ring.carrier(polynomialRing(B, 3)) proof unfold relX typecheck instance relY.mem (h y : Set) requires hIn : h ∈ Ring.carrier(B) requires yIn : y ∈ Ring.carrier(B) shows relY(B, h, y) ∈ Ring.carrier(polynomialRing(B, 3)) proof unfold relY typecheck instance relS.mem (h s : Set) requires hIn : h ∈ Ring.carrier(B) requires sIn : s ∈ Ring.carrier(B) shows relS(B, h, s) ∈ Ring.carrier(polynomialRing(B, 3)) proof unfold relS typecheck end Relations -- The presented algebra, the two homomorphisms, and the parameter. def liftingRelations (B h x y s : Set) : Set := {relX(B, h, x), relY(B, h, y), relS(B, h, s)} def liftingIdeal (B h x y s : Set) : Set := generatedIdeal(polynomialRing(B, 3), liftingRelations(B, h, x, y, s)) -- The presented algebra Q = B[U, V, W] ⧸ (relX, relY, relS). def liftingAlgebra (B h x y s : Set) : Set := quotientAlgebra(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s)) -- The classes of U, V, W in the presented algebra. def liftingVariable (B h x y s i : Set) : Set := algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))( X(B, 3, i)) -- The values of U, V, W in B[T] given by the inverse formulas, with T the -- variable 0 of B[1]. def polyU (B h x β : Set) : Set := inverseU(polynomialRing(B, 1), polynomialConstant(B, 1)(h), polynomialConstant(B, 1)(x), polynomialConstant(B, 1)(β), X(B, 1, 0)) def polyG (B x y α : Set) : Set := inverseG(polynomialRing(B, 1), polynomialConstant(B, 1)(x), polynomialConstant(B, 1)(y), polynomialConstant(B, 1)(α), X(B, 1, 0)) def polyW (B h x y s α β : Set) : Set := inverseW(polynomialRing(B, 1), polynomialConstant(B, 1)(h), polynomialConstant(B, 1)(y), polynomialConstant(B, 1)(s), polynomialConstant(B, 1)(α), polynomialConstant(B, 1)(β), polyU(B, h, x, β), polyG(B, x, y, α)) def polyV (B h x y s α β : Set) : Set := inverseV(polynomialRing(B, 1), polyU(B, h, x, β), polyG(B, x, y, α), polyW(B, h, x, y, s, α, β)) def liftingValues (B h x y s α β : Set) : Set := tripleMap(Ring.carrier(polynomialRing(B, 1)), polyU(B, h, x, β), polyV(B, h, x, y, s, α, β), polyW(B, h, x, y, s, α, β)) -- Forward: Q → B[T], the evaluation at the inverse formulas, lifted. def liftingForward (B h x y s α β : Set) : Set := algebraLift(evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β)), polynomialAlgebra(B, 3), polynomialAlgebra(B, 1), liftingIdeal(B, h, x, y, s)) -- The parameter T = αU + β(V + UW) in Q. def liftingParameter (B h x y s α β : Set) : Set := parameter(Algebra.ring(liftingAlgebra(B, h, x, y, s)), Algebra.map(liftingAlgebra(B, h, x, y, s))(α), Algebra.map(liftingAlgebra(B, h, x, y, s))(β), liftingVariable(B, h, x, y, s, 0), liftingVariable(B, h, x, y, s, 1), liftingVariable(B, h, x, y, s, 2)) -- Backward: B[T] → Q, the evaluation at the parameter. def liftingBackward (B h x y s α β : Set) : Set := evaluationHom(B, Algebra.ring(liftingAlgebra(B, h, x, y, s)), 1, Algebra.map(liftingAlgebra(B, h, x, y, s)), pointMap(algebraCarrier(liftingAlgebra(B, h, x, y, s)), liftingParameter(B, h, x, y, s, α, β))) -- The projections of the presented algebra, and the classes of the -- variables as values of the projection. theorem liftingAlgebra.base (B h x y s : Set) shows Algebra.base(liftingAlgebra(B, h, x, y, s)) = B proof unfold liftingAlgebra rw [quotientAlgebra.baseOf, polynomialAlgebra.base] theorem liftingAlgebra.ring (B h x y s : Set) shows Algebra.ring(liftingAlgebra(B, h, x, y, s)) = quotientRing(polynomialRing(B, 3), liftingIdeal(B, h, x, y, s)) proof unfold liftingAlgebra rw [quotientAlgebra.ringOf, polynomialAlgebra.ring] theorem liftingProjection.variable (B h x y s i : Set) shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))( X(B, 3, i)) = liftingVariable(B, h, x, y, s, i) proof simp [liftingVariable] -- The members and instances: Q is an algebra, its projection a -- homomorphism that kills the relations, and the classes of the variables -- and the constants are members of its ring. section Members variable (B h x y s : Set) hypothesis base : CommRing(B) hypothesis hIn : h ∈ Ring.carrier(B) hypothesis xIn : x ∈ Ring.carrier(B) hypothesis yIn : y ∈ Ring.carrier(B) hypothesis sIn : s ∈ Ring.carrier(B) theorem liftingRelations.subset shows liftingRelations(B, h, x, y, s) ⊆ algebraCarrier(polynomialAlgebra(B, 3)) proof have polynomials := polynomialRing.comm_ring at B, 3 with base have memberX := relX.mem at B, h, x with * have memberY := relY.mem at B, h, y with * have memberS := relS.mem at B, h, s with * intros g hg unfold liftingRelations at hg simp at hg rw (polynomialAlgebra.carrierOf at B, 3) rcases hg with hX | hY | hS . rw hX exact memberX . rw hY exact memberY . rw hS exact memberS theorem liftingIdeal.ideal shows Ideal(Algebra.ring(polynomialAlgebra(B, 3)), liftingIdeal(B, h, x, y, s)) proof have polynomials := polynomialRing.comm_ring at B, 3 with base rw polynomialAlgebra.ring unfold liftingIdeal exact generatedIdeal.ideal at _, liftingRelations(B, h, x, y, s) with polynomials theorem liftingAlgebra.algebra shows Algebra(liftingAlgebra(B, h, x, y, s)) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have ideal := liftingIdeal.ideal at B, h, x, y, s with * unfold liftingAlgebra exact quotientAlgebra.algebra with polynomial, ideal -- The projection onto the presented algebra: a function, a ring -- homomorphism, an algebra homomorphism; it kills the relations and -- carries the constants to the structure map. theorem liftingProjection.function shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s)) : algebraCarrier(polynomialAlgebra(B, 3)) → algebraCarrier(liftingAlgebra(B, h, x, y, s)) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have ideal := liftingIdeal.ideal at B, h, x, y, s with * have function := algebraProjection.function with polynomial, ideal unfold liftingAlgebra rw quotientAlgebra.carrierOf exact function theorem liftingProjection.ring_hom shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s)) : polynomialRing(B, 3) →+* Algebra.ring(liftingAlgebra(B, h, x, y, s)) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have ideal := liftingIdeal.ideal at B, h, x, y, s with * have projection := algebraProjection.ring_hom with polynomial, ideal rw polynomialAlgebra.ring at projection rw liftingAlgebra.ring exact projection theorem liftingProjection.hom shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s)) : polynomialAlgebra(B, 3) →ₐ liftingAlgebra(B, h, x, y, s) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have ideal := liftingIdeal.ideal at B, h, x, y, s with * unfold liftingAlgebra exact algebraProjection.hom with polynomial, ideal theorem liftingProjection.constant (a : Set) requires member : a ∈ Ring.carrier(B) shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))( polynomialConstant(B, 3)(a)) = Algebra.map(liftingAlgebra(B, h, x, y, s))(a) proof have projection := liftingProjection.hom at B, h, x, y, s with * have inBase : a ∈ Ring.carrier(Algebra.base(polynomialAlgebra(B, 3))) rw polynomialAlgebra.base exact member have commutes := AlgebraHom.map_base with projection, inBase rw polynomialAlgebra.map at commutes exact commutes theorem liftingProjection.kills (g : Set) requires member : g ∈ liftingRelations(B, h, x, y, s) shows algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))( g) = Ring.zero(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have generators := liftingRelations.subset at B, h, x, y, s with * have killed := algebraProjection.kills_generator with polynomial, generators, member rw polynomialAlgebra.ring at killed rw liftingAlgebra.ring unfold liftingIdeal exact killed theorem liftingAlgebra.structure_hom shows Algebra.map(liftingAlgebra(B, h, x, y, s)) : B →+* Algebra.ring(liftingAlgebra(B, h, x, y, s)) proof have algebra := liftingAlgebra.algebra at B, h, x, y, s with * have raw := algebra.right.right.right rw liftingAlgebra.base at raw exact raw theorem liftingVariable.mem (i : Set) requires index : i ∈ 3 shows liftingVariable(B, h, x, y, s, i) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have function := liftingProjection.function at B, h, x, y, s with * have member : X(B, 3, i) ∈ algebraCarrier(polynomialAlgebra(B, 3)) rw (polynomialAlgebra.carrierOf at B, 3) exact X.mem at B, 3, i with base have image := FunctionBetween.apply_closed with function, member unfold algebraCarrier at image unfold liftingVariable exact image instance liftingU.mem shows liftingVariable(B, h, x, y, s, 0) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have zero : 0 ∈ 3 by simp [membership.three] exact liftingVariable.mem with zero, * instance liftingV.mem shows liftingVariable(B, h, x, y, s, 1) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have one : 1 ∈ 3 by simp [membership.three] exact liftingVariable.mem with one, * instance liftingW.mem shows liftingVariable(B, h, x, y, s, 2) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have two : 2 ∈ 3 by simp [membership.three] exact liftingVariable.mem with two, * instance liftingConstant.mem (a : Set) requires member : a ∈ Ring.carrier(B) shows Algebra.map(liftingAlgebra(B, h, x, y, s))(a) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have algebra := liftingAlgebra.algebra at B, h, x, y, s with * have inBase : a ∈ Ring.carrier(Algebra.base(liftingAlgebra(B, h, x, y, s))) rw liftingAlgebra.base exact member exact Algebra.map_mem with algebra, inBase instance liftingAlgebra.comm_ring shows CommRing(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have algebra := liftingAlgebra.algebra at B, h, x, y, s with * exact Algebra.comm_ring with algebra end Members -- The inverse formulas as members of B[T], the values as a function on 3, -- and the evaluation at them as a homomorphism out of B[U, V, W]. section Values variable (B h x y s α β : Set) hypothesis base : CommRing(B) hypothesis polynomials : CommRing(polynomialRing(B, 1)) hypothesis hIn : h ∈ Ring.carrier(B) hypothesis xIn : x ∈ Ring.carrier(B) hypothesis yIn : y ∈ Ring.carrier(B) hypothesis sIn : s ∈ Ring.carrier(B) hypothesis αIn : α ∈ Ring.carrier(B) hypothesis βIn : β ∈ Ring.carrier(B) theorem polyU.mem shows polyU(B, h, x, β) ∈ Ring.carrier(polynomialRing(B, 1)) proof unfold polyU typecheck theorem polyG.mem shows polyG(B, x, y, α) ∈ Ring.carrier(polynomialRing(B, 1)) proof unfold polyG typecheck theorem polyW.mem shows polyW(B, h, x, y, s, α, β) ∈ Ring.carrier(polynomialRing(B, 1)) proof have first := polyU.mem at B, h, x, y, s, α, β with * have second := polyG.mem at B, h, x, y, s, α, β with * unfold polyW typecheck theorem polyV.mem shows polyV(B, h, x, y, s, α, β) ∈ Ring.carrier(polynomialRing(B, 1)) proof have first := polyU.mem at B, h, x, y, s, α, β with * have second := polyG.mem at B, h, x, y, s, α, β with * have third := polyW.mem at B, h, x, y, s, α, β with * unfold polyV typecheck theorem liftingValues.function shows liftingValues(B, h, x, y, s, α, β) : 3 → Ring.carrier(polynomialRing(B, 1)) proof have first := polyU.mem at B, h, x, y, s, α, β with * have second := polyV.mem at B, h, x, y, s, α, β with * have third := polyW.mem at B, h, x, y, s, α, β with * unfold liftingValues exact tripleMap.function with first, second, third theorem liftingValues.value shows liftingValues(B, h, x, y, s, α, β)(0) = polyU(B, h, x, β) ∧ liftingValues(B, h, x, y, s, α, β)(1) = polyV(B, h, x, y, s, α, β) ∧ liftingValues(B, h, x, y, s, α, β)(2) = polyW(B, h, x, y, s, α, β) proof have first := polyU.mem at B, h, x, y, s, α, β with * have second := polyV.mem at B, h, x, y, s, α, β with * have third := polyW.mem at B, h, x, y, s, α, β with * unfold liftingValues exact tripleMap.value with first, second, third theorem liftingEvaluation.hom shows evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β)) : polynomialAlgebra(B, 3) →ₐ polynomialAlgebra(B, 1) proof have polynomial := polynomialAlgebra.algebra at B, 1 with base have over := polynomialAlgebra.base at B, 1 have assignment : liftingValues(B, h, x, y, s, α, β) : 3 → algebraCarrier(polynomialAlgebra(B, 1)) rw (polynomialAlgebra.carrierOf at B, 1) exact liftingValues.function with * have hom := evaluationHom.algebra_hom at B, 3, polynomialAlgebra(B, 1), liftingValues(B, h, x, y, s, α, β) with base, polynomial, over, assignment rw [polynomialAlgebra.ring, polynomialAlgebra.map] at hom exact hom theorem liftingEvaluation.ring_hom shows evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β)) : polynomialRing(B, 3) →+* polynomialRing(B, 1) proof have constants := polynomialConstant.hom at B, 1 with base have assignment := liftingValues.function at B, h, x, y, s, α, β with * exact evaluationHom.hom at B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β) with base, polynomials, constants, assignment -- The cusp and Bézout relations carried into B[T] by the constants. theorem liftingValues.cusp requires cusp : x^2 + y^3 = h*s shows polynomialConstant(B, 1)(x)^2 + polynomialConstant(B, 1)(y)^3 = polynomialConstant(B, 1)(h) * polynomialConstant(B, 1)(s) proof have constants := polynomialConstant.hom at B, 1 with base exact RingHom.map_cusp at B, polynomialRing(B, 1), polynomialConstant(B, 1), h, x, y, s with base, polynomials, constants, cusp theorem liftingValues.bezout requires bezout : α*h + β*y = B[1] shows polynomialConstant(B, 1)(α) * polynomialConstant(B, 1)(h) + polynomialConstant(B, 1)(β) * polynomialConstant(B, 1)(y) = Ring.one(polynomialRing(B, 1)) proof have constants := polynomialConstant.hom at B, 1 with base exact RingHom.map_bezout at B, polynomialRing(B, 1), polynomialConstant(B, 1), h, y, α, β with base, polynomials, constants, bezout end Values -- The lifting lemma: the forward and backward homomorphisms are mutually -- inverse, so Q ≅ B[T]. section Lifting variable (B h x y s α β : Set) hypothesis base : CommRing(B) hypothesis hIn : h ∈ Ring.carrier(B) hypothesis xIn : x ∈ Ring.carrier(B) hypothesis yIn : y ∈ Ring.carrier(B) hypothesis sIn : s ∈ Ring.carrier(B) hypothesis αIn : α ∈ Ring.carrier(B) hypothesis βIn : β ∈ Ring.carrier(B) hypothesis cusp : x^2 + y^3 = h*s hypothesis bezout : α*h + β*y = B[1] hypothesis quotient : CommRing(Algebra.ring(liftingAlgebra(B, h, x, y, s))) -- The Bézout relation carried into Q by the structure map. theorem liftingAlgebra.bezout shows Algebra.map(liftingAlgebra(B, h, x, y, s))(α) * Algebra.map(liftingAlgebra(B, h, x, y, s))(h) + Algebra.map(liftingAlgebra(B, h, x, y, s))(β) * Algebra.map(liftingAlgebra(B, h, x, y, s))(y) = Ring.one(Algebra.ring(liftingAlgebra(B, h, x, y, s))) proof have structureMap := liftingAlgebra.structure_hom at B, h, x, y, s with * exact RingHom.map_bezout at B, Algebra.ring(liftingAlgebra(B, h, x, y, s)), Algebra.map(liftingAlgebra(B, h, x, y, s)), h, y, α, β with base, quotient, structureMap, bezout -- The parameter is a member of Q. theorem liftingParameter.mem shows liftingParameter(B, h, x, y, s, α, β) ∈ algebraCarrier(liftingAlgebra(B, h, x, y, s)) proof unfold liftingParameter unfold algebraCarrier typecheck -- The relations hold between the classes of U, V, W. theorem liftingAlgebra.relations shows liftingVariable(B, h, x, y, s, 0)^3 + Algebra.map(liftingAlgebra(B, h, x, y, s))(h) * liftingVariable(B, h, x, y, s, 1) = Algebra.map(liftingAlgebra(B, h, x, y, s))(x) ∧ -liftingVariable(B, h, x, y, s, 0)^2 + Algebra.map(liftingAlgebra(B, h, x, y, s))(h) * liftingVariable(B, h, x, y, s, 2) = Algebra.map(liftingAlgebra(B, h, x, y, s))(y) ∧ cuspS(Algebra.ring(liftingAlgebra(B, h, x, y, s)), Algebra.map(liftingAlgebra(B, h, x, y, s))(h), liftingVariable(B, h, x, y, s, 0), liftingVariable(B, h, x, y, s, 1), liftingVariable(B, h, x, y, s, 2)) = Algebra.map(liftingAlgebra(B, h, x, y, s))(s) proof have projection := liftingProjection.ring_hom at B, h, x, y, s with * have polynomials := polynomialRing.comm_ring at B, 3 with base have constantH := liftingProjection.constant at B, h, x, y, s, h with * have constantX := liftingProjection.constant at B, h, x, y, s, x with * have constantY := liftingProjection.constant at B, h, x, y, s, y with * have constantS := liftingProjection.constant at B, h, x, y, s, s with * have variableU := liftingProjection.variable at B, h, x, y, s, 0 have variableV := liftingProjection.variable at B, h, x, y, s, 1 have variableW := liftingProjection.variable at B, h, x, y, s, 2 -- The projection kills each relation; push it through the relation. have memberX : relX(B, h, x) ∈ liftingRelations(B, h, x, y, s) unfold liftingRelations simp have memberY : relY(B, h, y) ∈ liftingRelations(B, h, x, y, s) unfold liftingRelations simp have memberS : relS(B, h, s) ∈ liftingRelations(B, h, x, y, s) unfold liftingRelations simp have killX := liftingProjection.kills at B, h, x, y, s, relX(B, h, x) with * have killY := liftingProjection.kills at B, h, x, y, s, relY(B, h, y) with * have killS := liftingProjection.kills at B, h, x, y, s, relS(B, h, s) with * unfold relX at killX unfold relY at killY unfold relS at killS simp [RingHom.map_sub, RingHom.map_add, RingHom.map_mul, RingHom.map_pow, constantH, constantX, variableU, variableV] at killX simp [RingHom.map_sub, RingHom.map_add, RingHom.map_neg, RingHom.map_mul, RingHom.map_pow, constantH, constantY, variableU, variableW] at killY simp [RingHom.map_sub, cuspS.map, constantH, constantS, variableU, variableV, variableW] at killS -- The value of S in Q is placed in the ring for linear_combination. have cuspIn : cuspS(Algebra.ring(liftingAlgebra(B, h, x, y, s)), Algebra.map(liftingAlgebra(B, h, x, y, s))(h), liftingVariable(B, h, x, y, s, 0), liftingVariable(B, h, x, y, s, 1), liftingVariable(B, h, x, y, s, 2)) ∈ Ring.carrier(Algebra.ring(liftingAlgebra(B, h, x, y, s))) := cuspS.mem with * constructor . linear_combination killX constructor . linear_combination killY . unfold cuspS at killS unfold cuspS linear_combination killS -- The inverse formulas satisfy the relations in B[T]. theorem liftingValues.relations shows evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β))(relX(B, h, x)) = Ring.zero(polynomialRing(B, 1)) ∧ evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β))(relY(B, h, y)) = Ring.zero(polynomialRing(B, 1)) ∧ evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β))(relS(B, h, s)) = Ring.zero(polynomialRing(B, 1)) proof have polynomials := polynomialRing.comm_ring at B, 1 with base -- The constants and T are members of B[T], so ring can place the terms. have memberH : polynomialConstant(B, 1)(h) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberX : polynomialConstant(B, 1)(x) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberY : polynomialConstant(B, 1)(y) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberS : polynomialConstant(B, 1)(s) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberα : polynomialConstant(B, 1)(α) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberβ : polynomialConstant(B, 1)(β) ∈ Ring.carrier(polynomialRing(B, 1)) := polynomialConstant.mem with * have memberT : X(B, 1, 0) ∈ Ring.carrier(polynomialRing(B, 1)) := X.mem with * have constants := polynomialConstant.hom at B, 1 with base have assignment := liftingValues.function at B, h, x, y, s, α, β with * have evaluation := liftingEvaluation.ring_hom at B, h, x, y, s, α, β with * have zero : 0 ∈ 3 by simp [membership.three] have one : 1 ∈ 3 by simp [membership.three] have two : 2 ∈ 3 by simp [membership.three] obtain ⟨valueU, valueV, valueW⟩ := liftingValues.value at B, h, x, y, s, α, β with * -- The relations hold in B[T] by inverse_relations over the constants. have cuspP := liftingValues.cusp at B, h, x, y, s, α, β with * have bezoutP := liftingValues.bezout at B, h, x, y, s, α, β with * obtain ⟨relationX, relationY, relationS⟩ := inverse_relations at polynomialRing(B, 1), polynomialConstant(B, 1)(h), polynomialConstant(B, 1)(x), polynomialConstant(B, 1)(y), polynomialConstant(B, 1)(s), polynomialConstant(B, 1)(α), polynomialConstant(B, 1)(β), X(B, 1, 0) with polynomials, cuspP, bezoutP unfold polyV at valueV unfold polyW at valueV, valueW unfold polyU at valueU, valueV, valueW unfold polyG at valueV, valueW constructor . unfold relX simp [RingHom.map_sub, RingHom.map_add, RingHom.map_mul, RingHom.map_pow, evaluationHom.map_constant, evaluationHom.map_X, valueU, valueV, relationX] rw Ring.sub.value ring constructor . unfold relY simp [RingHom.map_sub, RingHom.map_add, RingHom.map_neg, RingHom.map_mul, RingHom.map_pow, evaluationHom.map_constant, evaluationHom.map_X, valueU, valueW, relationY] rw Ring.sub.value ring . unfold relS simp [RingHom.map_sub, cuspS.map, evaluationHom.map_constant, evaluationHom.map_X, valueU, valueV, valueW, relationS] rw Ring.sub.value ring -- The evaluation kills the relations. theorem liftingEvaluation.kills shows ∀ g ∈ liftingRelations(B, h, x, y, s), evaluationHom(B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β))(g) = Ring.zero(Algebra.ring(polynomialAlgebra(B, 1))) proof obtain ⟨relationX, relationY, relationS⟩ := liftingValues.relations at B, h, x, y, s, α, β with * intros g hg rw polynomialAlgebra.ring unfold liftingRelations at hg simp at hg rcases hg with hX | hY | hS . rw hX exact relationX . rw hY exact relationY . rw hS exact relationS -- The forward homomorphism, and its values on the classes of U, V, W. theorem liftingForward.hom shows liftingForward(B, h, x, y, s, α, β) : liftingAlgebra(B, h, x, y, s) →ₐ polynomialAlgebra(B, 1) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have generators := liftingRelations.subset at B, h, x, y, s with * have hom := liftingEvaluation.hom at B, h, x, y, s, α, β with * have killed := liftingEvaluation.kills at B, h, x, y, s, α, β with * have lifted := AlgebraHom.lift_generated with polynomial, generators, hom, killed rw polynomialAlgebra.ring at lifted unfold liftingForward unfold liftingAlgebra unfold liftingIdeal exact lifted theorem liftingForward.variable (i : Set) requires index : i ∈ 3 shows liftingForward(B, h, x, y, s, α, β)( liftingVariable(B, h, x, y, s, i)) = liftingValues(B, h, x, y, s, α, β)(i) proof have polynomial := polynomialAlgebra.algebra at B, 3 with base have generators := liftingRelations.subset at B, h, x, y, s with * have hom := liftingEvaluation.hom at B, h, x, y, s, α, β with * have killed := liftingEvaluation.kills at B, h, x, y, s, α, β with * have member : X(B, 3, i) ∈ algebraCarrier(polynomialAlgebra(B, 3)) rw (polynomialAlgebra.carrierOf at B, 3) exact X.mem at B, 3, i with base have factors := AlgebraHom.lift_generated_factors with polynomial, generators, hom, killed, member rw polynomialAlgebra.ring at factors have polynomials := polynomialRing.comm_ring at B, 1 with base have constants := polynomialConstant.hom at B, 1 with base have assignment := liftingValues.function at B, h, x, y, s, α, β with * have value := evaluationHom.map_X at B, polynomialRing(B, 1), 3, polynomialConstant(B, 1), liftingValues(B, h, x, y, s, α, β), i with base, polynomials, constants, assignment, index unfold liftingForward unfold liftingVariable unfold liftingIdeal rw factors exact value -- The backward homomorphism, and its value on T. theorem liftingBackward.hom shows liftingBackward(B, h, x, y, s, α, β) : polynomialAlgebra(B, 1) →ₐ liftingAlgebra(B, h, x, y, s) proof have algebra := liftingAlgebra.algebra at B, h, x, y, s with * have over := liftingAlgebra.base at B, h, x, y, s have parameterIn := liftingParameter.mem at B, h, x, y, s, α, β with * have values := pointMap.function with parameterIn unfold liftingBackward exact evaluationHom.algebra_hom with base, algebra, over, values theorem liftingBackward.variable shows liftingBackward(B, h, x, y, s, α, β)(X(B, 1, 0)) = liftingParameter(B, h, x, y, s, α, β) proof have algebra := liftingAlgebra.algebra at B, h, x, y, s with * have over := liftingAlgebra.base at B, h, x, y, s have parameterIn := liftingParameter.mem at B, h, x, y, s, α, β with * have values := pointMap.function with parameterIn have zero : 0 ∈ 1 by simp [membership.one] have value := evaluationHom.algebra_X at B, 1, liftingAlgebra(B, h, x, y, s), pointMap(algebraCarrier(liftingAlgebra(B, h, x, y, s)), liftingParameter(B, h, x, y, s, α, β)), 0 with base, algebra, over, values, zero have point := pointMap.zero with parameterIn unfold liftingBackward rw value exact point -- The two homomorphisms on the constants, the forward one on the -- parameter, and the backward one on the inverse formulas. theorem liftingForward.constant (a : Set) requires member : a ∈ Ring.carrier(B) shows liftingForward(B, h, x, y, s, α, β)( Algebra.map(liftingAlgebra(B, h, x, y, s))(a)) = polynomialConstant(B, 1)(a) proof have forward := liftingForward.hom at B, h, x, y, s, α, β with * have inBase : a ∈ Ring.carrier(Algebra.base(liftingAlgebra(B, h, x, y, s))) rw liftingAlgebra.base exact member have commutes := AlgebraHom.map_base with forward, inBase rw polynomialAlgebra.map at commutes exact commutes theorem liftingBackward.constant (a : Set) requires member : a ∈ Ring.carrier(B) shows liftingBackward(B, h, x, y, s, α, β)(polynomialConstant(B, 1)(a)) = Algebra.map(liftingAlgebra(B, h, x, y, s))(a) proof have backward := liftingBackward.hom at B, h, x, y, s, α, β with * have inBase : a ∈ Ring.carrier(Algebra.base(polynomialAlgebra(B, 1))) rw polynomialAlgebra.base exact member have commutes := AlgebraHom.map_base with backward, inBase rw polynomialAlgebra.map at commutes exact commutes theorem liftingForward.parameter shows liftingForward(B, h, x, y, s, α, β)( liftingParameter(B, h, x, y, s, α, β)) = X(B, 1, 0) proof have forwardHom := AlgebraHom.ring_hom with (liftingForward.hom at B, h, x, y, s, α, β with *) rw polynomialAlgebra.ring at forwardHom have polynomials := polynomialRing.comm_ring at B, 1 with base have zero : 0 ∈ 3 by simp [membership.three] have one : 1 ∈ 3 by simp [membership.three] have two : 2 ∈ 3 by simp [membership.three] have forwardU := liftingForward.variable at B, h, x, y, s, α, β, 0 with * have forwardV := liftingForward.variable at B, h, x, y, s, α, β, 1 with * have forwardW := liftingForward.variable at B, h, x, y, s, α, β, 2 with * obtain ⟨valueU, valueV, valueW⟩ := liftingValues.value at B, h, x, y, s, α, β with * have constantα := liftingForward.constant at B, h, x, y, s, α, β, α with * have constantβ := liftingForward.constant at B, h, x, y, s, α, β, β with * have bezoutP := liftingValues.bezout at B, h, x, y, s, α, β with * -- The parameter goes to the parameter of the inverse formulas, which is -- T by inverse_parameter. unfold liftingParameter simp [parameter.map, constantα, constantβ, forwardU, forwardV, forwardW, valueU, valueV, valueW] unfold polyV unfold polyW unfold polyU unfold polyG exact inverse_parameter at polynomialRing(B, 1), polynomialConstant(B, 1)(h), polynomialConstant(B, 1)(x), polynomialConstant(B, 1)(y), polynomialConstant(B, 1)(s), polynomialConstant(B, 1)(α), polynomialConstant(B, 1)(β), X(B, 1, 0) with polynomials, bezoutP theorem liftingBackward.values shows liftingBackward(B, h, x, y, s, α, β)(polyU(B, h, x, β)) = liftingVariable(B, h, x, y, s, 0) ∧ liftingBackward(B, h, x, y, s, α, β)(polyV(B, h, x, y, s, α, β)) = liftingVariable(B, h, x, y, s, 1) ∧ liftingBackward(B, h, x, y, s, α, β)(polyW(B, h, x, y, s, α, β)) = liftingVariable(B, h, x, y, s, 2) proof have backwardHom := AlgebraHom.ring_hom with (liftingBackward.hom at B, h, x, y, s, α, β with *) rw polynomialAlgebra.ring at backwardHom have polynomials := polynomialRing.comm_ring at B, 1 with base have constantH := liftingBackward.constant at B, h, x, y, s, α, β, h with * have constantX := liftingBackward.constant at B, h, x, y, s, α, β, x with * have constantY := liftingBackward.constant at B, h, x, y, s, α, β, y with * have constantS := liftingBackward.constant at B, h, x, y, s, α, β, s with * have constantα := liftingBackward.constant at B, h, x, y, s, α, β, α with * have constantβ := liftingBackward.constant at B, h, x, y, s, α, β, β with * have variableT := liftingBackward.variable at B, h, x, y, s, α, β with * -- The inverse formulas go to the inverse formulas at the parameter in -- Q, which return the classes of U, V, W by original_reconstruction. have bezoutQ := liftingAlgebra.bezout at B, h, x, y, s, α, β with * obtain ⟨relationX, relationY, relationS⟩ := liftingAlgebra.relations at B, h, x, y, s, α, β with * obtain ⟨recoveredU, recoveredV, recoveredW⟩ := original_reconstruction at Algebra.ring(liftingAlgebra(B, h, x, y, s)), Algebra.map(liftingAlgebra(B, h, x, y, s))(h), Algebra.map(liftingAlgebra(B, h, x, y, s))(x), Algebra.map(liftingAlgebra(B, h, x, y, s))(y), Algebra.map(liftingAlgebra(B, h, x, y, s))(s), Algebra.map(liftingAlgebra(B, h, x, y, s))(α), Algebra.map(liftingAlgebra(B, h, x, y, s))(β), liftingVariable(B, h, x, y, s, 0), liftingVariable(B, h, x, y, s, 1), liftingVariable(B, h, x, y, s, 2) with quotient, bezoutQ, relationX, relationY, relationS unfold liftingParameter at variableT unfold polyV unfold polyW unfold polyU unfold polyG simp [inverseU.map, inverseG.map, inverseW.map, inverseV.map, constantH, constantX, constantY, constantS, constantα, constantβ, variableT, recoveredU, recoveredV, recoveredW] -- The main theorems: the composites are the identities, by the two -- extensionality principles, and the forward map is an isomorphism. -- Forward after backward is the identity of B[T]: T goes to the parameter -- and back to T by inverse_parameter. theorem liftingForward.after_backward (p : Set) requires member : p ∈ Ring.carrier(polynomialRing(B, 1)) shows liftingForward(B, h, x, y, s, α, β)( liftingBackward(B, h, x, y, s, α, β)(p)) = p proof have forward := liftingForward.hom at B, h, x, y, s, α, β with * have backward := liftingBackward.hom at B, h, x, y, s, α, β with * have polynomial := polynomialAlgebra.algebra at B, 1 with base have composite := AlgebraHom.compose with backward, forward have identityHom := AlgebraHom.identity with polynomial have forwardFunction := AlgebraHom.function with forward have backwardFunction := AlgebraHom.function with backward have memberP : p ∈ algebraCarrier(polynomialAlgebra(B, 1)) rw (polynomialAlgebra.carrierOf at B, 1) exact member -- The composite and the identity agree on the variable T. have agree : ∀ j ∈ 1, compose(liftingForward(B, h, x, y, s, α, β), liftingBackward(B, h, x, y, s, α, β), algebraCarrier(polynomialAlgebra(B, 1)), algebraCarrier(liftingAlgebra(B, h, x, y, s)), algebraCarrier(polynomialAlgebra(B, 1)))(X(B, 1, j)) = identity(algebraCarrier(polynomialAlgebra(B, 1)))(X(B, 1, j)) intros j hj have index := membership.one.forward with hj rw index have memberT : X(B, 1, 0) ∈ algebraCarrier(polynomialAlgebra(B, 1)) rw (polynomialAlgebra.carrierOf at B, 1) exact X.mem at B, 1, 0 with base rw compose.apply with backwardFunction, forwardFunction, memberT rw identity.apply with memberT rw (liftingBackward.variable at B, h, x, y, s, α, β with *) exact liftingForward.parameter at B, h, x, y, s, α, β with * have same := AlgebraHom.polynomial_ext with base, composite, identityHom, agree have composed := compose.apply with backwardFunction, forwardFunction, memberP have identityP := identity.apply with memberP rw ← composed rw same exact identityP -- Backward after forward is the identity of Q: the classes of U, V, W are -- recovered from the parameter by original_reconstruction. theorem liftingBackward.after_forward (q : Set) requires member : q ∈ algebraCarrier(liftingAlgebra(B, h, x, y, s)) shows liftingBackward(B, h, x, y, s, α, β)( liftingForward(B, h, x, y, s, α, β)(q)) = q proof have forward := liftingForward.hom at B, h, x, y, s, α, β with * have backward := liftingBackward.hom at B, h, x, y, s, α, β with * have algebra := liftingAlgebra.algebra at B, h, x, y, s with * have polynomial := polynomialAlgebra.algebra at B, 3 with base have ideal := liftingIdeal.ideal at B, h, x, y, s with * have projection := liftingProjection.hom at B, h, x, y, s with * have projectionFunction := liftingProjection.function at B, h, x, y, s with * have composite := AlgebraHom.compose with forward, backward have compositeFunction := AlgebraHom.function with composite have forwardFunction := AlgebraHom.function with forward have backwardFunction := AlgebraHom.function with backward have composed := AlgebraHom.compose with projection, composite have identityHom := AlgebraHom.identity with algebra obtain ⟨backU, backV, backW⟩ := liftingBackward.values at B, h, x, y, s, α, β with * obtain ⟨valueU, valueV, valueW⟩ := liftingValues.value at B, h, x, y, s, α, β with * unfold liftingVariable at backU, backV, backW -- The composite after the projection agrees with the projection on the -- variables U, V, W, hence on all of B[U, V, W]. have agreeX : ∀ j ∈ 3, compose(compose(liftingBackward(B, h, x, y, s, α, β), liftingForward(B, h, x, y, s, α, β), algebraCarrier(liftingAlgebra(B, h, x, y, s)), algebraCarrier(polynomialAlgebra(B, 1)), algebraCarrier(liftingAlgebra(B, h, x, y, s))), algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s)), algebraCarrier(polynomialAlgebra(B, 3)), algebraCarrier(liftingAlgebra(B, h, x, y, s)), algebraCarrier(liftingAlgebra(B, h, x, y, s)))(X(B, 3, j)) = algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))( X(B, 3, j)) intros j hj have memberX : X(B, 3, j) ∈ algebraCarrier(polynomialAlgebra(B, 3)) rw (polynomialAlgebra.carrierOf at B, 3) exact X.mem at B, 3, j with base have projected := FunctionBetween.apply_closed with projectionFunction, memberX rw compose.apply with projectionFunction, compositeFunction, memberX rw compose.apply with forwardFunction, backwardFunction, projected have forwardValue := liftingForward.variable at B, h, x, y, s, α, β, j with * unfold liftingVariable at forwardValue rw forwardValue have cases := membership.three.forward with hj rcases cases with rfl | rfl | rfl . rw valueU exact backU . rw valueV exact backV . rw valueW exact backW have sameHom := AlgebraHom.polynomial_ext with base, composed, projection, agreeX -- So the composite is the identity on every class, by quotient_ext. have agree : ∀ z ∈ algebraCarrier(polynomialAlgebra(B, 3)), compose(liftingBackward(B, h, x, y, s, α, β), liftingForward(B, h, x, y, s, α, β), algebraCarrier(liftingAlgebra(B, h, x, y, s)), algebraCarrier(polynomialAlgebra(B, 1)), algebraCarrier(liftingAlgebra(B, h, x, y, s)))( algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))(z)) = identity(algebraCarrier(liftingAlgebra(B, h, x, y, s)))( algebraProjection(polynomialAlgebra(B, 3), liftingIdeal(B, h, x, y, s))(z)) intros z hz have projected := FunctionBetween.apply_closed with projectionFunction, hz have step := compose.apply with projectionFunction, compositeFunction, hz rw identity.apply with projected rw ← step rw sameHom unfold liftingAlgebra at composite, identityHom, agree have same := AlgebraHom.quotient_ext with polynomial, ideal, composite, identityHom, agree have composedQ := compose.apply with forwardFunction, backwardFunction, member rw ← composedQ unfold liftingAlgebra unfold liftingAlgebra at member rw same exact identity.apply with member theorem lifting_equivalence shows liftingForward(B, h, x, y, s, α, β) : liftingAlgebra(B, h, x, y, s) ≃ₐ polynomialAlgebra(B, 1) proof have forward := liftingForward.hom at B, h, x, y, s, α, β with * have backward := liftingBackward.hom at B, h, x, y, s, α, β with * have left : ∀ q ∈ algebraCarrier(liftingAlgebra(B, h, x, y, s)), liftingBackward(B, h, x, y, s, α, β)( liftingForward(B, h, x, y, s, α, β)(q)) = q intros q hq exact liftingBackward.after_forward at B, h, x, y, s, α, β, q with * have right : ∀ p ∈ algebraCarrier(polynomialAlgebra(B, 1)), liftingForward(B, h, x, y, s, α, β)( liftingBackward(B, h, x, y, s, α, β)(p)) = p intros p hp rw (polynomialAlgebra.carrierOf at B, 1) at hp exact liftingForward.after_backward at B, h, x, y, s, α, β, p with * exact AlgebraIso.of_inverse with forward, backward, left, right end Lifting