Skip to content

The exact precision computation

The five natural inputs of the precision computation are signed encodings, decoded in the fixed order \((n,\kappa,a,l,j)\).

DefinitionThe signed encoding of integers#✓

The signed encoding \(\operatorname{enc}:\mathbb Z\to\mathbb N\) and its decoding \(\operatorname{dec}:\mathbb N\to\mathbb Z\) are $\(\operatorname{enc}(n)=\begin{cases}2n,&n\ge0,\\-2n-1,&n<0,\end{cases}\qquad \operatorname{dec}(c)=\begin{cases}c/2,&c\text{ even},\\-(c+1)/2,&c\text{ odd}.\end{cases}\)$ A tuple \(c=(c_0,c_1,c_2,c_3,c_4)\in\mathbb N^5\) of precision inputs decodes, in this fixed order, to \((n,\kappa,a,l,j)=(\operatorname{dec}c_0,\dots,\operatorname{dec}c_4)\in\mathbb Z^5\).

This is a definition. The order \((n,\kappa,a,l,j)\) is the order in which the ordinary-value relation links its five signed codes to the precision inputs.

def enc (n : ℤ) : ℕ := if 0 ≤ n then 2 * n.toNat else 2 * (-n).toNat - 1
def dec (c : ℕ) : ℤ := if c % 2 = 0 then ((c / 2 : ℕ) : ℤ) else -(((c + 1) / 2 : ℕ) : ℤ)
def decode5 (c : Fin 5 → ℕ) : Fin 5 → ℤ := fun i => dec (c i)
Used by 6

TheoremThe signed encoding is a bijection#✓

\(\operatorname{dec}(\operatorname{enc}(n))=n\) for every \(n\in\mathbb Z\) and \(\operatorname{enc}(\operatorname{dec}(c))=c\) for every \(c\in\mathbb N\). Moreover \(\operatorname{enc}(n)\) is even exactly when \(n\ge0\), and \(|\operatorname{dec}(c)|=\lceil c/2\rceil\).

Proof sketch. Case analysis on the sign of \(n\) and the parity of \(c\): \(2n\) is even with half \(n\); \(-2n-1\) is odd for \(n<0\) and \(-((-2n-1)+1)/2=n\); conversely \(c=2h\) decodes to \(h\ge0\) and \(c=2h+1\) to \(-(h+1)<0\), which encodes to \(2h+1\).

theorem dec_enc (n : ℤ) : dec (enc n) = n
theorem enc_dec (c : ℕ) : enc (dec c) = c
def encEquiv : ℤ ≃ ℕ where
  toFun := enc
  invFun := dec
  left_inv := dec_enc
  right_inv := enc_dec
Uses 1 · Used by 2

The local parameter \(z=-x/y\) is defined at multiples of \(P_0\) that are affine with nonzero ordinate; at such an index \(k\) it gives the components \(u_k,v_k\), the size \(\epsilon_k=|u_k|+|v_k|\), and the trace ratio \(r(a,j)\).

DefinitionThe local parameter z on multiples of the generator#✓

Let \(E:y^2=x^3+Ax\) over \(K_0\) with \(A=-d^2\), and \(P_0\) the fixed point.

  1. For an affine point \(P=(x,y)\in E(K_0)\) with \(y\ne0\) put \(z(P)=-x/y\in K_0\). Such a point has \(x\ne0\) (if \(x=0\) then \(y^2=0\)), so \(z(P)\ne0\); and \(z(-P)=-z(P)\).
  2. An index \(k\in\mathbb Z\) is admissible if \([k]P_0\) is an affine point with nonzero ordinate. For admissible \(k\) write $\(z_k=z([k]P_0)=u_k+v_ks\quad(u_k,v_k\in\mathbb Q),\qquad \epsilon_k=|u_k|+|v_k|>0 .\)$
  3. For admissible \(a\) and \(j\) put $\(r(a,j)=\tfrac12\operatorname{Tr}_{K_0/\mathbb Q}\frac{z_j}{z_a}\in\mathbb Q,\)$ the rational component of \(z_j/z_a\).

This is a definition. The manuscript defines \(z\) on nonzero multiples of \(P_0\), where it is well defined because \(P_0\) has infinite order (no nonzero multiple is the identity or a point of order two); admissibility makes this explicit, so that the precision relation and its computation do not depend on the generator theorem.

noncomputable def zPt : genCurve.toAffine.Point → K0
  | .zero => 0
  | .some x y _ => -x / y
theorem zPt_ne_zero {x y : K0} (h : genCurve.toAffine.Nonsingular x y) (hy : y ≠ 0) :
    zPt (.some x y h) ≠ 0
def Admissible (k : ℤ) : Prop :=
  ∃ (x y : K0) (h : genCurve.toAffine.Nonsingular x y), k • genP0 = .some x y h ∧ y ≠ 0
Uses 3 · Used by 5

The precision exponent uses the six-contact constant for the primes up to \(324\), written as an explicit natural-number expression; it is never evaluated.

DefinitionThe precision height constant#✓

