-- The critical point (h, u, v, w) = (2, 0, −1/2, 1/2): there x = −1, y = 1, -- s = 1, p = 2, F = −1, and the shifted coordinates vanish, so every -- partial derivative of F vanishes by the ambient identity. -- 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.CriticalPoint import Grace.Cumulus.AlgebraicGeometry.Coordinates.CriticalValues import Grace.Cumulus.AlgebraicGeometry.Coordinates.Ambient import Grace.Cumulus.Algebra.Polynomial.Derivative -- The arithmetic of the evaluations: closed computations in ℂ, carried -- out on real parts, where 2 · (1/2) = 1 does the work. section Arithmetic notation ring ℂ := (complexCarrier, complexAdd, complexZero, complexNeg, complexMul, complexOne) notation ring R := (ℝ, realAdd, realZero, realNeg, realMul, realOne) -- x = u³ + hv = 0 + 2 · (−1/2) = −1. theorem criticalArithmetic.x_is_neg_one shows ℂ[complexZero ^ 3 + criticalH * criticalV] = complexNeg(complexOne) proof have halfReal := half.real at realOne with * have twoReal := realNumeral.real at (2:Nat) with * have negReal : Real(realNeg(half(realOne))) by typecheck unfold complexZero unfold criticalH unfold criticalV simp [realPair.add, realPair.mul, realPair.pow] unfold complexOne have negation := realPair.neg at realOne with * rw negation apply orderedPair.first_congr rw realNumeral.numeral have twice := half.add_self at realOne with * linear_combination (-1) * twice -- y = −u² + hw = 0 + 2 · (1/2) = 1. theorem criticalArithmetic.y_is_one shows ℂ[-complexZero ^ 2 + criticalH * criticalW] = complexOne proof have halfReal := half.real at realOne with * have twoReal := realNumeral.real at (2:Nat) with * unfold complexZero unfold criticalH unfold criticalW simp [realPair.add, realPair.mul, realPair.neg, realPair.pow] unfold complexOne apply orderedPair.first_congr rw realNumeral.numeral have twice := half.add_self at realOne with * linear_combination twice -- s = S(h, u, v, w) = hv² + h²w³ = 2 · 1/4 + 4 · 1/8 = 1, as u = 0 kills -- the other terms. theorem criticalArithmetic.s_is_one shows ℂ[2 * complexZero^3 * criticalV + 3 * complexZero^4 * criticalW + criticalH * (criticalV^2 - 3 * complexZero^2 * criticalW^2) + criticalH^2 * criticalW^3] = complexOne proof have halfReal := half.real at realOne with * have twoReal := realNumeral.real at (2:Nat) with * have negReal : Real(realNeg(half(realOne))) by typecheck have reduce : ℂ[2 * complexZero^3 * criticalV + 3 * complexZero^4 * criticalW + criticalH * (criticalV^2 - 3 * complexZero^2 * criticalW^2) + criticalH^2 * criticalW^3] = ℂ[criticalH * criticalV^2 + criticalH^2 * criticalW^3] ring rw reduce unfold criticalH unfold criticalV unfold criticalW simp [realPair.add, realPair.mul, realPair.neg, realPair.pow] unfold complexOne apply orderedPair.first_congr rw realNumeral.numeral have twice := half.add_self at realOne with * linear_combination (2 * half(realOne)^2 + 2 * half(realOne) + 1) * twice end Arithmetic -- The values of the four variables at the critical point. theorem criticalPoint.value_h shows evaluationAt(complexRing, 4, criticalPoint)(X(complexRing, 4, 0)) = criticalH proof have function := criticalPoint.function have zero : 0 ∈ 4 by simp [membership.four] have value := evaluationAt.map_X at complexRing, 4, criticalPoint, 0 with * rw value unfold criticalPoint have zeroIn := complexZero.member exact quadrupleMap.zero with * theorem criticalPoint.value_u shows evaluationAt(complexRing, 4, criticalPoint)(X(complexRing, 4, 1)) = complexZero proof have function := criticalPoint.function have one : 1 ∈ 4 by simp [membership.four] have value := evaluationAt.map_X at complexRing, 4, criticalPoint, 1 with * rw value unfold criticalPoint have zeroIn := complexZero.member exact quadrupleMap.one with * theorem criticalPoint.value_v shows evaluationAt(complexRing, 4, criticalPoint)(X(complexRing, 4, 2)) = criticalV proof have function := criticalPoint.function have two : 2 ∈ 4 by simp [membership.four] have value := evaluationAt.map_X at complexRing, 4, criticalPoint, 2 with * rw value unfold criticalPoint have zeroIn := complexZero.member exact quadrupleMap.two with * theorem criticalPoint.value_w shows evaluationAt(complexRing, 4, criticalPoint)(X(complexRing, 4, 3)) = criticalW proof have function := criticalPoint.function have three : 3 ∈ 4 by simp [membership.four] have value := evaluationAt.map_X at complexRing, 4, criticalPoint, 3 with * rw value unfold criticalPoint have zeroIn := complexZero.member exact quadrupleMap.three with * -- The evaluations: push the evaluation homomorphism through the -- polynomial expressions, then compute in ℂ. theorem criticalPoint.eval_x shows evaluationAt(complexRing, 4, criticalPoint)(ambientX) = complexNeg(complexOne) proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have h := criticalPoint.value_h have u := criticalPoint.value_u have v := criticalPoint.value_v unfold ambientX simp [RingHom.map_add, RingHom.map_mul, RingHom.map_pow, h, u, v] simp [Ring.pow.value, complexRing.addOf, complexRing.mulOf, complexRing.oneOf] exact criticalArithmetic.x_is_neg_one theorem criticalPoint.eval_y shows evaluationAt(complexRing, 4, criticalPoint)(ambientY) = complexOne proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have h := criticalPoint.value_h have u := criticalPoint.value_u have w := criticalPoint.value_w unfold ambientY simp [RingHom.map_add, RingHom.map_neg, RingHom.map_mul, RingHom.map_pow, h, u, w] simp [Ring.pow.value, complexRing.addOf, complexRing.mulOf, complexRing.negOf, complexRing.oneOf] exact criticalArithmetic.y_is_one theorem criticalPoint.eval_s shows evaluationAt(complexRing, 4, criticalPoint)(ambientS) = complexOne proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have h := criticalPoint.value_h have u := criticalPoint.value_u have v := criticalPoint.value_v have w := criticalPoint.value_w unfold ambientS unfold cuspS simp [RingHom.map_add, RingHom.map_sub, RingHom.map_mul, RingHom.map_pow, RingHom.map_numeral, h, u, v, w] unfold Ring.sub simp [Ring.pow.value, complexRing.addOf, complexRing.mulOf, complexRing.negOf, complexRing.zeroOf, complexRing.oneOf] exact criticalArithmetic.s_is_one theorem criticalPoint.eval_p shows evaluationAt(complexRing, 4, criticalPoint)(ambientP) = ringNat(complexAdd, complexZero, complexOne, 2) proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have x := criticalPoint.eval_x have y := criticalPoint.eval_y have s := criticalPoint.eval_s unfold ambientP unfold shiftP rw RingHom.map_sub with * rw RingHom.map_add with * rw RingHom.map_mul with * rw RingHom.map_mul with * rw RingHom.map_neg with * rw RingHom.map_pow with * rw RingHom.map_numeral with * rw [x, y, s] rw [← complexRing.addOf, ← complexRing.zeroOf, ← complexRing.negOf, ← complexRing.oneOf] ring theorem criticalPoint.eval_F shows evaluationAt(complexRing, 4, criticalPoint)(ambientF) = complexNeg(complexOne) proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have h := criticalPoint.value_h have p := criticalPoint.eval_p unfold ambientF rw RingHom.map_sub with * rw RingHom.map_sub with * rw RingHom.map_one with * rw [h, p, criticalH.numeral] rw [← complexRing.addOf, ← complexRing.zeroOf, ← complexRing.negOf, ← complexRing.oneOf] unfold Ring.sub ring theorem criticalPoint.eval_shiftX shows evaluationAt(complexRing, 4, criticalPoint)(shiftX) = complexZero proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have x := criticalPoint.eval_x have s := criticalPoint.eval_s unfold shiftX rw RingHom.map_add with * rw RingHom.map_pow with * rw [x, s] rw [← complexRing.zeroOf, ← complexRing.negOf, ← complexRing.oneOf] ring theorem criticalPoint.eval_shiftY shows evaluationAt(complexRing, 4, criticalPoint)(shiftY) = complexZero proof have function := criticalPoint.function have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have hom := evaluationAt.hom at complexRing, 4, criticalPoint with * have y := criticalPoint.eval_y have s := criticalPoint.eval_s unfold shiftY rw RingHom.map_sub with * rw RingHom.map_pow with * rw [y, s] rw [← complexRing.zeroOf, ← complexRing.oneOf] unfold Ring.sub ring -- The partial derivatives: from the ambient identity A² + D³ = E(1 + f) -- to the vanishing of every ∂ᵢf at the point. section AmbientIdentity variable (R I point : Set) hypothesis ring : CommRing(R) hypothesis polynomials : CommRing(polynomialRing(R, I)) hypothesis values : point : I → Ring.carrier(R) -- If A² + D³ = E(1 + f) and at a point A, D vanish, E is 1, and f is −1, -- then every partial derivative of f vanishes at the point. theorem critical_of_ambient_identity (A D E f i : Set) requires aIn : A ∈ Ring.carrier(polynomialRing(R, I)) requires dIn : D ∈ Ring.carrier(polynomialRing(R, I)) requires eIn : E ∈ Ring.carrier(polynomialRing(R, I)) requires fIn : f ∈ Ring.carrier(polynomialRing(R, I)) requires identity : A^2 + D^3 = E * (Ring.one(polynomialRing(R, I)) + f) requires evalA : evaluationAt(R, I, point)(A) = R[0] requires evalD : evaluationAt(R, I, point)(D) = R[0] requires evalE : evaluationAt(R, I, point)(E) = R[1] requires evalF : evaluationAt(R, I, point)(f) = -R[1] requires index : i ∈ I shows evaluationAt(R, I, point)(partialDerivative(R, I, i)(f)) = R[0] proof have evaluation := evaluationAt.hom at R, I, point with ring, values have oneIn : R[1] ∈ R := Ring.one_mem with * have constants := polynomialConstant.hom at R, I with ring have oneConstant := RingHom.map_one with constants have derivativeOne := partialDerivative.constant at R, I, i, R[1] with * rw oneConstant at derivativeOne have two : (1:Nat) + 1 = 2 by arith have three : (2:Nat) + 1 = 3 by arith have powA := partialDerivative.pow at R, I, i, A, 1 with * have powD := partialDerivative.pow at R, I, i, D, 2 with * rw two at powA rw three at powD -- Differentiate the identity and evaluate: 2A·∂A + 3D²·∂D = -- ∂E·(1 + f) + E·∂f becomes 0 = ∂f at the point. have evaluated : evaluationAt(R, I, point)(partialDerivative(R, I, i)(A^2 + D^3)) = evaluationAt(R, I, point)(partialDerivative(R, I, i)(E * (Ring.one(polynomialRing(R, I)) + f))) rw identity clear identity simp [partialDerivative.add, partialDerivative.mul, powA, powD, derivativeOne, RingHom.map_add, RingHom.map_mul, RingHom.map_pow, RingHom.map_numeral, RingHom.map_one, RingHom.map_zero, evalA, evalD, evalE, evalF] at evaluated linear_combination (-R[1]) * evaluated end AmbientIdentity theorem criticalPoint.derivatives (i : Set) requires index : i ∈ 4 shows evaluationAt(complexRing, 4, criticalPoint)( partialDerivative(complexRing, 4, i)(ambientF)) = complexZero proof have ambient : CommRing(polynomialRing(complexRing, 4)) := polynomialRing.comm_ring with * have function := criticalPoint.function have identity := ambient.identity with * have aIn := shiftX.mem with * have dIn := shiftY.mem with * have eIn := ambientS.mem with * have fIn := ambientF.mem with * have evalA := criticalPoint.eval_shiftX have evalD := criticalPoint.eval_shiftY have evalE := criticalPoint.eval_s have evalF := criticalPoint.eval_F rw ← complexRing.zeroOf at evalA, evalD rw ← complexRing.oneOf at evalE, evalF rw ← complexRing.negOf at evalF have result := critical_of_ambient_identity at complexRing, 4, criticalPoint, shiftX, shiftY, ambientS, ambientF, i with * rw complexRing.zeroOf at result exact result