Grace/Cumulus/AlgebraicGeometry/Coordinates/LiftingIdentities.g17
Imports
Grace.Cumulus.AlgebraicGeometry.Coordinates.Identities · Grace.Cumulus.Algebra.Ring
Declarations
- substitute_S theorem derivation
- compatibility_identity theorem derivation
- compatibility theorem derivation
- squared_bezout theorem derivation
- solve_h theorem derivation
- solve_c theorem derivation
- solve_unique theorem derivation
- linear_parameter_relation theorem derivation
- linear_parameter_inverse theorem derivation
- recover_U theorem derivation
- recover_G theorem derivation
- original_to_linear theorem derivation
- linear_to_original theorem derivation
- inverseU def
- inverseG def
- inverseW def
- inverseV def
- parameter def
- inverseU.mem instance derivation
- inverseG.mem instance derivation
- inverseW.mem instance derivation
- inverseV.mem instance derivation
- parameter.mem instance derivation
- inverse_relations theorem derivation
- inverse_parameter theorem derivation
- original_reconstruction theorem derivation
- inverseU.map theorem derivation
- inverseG.map theorem derivation
- inverseW.map theorem derivation
- inverseV.map theorem derivation
- parameter.map theorem derivation
Source
1-- The identities behind the lifting lemma: the substitution of V = G − UW2-- into S, the compatibility of the linear presentation with the cusp, the3-- squared Bézout relation, the solution of a pair of linear equations with4-- a Bézout certificate, and the passage between the original relations5-- (x, y, s) and the linear ones (h, G, W) in both directions.6-- Part of Cumulus, the Grace17 mathematics library.7-- Copyright (c) 2026 Grant Passmore.8-- Released under the Apache License 2.0. See LICENSE in the repository root.9-- Authors: Grant Passmore1011module Grace.Cumulus.AlgebraicGeometry.Coordinates.LiftingIdentities12import Grace.Cumulus.AlgebraicGeometry.Coordinates.Identities13import Grace.Cumulus.Algebra.Ring1415section LiftingIdentities16variable (R : Set)17hypothesis ring : CommRing(R)1819-- The substitution V = G − UW in S, and the cusp in the linear variables.2021theorem substitute_S (h U G W : R)22 shows cuspS(R, h, U, G - U*W, W) =23 h*G^2 - R[2]*U*(h*W - U^2)*G + (h*W - U^2)^2*W24proof25 unfold cuspS26 ring2728theorem compatibility_identity (h y s U G : R)29 shows y^2*(y + U^2) - h*(s - h*G^2 + R[2]*U*y*G) =30 (h*G - y*U)^2 + y^3 - h*s31proof32 ring3334theorem compatibility (h x y s U G : R)35 requires cusp : x^2 + y^3 = h*s36 requires linear : h*G - y*U = x37 shows y^2*(y + U^2) = h*(s - h*G^2 + R[2]*U*y*G)38proof39 linear_combination (h*G - y*U + x) * linear + cusp4041-- Linear equations hW = a, cW = b with a Bézout certificate rh + qc = 1:42-- W = ra + qb is a solution when ca = hb, and the only one.4344theorem squared_bezout (h y α β : R)45 requires bezout : α*h + β*y = R[1]46 shows α*(R[1] + β*y)*h + β^2*y^2 = R[1]47proof48 linear_combination (R[1] + β*y) * bezout4950theorem solve_h (h c a b r q : R)51 requires cross : c*a = h*b52 requires bezout : r*h + q*c = R[1]53 shows h*(r*a + q*b) = a54proof55 linear_combination a * bezout - q * cross5657theorem solve_c (h c a b r q : R)58 requires cross : c*a = h*b59 requires bezout : r*h + q*c = R[1]60 shows c*(r*a + q*b) = b61proof62 linear_combination b * bezout + r * cross6364theorem solve_unique (h c a b r q W : R)65 requires bezout : r*h + q*c = R[1]66 requires first : h*W = a67 requires second : c*W = b68 shows W = r*a + q*b69proof70 linear_combination (-W) * bezout + r * first + q * second7172-- The parameter T against U and G: U = hT − βx, G = yT + αx satisfy the73-- linear relation, T = αU + βG recovers T, and U, G are recovered from T.7475theorem linear_parameter_relation (h x y α β T : R)76 requires bezout : α*h + β*y = R[1]77 shows h*(y*T + α*x) - y*(h*T - β*x) = x78proof79 linear_combination x * bezout8081theorem linear_parameter_inverse (h x y α β T : R)82 requires bezout : α*h + β*y = R[1]83 shows α*(h*T - β*x) + β*(y*T + α*x) = T84proof85 linear_combination T * bezout8687theorem recover_U (h x y α β U G : R)88 requires bezout : α*h + β*y = R[1]89 requires linear : h*G - y*U = x90 shows h*(α*U + β*G) - β*x = U91proof92 linear_combination U * bezout + β * linear9394theorem recover_G (h x y α β U G : R)95 requires bezout : α*h + β*y = R[1]96 requires linear : h*G - y*U = x97 shows y*(α*U + β*G) + α*x = G98proof99 linear_combination G * bezout - α * linear100101-- The two presentations are equivalent.102103-- From the original relations to the linear ones, with G = V + UW.104theorem original_to_linear (h x y s U V W : R)105 requires relX : U^3 + h*V = x106 requires relY : -U^2 + h*W = y107 requires relS : cuspS(R, h, U, V, W) = s108 shows h*(V + U*W) - y*U = x ∧ h*W = y + U^2 ∧109 y^2*W = s - h*(V + U*W)^2 + R[2]*U*y*(V + U*W)110proof111 unfold cuspS at relS112 constructor113 . linear_combination relX + U * relY114 constructor115 . linear_combination relY116 . linear_combination relS -117 (W*(y + h*W - U^2) - R[2]*U*(V + U*W)) * relY118119-- From the linear relations back to the original ones, with V = G − UW.120theorem linear_to_original (h x y s U G W : R)121 requires linear : h*G - y*U = x122 requires square : h*W = y + U^2123 requires cubic : y^2*W = s - h*G^2 + R[2]*U*y*G124 shows U^3 + h*(G - U*W) = x ∧ -U^2 + h*W = y ∧125 cuspS(R, h, U, G - U*W, W) = s126proof127 unfold cuspS128 constructor129 . linear_combination linear - U * square130 constructor131 . linear_combination square132 . linear_combination cubic + (W*(h*W - U^2 + y) - R[2]*U*G) * square133134end LiftingIdentities135136-- The inverse formulas: from the parameter T, the point (U, V, W) over137-- (h, x, y, s) with the Bézout coefficients α, β.138section Reconstruction139variable (R : Set)140hypothesis ring : CommRing(R)141142-- The formulas.143144def inverseU (h x β T : Set) : Set := h*T - β*x145146def inverseG (x y α T : Set) : Set := y*T + α*x147148def inverseW (h y s α β U G : Set) : Set :=149 α*(R[1] + β*y)*(y + U^2) + β^2*(s - h*G^2 + R[2]*U*y*G)150151def inverseV (U G W : Set) : Set := G - U*W152153def parameter (α β U V W : Set) : Set := α*U + β*(V + U*W)154155-- Each is a member of R.156157instance inverseU.mem (h x β T : R)158 shows inverseU(R, h, x, β, T) ∈ R159proof160 unfold inverseU161 typecheck162163instance inverseG.mem (x y α T : R)164 shows inverseG(R, x, y, α, T) ∈ R165proof166 unfold inverseG167 typecheck168169instance inverseW.mem (h y s α β U G : R)170 shows inverseW(R, h, y, s, α, β, U, G) ∈ R171proof172 unfold inverseW173 typecheck174175instance inverseV.mem (U G W : R)176 shows inverseV(R, U, G, W) ∈ R177proof178 unfold inverseV179 typecheck180181instance parameter.mem (α β U V W : R)182 shows parameter(R, α, β, U, V, W) ∈ R183proof184 unfold parameter185 typecheck186187-- The point given by the formulas satisfies the original relations, its188-- parameter is T, and the formulas applied to the parameter of a point189-- satisfying the relations return the point.190191theorem inverse_relations (h x y s α β T : R)192 requires cusp : x^2 + y^3 = h*s193 requires bezout : α*h + β*y = R[1]194 shows inverseU(R, h, x, β, T)^3 +195 h*inverseV(R, inverseU(R, h, x, β, T), inverseG(R, x, y, α, T),196 inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),197 inverseG(R, x, y, α, T))) = x ∧198 -inverseU(R, h, x, β, T)^2 +199 h*inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),200 inverseG(R, x, y, α, T)) = y ∧201 cuspS(R, h, inverseU(R, h, x, β, T),202 inverseV(R, inverseU(R, h, x, β, T), inverseG(R, x, y, α, T),203 inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),204 inverseG(R, x, y, α, T))),205 inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),206 inverseG(R, x, y, α, T))) = s207proof208 -- U = hT − βx and G = yT + αx satisfy the linear relation; W solves the209 -- pair hW = y + U², y²W = s − hG² + 2UyG by the squared Bézout relation.210 have linear := linear_parameter_relation at R, h, x, y, α, β, T with *211 have cross := compatibility at R, h, x, y, s, h*T - β*x, y*T + α*x with *212 have squared := squared_bezout at R, h, y, α, β with *213 have square := solve_h at R, h, y^2, y + (h*T - β*x)^2,214 s - h*(y*T + α*x)^2 + R[2]*(h*T - β*x)*y*(y*T + α*x),215 α*(R[1] + β*y), β^2 with *216 have cubic := solve_c at R, h, y^2, y + (h*T - β*x)^2,217 s - h*(y*T + α*x)^2 + R[2]*(h*T - β*x)*y*(y*T + α*x),218 α*(R[1] + β*y), β^2 with *219 unfold inverseV220 unfold inverseW221 unfold inverseU222 unfold inverseG223 exact linear_to_original with linear, square, cubic224225theorem inverse_parameter (h x y s α β T : R)226 requires bezout : α*h + β*y = R[1]227 shows parameter(R, α, β, inverseU(R, h, x, β, T),228 inverseV(R, inverseU(R, h, x, β, T), inverseG(R, x, y, α, T),229 inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),230 inverseG(R, x, y, α, T))),231 inverseW(R, h, y, s, α, β, inverseU(R, h, x, β, T),232 inverseG(R, x, y, α, T))) = T233proof234 have identity := linear_parameter_inverse at R, h, x, y, α, β, T with *235 unfold parameter236 unfold inverseV237 unfold inverseU238 unfold inverseG239 linear_combination identity240241theorem original_reconstruction (h x y s α β U V W : R)242 requires bezout : α*h + β*y = R[1]243 requires relX : U^3 + h*V = x244 requires relY : -U^2 + h*W = y245 requires relS : cuspS(R, h, U, V, W) = s246 shows inverseU(R, h, x, β, parameter(R, α, β, U, V, W)) = U ∧247 inverseV(R, inverseU(R, h, x, β, parameter(R, α, β, U, V, W)),248 inverseG(R, x, y, α, parameter(R, α, β, U, V, W)),249 inverseW(R, h, y, s, α, β,250 inverseU(R, h, x, β, parameter(R, α, β, U, V, W)),251 inverseG(R, x, y, α, parameter(R, α, β, U, V, W)))) = V ∧252 inverseW(R, h, y, s, α, β,253 inverseU(R, h, x, β, parameter(R, α, β, U, V, W)),254 inverseG(R, x, y, α, parameter(R, α, β, U, V, W))) = W255proof256 obtain ⟨linear, square, cubic⟩ :=257 original_to_linear at R, h, x, y, s, U, V, W with *258 have squared := squared_bezout at R, h, y, α, β with *259 have recoverU := recover_U at R, h, x, y, α, β, U, V + U*W with *260 have recoverG := recover_G at R, h, x, y, α, β, U, V + U*W with *261 have valueU : inverseU(R, h, x, β, parameter(R, α, β, U, V, W)) = U262 unfold inverseU263 unfold parameter264 exact recoverU265 have valueG : inverseG(R, x, y, α, parameter(R, α, β, U, V, W)) = V + U*W266 unfold inverseG267 unfold parameter268 exact recoverG269 have valueW : inverseW(R, h, y, s, α, β, U, V + U*W) = W270 unfold inverseW271 symm272 exact solve_unique at R, h, y^2, y + U^2,273 s - h*(V + U*W)^2 + R[2]*U*y*(V + U*W), α*(R[1] + β*y), β^2, W with *274 rw valueU275 rw valueG276 rw valueW277 constructor278 . rfl279 constructor280 . unfold inverseV281 ring282 . rfl283284end Reconstruction285286-- Ring homomorphisms carry the inverse formulas and the parameter along.287section Transport288variable (R S f : Set)289hypothesis source : CommRing(R)290hypothesis target : CommRing(S)291hypothesis hom : f : R →+* S292293theorem inverseU.map (h x β T : R)294 shows f(inverseU(R, h, x, β, T)) = inverseU(S, f(h), f(x), f(β), f(T))295proof296 unfold inverseU297 simp [RingHom.map_sub, RingHom.map_mul]298299theorem inverseG.map (x y α T : R)300 shows f(inverseG(R, x, y, α, T)) = inverseG(S, f(x), f(y), f(α), f(T))301proof302 unfold inverseG303 simp [RingHom.map_add, RingHom.map_mul]304305theorem inverseW.map (h y s α β U G : R)306 shows f(inverseW(R, h, y, s, α, β, U, G)) =307 inverseW(S, f(h), f(y), f(s), f(α), f(β), f(U), f(G))308proof309 have two := RingHom.map_two with *310 have one := RingHom.map_one with hom311 unfold inverseW312 simp [RingHom.map_add, RingHom.map_mul, RingHom.map_sub, RingHom.map_pow,313 two, one]314315theorem inverseV.map (U G W : R)316 shows f(inverseV(R, U, G, W)) = inverseV(S, f(U), f(G), f(W))317proof318 unfold inverseV319 simp [RingHom.map_sub, RingHom.map_mul]320321theorem parameter.map (α β U V W : R)322 shows f(parameter(R, α, β, U, V, W)) =323 parameter(S, f(α), f(β), f(U), f(V), f(W))324proof325 unfold parameter326 simp [RingHom.map_add, RingHom.map_mul]327328end Transport329