The following natural numbers are defined by their displayed expressions and are never evaluated: $\(\begin{aligned} F_0&=324!, & D&=F_0\,3^{256F_0^4}, & G_0&=116064000000, & E_0&=10(DG_0)^2,\\ Q_0&=D^{DE_0}, & B_{\rm cm}&=D^2\,3^{21000D^2}+1, & C_{\rm cm}&=2B_{\rm cm}+4096(1028+5D+84000D^2), \end{aligned}\)$ $\(A^{(0)}_{\rm ht}=2\cdot10^{13}\cdot\max\bigl(1,\ C_{\rm cm},\ Q_0^{17}\bigr).\)$ With \(F(u)=u(u+15)(u+20)(u+24)(u+30)(u+60)\) and \(\mathcal C=\{0,-15,-20,-24,-30,-60\}\), the precision bound of \((n,\kappa)\in\mathbb Z^2\) is the natural number $\(\mathcal B(n,\kappa)=A^{(0)}_{\rm ht}\,|\kappa F(n)|^{24}.\)$

This is a definition. \(A^{(0)}_{\rm ht}\) is the six-contact constant \(H_6(S_{\rm ht})\) for \(S_{\rm ht}=\{p\le324\}\); the identification is a separate statement. Its symbol \(F_0\) is distinct from the polynomial \(F\).

noncomputable def Q0 : ℕ := qFn heightD heightE0
noncomputable def A0 : ℕ := h6Fn heightCcm Q0
def sixF (u : ℤ) : ℤ := u * (u + 15) * (u + 20) * (u + 24) * (u + 30) * (u + 60)
Used by 4

TheoremThe precision constant is the six-contact constant#✓

Let \(S_{\rm ht}\) be the set of primes at most \(324\). Then \(\max(D,\max S_{\rm ht},10^{12})=D\), and the six-contact constant at this argument is the precision constant: $\(H_6(S_{\rm ht})=H_6(S_{\rm ht};D)=2\cdot10^{13}\max(1,C_{\rm cm},Q_D^{17})=A^{(0)}_{\rm ht},\)$ where \(Q_D=D^{DE_0}\) is computed as a real power. Consequently, for all \((n,\kappa)\in\mathbb Z^2\), \(\mathcal B(n,\kappa)=H_6(S_{\rm ht})\,|\kappa F(n)|^{24}\) is the bound \(B(n,\kappa)\) of the ordinary-value relation, and \(R=D\) is an admissible argument of the six-contact estimate for \(S_{\rm ht}\).

Proof sketch. \(\max S_{\rm ht}=317\), and \(D\ge F_0=324!>10^{12}\), so the maximum is \(D\) (no evaluation of \(D\) is needed: \(324!\ge10^{12}\) is a small finite check, for instance \(324!\ge20!>10^{12}\)). The real power \(D^{D E_0}\) with natural base and natural exponent equals the natural power, so \(Q_D=Q_0\), and the remaining expressions agree term by term.

theorem A0_eq_heightH6 : (A0 : ℝ) = heightH6 (heightD : ℝ)
theorem max_heightD_heightPrimes :
    max (heightD : ℝ) (max ((heightPrimes.sup id : ℕ) : ℝ) ((10 : ℝ) ^ 12)) = heightD
theorem bound_eq_heightH6 (n κ : ℤ) :
    (bound n κ : ℝ) = heightH6 (heightD : ℝ) * |((κ * sixF n : ℤ) : ℝ)| ^ 24
Uses 2 · Used by 4

The relation itself consists of the early tests, admissibility, and two strict tests. Given that \(P_0\) has infinite order, admissibility follows from the early tests; the model chapter proves this unconditionally (nonzero multiples of the generator).

DefinitionThe precision relation#✓

For \(c\in\mathbb N^5\) let \((n,\kappa,a,l,j)\in\mathbb Z^5\) be its signed decoding. The precision relation \(\operatorname{accepts}(c)\) holds if and only if all of the following hold:

  1. (early tests) \(n\notin\mathcal C=\{0,-15,-20,-24,-30,-60\}\), \(\kappa\ne0\), \(a\ge1\), \(l\ge1\) and \(j=na\);
  2. (admissibility) \(l\), \(a\) and \(j\) are admissible indices;
  3. (closeness) \(|r(a,j)-n|<\epsilon_l\);
  4. (precision) \(4\epsilon_l<4^{-\mathcal B(n,\kappa)}\), that is \(4\,\epsilon_l\cdot4^{\mathcal B(n,\kappa)}<1\), with \(\mathcal B(n,\kappa)=A^{(0)}_{\rm ht}|\kappa F(n)|^{24}\).

Both final tests are strict inequalities between rational numbers (equivalently, between real numbers). This is the predicate called \(\operatorname{accepts\_naturals}\) in equation (C.4).

This is a definition. Item 2 is implicit in the manuscript, which defines \(z\) only on nonzero multiples of \(P_0\); given the generator theorem it follows from item 1, so the relation is the manuscript's on every input where the latter is meaningful.

def accepts (c : Fin 5 → ℕ) : Prop :=
  acceptsInt (dec (c 0)) (dec (c 1)) (dec (c 2)) (dec (c 3)) (dec (c 4))
def acceptsInt (n κ a l j : ℤ) : Prop :=
  EarlyTestsInt n κ a l j ∧ (Admissible l ∧ Admissible a ∧ Admissible j) ∧
    CloseTestInt n a l j ∧ PrecisionTestInt n κ l
