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)
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def rawZBuild (p : Code) (ζ : Pair) : Build Formula := Build.zGadget p ζ
ZInQKernel/Syntax/Templates/Core.lean:21
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def varPair (k : ℕ) : Pair := (X k, X (k + 1))
ZInQKernel/Syntax/Templates/Scope.lean:469
noncomputable def rawZTemplate : ExPoly := Build.template 7 (rawZBuild (varPoint 0) (varPair 5))
ZInQKernel/Syntax/Templates/Core.lean:24
noncomputable def zFormula (p : Code) (ζ : Pair) (k : ℕ) : Formula :=
.or [.and [isO p, feq ζ Pair.zero], .and [fin p, nzFormula p.y.norm k, feq (p.y.mul ζ) p.x.neg]]
ZInQKernel/Syntax/Language/Pairs.lean:143
def assign (p m : ℕ) (a : Fin p → ℚ) (y : Fin m → ℚ) (i : ℕ) : ℚ :=
if h : i < p then a ⟨i, h⟩ else if h' : i - p < m then y ⟨i - p, h'⟩ else 0
ZInQKernel/Syntax/Language/Basic.lean:181
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)
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def rawInverseXBuild (p : Code) (v : Pair) : Build Formula := pure (ixFormula p v)
ZInQKernel/Syntax/Templates/Core.lean:58
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def varPair (k : ℕ) : Pair := (X k, X (k + 1))
ZInQKernel/Syntax/Templates/Scope.lean:469
noncomputable def rawInverseXTemplate : ExPoly :=
Build.template 7 (rawInverseXBuild (varPoint 0) (varPair 5))
ZInQKernel/Syntax/Templates/Core.lean:61
noncomputable def ixFormula (p : Code) (v : Pair) : Formula :=
.or [.and [isO p, feq v Pair.zero], .and [fin p, feq (p.x.mul v) Pair.one]]
ZInQKernel/Syntax/Language/Pairs.lean:152
def assign (p m : ℕ) (a : Fin p → ℚ) (y : Fin m → ℚ) (i : ℕ) : ℚ :=
if h : i < p then a ⟨i, h⟩ else if h' : i - p < m then y ⟨i - p, h'⟩ else 0
ZInQKernel/Syntax/Language/Basic.lean:181
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)
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def log25Build (ζ lam : Pair) : Build Formula := pure (feq ζ.log25 lam)
ZInQKernel/Syntax/Templates/Core.lean:197
noncomputable def varPair (k : ℕ) : Pair := (X k, X (k + 1))
ZInQKernel/Syntax/Templates/Scope.lean:469
noncomputable def log25Template : ExPoly := Build.template 4 (log25Build (varPair 0) (varPair 2))
ZInQKernel/Syntax/Templates/Core.lean:200
noncomputable def feq (u v : Pair) : Formula := .and [.eq u.1 v.1, .eq u.2 v.2]
ZInQKernel/Syntax/Language/Pairs.lean:81
def assign (p m : ℕ) (a : Fin p → ℚ) (y : Fin m → ℚ) (i : ℕ) : ℚ :=
if h : i < p then a ⟨i, h⟩ else if h' : i - p < m then y ⟨i - p, h'⟩ else 0
ZInQKernel/Syntax/Language/Basic.lean:181
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 : ℤ)
def log25Coeffs : List ℤ := [16575, -6630, 11050, -25500, 68250, -198900, 612612]
ZInQKernel/Syntax/Templates/Core.lean:170
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
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def poleBuild (B : Poly) : Build Formula := do
let b0 ← Build.fresh
let b1 ← Build.fresh
let b2 ← Build.fresh
let b3 ← Build.fresh
let b4 ← Build.fresh
let b5 ← Build.fresh
let e ← Build.fresh
let z ← Build.fresh
let r1 ← Build.fresh
let r2 ← Build.fresh
let w ← Build.fresh
⋯
ZInQKernel/Syntax/Templates/Core.lean:279
noncomputable def poleTemplate : ExPoly := Build.template 1 (poleBuild (X 0))
ZInQKernel/Syntax/Templates/Core.lean:294
noncomputable def polePolyX : Poly :=
polePolyOf (X 0) ![X 1, X 2, X 3, X 4, X 5, X 6] (X 7) (X 8) (X 9) (X 10) (X 11)
ZInQKernel/Syntax/Templates/Core.lean:298
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)
noncomputable def poleTemplate : ExPoly := Build.template 1 (poleBuild (X 0))
ZInQKernel/Syntax/Templates/Core.lean:294
def PoleSoluble (B : ℚ) : Prop :=
∃ (b : Fin 6 → ℚ) (e z r₁ r₂ w : ℚ), polePoly B b e z r₁ r₂ w = 0
ZInQKernel/Hypotheses/Pole.lean:34
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:
- 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\);
- \(\mathrm{fin}(F_0)\) and \(\mathrm{fin}(V_0)\);
- 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\);
- \(N(\lambda_0)\,u_1\doteq1\) and \(N(\lambda_4)\,u_2\doteq1\);
- for \(\sigma=0,1\) and \(i=1,2,3\): \(\lambda_{4\sigma}\cdot q_{\sigma,i}\doteq\lambda_{4\sigma+i}\);
- 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
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def testGroupBuild (C : Fin 4 → Code) (D : Fin 12 → Pair) : Build Formula := do
let F ← Build.freshPoints 4
let V ← Build.freshPoints 4
let a0 ← testGroupRoot (F 0) (C 0) (V 0)
let a1 ← testGroupRoot (F 1) (C 1) (V 1)
let a2 ← testGroupRoot (F 2) (C 2) (V 2)
let a3 ← testGroupRoot (F 3) (C 3) (V 3)
let ⟨_, L0, r0, c0⟩ ← testGroupLocal (F 0)
let ⟨_, L1, r1, c1⟩ ← testGroupLocal (F 1)
let ⟨_, L2, r2, c2⟩ ← testGroupLocal (F 2)
let ⟨_, L3, r3, c3⟩ ← testGroupLocal (F 3)
let ⟨_, L4, r4, c4⟩ ← testGroupLocal (V 0)
⋯
ZInQKernel/Syntax/Templates/Certificate.lean:39
noncomputable def testGroupC : Fin 4 → Code := fun i => varPoint (5 * i)
ZInQKernel/Syntax/Templates/Certificate.lean:67
noncomputable def testGroupD : Fin 12 → Pair := fun j => varPair (20 + 2 * j)
ZInQKernel/Syntax/Templates/Certificate.lean:70
noncomputable def testGroupFormula : Formula :=
let C := testGroupC
let D := testGroupD
let lam : ℕ → Pair := fun i => varPair (138 + 7 * i)
let ρ : ℕ → Pair := fun i => varPair (140 + 7 * i)
let q : ℕ → Pair := fun k => varPair (194 + 2 * k)
.and (testGroupRootFormula (varPoint 44) (C 0) (varPoint 64) 84 ++
testGroupRootFormula (varPoint 49) (C 1) (varPoint 69) 97 ++
testGroupRootFormula (varPoint 54) (C 2) (varPoint 74) 110 ++
testGroupRootFormula (varPoint 59) (C 3) (varPoint 79) 123 ++
[fin (varPoint 44), fin (varPoint 64)] ++
testGroupLocalFormula (varPoint 44) 136 ++ testGroupLocalFormula (varPoint 49) 143 ++
⋯
ZInQKernel/Syntax/Templates/Certificate.lean:114
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:
- \(\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\);
- 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)\);
- \(\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
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def slopeBuild (t ell : Poly) (C : Fin 20 → Poly) : Build Formula := do
let eta ← Build.fresh
let q ← Build.fresh
let R0 ← Build.fresh
let a := 1 - R0 * q ^ 2
let R := ell ^ 2 * a ^ 2 * R0
let n1 ← Build.nz (t - 1)
let n2 ← Build.nz (slopeContact t)
let n3 ← Build.nz ell
let n4 ← Build.nz a
let den1 := R0 * (t - 1) ^ 2
let den2 := R0 ^ 25 * (t - 1) ^ 26
⋯
ZInQKernel/Syntax/Templates/Certificate.lean:196
noncomputable def varArgs (k n : ℕ) : Fin n → Poly := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:553
noncomputable def slopeFormula : Formula :=
let t := X 0
let ell := X 1
let eta := X 22
let R0 := X 24
let a := 1 - R0 * X 23 ^ 2
let R := ell ^ 2 * a ^ 2 * R0
let den1 := R0 * (t - 1) ^ 2
let den2 := R0 ^ 25 * (t - 1) ^ 26
let C := varArgs 2 20
let θ := 2 * (X 239 + X 452 + X 665 + X 878 + X 1091 + X 1304)
.and ([.eq (eta ^ 2) 1, nzFormula (t - 1) 25, nzFormula (slopeContact t) 26, nzFormula ell 27,
⋯
ZInQKernel/Syntax/Templates/Certificate.lean:259
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:
- 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}\);
- 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
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def heightBuild (P0 P1 P2 : Code) (ell : Poly) (C : Fin 20 → Poly) :
Build Formula := do
let ⟨a00, a01, b0, f0⟩ ← heightRoot P0
let ⟨a10, a11, b1, f1⟩ ← heightRoot P1
let ⟨a20, a21, b2, f2⟩ ← heightRoot P2
let g0 ← heightQuantity a00 ell C
let g1 ← heightQuantity a01 ell C
let g2 ← heightQuantity b0 ell C
let g3 ← heightQuantity a10 ell C
let g4 ← heightQuantity a11 ell C
let g5 ← heightQuantity b1 ell C
let g6 ← heightQuantity a20 ell C
⋯
ZInQKernel/Syntax/Templates/Certificate.lean:321
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def varArgs (k n : ℕ) : Fin n → Poly := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:553
noncomputable def heightFormula : Formula :=
.and (heightRootFormula (varPoint 0) 36 ++ heightRootFormula (varPoint 5) 47 ++
heightRootFormula (varPoint 10) 58 ++
heightQuantityFormula (X 43) 69 ++ heightQuantityFormula (X 44) 3966 ++
heightQuantityFormula (X 45) 7863 ++ heightQuantityFormula (X 54) 11760 ++
heightQuantityFormula (X 55) 15657 ++ heightQuantityFormula (X 56) 19554 ++
heightQuantityFormula (X 65) 23451 ++ heightQuantityFormula (X 66) 27348 ++
heightQuantityFormula (X 67) 31245)
ZInQKernel/Syntax/Templates/Certificate.lean:379
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)
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def scalarBuild (I : Constructors E) (n : ℤ) (p r : Code) : Build Formula := do
let u ← Build.freshIdx
pure (scalarFormula I n p r u)
ZInQKernel/Syntax/Templates/Multiply.lean:46
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def scalarTemplate (I : Constructors E) (n : ℤ) : ExPoly :=
Build.template 10 (scalarBuild I n (varPoint 0) (varPoint 5))
ZInQKernel/Syntax/Templates/Multiply.lean:53
noncomputable def scalarFormula (I : Constructors E) (n : ℤ) (p r : Code) (u : ℕ) : Formula :=
let g := psiPair I n p
let g2 := g.sq
let gp := psiPair I (n + 1) p
let gm := psiPair I (n + -1) p
let gd := psiPair I (2 * n) p
.or [.and [isO p, isO r],
.and [fin p, fin r, nzFormula g.norm u, feq (g2.mul r.x) ((p.x.mul g2).sub (gp.mul gm)),
feq ((Pair.smul 2 g2.sq).mul r.y) gd]]
ZInQKernel/Syntax/Templates/Multiply.lean:35
def assign (p m : ℕ) (a : Fin p → ℚ) (y : Fin m → ℚ) (i : ℕ) : ℚ :=
if h : i < p then a ⟨i, h⟩ else if h' : i - p < m then y ⟨i - p, h'⟩ else 0
ZInQKernel/Syntax/Language/Basic.lean:181
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
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def guardBuild (I : Constructors E) (T : ℤ) (g : Fin 15 → Poly) : Build Formula :=
Build.nz (bind₁ g (I.guard T))
ZInQKernel/Syntax/Templates/Multiply.lean:92
noncomputable def varArgs (k n : ℕ) : Fin n → Poly := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:553
noncomputable def guardTemplate (I : Constructors E) (T : ℤ) : ExPoly :=
Build.template 15 (guardBuild I T (varArgs 0 15))
ZInQKernel/Syntax/Templates/Multiply.lean:97
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
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
noncomputable def guardPoly (T : ℤ) : MvPolynomial (Fin 15) ℤ :=
∏ t ∈ falseTriples T, guardFactor t
ZInQKernel/Syntax/Constants/Guard.lean:79
noncomputable def guardTemplate (I : Constructors E) (T : ℤ) : ExPoly :=
Build.template 15 (guardBuild I T (varArgs 0 15))
ZInQKernel/Syntax/Templates/Multiply.lean:97
def codes3 (P Q R : Fin 5 → ℚ) : Fin 15 → ℚ := Fin.append (Fin.append P Q) R
ZInQKernel/Syntax/Templates/Multiply.lean:151
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def FalseTripleCodes (T : ℤ) (P : Fin 15 → ℚ) : Prop :=
∃ a b c : ℤ, |a| ≤ T ∧ |b| ≤ T ∧ |c| ≤ T ∧ a * b ≠ c ∧ P = codes3 (iota a) (iota b) (iota c)
ZInQKernel/Syntax/Templates/Multiply.lean:154
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
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def multiplyBuild (I : Constructors E) (cstar ell T : ℤ) (P0 P1 P2 : Code) :
Build Formula := do
let G ← Build.gen
let S0 ← Build.point
let c0 ← Build.call (scalarTemplate I cstar) (Fin.append G S0)
let S1 ← Build.point
let c1 ← Build.call (scalarTemplate I cstar) (Fin.append P0 S1)
let S2 ← Build.point
let c2 ← Build.call (scalarTemplate I cstar) (Fin.append P1 S2)
let S3 ← Build.point
let c3 ← Build.call (scalarTemplate I cstar) (Fin.append P2 S3)
let h ← Build.call heightTemplate (Fin.append (Fin.append (Fin.append (Fin.append
⋯
ZInQKernel/Syntax/Templates/Multiply.lean:191
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def multiplyFormula (I : Constructors E) (cstar ell T : ℤ) : Formula :=
.and [.call (scalarTemplate I cstar) (Fin.append (genPoint 15) (varPoint 18)) 23,
.call (scalarTemplate I cstar) (Fin.append (varPoint 0) (varPoint 24)) 29,
.call (scalarTemplate I cstar) (Fin.append (varPoint 5) (varPoint 30)) 35,
.call (scalarTemplate I cstar) (Fin.append (varPoint 10) (varPoint 36)) 41,
.call heightTemplate (Fin.append (Fin.append (Fin.append (Fin.append
(Fin.append (varPoint 0) (varPoint 5)) (varPoint 10)) ![C ell])
(Fin.append (Fin.append (varPoint 18) (varPoint 24)) (varPoint 30))) (varPoint 36)) 42,
.call (guardTemplate I T) (Fin.append (Fin.append (varPoint 0) (varPoint 5)) (varPoint 10))
35148]
ZInQKernel/Syntax/Templates/Multiply.lean:239
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
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def naturalBuild (I : Constructors E) (cstar ell T : ℤ) (A : Code) :
Build Formula := do
let σ ← Build.freshPoints 4
let Sq ← Build.freshPoints 4
let m0 ← Build.call (multiplyTemplate I cstar ell T) (Fin.append (Fin.append (σ 0) (σ 0)) (Sq 0))
let m1 ← Build.call (multiplyTemplate I cstar ell T) (Fin.append (Fin.append (σ 1) (σ 1)) (Sq 1))
let m2 ← Build.call (multiplyTemplate I cstar ell T) (Fin.append (Fin.append (σ 2) (σ 2)) (Sq 2))
let m3 ← Build.call (multiplyTemplate I cstar ell T) (Fin.append (Fin.append (σ 3) (σ 3)) (Sq 3))
let π1 ← Build.point
let a1 ← Build.call rawAddTemplate (Fin.append (Fin.append (Sq 0) (Sq 1)) π1)
let π2 ← Build.point
let a2 ← Build.call rawAddTemplate (Fin.append (Fin.append π1 (Sq 2)) π2)
⋯
ZInQKernel/Syntax/Templates/Multiply.lean:283
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
noncomputable def naturalFormula (I : Constructors E) (cstar ell T : ℤ) : Formula :=
.and [.call (multiplyTemplate I cstar ell T)
(Fin.append (Fin.append (varPoint 5) (varPoint 5)) (varPoint 25)) 45,
.call (multiplyTemplate I cstar ell T)
(Fin.append (Fin.append (varPoint 10) (varPoint 10)) (varPoint 30)) 35179,
.call (multiplyTemplate I cstar ell T)
(Fin.append (Fin.append (varPoint 15) (varPoint 15)) (varPoint 35)) 70313,
.call (multiplyTemplate I cstar ell T)
(Fin.append (Fin.append (varPoint 20) (varPoint 20)) (varPoint 40)) 105447,
.call rawAddTemplate (Fin.append (Fin.append (varPoint 25) (varPoint 30)) (varPoint 140581))
140586,
.call rawAddTemplate (Fin.append (Fin.append (varPoint 140581) (varPoint 35))
⋯
ZInQKernel/Syntax/Templates/Multiply.lean:321
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
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def signedEncodeBuild (I : Constructors E) (cstar ell T : ℤ) (N C : Code) :
Build Formula := do
let Q ← Build.point
let Q2 ← Build.point
let Qp ← Build.point
let m1 ← Build.call memberTemplate N
let m2 ← Build.call memberTemplate C
let n ← Build.call (naturalTemplate I cstar ell T) Q
let a ← Build.call rawAddTemplate (Fin.append (Fin.append Q Q) Q2)
let G ← Build.gen
let b1 ← Build.call rawAddTemplate (Fin.append (Fin.append Q G) Qp)
let G' ← Build.gen
⋯
ZInQKernel/Syntax/Templates/Value.lean:73
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
structure Build.Facts (p : ℕ) (b : Build Formula) (N : ℕ) (B : List (ℕ × ℕ))
(GE : List (ℕ × ℤ × ℤ)) : Prop where
next : (b ⟨p, []⟩).2.next = N
blocks : (b ⟨p, []⟩).1.blocks = B
globalsEq : (b ⟨p, []⟩).2.globals = GE
sep : blocksSep B
above : ∀ bl ∈ B, p ≤ bl.1
le : p ≤ N
globals : ∀ e ∈ GE, Avail N B e.1 ∧ e.2.2 ≠ 0
fok : FOk (Avail N B) N (b ⟨p, []⟩).1
ZInQKernel/Syntax/Templates/Scope.lean:718
def signedEncodeBlocks : List (ℕ × ℕ) :=
[(25, 7), (32, 7), (39, 140604), (140643, 6), (140652, 6), (140658, 6)]
ZInQKernel/Syntax/Templates/Value.lean:94
def signedEncodeGlobals : List (ℕ × ℤ × ℤ) :=
[(140649, 1641, 8), (140650, -15465, 4), (140651, 87483, 32)]
ZInQKernel/Syntax/Templates/Value.lean:98
- The absolute-value template (with the formula language, whose absolute-value gadget uses it)
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 []
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def closeBuild (A L J : Code) (t : Poly) : Build Formula := do
let za ← Build.freshPair
let zl ← Build.freshPair
let zj ← Build.freshPair
let ⟨q, fr⟩ ← Build.fdiv zj za
let a0 ← Build.fresh
let a1 ← Build.fresh
let δ ← Build.fresh
let fp ← Build.pos (a0 + a1 - δ)
let m1 ← Build.call memberTemplate A
let m2 ← Build.call memberTemplate L
let m3 ← Build.call memberTemplate J
⋯
ZInQKernel/Syntax/Templates/Value.lean:165
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
structure Build.Facts (p : ℕ) (b : Build Formula) (N : ℕ) (B : List (ℕ × ℕ))
(GE : List (ℕ × ℤ × ℤ)) : Prop where
next : (b ⟨p, []⟩).2.next = N
blocks : (b ⟨p, []⟩).1.blocks = B
globalsEq : (b ⟨p, []⟩).2.globals = GE
sep : blocksSep B
above : ∀ bl ∈ B, p ≤ bl.1
le : p ≤ N
globals : ∀ e ∈ GE, Avail N B e.1 ∧ e.2.2 ≠ 0
fok : FOk (Avail N B) N (b ⟨p, []⟩).1
ZInQKernel/Syntax/Templates/Scope.lean:718
def closeBlocks : List (ℕ × ℕ) := [(32, 7), (39, 7), (46, 7), (56, 4), (60, 4), (65, 4)]
ZInQKernel/Syntax/Templates/Value.lean:192
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:
- \(\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\);
- \(\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)\);
- for \(i=0,\dots,3\): \(I\!X(\Pi_i,w_i)\) and \(Z(\Pi_i,\zeta_i)\);
- \(\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}\);
- \(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\);
- \(F\,C_i'\doteq\Delta_i\) for \(i=0,\dots,5\) (pair equations);
- \(\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 []
structure Constructors (E : Type) where
/-- The value `val(e)` of a fixed integer expression. -/
val : E → ℤ
/-- The component polynomial `Ψ_{n,c}` in the four variables `x₀, x₁, y₀, y₁`. -/
psi : ℤ → Fin 2 → MvPolynomial (Fin 4) ℤ
/-- The guard polynomial `G_T` in fifteen variables (point-major order). -/
guard : ℤ → MvPolynomial (Fin 15) ℤ
ZInQKernel/Syntax/Language/Nodes.lean:29
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def valueTestBuild (I : Constructors E) (cstar ell T : ℤ) (N K : Code) (t : Poly) :
Build Formula := do
let C1 ← Build.point
let H ← Build.point
let U ← Build.point
let V0 ← Build.point
let V1 ← Build.point
let m0 ← Build.call memberTemplate N
let m1 ← Build.call memberTemplate K
let m2 ← Build.call memberTemplate C1
let m3 ← Build.call memberTemplate H
let m4 ← Build.call memberTemplate U
⋯
ZInQKernel/Syntax/Templates/Value.lean:255
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
structure Build.Facts (p : ℕ) (b : Build Formula) (N : ℕ) (B : List (ℕ × ℕ))
(GE : List (ℕ × ℤ × ℤ)) : Prop where
next : (b ⟨p, []⟩).2.next = N
blocks : (b ⟨p, []⟩).1.blocks = B
globalsEq : (b ⟨p, []⟩).2.globals = GE
sep : blocksSep B
above : ∀ bl ∈ B, p ≤ bl.1
le : p ≤ N
globals : ∀ e ∈ GE, Avail N B e.1 ∧ e.2.2 ≠ 0
fok : FOk (Avail N B) N (b ⟨p, []⟩).1
ZInQKernel/Syntax/Templates/Scope.lean:718
def valueTestBlocks : List (ℕ × ℕ) :=
[(36, 7), (43, 7), (50, 7), (57, 7), (64, 7), (71, 7), (78, 7), (85, 35134), (35219, 6),
(35225, 6), (35282, 11)]
ZInQKernel/Syntax/Templates/Value.lean:307
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
structure ExPoly where
/-- The parameter count `p`; the parameters are `X_0, …, X_{p-1}`. -/
params : ℕ
/-- The witness count `m`; the witnesses are `X_p, …, X_{p+m-1}`. -/
witnesses : ℕ
/-- The polynomial. -/
poly : Poly
ZInQKernel/Syntax/Language/Basic.lean:172
noncomputable def Build.template (p : ℕ) (b : Build Formula) : ExPoly :=
⟨p, (b ⟨p, []⟩).2.next - p,
(Formula.and ((b ⟨p, []⟩).2.globals.map globalEq ++ [(b ⟨p, []⟩).1])).compile⟩
ZInQKernel/Syntax/Language/Build.lean:108
noncomputable def exceptionsBuild (N : Code) (t : Poly) : Build Formula := do
let b0 ← exceptionBranch N t 0
let b1 ← exceptionBranch N t (-15)
let b2 ← exceptionBranch N t (-20)
let b3 ← exceptionBranch N t (-24)
let b4 ← exceptionBranch N t (-30)
let b5 ← exceptionBranch N t (-60)
let m ← Build.call memberTemplate N
pure (.and [m, .or [b0, b1, b2, b3, b4, b5]])
ZInQKernel/Syntax/Templates/Value.lean:443
noncomputable def varPoint (k : ℕ) : Code := fun i => X (k + i)
ZInQKernel/Syntax/Templates/Scope.lean:466
structure Build.Facts (p : ℕ) (b : Build Formula) (N : ℕ) (B : List (ℕ × ℕ))
(GE : List (ℕ × ℤ × ℤ)) : Prop where
next : (b ⟨p, []⟩).2.next = N
blocks : (b ⟨p, []⟩).1.blocks = B
globalsEq : (b ⟨p, []⟩).2.globals = GE
sep : blocksSep B
above : ∀ bl ∈ B, p ≤ bl.1
le : p ≤ N
globals : ∀ e ∈ GE, Avail N B e.1 ∧ e.2.2 ≠ 0
fok : FOk (Avail N B) N (b ⟨p, []⟩).1
ZInQKernel/Syntax/Templates/Scope.lean:718
def exceptionsBlocks : List (ℕ × ℕ) :=
(405, 7) :: (List.range 36).map (fun i => (14 + 11 * i, 6))
ZInQKernel/Syntax/Templates/Value.lean:458
def exceptionsGlobals : List (ℕ × ℤ × ℤ) := [(6, 1641, 8), (7, -15465, 4), (8, 87483, 32)]
ZInQKernel/Syntax/Templates/Value.lean:462
The library lists the 23 templates in order, including five fixed-scalar templates for the constants of the natural precision polynomial.
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.