The other templates

Besides membership and raw addition, the core elliptic templates express the local parameter \(z=-x/y\), the inverse abscissa and the truncated formal logarithm, whose seven coefficients are \(16575(-1)^j\binom{2j}{j}/(4j+1)\).

DefinitionThe local parameter template#✓

The template \(\mathtt{raw\_z}\) has \(7\) parameters and \(1\) witness (\(8\) variables): the point \(p=(X_0,\dots,X_4)\), the pair \(\zeta=(X_5,X_6)\), and the inverse witness \(X_7\) of the local-parameter gadget. Its formula is \(Z(p,\zeta)\) and its polynomial is \([\![\mathtt{raw\_z}]\!]=\kappa(Z(p,\zeta))^2\). It expresses \(\zeta=z(p)=-x(p)/y(p)\), with \(z(O)=0\), on codes of points of \(2E(K_0)\).

This is a definition (template index \(2\)).

noncomputable def rawZTemplate : ExPoly := Build.template 7 (rawZBuild (varPoint 0) (varPair 5))
theorem rawZTemplate_rel_iff (a : Fin 7 → ℚ) :
    rawZTemplate.Rel a ↔ ∃ y : Fin 1 → ℚ,
      (zFormula (varPoint 0) (varPair 5) 7).Holds (assign 7 1 a y)
Sources
Uses 2 · Used by 3

DefinitionThe inverse abscissa template#✓

The template \(\mathtt{raw\_inverse\_x}\) has \(7\) parameters and no witnesses: the point \(p=(X_0,\dots,X_4)\) and the pair \(v=(X_5,X_6)\). Its formula is \(I\!X(p,v)\) and its polynomial is \([\![\mathtt{raw\_inverse\_x}]\!]=\kappa(I\!X(p,v))^2\). It expresses \(v=1/x(p)\), with value \(0\) at the identity.

This is a definition (template index \(3\)).

noncomputable def rawInverseXTemplate : ExPoly :=
  Build.template 7 (rawInverseXBuild (varPoint 0) (varPair 5))
theorem rawInverseXTemplate_rel_iff (a : Fin 7 → ℚ) :
    rawInverseXTemplate.Rel a ↔ ∃ y : Fin 0 → ℚ,
      (ixFormula (varPoint 0) (varPair 5)).Holds (assign 7 0 a y)
Sources
Uses 2 · Used by 3

DefinitionThe truncated logarithm template#✓

The template \(\mathtt{log25}\) has \(4\) parameters and no witnesses: the pairs \(\zeta=(X_0,X_1)\) and \(\lambda=(X_2,X_3)\). With \(\delta=(11243,-7950)\) (that is \(d^2\)) and $\(L(\zeta)=\sum_{j=0}^{6}c_j\,\bigl(\delta^j\cdot\zeta^{4j+1}\bigr),\qquad (c_0,\dots,c_6)=(16575,\,-6630,\,11050,\,-25500,\,68250,\,-198900,\,612612),\)$ computed in pair arithmetic (\(\delta^j\) by successive multiplication, \(\zeta^{4j+1}\) by repeated squaring), its formula is the pair equation \(L(\zeta)\doteq\lambda\) and its polynomial is $\([\![\mathtt{log25}]\!]=\bigl((L_0(\zeta)-\lambda_0)^2+(L_1(\zeta)-\lambda_1)^2\bigr)^2 .\)$

\(L(z)=16575z-6630d^2z^5+11050d^4z^9-25500d^6z^{13}+68250d^8z^{17}-198900d^{10}z^{21}+612612d^{12}z^{25}\) is \(16575\) times the degree-\(25\) truncation of the formal logarithm \(\sum_{j\ge0}(-1)^j\binom{2j}{j}d^{2j}z^{4j+1}/(4j+1)\) of \(E\); that the coefficients are \(16575\cdot(-1)^j\binom{2j}{j}/(4j+1)\) for \(j=0,\dots,6\) is a separate finite check.

This is a definition (template index \(4\)).

noncomputable def log25Template : ExPoly := Build.template 4 (log25Build (varPair 0) (varPair 2))
theorem log25Template_rel_iff (a : Fin 4 → ℚ) :
    log25Template.Rel a ↔ ∃ y : Fin 0 → ℚ,
      (feq (varPair 0).log25 (varPair 2)).Holds (assign 4 0 a y)
Sources
Uses 2 · Used by 9

TheoremThe coefficients of the truncated logarithm#✓

The seven coefficients \((c_0,\dots,c_6)=(16575,-6630,11050,-25500,68250,-198900,612612)\) of the truncated logarithm template satisfy $\((4j+1)\,c_j=16575\,(-1)^j\binom{2j}{j}\qquad(j=0,1,\dots,6).\)$ Hence \(L(z)=16575\sum_{j=0}^{6}\frac{(-1)^j\binom{2j}{j}}{4j+1}d^{2j}z^{4j+1}\), which is \(16575\) times the degree-\(25\) truncation of the formal logarithm \(\sum_{j\ge0}\frac{(-1)^j\binom{2j}{j}}{4j+1}d^{2j}z^{4j+1}\) of \(E\) in the parameter \(z=-x/y\).

This is a closed decidable statement: seven integer identities. The identification of the series with the formal logarithm of \(E\) (from \(dx/(2y)=dz/\sqrt{1+4d^2z^4}\)) is part of the multiplication chapter's argument and is not claimed here.

theorem log25Coeffs_spec : ∀ j : Fin 7,
    (4 * (j : ℤ) + 1) * log25Coeffs.get ⟨j, by simp [log25Coeffs]⟩ =
      16575 * (-1) ^ (j : ℕ) * ((2 * (j : ℕ)).choose j : ℤ)