theorem accepts_iff (c : Fin 5 → ℕ) :
    accepts c ↔
      (dec (c 0) ∉ contacts ∧ dec (c 1) ≠ 0 ∧ 1 ≤ dec (c 2) ∧ 1 ≤ dec (c 3) ∧
        dec (c 4) = dec (c 0) * dec (c 2)) ∧
      (Admissible (dec (c 3)) ∧ Admissible (dec (c 2)) ∧ Admissible (dec (c 4))) ∧
      |rRatio (dec (c 2)) (dec (c 4)) - dec (c 0)| < epsIdx (dec (c 3)) ∧
      4 * epsIdx (dec (c 3)) * 4 ^ bound (dec (c 0)) (dec (c 1)) < 1
Uses 3 · Used by 9

TheoremAdmissibility of nonzero indices#✓

Assume \(P_0\) has infinite order in \(E(K_0)\). Then every \(k\in\mathbb Z\setminus\{0\}\) is admissible. Consequently, for \(c\in\mathbb N^5\) passing the early tests of the precision relation, the indices \(l,a,j\) are admissible, and \(\operatorname{accepts}(c)\) holds if and only if the closeness and precision tests hold.

Proof sketch. For \(k\ne0\), \([k]P_0\ne O\) since \(P_0\) has infinite order. If its ordinate were \(0\) then \([k]P_0=-[k]P_0\), so \([2k]P_0=O\) with \(2k\ne0\), again impossible. For inputs passing the early tests, \(l,a\ge1\) and \(j=na\ne0\) because \(n\ne0\) (\(0\in\mathcal C\)) and \(a\ne0\).

theorem admissible_of_ne_zero {k : ℤ} (hk : k ≠ 0) : Admissible k
theorem accepts_iff_tests (c : Fin 5 → ℕ) (hc : EarlyTests c) :
    accepts c ↔
      CloseTestInt (dec (c 0)) (dec (c 2)) (dec (c 3)) (dec (c 4)) ∧
        PrecisionTestInt (dec (c 0)) (dec (c 1)) (dec (c 3))
Informally uses
Sources
Uses 2 · Informal links 1
17 fully proved

Exact evaluation

The second strict test compares \(\epsilon_l=U/V\) with \(4^{-\mathcal B}\); it becomes an integer comparison with the finite cap \(L=\lfloor(V-1)/(4U)\rfloor\). Saturating every operation at \(L+1\) computes the comparison exactly without evaluating \(\mathcal B\).

TheoremThe precision threshold as an integer comparison#✓

Let \(U,V\) be positive natural numbers, \(\epsilon=U/V\), and \(B\in\mathbb N\). Then $\(4\epsilon<4^{-B}\iff4U\cdot4^B<V\iff4^B\le\left\lfloor\frac{V-1}{4U}\right\rfloor .\)$

Proof sketch. Multiply by the positive number \(V4^B\) for the first equivalence. For the second, for positive \(a\) and \(D\) and natural \(x\), \(ax<D\iff ax\le D-1\iff x\le\lfloor(D-1)/a\rfloor\), applied with \(a=4U\), \(x=4^B\), \(D=V\).

theorem four_eps_lt_iff_nat (U V B : ℕ) (hV : 0 < V) :
    4 * ((U : ℚ) / V) < ((4 : ℚ) ^ B)⁻¹ ↔ 4 * U * 4 ^ B < V
theorem four_eps_lt_iff (U V B : ℕ) (hU : 0 < U) (hV : 0 < V) :
    4 * ((U : ℚ) / V) < ((4 : ℚ) ^ B)⁻¹ ↔ 4 ^ B ≤ (V - 1) / (4 * U)
theorem four_eps_mul_pow_lt_one_iff (U V B : ℕ) (hU : 0 < U) (hV : 0 < V) :
    4 * ((U : ℚ) / V) * 4 ^ B < 1 ↔ 4 ^ B ≤ (V - 1) / (4 * U)
Sources
Used by 1

TheoremSaturated arithmetic#✓

For \(L\in\mathbb N\) let \(\sigma_L(x)=\min(x,L+1)\) on \(\mathbb N\). For all natural \(x,y,n\):

  1. \(\sigma_L(x)\le L\iff x\le L\), and more generally \(\sigma_L(x)\le k\iff x\le k\) for \(k\le L\); \(\sigma_L(\sigma_L(x))=\sigma_L(x)\); \(\sigma_L(0)=0\), \(\sigma_L(1)=1\);
  2. \(\sigma_L(\sigma_L(x)+\sigma_L(y))=\sigma_L(x+y)\), \(\sigma_L(\sigma_L(x)\cdot\sigma_L(y))=\sigma_L(xy)\) and \(\sigma_L(\max(\sigma_L(x),\sigma_L(y)))=\sigma_L(\max(x,y))\);
  3. \(\sigma_L(\sigma_L(x)^n)=\sigma_L(x^n)\);
  4. if \(L\ge1\), then \(\sigma_L(x^{\sigma_L(n)})=\sigma_L(x^n)\), hence \(\sigma_L(\sigma_L(x)^{\sigma_L(n)})=\sigma_L(x^n)\);
  5. \(\sigma_L((n+1)!)=\sigma_L(\sigma_L(n!)\cdot(n+1))\), so factorials are computed exactly by iterating saturated multiplication.

Item 4 is where bases zero and one and exponent zero are separate cases: for \(x\ge2\) an exponent above \(L\) already gives \(x^n>L\).

