1-- The polynomial identities behind the explicit hypersurface: the cusp2-- identity (u³ + hv)² + (−u² + hw)³ = h·S, the shift identity, and the3-- Bézout certificate, over every commutative ring.4-- Part of Cumulus, the Grace17 mathematics library.5-- Copyright (c) 2026 Grant Passmore.6-- Released under the Apache License 2.0. See LICENSE in the repository root.7-- Authors: Grant Passmore89module Grace.Cumulus.AlgebraicGeometry.Coordinates.Identities10import Grace.Cumulus.Algebra.Ring1112section Identities13variable (R : Set)14hypothesisring : CommRing(R)1516-- The four polynomials.1718-- S(h, u, v, w), with h·S the cusp x² + y³ of x = u³ + hv, y = −u² + hw.19def cuspS (h u v w : Set) : Set:=20 R[2]*u^3*v + R[3]*u^4*w + h*(v^2 - R[3]*u^2*w^2) + h^2*w^32122-- P(x, y, s), the correction in the shift identity.23def shiftP (x y s : Set) : Set:= -R[2]*s^2*x + R[3]*s*y^2 - R[3]*s^3*y2425-- The Bézout coefficients of h and y.26def bezoutAlpha (x s : Set) : Set:= R[1] + R[2]*s^2*x + R[4]*s^52728def bezoutBeta (x y s : Set) : Set:=29 (R[3]*s^3 - R[3]*s*y)*(R[1] + R[2]*s^2*x) - R[4]*s^4*y^23031-- Each is a member of R.3233instance cuspS.mem (h u v w : R)34shows cuspS(R, h, u, v, w) ∈ R35proof36unfold cuspS37typecheck3839instance shiftP.mem (x y s : R)40shows shiftP(R, x, y, s) ∈ R41proof42unfold shiftP43typecheck4445instance bezoutAlpha.mem (x s : R)46shows bezoutAlpha(R, x, s) ∈ R47proof48unfold bezoutAlpha49typecheck5051instance bezoutBeta.mem (x y s : R)52shows bezoutBeta(R, x, y, s) ∈ R53proof54unfold bezoutBeta55typecheck5657-- The three identities, each a ring identity once the names are opened.5859theorem cusp_universal (h u v w : R)60shows (u^3+ h*v)^2+ (-u^2+ h*w)^3= h * cuspS(R, h, u, v, w)61proof62unfold cuspS63ring6465theorem shift_universal (x y s : R)66shows (x + s^3)^2+ (y - s^2)^3= x^2+ y^3 - s * shiftP(R, x, y, s)67proof68unfold shiftP69ring7071theorem bezout_certificate (h x y s : R)72shows bezoutAlpha(R, x, s)*h + bezoutBeta(R, x, y, s)*y - R[1] =73 (R[1] + R[2]*s^2*x)*(h - R[1] - shiftP(R, x, y, s)) -74 R[4]*s^4*(x^2+ y^3 - s*h)75proof76unfold bezoutAlpha77unfold bezoutBeta78unfold shiftP79ring8081end Identities8283-- Ring homomorphisms carry S and P along, and with them the cusp and84-- Bézout relations.85section Transport86variable (R S f : Set)87hypothesis source : CommRing(R)88hypothesis target : CommRing(S)89hypothesis hom : f : R→+* S9091theorem cuspS.map (h u v w : R)92shows f(cuspS(R, h, u, v, w)) = cuspS(S, f(h), f(u), f(v), f(w))93proof94have two := RingHom.map_two with*95have three := RingHom.map_three with*96unfold cuspS97simp [RingHom.map_add, RingHom.map_mul, RingHom.map_sub, RingHom.map_pow,98 two, three]99100theorem RingHom.map_shiftP (x y s : R)101shows f(shiftP(R, x, y, s)) = shiftP(S, f(x), f(y), f(s))102proof103have two := RingHom.map_two with*104have three := RingHom.map_three with*105unfold shiftP106simp [RingHom.map_sub, RingHom.map_add, RingHom.map_mul, RingHom.map_neg,107 RingHom.map_pow, two, three]108109theorem RingHom.map_cusp (h x y s : R)110requires cusp : x^2+ y^3= h*s111shows f(x)^2+ f(y)^3= f(h)*f(s)112proof113have mapped : f(x^2+ y^3) = f(h*s)114rw cusp115have sum := RingHom.map_add at f, R, S, x^2, y^3with hom116have powerX := RingHom.map_pow at R, S, f, x, 2with*117have powerY := RingHom.map_pow at R, S, f, y, 3with*118have product := RingHom.map_mul at f, R, S, h, s with hom119rw [sum, powerX, powerY, product] at mapped120exact mapped121122theorem RingHom.map_bezout (h y α β : R)123requires bezout : α*h + β*y = R[1]124shows f(α)*f(h) + f(β)*f(y) = S[1]125proof126have mapped : f(α*h + β*y) = f(R[1])127rw bezout128have sum := RingHom.map_add at f, R, S, α*h, β*y with hom129have productα := RingHom.map_mul at f, R, S, α, h with hom130have productβ := RingHom.map_mul at f, R, S, β, y with hom131have one := RingHom.map_one at f, R, S with hom132rw [sum, productα, productβ, one] at mapped133exact mapped134135end Transport136