Sources
Uses 1 · Used by 1

The multiplication certificate is assembled from the pole polynomial, twelve local tests, the normalized slope certificate and the height certificate. The pole template's relation is the pole predicate \(\Phi\) of pole completeness.

DefinitionThe pole template#✓

The template \(\mathtt{pole}\) has \(1\) parameter and \(11\) witnesses (\(12\) variables): \(B=X_0\), the bits \(b_i=X_{1+i}\) (\(i=0,\dots,5\)), and \(e=X_7\), \(z=X_8\), \(r_1=X_9\), \(r_2=X_{10}\), \(w=X_{11}\). With $\(m=(1-2b_0)(1+b_1)(1+2b_2)(1+4b_3)(1+6b_4)(1+12b_5),\quad A=mB,\quad H=A(A-B^2),\)$ $\(T_1=A(A-e)(A+3e),\qquad T_2=A(Az^2-eH)(Az^2+3eH),\)$ $\(S=\sum_{i=0}^5(b_i^2-b_i)^2+(eHzw-1)^2+(r_1^2-T_1)^2+(r_2^2-T_2)^2,\)$ its formula is the atom \(B\,S\doteq0\) and its polynomial is $\([\![\mathtt{pole}]\!]=(B\,S)^2=Q_{\rm pole}^2 ,\)$ where \(Q_{\rm pole}=BS\) is the pole polynomial of the pole completeness statement, with the witnesses in the same order. Its relation is therefore \(\Phi(B)\), as stated in the pole-template semantics.

This is a definition (template index \(5\)).

noncomputable def poleTemplate : ExPoly := Build.template 1 (poleBuild (X 0))
theorem poleTemplate_poly : poleTemplate.poly = (polePolyX - 0) ^ 2
Sources
Uses 2 · Used by 6

TheoremSemantics of the pole template#✓

For every \(B\in\mathbb Q\), $\(\mathrm{Rel}_{\mathtt{pole}}(B)\iff\Phi(B),\)$ where \(\Phi(B)\) is the statement that the pole polynomial \(Q_{\rm pole}\) of pole completeness has a rational zero with input \(B\): there are \(b_0,\dots,b_5,e,z,r_1,r_2,w\in\mathbb Q\) with \(Q_{\rm pole}(B;b,e,z,r_1,r_2,w)=0\).

Proof sketch. The template polynomial is \((B\,S)^2\), where \(B\,S\) is \(Q_{\rm pole}\) written with \(B=X_0\), \(b_i=X_{1+i}\), \(e=X_7\), \(z=X_8\), \(r_1=X_9\), \(r_2=X_{10}\), \(w=X_{11}\); the compilation \(B\,S-0\) of the atom \(B\,S\doteq0\) is the same polynomial. Evaluating at \((B,y_0,\dots,y_{10})\) gives \(Q_{\rm pole}(B;y)^2\), which vanishes exactly when \(Q_{\rm pole}(B;y)=0\). The eleven witnesses of the template are exactly the eleven witnesses of \(\Phi\), in the same order.

theorem poleTemplate_rel_iff (a : Fin 1 → ℚ) : poleTemplate.Rel a ↔ PoleSoluble (a 0)
Sources
Uses 4

DefinitionThe test-group template#✓

The template \(\mathtt{test\_group}\) has \(44\) parameters and \(162\) witnesses (\(206\) variables). Parameters: points \(C_0,\dots,C_3\) (\(C_i=(X_{5i},\dots,X_{5i+4})\)) and output pairs \(D_0,\dots,D_{11}\) (\(D_j=(X_{20+2j},X_{21+2j})\)). Witnesses in allocation order:

  • points \(F_i=(X_{44+5i},\dots,X_{48+5i})\) and \(V_i=(X_{64+5i},\dots,X_{68+5i})\), \(i=0,\dots,3\);
  • for \(i=0,\dots,3\): a \(\mathtt{member}\) block of \(7\) and a \(\mathtt{raw\_add}\) block of \(6\) (starts \(84,91,97,104,110,117,123,130\));
  • for \(i=0,\dots,7\), with base \(b=136+7i\): pairs \(\zeta_i=(X_b,X_{b+1})\), \(\lambda_i=(X_{b+2},X_{b+3})\), \(\rho_i=(X_{b+4},X_{b+5})\), then a \(\mathtt{raw\_z}\) block \(\{X_{b+6}\}\) and empty \(\mathtt{log25}\) and \(\mathtt{raw\_inverse\_x}\) blocks at \(b+7\);
  • inverse witnesses \(u_1=X_{192}\), \(u_2=X_{193}\);
  • ratio pairs \(q_{0,1},q_{0,2},q_{0,3},q_{1,1},q_{1,2},q_{1,3}\) at \(X_{194},\dots,X_{205}\).

