Skip to content

Commit 63bf4ff

Browse files
committed
wip need more credits
1 parent 715f5ec commit 63bf4ff

5 files changed

Lines changed: 84 additions & 51 deletions

File tree

Mathlib/Algebra/MvPolynomial/PDeriv.lean

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,6 @@ lemma pderiv_sumToIter {σ ι} (p i) :
158158
| add p q _ _ => simp_all
159159
| mul_X p n _ => cases n <;> simp_all [pderiv_X, Pi.single_apply, apply_ite]
160160

161-
theorem pderiv_map {S} [CommSemiring S] {φ : R →+* S} {f : MvPolynomial σ R} {i : σ} :
162-
pderiv i (map φ f) = map φ (pderiv i f) := by
163-
apply induction_on f (fun r ↦ by simp) (fun p q hp hq ↦ by simp [hp, hq]) fun p j eq ↦ ?_
164-
obtain rfl | h := eq_or_ne j i
165-
· simp [eq]
166-
· simp [eq, h]
167-
168161
end PDeriv
169162

170163
end MvPolynomial

Mathlib/AlgebraicGeometry/EllipticCurve/Affine/Point.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ lemma smul_basis_mul_Y (p q : R[X]) : (p • (1 : W'.CoordinateRing) + q • mk
174174
simp only [smul, add_mul, mul_assoc, ← sq, Y_sq, map_sub, map_mul]
175175
ring1
176176

177+
lemma algebraMap_poly_injective : Function.Injective (algebraMap R[X] W'.CoordinateRing) :=
178+
(injective_iff_map_eq_zero _).mpr fun p hp ↦ And.left <|
179+
smul_basis_eq_zero (W' := W') (q := 0) <| by
180+
rwa [Algebra.smul_def, mul_one, zero_smul, add_zero]
181+
182+
lemma algebraMap_injective' : Function.Injective (algebraMap R W'.CoordinateRing) :=
183+
(CoordinateRing.algebraMap_poly_injective (W' := W')).comp C_injective
184+
177185
variable (W') in
178186
/-- The ring homomorphism `R[W] →+* S[W.map f]` induced by a ring homomorphism `f : R →+* S`. -/
179187
noncomputable def map (f : R →+* S) : W'.CoordinateRing →+* (W'.map f).toAffine.CoordinateRing :=
@@ -490,6 +498,10 @@ lemma zero_def : 0 = (.zero : W'.Point) :=
490498
lemma some_ne_zero {x y : R} (h : W'.Nonsingular x y) : Point.some h ≠ 0 := by
491499
rintro (_ | _)
492500

501+
lemma some_eq_some_iff {x₁ x₂ y₁ y₂ : R} (h₁ : W'.Nonsingular x₁ y₁)
502+
(h₂ : W'.Nonsingular x₂ y₂) : some h₁ = some h₂ ↔ x₁ = x₂ ∧ y₁ = y₂ :=
503+
by rintro (_ | _); trivial, by rintro ⟨rfl, rfl⟩; rfl⟩
504+
493505
/-- The negation of a nonsingular point on a Weierstrass curve in affine coordinates.
494506
495507
Given a nonsingular point `P` in affine coordinates, use `-P` instead of `neg P`. -/

Mathlib/AlgebraicGeometry/EllipticCurve/DivisionPolynomial/ZSMul.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Equivalently, we aim to prove the formula in affine coordinates: `n • (X,Y) =
6060
for `n ≠ 0` (`Universal.Affine.zsmul_point_eq_smulX_smulY`), but this time it is easier to use
6161
the usual strong induction on `n` rather than the even-odd induction, because we have formulas
6262
expressing the affine coordinates of `(n+1) • P` in terms of those of `P`, `n • P` and
63-
`(n-1) • P` (`Affine.addX_eq_subX_sub`, `Affine.addY_sub_negY`).
63+
`(n-1) • P` (`Affine.addX_eq_addX_negY_sub`, `Affine.addY_sub_negY_addY`).
6464
We only need to verify the base cases `n = 1` and `n = 2`, and the induction step is handled
6565
by fancy identities of division polynomials and elliptic divisibility sequences
6666
(`smulX_sub_sub_smulX_add`, `smulX_add` and `smulY_add_sub_negY`).
@@ -72,7 +72,7 @@ instead of `Frac(Universal.Ring) = Frac(ℤ[A₁,A₂,A₃,A₄,A₆,X,Y]/⟨P
7272
result by specializing the characteristic 0, universal result.
7373
-/
7474

75-
open scoped PolynomialPolynomial
75+
open scoped Polynomial.Bivariate
7676

7777
namespace WeierstrassCurve
7878

@@ -323,7 +323,7 @@ theorem zsmul_point_eq_smulX_smulY : n ≠ 0 →
323323
obtain _|_|_|n := n
324324
· exact (h0 rfl).elim
325325
· simp_rw [zero_add, Nat.cast_one, one_zsmul, smulX_one, smulY_one]
326-
exact ⟨EllipticCurve.Affine.nonsingular pointedCurve equation_point, rfl⟩
326+
exact ⟨equation_iff_nonsingular.mp equation_point, rfl⟩
327327
all_goals obtain ⟨ns, eq⟩ := ih 1 (by omega) one_ne_zero
328328
· erw [← addX_smul_one_smul_one, ← addY_smul_one_smul_one, zero_add, add_zsmul _ 1 1, eq]
329329
exact ⟨Affine.nonsingular_add ns ns fun _ ↦ smulY_one_ne_negY,
@@ -338,13 +338,13 @@ theorem zsmul_point_eq_smulX_smulY : n ≠ 0 →
338338
let L := _U.slope (smulX n2) (smulX 1) (smulY n2) (smulY 1)
339339
have X_eq : smulX (n2 + 1 : ℕ) = _U.addX (smulX n2) (smulX 1) L := by
340340
rw [Nat.cast_add, Nat.cast_one, smulX_add one_ne_zero (by omega) (by omega) (by omega),
341-
Affine.addX_eq_subX_sub _ _ ne, sub_eq_add_neg (n2 : ℤ), ← eq1.1]; rfl
341+
Affine.addX_eq_addX_negY_sub _ _ ne, sub_eq_add_neg (n2 : ℤ), ← eq1.1]; rfl
342342
have Y_eq : smulY (n2 + 1 : ℕ) = _U.addY (smulX n2) (smulX 1) (smulY n2) L := by
343343
rw [← mul_cancel_left_mem_nonZeroDivisors (mem_nonZeroDivisors_of_ne_zero Field.two_ne_zero),
344344
← add_right_cancel_iff (a := _U.a₁ * smulX (n2 + 1 : ℕ) + _U.a₃)]
345345
convert smulY_add_sub_negY (n := n2) one_ne_zero (by omega) (by omega) (by omega) using 1
346346
· simp_rw [Affine.negY, Nat.cast_add]; ring_nf
347-
convert _U.addY_sub_negY (smulY n2) (smulY 1) ne using 1
347+
convert _U.addY_sub_negY_addY (smulY n2) (smulY 1) ne using 1
348348
· rw [Affine.negY, ← X_eq]; ring
349349
· rw [← X_eq]; rfl
350350
rw [X_eq, Y_eq, n2.cast_add, add_zsmul, eq, eq2]

Mathlib/AlgebraicGeometry/EllipticCurve/Universal.lean

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2024 Junyan Xu. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Junyan Xu
55
-/
6-
import Mathlib.AlgebraicGeometry.EllipticCurve.Group
6+
import Mathlib.AlgebraicGeometry.EllipticCurve.Jacobian.Point
77

88
/-!
99
# The universal elliptic curve
@@ -27,7 +27,7 @@ order on the universal pointed elliptic curve.
2727

2828
noncomputable section
2929

30-
open scoped PolynomialPolynomial
30+
open scoped Polynomial.Bivariate
3131

3232
namespace WeierstrassCurve
3333

@@ -37,7 +37,7 @@ inductive Coeff : Type | A₁ : Coeff | A₂ : Coeff | A₃ : Coeff | A₄ : Coe
3737

3838
namespace Universal
3939

40-
open scoped Polynomial PolynomialPolynomial
40+
open scoped Polynomial Polynomial.Bivariate
4141
open Coeff
4242

4343
open MvPolynomial (X) in
@@ -86,26 +86,33 @@ lemma algebraMap_ring_eq_comp :
8686
lemma algebraMap_field_injective :
8787
Function.Injective (algebraMap (MvPolynomial Coeff ℤ) Universal.Field) :=
8888
(IsFractionRing.injective Universal.Ring Universal.Field).comp
89-
(Affine.CoordinateRing.algebraMap_injective' _)
89+
(Affine.CoordinateRing.algebraMap_injective' (W' := curve))
9090

9191
/-- The universal pointed Weierstrass curve is an elliptic curve
92-
when base-changed to the the universal field. -/
93-
def pointedCurve : EllipticCurve Universal.Field where
94-
__ := baseChange curve Universal.Field
95-
Δ' := .mk0 (baseChange curve Universal.Field).Δ <| by
96-
simpa only [map_Δ, map_ne_zero_iff _ algebraMap_field_injective] using Δ_curve_ne_zero
97-
coe_Δ' := rfl
92+
when base-changed to the universal field. -/
93+
abbrev pointedCurve : WeierstrassCurve Universal.Field := baseChange curve Universal.Field
94+
95+
instance : pointedCurve.IsElliptic where
96+
isUnit := by
97+
rw [show pointedCurve.Δ = _ from map_Δ curve (algebraMap _ Universal.Field)]
98+
exact ((map_ne_zero_iff _ algebraMap_field_injective).mpr Δ_curve_ne_zero).isUnit
9899

99100
open Polynomial in
100101
lemma equation_point : pointedCurve.toAffine.Equation (polyToField (C X)) (polyToField Y) := by
101-
simp_rw [Affine.Equation, pointedCurve, baseChange, EllipticCurve.toAffine,
102-
algebraMap_field_eq_comp, ← map_map, Affine.map_polynomial_evalEval, Affine.map_polynomial,
103-
evalEval, eval_map, eval_C_X_eval₂_map_C_X, polyToField_polynomial]
102+
show evalEval (polyToField (C X)) (polyToField Y)
103+
((curve.map (algebraMap _ Universal.Field)).toAffine.polynomial) = 0
104+
have h : (evalEvalRingHom (polyToField (C X)) (polyToField Y)).comp
105+
(mapRingHom <| mapRingHom (algebraMap _ Universal.Field)) = polyToField := by
106+
ext <;> simp [polyToField, algebraMap_field_eq_comp]
107+
have : ∀ p, evalEval (polyToField (C X)) (polyToField Y)
108+
(p.map (mapRingHom (algebraMap _ Universal.Field))) = polyToField p :=
109+
fun p ↦ congr($h p)
110+
rw [Affine.map_polynomial, this, polyToField_polynomial]
104111

105112
open Polynomial Affine in
106113
/-- The distinguished point on the universal pointed Weierstrass curve. -/
107114
def Affine.point : curve⟮Universal.Field⟯ :=
108-
.some (EllipticCurve.Affine.nonsingular pointedCurve equation_point)
115+
.some (equation_iff_nonsingular.mp equation_point)
109116

110117
/-- The distinguished point on the universal curve in Jacobian coordinates. -/
111118
def Jacobian.point : Jacobian.Point (curve.baseChange Universal.Field) :=
@@ -128,7 +135,7 @@ abbrev curveRing : WeierstrassCurve Universal.Ring := curve.baseChange Universal
128135
(the universal field), where `P` is the Weierstrass polynomial. -/
129136
abbrev curveField : WeierstrassCurve Universal.Field := curve.baseChange Universal.Field
130137

131-
lemma curveField_eq : curveField = pointedCurve.toWeierstrassCurve := rfl
138+
lemma curveField_eq : curveField = pointedCurve := rfl
132139

133140
end Universal
134141

@@ -190,8 +197,9 @@ protected lemma Field.two_ne_zero : (2 : Universal.Field) ≠ 0 := by
190197
intro h; replace h := congr(ringEval cusp_equation_one_one $h)
191198
rw [map_ofNat, map_zero] at h; cases h
192199

193-
lemma curveRing_map_ringEval : curveRing.map (ringEval eqn) = W := by
194-
rw [curveRing, baseChange, map_map, ringEval_comp_eq_specialize, map_specialize]
200+
lemma curveRing_map_ringEval : curveRing.map (ringEval eqn) = W :=
201+
(map_map curve (algebraMap _ _) (ringEval eqn)).symm ▸
202+
(ringEval_comp_eq_specialize eqn) ▸ map_specialize W
195203

196204
end Universal
197205

0 commit comments

Comments
 (0)