Proof sketch. Items 1-3 and 5 by cases on whether the arguments exceed \(L\): if \(x\ge L+1\) and \(y\ge1\) then \(xy\ge L+1\), and \(\sigma_L(x)\cdot y\ge L+1\); if \(y=0\) both sides are \(0\); item 3 by induction on \(n\) from item 2. Item 4: if \(n\le L+1\) nothing changes; otherwise \(\sigma_L(n)=L+1\) and, for \(x=0\), \(0^n=0^{L+1}=0\) (both exponents positive), for \(x=1\) both powers are \(1\), and for \(x\ge2\) both \(x^n\) and \(x^{L+1}\) exceed \(L\) because \(x^e>e\) for \(e\ge0\).

theorem saturatedArithmetic (L : ℕ) :
    (∀ x, saturate L x ≤ L ↔ x ≤ L) ∧ (∀ x k, k ≤ L → (saturate L x ≤ k ↔ x ≤ k)) ∧
    (∀ x, saturate L (saturate L x) = saturate L x) ∧ saturate L 0 = 0 ∧ saturate L 1 = 1 ∧
    (∀ x y, saturate L (saturate L x + saturate L y) = saturate L (x + y)) ∧
    (∀ x y, saturate L (saturate L x * saturate L y) = saturate L (x * y)) ∧
    (∀ x y, saturate L (max (saturate L x) (saturate L y)) = saturate L (max x y)) ∧
    (∀ x n, saturate L (saturate L x ^ n) = saturate L (x ^ n)) ∧
    (1 ≤ L → ∀ x n, saturate L (x ^ saturate L n) = saturate L (x ^ n)) ∧
    (1 ≤ L → ∀ x n, saturate L (saturate L x ^ saturate L n) = saturate L (x ^ n)) ∧
    (∀ n, saturate L (n + 1).factorial = saturate L (saturate L n.factorial * (n + 1)))
Sources
Used by 2

TheoremCapped multiplication and binary exponentiation#✓