Let \(\Pi_i=F_i\) and \(\Pi_{4+i}=V_i\) (\(i=0,\dots,3\)), and let the twelve tests be $\(\tau=\bigl(\rho_0,\rho_1,\rho_2,\rho_3,\ \bar\rho_4,\bar\rho_5,\bar\rho_6,\bar\rho_7,\ q_{0,1}-\bar q_{1,1},\ q_{0,2}-\bar q_{1,2},\ q_{0,3}-\bar q_{1,3},\ q_{0,1}\cdot q_{0,2}-q_{0,3}\bigr).\)$ The formula is the conjunction of the following items, in this order:

  1. for \(i=0,\dots,3\): \(\langle\mathtt{member}[F_i]\rangle\) and \(\langle\mathtt{raw\_add}[F_i,\mathrm{neg}(C_i),V_i]\rangle\);
  2. \(\mathrm{fin}(F_0)\) and \(\mathrm{fin}(V_0)\);
  3. for \(i=0,\dots,7\): \(\langle\mathtt{raw\_z}[\Pi_i,\zeta_i]\rangle\), \(\langle\mathtt{log25}[\zeta_i,\lambda_i]\rangle\), \(\langle\mathtt{raw\_inverse\_x}[\Pi_i,\rho_i]\rangle\);
  4. \(N(\lambda_0)\,u_1\doteq1\) and \(N(\lambda_4)\,u_2\doteq1\);
  5. for \(\sigma=0,1\) and \(i=1,2,3\): \(\lambda_{4\sigma}\cdot q_{\sigma,i}\doteq\lambda_{4\sigma+i}\);
  6. for \(j=0,\dots,11\): \(D_j\doteq\tau_j\).

Each call uses its block listed above. The polynomial is \(\kappa\) of this conjunction, squared.

With \(V_i=F_i-C_i\), the tests are four inverse abscissas at \(F_0,\dots,F_3\), the conjugates of the inverse abscissas at \(V_0,\dots,V_3\), three differences of \(L\)-ratios and the product test; their use is the multiplication chapter's.

This is a definition (template index \(6\)).

noncomputable def testGroupTemplate : ExPoly :=
  Build.template 44 (testGroupBuild testGroupC testGroupD)
theorem testGroupBuild_formula :
    (testGroupBuild testGroupC testGroupD ⟨44, []⟩).1 = testGroupFormula
Uses 7 · Used by 3

DefinitionThe slope template#✓

