def
definition
neg
show as:
view math explainer →
open explainer
Read the cached plain-language explainer.
open lean source
IndisputableMonolith.Cryptography.ECDLPWatch on GitHub at line 43.
browse module
All declarations in this module, on Recognition.
explainer page
depends on
used by
-
sub_eq_add -
J_at_phi -
PhiInt -
PhiInt -
canonicalPhiRingObj -
PhiRingHom -
PhiRingObj -
duhamelRemainderOfGalerkin_integratingFactor -
tendsto_duhamelKernelIntegral_of_dominated_convergence -
encodeClause -
clauseUnit -
clauseUnit_correct -
known_lit_false'' -
valueOfLit -
evalLit -
Lit -
mentionsVarLit -
deriv_alphaInv_of_gap -
logarithmic_derivative_constant -
dAlembert_to_ODE_general -
ode_cos_uniqueness -
dAlembert_to_ODE_general -
ode_cos_uniqueness -
dAlembert_to_ODE_general_theorem -
dAlembert_to_ODE_theorem -
dAlembert_to_ODE_theorem -
Jcost_log_second_deriv_normalized -
ode_cos_unit_uniqueness -
toComplex_neg -
even_function_deriv_zero -
separable_forces_flat_ode -
Gspher_satisfies_spherical -
dalembert_deriv_ode -
neg -
neg -
C_RS_minus_C_classical_tendsto_zero -
ode_cos_uniqueness_contdiff -
bet1_boundaryTerm_integrable_of_L2_mul_r -
operatorPairing_of_decayFull -
integral_Ioi_radial_skew_identity
formal source
40 | ECPoint.affine x y => y ^ 2 = x ^ 3 + E.a * x + E.b
41
42/-- Negation in the elliptic-curve group law. -/
43def neg {p : ℕ} : ECPoint p → ECPoint p
44 | ECPoint.infinity => ECPoint.infinity
45 | ECPoint.affine x y => ECPoint.affine x (-y)
46
47instance {p : ℕ} : Neg (ECPoint p) where
48 neg := neg
49
50/-- Chord slope for two distinct affine x-coordinates. -/
51def chordSlope {p : ℕ} (x₁ y₁ x₂ y₂ : ZMod p) : ZMod p :=
52 (y₂ - y₁) * (x₂ - x₁)⁻¹
53
54/-- Tangent slope for point doubling. -/
55def tangentSlope {p : ℕ} (E : ShortWeierstrassCurve p) (x y : ZMod p) : ZMod p :=
56 ((3 : ZMod p) * x ^ 2 + E.a) * ((2 : ZMod p) * y)⁻¹
57
58/-- Third point obtained from the usual slope formula. -/
59def slopeAddPoint {p : ℕ} (m x₁ y₁ x₂ : ZMod p) : ECPoint p :=
60 let x₃ := m ^ 2 - x₁ - x₂
61 let y₃ := m * (x₁ - x₃) - y₁
62 ECPoint.affine x₃ y₃
63
64/-- Total chord-tangent addition formula. The usual prime-field side
65conditions are carried separately by benchmark code and hypotheses. -/
66def pointAdd {p : ℕ} (E : ShortWeierstrassCurve p) : ECPoint p → ECPoint p → ECPoint p
67 | ECPoint.infinity, Q => Q
68 | P, ECPoint.infinity => P
69 | ECPoint.affine x₁ y₁, ECPoint.affine x₂ y₂ =>
70 if _hx : x₁ = x₂ then
71 if _hy : y₁ + y₂ = 0 then
72 ECPoint.infinity
73 else