For \(L\in\mathbb N\) define capped multiplication by \(\mathrm{cmul}_L(a,b)=0\) if \(a=0\) or \(b=0\), \(L+1\) if \(a>\lfloor L/b\rfloor\), and \(ab\) otherwise; and capped binary exponentiation \(\mathrm{cpow}_L(x,e)\) by: \(1\) if \(e=0\); \(x\) if \(x\le1\); otherwise run the loop with state \((\beta,e,\pi)\) starting from \((x,e,1)\): if \(e=0\) return \(\pi\); if \(\beta>L\) return \(L+1\); put \(\pi'=\mathrm{cmul}_L(\pi,\beta)\) if \(e\) is odd and \(\pi'=\pi\) otherwise; if \(e\) is odd and \(\pi'=L+1\) return \(L+1\); if \(\lfloor e/2\rfloor=0\) return \(\pi'\); else continue with \((\mathrm{cmul}_L(\beta,\beta),\lfloor e/2\rfloor,\pi')\). Then for all natural \(L,a,b,x,e\): $\(\mathrm{cmul}_L(a,b)=\sigma_L(ab),\qquad\mathrm{cpow}_L(x,e)=\sigma_L(x^e),\)$ and \(\mathrm{cpow}_L(x,e)\le L\iff x^e\le L\). The loop terminates because \(e\) halves.

Proof sketch. For \(b>0\), \(a>\lfloor L/b\rfloor\iff ab>L\). For the loop, prove by strong induction on \(e\) the invariant \(\mathrm{loop}(\beta,e,\pi)=\sigma_L(\pi\beta^e)\) for \(\beta\ge1\), \(1\le\pi\le L+1\), using \(\beta^e=\beta^{e\bmod2}(\beta^2)^{\lfloor e/2\rfloor}\) and the saturation identities; the early returns are justified because \(\beta>L\) or \(\pi'=L+1\) force \(\sigma_L(\pi\beta^e)=L+1\). The initial cases are \(x^0=1\), \(0^e=0\), \(1^e=1\) for \(e>0\).

theorem cappedArithmetic (L : ℕ) :
    (∀ a b, cappedMul L a b = saturate L (a * b)) ∧
    (∀ x e, cappedPower L x e = saturate L (x ^ e)) ∧
    (∀ x e, cappedPower L x e ≤ L ↔ x ^ e ≤ L)
Uses 1 · Used by 2

TheoremThe capped precision test#✓

Expressions. Natural-number expressions are built from natural literals with \(+\), \(\cdot\), \(\max\), powers \(e_1^{e_2}\) and factorials \(e!\); \([\![e]\!]\in\mathbb N\) is the value. For \(L\in\mathbb N\) the capped value \(\langle e\rangle_L\) is defined by recursion on \(e\): \(\langle c\rangle_L=\sigma_L(c)\) for a literal \(c\); \(\langle e_1+e_2\rangle_L=\sigma_L(\langle e_1\rangle_L+\langle e_2\rangle_L)\); \(\langle e_1\cdot e_2\rangle_L=\mathrm{cmul}_L(\langle e_1\rangle_L,\langle e_2\rangle_L)\); \(\langle\max(e_1,e_2)\rangle_L=\sigma_L(\max(\langle e_1\rangle_L,\langle e_2\rangle_L))\); \(\langle e_1^{e_2}\rangle_L=\mathrm{cpow}_L(\langle e_1\rangle_L,\langle e_2\rangle_L)\); and \(\langle e!\rangle_L=f_L(\langle e\rangle_L)\), where \(f_L(0)=1\) and \(f_L(n+1)=\mathrm{cmul}_L(f_L(n),\sigma_L(n+1))\) (a loop of \(n\) capped multiplications).

The precision expressions. Let \(e_A\) be the expression of the precision height constant written with the literals displayed there: \(e_{F_0}=324!\), \(e_D=e_{F_0}\cdot3^{256\cdot e_{F_0}^4}\), \(e_{G_0}=116064000000\), \(e_{E_0}=10\cdot(e_D\cdot e_{G_0})^2\), \(e_{Q_0}=e_D^{\,e_D\cdot e_{E_0}}\), \(e_{B}=e_D^2\cdot3^{21000\cdot e_D^2}+1\), \(e_{C}=2\cdot e_B+4096\cdot(1028+5\cdot e_D+84000\cdot e_D^2)\) and \(e_A=2\cdot10^{13}\cdot\max(1,\max(e_C,e_{Q_0}^{17}))\) (here \(10^{13}\) is the literal \(10000000000000\)). So \([\![e_A]\!]=A^{(0)}_{\rm ht}\).

Let \(L\ge1\) and \(M\in\mathbb N\). Put $\(\beta=\mathrm{cmul}_L\bigl(\langle e_A\rangle_L,\ \mathrm{cpow}_L(\sigma_L(M),24)\bigr)\)$ and run the division-by-four loop: \(x_0=L\), \(x_{i+1}=\lfloor x_i/4\rfloor\), stopping after \(\beta\) steps. Then:

  1. \(\langle e\rangle_L=\sigma_L([\![e]\!])\) for every expression \(e\); in particular \(\langle e_A\rangle_L=\sigma_L(A^{(0)}_{\rm ht})\);
  2. \(\beta=\sigma_L(A^{(0)}_{\rm ht}M^{24})\);
  3. \(x_\beta=\lfloor L/4^\beta\rfloor\), and \(x_\beta\ge1\iff4^{A^{(0)}_{\rm ht}M^{24}}\le L\).

Moreover \(\beta\le L+1\), so the loop takes at most \(L+1\) steps, and every capped value \(\langle e\rangle_L\) is at most \(L+1\): nothing astronomically large is computed.

Proof sketch. (1) Induction on \(e\). Literals by definition. For \(+\), \(\max\): the saturation identities \(\sigma_L(\sigma_L(x)+\sigma_L(y))=\sigma_L(x+y)\) and the same for \(\max\). For \(\cdot\): \(\mathrm{cmul}_L(a,b)=\sigma_L(ab)\), then \(\sigma_L(\sigma_L(x)\sigma_L(y))=\sigma_L(xy)\). For powers: \(\mathrm{cpow}_L(a,b)=\sigma_L(a^b)\) and \(\sigma_L(\sigma_L(x)^{\sigma_L(n)})=\sigma_L(x^n)\), which needs \(L\ge1\). For factorials: by induction on \(n\), \(f_L(n)=\sigma_L(n!)\) (item 5 of the saturation statement), and \(f_L(\sigma_L(n))=\sigma_L(n!)\) because for \(n\ge L+1\) both \(n!\) and \((L+1)!\) are at least \(L+1\). (2) By (1), the capped power and the capped product, \(\beta=\sigma_L(\sigma_L(A^{(0)}_{\rm ht})\cdot\sigma_L(M^{24}))=\sigma_L(A^{(0)}_{\rm ht}M^{24})\). (3) \(\lfloor\lfloor x/4\rfloor/4^i\rfloor=\lfloor x/4^{i+1}\rfloor\) gives \(x_i=\lfloor L/4^i\rfloor\), and \(\lfloor L/4^\beta\rfloor\ge1\iff4^\beta\le L\). Put \(B=A^{(0)}_{\rm ht}M^{24}\). If \(B\le L\) then \(\beta=B\). Otherwise \(\beta=L+1\), and both \(4^{L+1}\le L\) and \(4^B\le L\) are false, since \(4^x>x\) for every \(x\) and \(B>L\).

theorem NExpr.capped_eq (L : ℕ) (hL : 1 ≤ L) (e : NExpr) : e.capped L = saturate L e.eval
theorem cappedBound_eq (L M : ℕ) (hL : 1 ≤ L) : cappedBound L M = saturate L (A0 * M ^ 24)
theorem precision_test_iff (L M : ℕ) (hL : 1 ≤ L) :
    1 ≤ divFourLoop L (cappedBound L M) ↔ 4 ^ (A0 * M ^ 24) ≤ L
Uses 3 · Used by 3

Field divisions are guarded by the norm, which vanishes only at zero. Points are handled in Jacobian coordinates over \(\mathbb Z[s]\), with explicit identities for doubling and addition and their exceptional branches, and a finite check that the fixed projective point is \(P_0\); scalar multiplication halves its counter.

TheoremElements of norm zero#✓

For \(u,v\in\mathbb Q\), if \(u^2-2v^2=0\) then \(u=v=0\). Equivalently, an element \(z\) of \(K_0\) with \(\operatorname N(z)=0\) is zero, and for \(Y\in\mathbb Z[s]\) with \(Y\ne0\) the integer \(\operatorname N(Y)=Y\bar Y\) is nonzero. Hence every division by an element of \(K_0\) in the precision computation can be guarded by the exact test \(\operatorname N\ne0\) on integer components.

Proof sketch. If \(v\ne0\) then \((u/v)^2=2\), contradicting the irrationality of \(\sqrt2\). Equivalently, after clearing denominators a primitive integer solution of \(a^2=2b^2\) has \(a\) even, then \(b\) even, a contradiction. So \(v=0\) and then \(u=0\).

theorem rat_eq_zero_of_sq_sub_two_sq {u v : ℚ} (h : u ^ 2 - 2 * v ^ 2 = 0) : u = 0 ∧ v = 0
theorem intNorm_ne_zero {g h : ℤ} (hne : (g, h) ≠ (0, 0)) : g ^ 2 - 2 * h ^ 2 ≠ 0
Sources
Uses 1 · Used by 1

TheoremJacobian formulas on the weighted model#✓

Let \(R\) be a commutative ring and \(A\in R\); write \(\mathcal E(X,Y,Z)=Y^2-X^3-AXZ^4\). Define the Jacobian doubling and addition $\(\mathrm{dbl}(X,Y,Z)=(M^2-2S,\ M(S-X_3)-8Y^4,\ 2YZ),\quad M=3X^2+AZ^4,\ S=4XY^2,\ X_3=M^2-2S,\)$ and, for \(P_1=(X_1,Y_1,Z_1)\), \(P_2=(X_2,Y_2,Z_2)\), with \(U_1=X_1Z_2^2\), \(U_2=X_2Z_1^2\), \(S_1=Y_1Z_2^3\), \(S_2=Y_2Z_1^3\), \(H=U_2-U_1\), \(\Lambda=S_2-S_1\), $\(\mathrm{add}(P_1,P_2)=\bigl(\Lambda^2-H^3-2U_1H^2,\ \Lambda(U_1H^2-X_3)-S_1H^3,\ HZ_1Z_2\bigr),\)$ \(X_3\) being the first coordinate. Then the following polynomial identities hold:

  1. \(\mathcal E(\mathrm{dbl}(X,Y,Z))\) lies in the ideal generated by \(\mathcal E(X,Y,Z)\);
  2. \(\mathcal E(\mathrm{add}(P_1,P_2))\) lies in the ideal generated by \(\mathcal E(P_1)\) and \(\mathcal E(P_2)\);
  3. for doubling over a field of characteristic \(\ne2\) with \(YZ\ne0\), with \(x=X/Z^2\), \(y=Y/Z^3\) and \(\lambda=(3x^2+A)/(2y)=M/Z_3\) where \(Z_3=2YZ\): \(X_3/Z_3^2=\lambda^2-2x\), by the identity \(X_3=M^2-2xZ_3^2\) (as \(xZ_3^2=4XY^2=S\));
  4. \(Y_3/Z_3^3=\lambda(x-X_3/Z_3^2)-y\) for doubling, by the identity \(Y_3=M(XZ_3^2/Z^2-X_3)-8Y^4\) with \(Z_3^2/Z^2=4Y^2\);
  5. for addition over a field with \(Z_1Z_2H\ne0\), with \(x_i=X_i/Z_i^2\), \(y_i=Y_i/Z_i^3\) and \(\lambda=(y_2-y_1)/(x_2-x_1)=\Lambda/Z_3\): \(X_3/Z_3^2=\lambda^2-x_1-x_2\), by the identity \(X_3=\Lambda^2-H^2(U_1+U_2)\) and \((x_1+x_2)Z_3^2=(U_1+U_2)H^2\);
  6. \(Y_3/Z_3^3=\lambda(x_1-X_3/Z_3^2)-y_1\) for addition, by \(x_1Z_3^2=U_1H^2\) and \(y_1Z_3^3=S_1H^3\);
  7. (equal abscissas) over a field with \(Z_1Z_2\ne0\): \(H=0\iff x_1=x_2\), and then \(\Lambda=0\iff y_1=y_2\); for points of the curve over a field of characteristic \(\ne2\), the sum is the doubling if \(\Lambda=0\) and the identity \(O\) otherwise (opposite points);
  8. (zero ordinate) over a field of characteristic \(\ne2\), if \(Y=0\) and \(Z\ne0\) the point has order two and its double is \(O\); negation is \((X,Y,Z)\mapsto(X,-Y,Z)\).

Together these say that the Jacobian formulas, with the branches 7 and 8 and \(Z=0\) for \(O\), compute the chord-and-tangent law of \(E\) on representatives. They are polynomial identities, independent of the generator theorem. That the fixed projective point is the affine \(P_0\) is the separate finite check on the fixed Jacobian point.

The manuscript reports nine polynomial identities for the nonexceptional projective formulas and the preservation of \(Y^2=X^3+AXZ^4\) without listing them; the list above is the set this chapter uses.

Proof sketch. Items 1-6 are identities in polynomial rings over \(\mathbb Z\), checked by ring normalization (items 1 and 2 with explicit cofactors, found by polynomial division by \(\mathcal E\)). Item 7: \(U_1=U_2\) iff \(x_1=x_2\) after dividing by \(Z_1^2Z_2^2\), and likewise for \(S_i\); on the curve, equal abscissas give \(y_2=\pm y_1\). Item 8 is \(-(x,0)=(x,0)\).

theorem curveE_jdbl (A : R) (P : JTriple R) : curveE A (jdbl A P) = 64 * P.Y ^ 6 * curveE A P
theorem curveE_jadd (A : R) (P Q : JTriple R) :
    curveE A (jadd P Q) = addCofactor₁ A P Q * curveE A P + addCofactor₂ A P Q * curveE A Q
theorem jdbl_affine (A : F) (P : JTriple F) (h2 : (2 : F) ≠ 0) (hY : P.Y ≠ 0) (hZ : P.Z ≠ 0) :
    let x := P.X / P.Z ^ 2
    let y := P.Y / P.Z ^ 3
    let l := (3 * x ^ 2 + A) / (2 * y)
    (jdbl A P).Z ≠ 0 ∧ l = (3 * P.X ^ 2 + A * P.Z ^ 4) / (jdbl A P).Z ∧
      (jdbl A P).X / (jdbl A P).Z ^ 2 = l ^ 2 - 2 * x ∧
      (jdbl A P).Y / (jdbl A P).Z ^ 3 = l * (x - (jdbl A P).X / (jdbl A P).Z ^ 2) - y
Uses 1 · Used by 1

TheoremThe fixed Jacobian point#✓

In \(\mathbb Z[s]\), \(s^2=2\), with \(A=-11243+7950s\), the triple $\((X_0,Y_0,Z_0)=(3282-2320s,\ -247440+174966s,\ 4)\)$ satisfies \(Y_0^2=X_0^3+AX_0Z_0^4\), and in \(K_0\) $\(\frac{X_0}{Z_0^2}=\frac{3282-2320s}{16}=\frac{1641-1160s}{8}=x(P_0),\qquad \frac{Y_0}{Z_0^3}=\frac{-247440+174966s}{64}=\frac{-123720+87483s}{32}=y(P_0).\)$ So the fixed projective point of the precision computation is the affine point \(P_0\).

This is a finite computation on six explicit integers: both sides of the curve equation equal \(122452755912-86587174080s\), and the two quotients are the displayed coordinates of \(P_0\) (\(3282=2\cdot1641\), \(2320=2\cdot1160\), \(247440=2\cdot123720\), \(174966=2\cdot87483\), \(Z_0^2=16\), \(Z_0^3=64\)). It does not use the generator theorem.

theorem curveE_P0J : curveE Acoef P0J = 0
theorem P0J_affine :
    Zs.toK0 P0J.X / Zs.toK0 P0J.Z ^ 2 = genX0 ∧ Zs.toK0 P0J.Y / Zs.toK0 P0J.Z ^ 3 = genY0
theorem rep_P0J : Rep (-genD ^ 2) (P0J.map Zs.toK0) genP0
Sources
Uses 2 · Used by 1

TheoremScalar multiplication by halving#✓

A Jacobian representative of a point of \(E(K_0)\) is a triple \((X,Y,Z)\in\mathbb Z[s]^3\) representing \(O\) when \(Z=0\) and the affine point \((X/Z^2,Y/Z^3)\) when \(Z\ne0\) (which then lies on \(E\) whenever \(\mathcal E(X,Y,Z)=0\)). Let \(\oplus\) be the branching addition: if one argument has \(Z=0\) return the other; otherwise compute \(H,\Lambda\); if \(H\ne0\) return \(\mathrm{add}\); if \(H=0\) and \(\Lambda=0\) return \(\mathrm{dbl}\) (or \(O\) if \(Y=0\)); if \(H=0\) and \(\Lambda\ne0\) return \(O\). Let \(\mathrm{dbl}^\ast\) be doubling with \(O\mapsto O\) and zero ordinate \(\mapsto O\).

For \(k\in\mathbb N\) define \(\mathrm{mul}(k)\) by the loop with state \((\Pi,\Theta,e)\) starting at \((O,P^{\rm J}_0,k)\), where \(P^{\rm J}_0=(3282-2320s,-247440+174966s,4)\) and \(O=(1,1,0)\): while \(e>0\), if \(e\) is odd replace \(\Pi\) by \(\Pi\oplus\Theta\); replace \(\Theta\) by \(\mathrm{dbl}^\ast(\Theta)\) and \(e\) by \(\lfloor e/2\rfloor\); return \(\Pi\). For a negative integer \(k\) let \(\mathrm{mul}(k)\) be the negation \((X,-Y,Z)\) of \(\mathrm{mul}(-k)\).

Then for every \(k\in\mathbb Z\) the loop terminates and \(\mathrm{mul}(k)\) is a Jacobian representative of \([k]P_0\) satisfying \(\mathcal E=0\); in particular \([k]P_0=O\) if and only if the third coordinate is \(0\), and otherwise its ordinate is zero if and only if the second coordinate is \(0\).

Proof sketch. Termination: \(e\) halves. Invariant: \(\Pi\) and \(\Theta\) represent points \(\pi,\theta\) on \(E\) with \(\pi+[e]\theta=[k]P_0\); it holds initially because \(O=(1,1,0)\) represents \(O\) and \(P^{\rm J}_0\) represents \(P_0\) (the fixed Jacobian point) and is preserved because \(\oplus\) and \(\mathrm{dbl}^\ast\) represent the group law (Jacobian formulas, items 1-8): if \(e\) is odd, \(\pi+[e]\theta=(\pi+\theta)+[e-1]\theta\), and \([2\lfloor e/2\rfloor]\theta=[\lfloor e/2\rfloor](2\theta)\). At \(e=0\), \(\pi=[k]P_0\). Negation represents \(-P\). The last claim: for \(Z\ne0\), \(y=Y/Z^3\).

theorem rep_jmul (k : ℤ) : Rep (-genD ^ 2) ((jmul k).map Zs.toK0) (k • genP0)
theorem jmul_eq_some {k : ℤ} (hZ : (jmul k).Z ≠ 0) :
    ∃ h : genCurve.toAffine.Nonsingular (Zs.toK0 (jmul k).X / Zs.toK0 (jmul k).Z ^ 2)
      (Zs.toK0 (jmul k).Y / Zs.toK0 (jmul k).Z ^ 3), k • genP0 = .some _ _ h
theorem admissible_iff_jmul (k : ℤ) : Admissible k ↔ (jmul k).Z ≠ 0 ∧ (jmul k).Y ≠ 0
Uses 3 · Used by 3

The decision program assembles these steps, and it computes the relation on every input.

DefinitionThe exact decision program#✓

The decision program is the total function \(\mathrm{decide}:\mathbb N^5\to\{\mathrm{true},\mathrm{false}\}\) computed by the following steps on \(c\in\mathbb N^5\); every quantity is an integer, an element of \(\mathbb Z[s]\) (a pair of integers) or a natural number, and every test is exact.

  1. Decode \((n,\kappa,a,l,j)\). Return false unless \(n\notin\mathcal C\), \(\kappa\ne0\), \(a\ge1\), \(l\ge1\) and \(j=na\).
  2. For \(k\in\{l,a,j\}\) compute the Jacobian representative \((X_k,Y_k,Z_k)=\mathrm{mul}(k)\). Return false if some \(Z_k=0\) or some \(Y_k=0\).
  3. For \(k\in\{l,a,j\}\) put \(\nu_k=-X_kZ_k\bar Y_k\in\mathbb Z[s]\) and \(N_k=Y_k\bar Y_k\in\mathbb Z\), so that \(z_k=\nu_k/N_k\), with \(N_k\ne0\). Write \(\nu_l=p+p's\) and put \(U=|p|+|p'|\), \(V=|N_l|\), so that \(\epsilon_l=U/V\) with \(U,V>0\).
  4. Put \(\delta=N_j\operatorname N(\nu_a)\in\mathbb Z\setminus\{0\}\) and let \(\theta\) be the rational component of \(\nu_j\bar\nu_aN_a\in\mathbb Z[s]\), so that \(r(a,j)=\theta/\delta\). Return false unless \(|\theta-n\delta|\cdot V<U\cdot|\delta|\).
  5. Put \(L=\lfloor(V-1)/(4U)\rfloor\). Return false if \(L=0\). Otherwise, with \(M=|\kappa F(n)|\), compute \(\beta=\mathrm{cmul}_L(\langle e_A\rangle_L,\mathrm{cpow}_L(\sigma_L(M),24))\) and run the division-by-four loop from \(L\) for \(\beta\) steps; return true if and only if the final value is at least \(1\).

This is a definition. It follows the description of the reference program S21: exact quadratic-field arithmetic on integer pairs, capped integer operations, a halving scalar loop, a precision loop dividing by four and a bounded factorial iteration. The source S21 itself is not available in this repository, so this program is specified here rather than transcribed.

def decide5 (c : Fin 5 → ℕ) : Bool :=
  decideInt (dec (c 0)) (dec (c 1)) (dec (c 2)) (dec (c 3)) (dec (c 4))
Uses 3 · Used by 2

TheoremCorrectness of the decision program#✓

For every \(c\in\mathbb N^5\), \(\mathrm{decide}(c)=\mathrm{true}\iff\operatorname{accepts}(c)\). The program terminates on every input, including every early rejection.

Proof sketch. Step 1 is item 1 of the relation (signed decoding). Step 2: by the scalar-multiplication statement, \(Z_k=0\) iff \([k]P_0=O\) and, for \(Z_k\ne0\), \(Y_k=0\) iff the ordinate vanishes; so step 2 passes iff \(l,a,j\) are admissible. Step 3: \(z_k=-x/y=-X_kZ_k/Y_k=\nu_k/N_k\) with \(N_k=\operatorname N(Y_k)\ne0\) by the norm-zero statement; \(\epsilon_l=(|p|+|p'|)/|N_l|\), and \(U>0\) because \(z_l\ne0\). Step 4: \(z_j/z_a=\nu_j\bar\nu_aN_a/(N_j\operatorname N(\nu_a))\), with \(\nu_a\ne0\) so \(\operatorname N(\nu_a)\ne0\); then \(|\theta/\delta-n|<U/V\) is the displayed integer inequality after multiplying by \(|\delta|V>0\). Step 5: by the threshold statement, \(4\epsilon_l<4^{-\mathcal B}\) iff \(4^{\mathcal B}\le L\); if \(L=0\) this is false since \(4^{\mathcal B}\ge1\); if \(L\ge1\) the capped precision test computes exactly this comparison with \(\mathcal B=A^{(0)}_{\rm ht}M^{24}\). Termination: the scalar loop halves, the factorial and capped-power loops are bounded, and the precision loop runs at most \(L+1\) steps.

theorem decide5_iff (c : Fin 5 → ℕ) : decide5 c = true ↔ accepts c
theorem decideInt_iff (n κ a l j : ℤ) : decideInt n κ a l j = true ↔ acceptsInt n κ a l j
Uses 7 · Used by 1

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.