The template \(\mathtt{slope}\) has \(22\) parameters and \(1298\) witnesses (\(1320\) variables). Parameters: \(t=X_0\), \(\ell=X_1\) and points \(C_0,\dots,C_3\) (\(C_i=(X_{2+5i},\dots,X_{6+5i})\)). Witnesses in allocation order: \(\eta=X_{22}\), \(q=X_{23}\), \(R_0=X_{24}\); inverse witnesses \(u_1,u_2,u_3,u_4=X_{25},\dots,X_{28}\); for each group \(g=0,\dots,5\) with base \(\beta=29+213g\): pairs \(D_{g,j}=(X_{\beta+2j},X_{\beta+2j+1})\) (\(j=0,\dots,11\)), a \(\mathtt{test\_group}\) block \([\beta+24,\beta+186)\), pairs \(C'_{g,j}=(X_{\beta+186+2j},X_{\beta+187+2j})\), the pair \(\omega_g=(X_{\beta+210},X_{\beta+211})\) and its inverse witness \(v_g=X_{\beta+212}\); then \(B=X_{1307}\), \(u_\theta=X_{1308}\) and a \(\mathtt{pole}\) block \([1309,1320)\).

Abbreviations: \(F(t)=t(t+15)(t+20)(t+24)(t+30)(t+60)\) (left to right, the first factor written \(t+0\)); \(a=1-R_0q^2\); \(R=\ell^2a^2R_0\); \(\mathrm{den}_j=R_0(t-1)^2\) for \(j<8\) and \(\mathrm{den}_j=R_0^{25}(t-1)^{26}\) for \(j\ge8\); \(W_g=\prod_{j=0}^{11}\bigl(1+R\,C_{g,j}'^{\,2}\bigr)\) in pair arithmetic (with \(R\,u=(Ru_0,Ru_1)\) and \(1=(1,0)\)); \(\theta=2\sum_{g=0}^5(\omega_g)_0\).

The formula is the conjunction of, in this order:

  1. \(\eta^2\doteq1\), \((t-1)\,u_1\doteq1\), \(F(t)\,u_2\doteq1\), \(\ell\,u_3\doteq1\), \(R_0(t-1)^8\doteq\eta F(t)\), \(a\,u_4\doteq1\);
  2. for \(g=0,\dots,5\): \(\langle\mathtt{test\_group}[C_0,\dots,C_3,D_{g,0},\dots,D_{g,11}]\rangle\); the pair equations \(\mathrm{den}_j\,C'_{g,j}\doteq D_{g,j}\) for \(j=0,\dots,11\); and \(\bigwedge\bigl(N(W_g)\,v_g\doteq1,\ W_g\cdot\omega_g\doteq(1,0)\bigr)\);
  3. \(\theta\,u_\theta\doteq1\), \(B\theta^2\doteq R\), \(\langle\mathtt{pole}[B]\rangle\).

The polynomial is \(\kappa\) of this conjunction, squared.

This is the normalized six-contact slope certificate: for a slope \(t\notin\{0,-15,-20,-24,-30,-60,1\}\) it imposes \(R_0=\eta F(t)/(t-1)^8\), \(a\ne0\), the normalized tests \(C'_{gj}=D_{gj}/(R_0^{k_j}(t-1)^{k_j+1})\) with \(k_j\in\{1,25\}\), \(W_g\ne0\), \(\theta=\mathrm{Tr}\sum_gW_g^{-1}\ne0\) and \(\Phi(R/\theta^2)\).

This is a definition (template index \(7\)).

noncomputable def slopeTemplate : ExPoly := Build.template 22 (slopeBuild (X 0) (X 1) (varArgs 2 20))
theorem slopeBuild_formula : (slopeBuild (X 0) (X 1) (varArgs 2 20) ⟨22, []⟩).1 = slopeFormula
Uses 4 · Used by 3

DefinitionThe height certificate template#✓

The template \(\mathtt{height\_certificate}\) has \(36\) parameters and \(35106\) witnesses (\(35142\) variables). Parameters: points \(P_0,P_1,P_2\) (\(P_i=(X_{5i},\dots,X_{5i+4})\)), \(\ell=X_{15}\) and points \(C_0,\dots,C_3\) (\(C_i=(X_{16+5i},\dots,X_{20+5i})\)). Witnesses in allocation order:

  • for \(i=0,1,2\) with base \(b=36+11i\): a \(\mathtt{member}\) block \([b,b+7)\), then \(a_{i0}=X_{b+7}\), \(a_{i1}=X_{b+8}\), \(b_i=X_{b+9}\) and the inverse witness \(u_i=X_{b+10}\);
  • for \(k=0,\dots,8\) with base \(c=69+3897k\): slopes \(s_{k,0},s_{k,1},s_{k,2}=X_c,X_{c+1},X_{c+2}\) and three \(\mathtt{slope}\) blocks \([c+3+1298l,\ c+1301+1298l)\), \(l=0,1,2\).

The nine quantities are \(Q=(a_{00},a_{01},b_0,a_{10},a_{11},b_1,a_{20},a_{21},b_2)\). The formula is the conjunction of, in this order:

  1. for \(i=0,1,2\): \(\langle\mathtt{member}[P_i]\rangle\), \(b_iu_i\doteq1\), \(b_i\,(P_i)_1\doteq a_{i0}\), \(b_i\,(P_i)_2\doteq a_{i1}\);
  2. for \(k=0,\dots,8\): \(s_{k,0}+s_{k,1}+s_{k,2}\doteq Q_k\), and \(\langle\mathtt{slope}[s_{k,l},\ell,C_0,\dots,C_3]\rangle\) for \(l=0,1,2\).

The polynomial is \(\kappa\) of this conjunction, squared. It writes the three abscissas as \(a_{i0}/b_i+(a_{i1}/b_i)s\) with \(b_i\ne0\), expresses each of the nine rational quantities as a sum of three slopes, and imposes the slope certificate on all \(27\) slopes; it is the unguarded certificate, and false triples in the finite box are excluded separately.

This is a definition (template index \(8\)).

noncomputable def heightTemplate : ExPoly :=
  Build.template 36 (heightBuild (varPoint 0) (varPoint 5) (varPoint 10) (X 15) (varArgs 16 20))
theorem heightBuild_formula :
    (heightBuild (varPoint 0) (varPoint 5) (varPoint 10) (X 15) (varArgs 16 20) ⟨36, []⟩).1 =
      heightFormula
Uses 3 · Used by 5

Fixed scalar multiples are expressed with division polynomials, and the guard excludes exactly the false triples of codes in the finite box.

DefinitionThe fixed-scalar templates#✓

For a fixed integer expression \(e\) with value \(n=\mathrm{val}(e)\), the template \(S_e\) has \(10\) parameters and \(1\) witness (\(11\) variables): points \(p=(X_0,\dots,X_4)\) and \(r=(X_5,\dots,X_9)\) and the inverse witness \(u=X_{10}\). For an index expression \(e'\) write \(\psi_{e'}=(\Psi_{\mathrm{val}(e'),0},\Psi_{\mathrm{val}(e'),1})(p_1,p_2,p_3,p_4)\), the pair of \(\mathrm{psi}\) nodes at \(x(p),y(p)\). With \(g=\psi_e\), \(g_+=\psi_{e+1}\), \(g_-=\psi_{e+(-1)}\), \(g_2=\psi_{2\cdot e}\) (index expressions \(\mathrm{add}(e,1)\), \(\mathrm{add}(e,-1)\), \(\mathrm{mul}(2,e)\)), the formula is $\(\bigvee\Bigl(\bigwedge(\mathrm{isO}(p),\mathrm{isO}(r)),\ \ \bigwedge\bigl(\mathrm{fin}(p),\ \mathrm{fin}(r),\ N(g)\,u\doteq1,\ g^2\cdot x(r)\doteq x(p)\cdot g^2-g_+\cdot g_-,\ \bigl(2(g^2)^2\bigr)\cdot y(r)\doteq g_2\bigr)\Bigr)\)$ in pair arithmetic, and the polynomial of \(S_e\) is \(\kappa\) of this formula, squared.

The library contains six instances: \(\mathtt{multiply.scalar}=S_{c_*}\) (template index \(9\)) and \(\mathtt{scalar.integer\_constant}_k=S_{\mathrm{integer\_constant}_k}\) for \(k=0,\dots,4\) (template indices \(18,\dots,22\)). The polynomials \(\Psi_{n,c}\) for \(n=c_*\) are never expanded.

The second branch is the denominator-cleared form of \(x(r)=x-\psi_{n+1}\psi_{n-1}/\psi_n^2\) and \(y(r)=\psi_{2n}/(2\psi_n^4)\) with \(\psi_n\ne0\).

This is a definition.

noncomputable def scalarTemplate (I : Constructors E) (n : ℤ) : ExPoly :=
  Build.template 10 (scalarBuild I n (varPoint 0) (varPoint 5))
theorem scalarTemplate_rel_iff (I : Constructors E) (n : ℤ) (a : Fin 10 → ℚ) :
    (scalarTemplate I n).Rel a ↔ ∃ y : Fin 1 → ℚ,
      (scalarFormula I n (varPoint 0) (varPoint 5) 10).Holds (assign 10 1 a y)
Uses 4 · Used by 4

DefinitionThe guard template#✓

The template \(\mathtt{multiply.guard}\) has \(15\) parameters and \(1\) witness (\(16\) variables): points \(P_0,P_1,P_2\) (\(P_i=(X_{5i},\dots,X_{5i+4})\)) and the inverse witness \(u=X_{15}\). Its formula is \(\mathrm{NZ}(G_T(X_0,\dots,X_{14}))\), the atom \(G_T(X_0,\dots,X_{14})\cdot u\doteq1\), where \(G_T\) is the false-triple product at the fixed constant \(T\) (the node \(\mathrm{guard}\ T\ (X_0,\dots,X_{14})\)). Its polynomial is $\([\![\mathtt{multiply.guard}]\!]=\bigl(G_T(X_0,\dots,X_{14})\,X_{15}-1\bigr)^2 .\)$

This is a definition (template index \(10\)).

noncomputable def guardTemplate (I : Constructors E) (T : ℤ) : ExPoly :=
  Build.template 15 (guardBuild I T (varArgs 0 15))
theorem guardTemplate_rel_iff (I : Constructors E) (T : ℤ) (a : Fin 15 → ℚ) :
    (guardTemplate I T).Rel a ↔ eval₂ (Int.castRingHom ℚ) a (I.guard T) ≠ 0
Sources
Uses 3 · Used by 5

TheoremSemantics of the guard template#✓

For all \(P_0,P_1,P_2\in\mathbb Q^5\), $\(\mathrm{Rel}_{\mathtt{multiply.guard}}(P_0,P_1,P_2)\iff\neg\,\exists\,(a,b,c)\in\mathbb Z^3:\ |a|,|b|,|c|\le T,\ ab\ne c,\ (P_0,P_1,P_2)=(\iota(a),\iota(b),\iota(c)).\)$ That is, the zero set of \(G_T\) over \(\mathbb Q\) is exactly the finite set of false triples of codes in the box, and the guard holds exactly off that set. Nothing here bounds or evaluates \(T\).

Proof sketch. By the inverse-witness statement the relation holds exactly when \(G_T(P_0,P_1,P_2)\ne0\), that is, when no factor vanishes. A factor \(\sum_j(D_{abc}X_j-(D_{abc}/B_j)A_j)^2\) vanishes at rational \(X\) exactly when \(D_{abc}X_j=(D_{abc}/B_j)A_j\) for all \(j\), i.e. \(X_j=A_j/B_j\) since \(D_{abc}>0\), i.e. \((X_1,\dots,X_{15})=(\iota(a),\iota(b),\iota(c))\).

theorem guardTemplate_rel_codes3_iff (I : Constructors E) (T : ℤ)
    (hI : I.guard T = guardPoly T) (P₀ P₁ P₂ : Fin 5 → ℚ) :
    (guardTemplate I T).Rel (codes3 P₀ P₁ P₂) ↔
      ¬ ∃ a b c : ℤ, |a| ≤ T ∧ |b| ≤ T ∧ |c| ≤ T ∧ a * b ≠ c ∧
        P₀ = iota a ∧ P₁ = iota b ∧ P₂ = iota c
theorem guardTemplate_rel_iff_not_falseTriple_guardPoly (I : Constructors E) (T : ℤ)
    (hI : I.guard T = guardPoly T) (a : Fin 15 → ℚ) :
    (guardTemplate I T).Rel a ↔ ¬ FalseTripleCodes T a
Sources
Uses 4 · Used by 1

The multiplication template conjoins four scalar shifts, the height certificate and the guard. The natural template expresses a code of a natural number as a sum of four squares; given the multiplication statement, its relation holds exactly on the codes of natural numbers.

DefinitionThe multiplication template#✓

The template \(\mathtt{multiply}\) has \(15\) parameters and \(35134\) witnesses (\(35149\) variables). Parameters: points \(P_0,P_1,P_2\) (\(P_i=(X_{5i},\dots,X_{5i+4})\)). Witnesses in allocation order: the rational constants \(c_1=X_{15}\) (\(1641/8\)), \(c_2=X_{16}\) (\(-15465/4\)), \(c_3=X_{17}\) (\(87483/32\)), giving the generator point \(G=(0,c_1,-145,c_2,c_3)\); for \(i=0,\dots,3\) a shift point \(S_i=(X_{18+6i},\dots,X_{22+6i})\) followed by an \(S_{c_*}\) block \(\{X_{23+6i}\}\); a \(\mathtt{height\_certificate}\) block \([42,35148)\); and a \(\mathtt{multiply.guard}\) block \(\{X_{35148}\}\).

With \((\Pi_0,\Pi_1,\Pi_2,\Pi_3)=(G,P_0,P_1,P_2)\) and \(\ell\) the node \(\mathrm{fixed}\ \ell\), the formula is the conjunction $\(\varphi_{\rm mul}=\bigwedge\Bigl(\langle S_{c_*}[\Pi_0,S_0]\rangle,\dots,\langle S_{c_*}[\Pi_3,S_3]\rangle,\ \langle\mathtt{height\_certificate}[P_0,P_1,P_2,\ell,S_0,S_1,S_2,S_3]\rangle,\ \langle\mathtt{multiply.guard}[P_0,P_1,P_2]\rangle\Bigr),\)$ and the polynomial, including the global generator equations, is $\([\![\mathtt{multiply}]\!]=(8X_{15}-1641)^2+(4X_{16}+15465)^2+(32X_{17}-87483)^2+\kappa(\varphi_{\rm mul})^2 .\)$

So the four scalar shifts are \(c_*G\), \(c_*P_0\), \(c_*P_1\), \(c_*P_2\), the membership of the three roots is imposed inside the height certificate, and the guard excludes the false triples in the box. That \(\mathrm{Rel}_{\mathtt{multiply}}\) holds exactly on code triples with indices \(a,b,ab\) is the multiplication statement M.

This is a definition (template index \(11\)).

noncomputable def multiplyTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
  Build.template 15 (multiplyBuild I cstar ell T (varPoint 0) (varPoint 5) (varPoint 10))
theorem multiplyBuild_formula (I : Constructors E) (cstar ell T : ℤ) :
    (multiplyBuild I cstar ell T (varPoint 0) (varPoint 5) (varPoint 10) ⟨15, []⟩).1 =
      multiplyFormula I cstar ell T
Uses 6 · Used by 10

DefinitionThe natural-code template#✓

The template \(\mathtt{natural}\) has \(5\) parameters and \(140604\) witnesses (\(140609\) variables). Parameter: the point \(A=(X_0,\dots,X_4)\). Witnesses in allocation order: points \(\sigma_i=(X_{5+5i},\dots,X_{9+5i})\) and \(\Sigma_i=(X_{25+5i},\dots,X_{29+5i})\) for \(i=0,\dots,3\); four \(\mathtt{multiply}\) blocks \([45+35134i,\ 35179+35134i)\); the point \(\pi_1=(X_{140581},\dots,X_{140585})\) and a \(\mathtt{raw\_add}\) block \([140586,140592)\); the point \(\pi_2=(X_{140592},\dots,X_{140596})\) and a \(\mathtt{raw\_add}\) block \([140597,140603)\); and a \(\mathtt{raw\_add}\) block \([140603,140609)\). The formula is $\(\bigwedge\Bigl(\langle\mathtt{multiply}[\sigma_i,\sigma_i,\Sigma_i]\rangle_{i=0,\dots,3},\ \langle\mathtt{raw\_add}[\Sigma_0,\Sigma_1,\pi_1]\rangle,\ \langle\mathtt{raw\_add}[\pi_1,\Sigma_2,\pi_2]\rangle,\ \langle\mathtt{raw\_add}[\pi_2,\Sigma_3,A]\rangle\Bigr),\)$ and the polynomial is \(\kappa\) of it, squared.

It says that \(A\) is the sum of four squares of indices; that, given the multiplication statement M, its relation holds exactly on \(\iota(\mathbb N)\) is the natural-code semantics.

This is a definition (template index \(12\)).

noncomputable def naturalTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
  Build.template 5 (naturalBuild I cstar ell T (varPoint 0))
theorem naturalBuild_formula (I : Constructors E) (cstar ell T : ℤ) :
    (naturalBuild I cstar ell T (varPoint 0) ⟨5, []⟩).1 = naturalFormula I cstar ell T
Sources
Uses 3 · Used by 4

Its semantics, the natural-code predicate, is proved in the chapter on the outer recipes and their translation: the natural-code predicate.

The value templates encode signed indices, absolute values, the coordinate window, the six raw tests with the pole predicate, and the six exceptional values.

DefinitionThe signed-encoding template#✓

The template \(\mathtt{value.signed\_encode}\) has \(10\) parameters and \(140654\) witnesses (\(140664\) variables). Parameters: points \(N=(X_0,\dots,X_4)\) and \(C=(X_5,\dots,X_9)\). Witnesses in allocation order: points \(Q=(X_{10},\dots,X_{14})\), \(Q_2=(X_{15},\dots,X_{19})\), \(Q_+=(X_{20},\dots,X_{24})\); \(\mathtt{member}\) blocks \([25,32)\) and \([32,39)\); a \(\mathtt{natural}\) block \([39,140643)\); a \(\mathtt{raw\_add}\) block \([140643,140649)\); the rational constants \(c_1=X_{140649}\), \(c_2=X_{140650}\), \(c_3=X_{140651}\) of the generator point \(G=(0,c_1,-145,c_2,c_3)\); and \(\mathtt{raw\_add}\) blocks \([140652,140658)\) and \([140658,140664)\). The formula is $\(\varphi=\bigwedge\Bigl(\langle\mathtt{member}[N]\rangle,\ \langle\mathtt{member}[C]\rangle,\ \langle\mathtt{natural}[Q]\rangle,\ \langle\mathtt{raw\_add}[Q,Q,Q_2]\rangle,\ \bigvee\bigl(\bigwedge(\mathrm{eq}(N,Q),\mathrm{eq}(C,Q_2)),\ \beta\bigr)\Bigr),\)$ $\(\beta=\bigwedge\bigl(\langle\mathtt{raw\_add}[Q,G,Q_+]\rangle,\ \mathrm{eq}(N,\mathrm{neg}(Q_+)),\ \langle\mathtt{raw\_add}[Q_2,G,C]\rangle\bigr),\)$ the two calls in \(\beta\) using the blocks \([140652,140658)\) and \([140658,140664)\), and the polynomial is $\((8c_1-1641)^2+(4c_2+15465)^2+(32c_3-87483)^2+\kappa(\varphi)^2 .\)$ The generator equations stay outside the internal disjunction.

With \(Q=\iota(q)\), \(q\ge0\), the branches are \(C=\iota(2q)\), \(N=\iota(q)\) and \(C=\iota(2q+1)\), \(N=\iota(-(q+1))\): the template says \(N=\iota(\mathrm{dec}(c))\) for \(C=\iota(c)\), \(c\ge0\), where \(\mathrm{dec}(c)=c/2\) for even \(c\) and \(-(c+1)/2\) for odd \(c\).

This is a definition (template index \(13\)).

noncomputable def signedEncodeTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
  Build.template 10 (signedEncodeBuild I cstar ell T (varPoint 0) (varPoint 5))
theorem signedEncode_facts (I : Constructors E) (cstar ell T : ℤ) :
    Build.Facts 10 (signedEncodeBuild I cstar ell T (varPoint 0) (varPoint 5)) 140664
      signedEncodeBlocks signedEncodeGlobals
Uses 5 · Used by 3

DefinitionThe coordinate-window template#✓

The template \(\mathtt{value.close\_coordinates}\) has \(16\) parameters and \(53\) witnesses (\(69\) variables). Parameters: points \(A=(X_0,\dots,X_4)\), \(L=(X_5,\dots,X_9)\), \(J=(X_{10},\dots,X_{14})\) and \(t=X_{15}\). Witnesses in allocation order: pairs \(\zeta_A=(X_{16},X_{17})\), \(\zeta_L=(X_{18},X_{19})\), \(\zeta_J=(X_{20},X_{21})\); the ratio pair \(q=(X_{22},X_{23})\) and its inverse witness \(v=X_{24}\); \(a_0=X_{25}\), \(a_1=X_{26}\), the distance \(\delta=X_{27}\); the positivity variables \(z_1,\dots,z_4=X_{28},\dots,X_{31}\); \(\mathtt{member}\) blocks \([32,39)\), \([39,46)\), \([46,53)\); the inverse witnesses \(X_{53},X_{54},X_{55}\) of the gadgets \(Z(A,\zeta_A)\), \(Z(L,\zeta_L)\), \(Z(J,\zeta_J)\); \(\mathtt{value.abs}\) blocks \([56,60)\) and \([60,64)\); the inverse witness \(u_\epsilon=X_{64}\); and a \(\mathtt{value.abs}\) block \([65,69)\).

With \(\epsilon=a_0+a_1\), \(r=q_0\) and \(\mu=\epsilon-\delta\), the formula is the conjunction of, in this order: \(\langle\mathtt{member}[A]\rangle\), \(\langle\mathtt{member}[L]\rangle\), \(\langle\mathtt{member}[J]\rangle\), \(\mathrm{fin}(A)\), \(\mathrm{fin}(L)\), \(Z(A,\zeta_A)\), \(Z(L,\zeta_L)\), \(Z(J,\zeta_J)\), \(\bigwedge(N(\zeta_A)\,v\doteq1,\ \zeta_A\cdot q\doteq\zeta_J)\), \(\langle\mathtt{value.abs}[(\zeta_L)_0,a_0]\rangle\), \(\langle\mathtt{value.abs}[(\zeta_L)_1,a_1]\rangle\), \(\epsilon\,u_\epsilon\doteq1\), \(\langle\mathtt{value.abs}[t-r,\delta]\rangle\) and \(\mu\,(z_1^2+z_2^2+z_3^2+z_4^2)\doteq1\). The polynomial is \(\kappa\) of it, squared.

It expresses the strict window \(|t-\tfrac12\mathrm{Tr}(z(J)/z(A))|<|u_L|+|v_L|\), where \(z(L)=u_L+v_Ls\), for codes \(A,L\) of nonzero points.

This is a definition (template index \(15\)).

noncomputable def closeTemplate : ExPoly :=
  Build.template 16 (closeBuild (varPoint 0) (varPoint 5) (varPoint 10) (X 15))
theorem close_facts :
    Build.Facts 16 (closeBuild (varPoint 0) (varPoint 5) (varPoint 10) (X 15)) 69 closeBlocks []
Uses 4 · Used by 3

DefinitionThe value-test template#✓

The template \(\mathtt{value.test}\) has \(11\) parameters and \(35282\) witnesses (\(35293\) variables). Parameters: points \(N=(X_0,\dots,X_4)\), \(K=(X_5,\dots,X_9)\) and \(t=X_{10}\). Witnesses in allocation order:

  • points \(C_1,H,U,V_0,V_1\) at \(X_{11},\dots,X_{35}\) (five each);
  • \(\mathtt{member}\) blocks for \(N,K,C_1,H,U,V_0,V_1\) at \(36,43,50,57,64,71,78\);
  • a \(\mathtt{multiply}\) block \([85,35219)\) and \(\mathtt{raw\_add}\) blocks \([35219,35225)\), \([35225,35231)\);
  • for \(i=0,\dots,3\) and \(\Pi=(H,U,V_0,V_1)\), with base \(b=35231+5i\): pairs \(w_i=(X_b,X_{b+1})\), \(\zeta_i=(X_{b+2},X_{b+3})\) and the inverse witness \(X_{b+4}\) of \(Z(\Pi_i,\zeta_i)\);
  • ratio pairs \(\rho_0=(X_{35251},X_{35252})\) with inverse witness \(X_{35253}\) and \(\rho_1=(X_{35254},X_{35255})\) with inverse witness \(X_{35256}\);
  • \(\eta=X_{35257}\), \(q=X_{35258}\), \(R_0=X_{35259}\), \(a_0=X_{35260}\), \(R=X_{35261}\), inverse witnesses \(u_F=X_{35262}\), \(u_a=X_{35263}\);
  • normalized pairs \(C'_0,\dots,C'_5\) at \(X_{35264},\dots,X_{35275}\);
  • \(\omega=(X_{35276},X_{35277})\) with inverse witness \(v_W=X_{35278}\); \(\Theta=X_{35279}\), \(B=X_{35280}\), \(u_\Theta=X_{35281}\); and a \(\mathtt{pole}\) block \([35282,35293)\).

Let \(F=(t-0)(t+15)(t+20)(t+24)(t+30)(t+60)\) (left to right), \(\Delta=(w_0,\ w_1,\ \bar w_2,\ \bar w_3,\ \rho_0-(t,0),\ \bar\rho_1-(t,0))\) and \(W=\prod_{i=0}^5(1+R\,C_i'^{\,2})\) in pair arithmetic. The formula is the conjunction of, in this order:

  1. \(\langle\mathtt{member}[N]\rangle\), \(\langle\mathtt{member}[K]\rangle\), \(\langle\mathtt{member}[C_1]\rangle\), \(\langle\mathtt{member}[H]\rangle\), \(\langle\mathtt{member}[U]\rangle\), \(\langle\mathtt{member}[V_0]\rangle\), \(\langle\mathtt{member}[V_1]\rangle\);
  2. \(\mathrm{fin}(K)\), \(\langle\mathtt{multiply}[K,N,C_1]\rangle\), \(\langle\mathtt{raw\_add}[H,\mathrm{neg}(K),V_0]\rangle\), \(\langle\mathtt{raw\_add}[U,\mathrm{neg}(C_1),V_1]\rangle\), \(\mathrm{fin}(H)\), \(\mathrm{fin}(V_0)\);
  3. for \(i=0,\dots,3\): \(I\!X(\Pi_i,w_i)\) and \(Z(\Pi_i,\zeta_i)\);
  4. \(\bigwedge(N(\zeta_0)\,v_0'\doteq1,\ \zeta_0\cdot\rho_0\doteq\zeta_1)\) and \(\bigwedge(N(\zeta_2)\,v_1'\doteq1,\ \zeta_2\cdot\rho_1\doteq\zeta_3)\), with \(v_0'=X_{35253}\), \(v_1'=X_{35256}\);
  5. \(F\,u_F\doteq1\), \(\eta^2\doteq1\), \(R_0\doteq\eta\cdot2730^6\cdot F\), \(a_0\doteq1-R_0q^2\), \(a_0u_a\doteq1\), \(R\doteq R_0a_0^2\);
  6. \(F\,C_i'\doteq\Delta_i\) for \(i=0,\dots,5\) (pair equations);
  7. \(\bigwedge(N(W)\,v_W\doteq1,\ W\cdot\omega\doteq(1,0))\), \(\Theta\doteq2\omega_0\), \(\Theta u_\Theta\doteq1\), \(B\Theta^2\doteq R\), \(\langle\mathtt{pole}[B]\rangle\).

The polynomial is \(\kappa\) of this conjunction, squared. Here \(2730^6=413976684737889000000\).

These are the six raw field-valued tests and the single pole predicate of the variable-shift relation (Section 11).

This is a definition (template index \(16\)).

noncomputable def valueTestTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
  Build.template 11 (valueTestBuild I cstar ell T (varPoint 0) (varPoint 5) (X 10))
theorem valueTest_facts (I : Constructors E) (cstar ell T : ℤ) :
    Build.Facts 11 (valueTestBuild I cstar ell T (varPoint 0) (varPoint 5) (X 10)) 35293
      valueTestBlocks []
Uses 6 · Used by 3

DefinitionThe exceptional-values template#✓

The template \(\mathtt{value.exceptions}\) has \(6\) parameters and \(406\) witnesses (\(412\) variables). Parameters: the point \(N=(X_0,\dots,X_4)\) and \(t=X_5\).

Chains. For a point \(p\) and an integer \(k\ge0\), the double-and-add chain is built as follows: start with \(\mathrm{out}=O\) (the literal code), \(\mathrm{base}=p\), \(i=0\); while \(k>0\): if \(k\) is odd, take a fresh point \(\sigma_i\), call \(\langle\mathtt{raw\_add}[\mathrm{out},\mathrm{base},\sigma_i]\rangle\) (a block of \(6\)) and set \(\mathrm{out}=\sigma_i\); replace \(k\) by \(\lfloor k/2\rfloor\); if now \(k>0\), take a fresh point \(\delta_i\), call \(\langle\mathtt{raw\_add}[\mathrm{base},\mathrm{base},\delta_i]\rangle\) and set \(\mathrm{base}=\delta_i\); increase \(i\). The chain's formula is the conjunction of its calls (the empty conjunction for \(k=0\)) and its value is the final \(\mathrm{out}\).

Variables. In allocation order: the rational constants \(c_1,c_2,c_3=X_6,X_7,X_8\) of the generator point \(G=(0,c_1,-145,c_2,c_3)\); the chains, in the order \(c=0,-15,-20,-24,-30,-60\), for \(k=|c|\) on \(G\) (for \(c=0\)) or \(\mathrm{neg}(G)\) (for \(c<0\)), each raw addition taking its fresh point and then its block; and a \(\mathtt{member}\) block \([405,412)\). The chains have \(0,7,6,6,8,9\) raw additions, \(36\) in all, occupying \(X_9,\dots,X_{404}\).

Formula. With \(\beta_c=\bigwedge(\text{chain formula},\ \mathrm{eq}(N,\text{chain value}),\ t\doteq c)\), the formula is $\(\varphi=\bigwedge\Bigl(\langle\mathtt{member}[N]\rangle,\ \bigvee(\beta_0,\beta_{-15},\beta_{-20},\beta_{-24},\beta_{-30},\beta_{-60})\Bigr),\)$ and the polynomial is $\((8c_1-1641)^2+(4c_2+15465)^2+(32c_3-87483)^2+\kappa(\varphi)^2 .\)$ The generator equations stay outside the disjunction. The template expresses exactly the six branches \(N=\iota(c)\) and \(t=c\) for \(c\in\{0,-15,-20,-24,-30,-60\}\).

This is a definition (template index \(17\)).

noncomputable def exceptionsTemplate : ExPoly := Build.template 6 (exceptionsBuild (varPoint 0) (X 5))
theorem exceptions_facts :
    Build.Facts 6 (exceptionsBuild (varPoint 0) (X 5)) 412 exceptionsBlocks exceptionsGlobals
Uses 4 · Used by 4

The library lists the 23 templates in order, including five fixed-scalar templates for the constants of the natural precision polynomial.

18 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.