The value templates and their relations
The value relation is assembled from the membership template, three value templates (signed encoding, coordinate window, value test), the exceptional-values template and the precision recipe, combined by five composition recipes. This section proves what each template expresses on arbitrary rational inputs. Every proof has the same shape: the template polynomial is the square of a compiled formula whose calls have disjoint private blocks, so the private-witness lemma replaces each call by its relation, and the model statements identify the relations on codes.
Nonzero multiples of \(P_0\) are affine with nonzero coordinates (nonzero multiples of the generator, in the model chapter); this makes every local parameter and inverse abscissa below well-defined.
Natural and signed codes
The natural-code template types four untyped tuples by multiplication before adding their squares, so it accepts exactly \(\iota(\mathbb N)\) by Lagrange's theorem; this is the natural-code predicate of the compiler chapter, with M supplied by the multiplication template. The signed encoding links a signed code \(\iota(m)\) to the natural code \(\iota(\operatorname{enc}m)\), in which form the integer enters the precision relation.
TheoremSemantics of the signed encoding#✓
Assume the six-contact estimate, pole completeness and the twenty-two-prime pattern. Then for all \(N,C\in\mathbb Q^5\), $\(\mathrm{Rel}_{\mathtt{value.signed\_encode}}(N,C)\iff\exists\,m\in\mathbb Z:\ N=\iota(m)\ \text{and}\ C=\iota(\operatorname{enc}(m)),\)$ equivalently, \(C=\iota(c)\) for some \(c\in\mathbb N\) and \(N=\iota(\operatorname{dec}(c))\).
Proof sketch. The template polynomial is the sum of the squares of the three generator equations and of \(\kappa(\varphi)\). By the rational-constant lemma the generator equations force \((c_1,c_2,c_3)=(1641/8,-15465/4,87483/32)\), so \(G=(0,c_1,-145,c_2,c_3)=\iota(1)\); they are outside the internal disjunction and constrain both branches. By the private-witness lemma, \(\mathrm{Rel}(N,C)\) holds exactly when there are points \(Q,Q_2,Q_+\) with \(\mathrm{Rel}_{\mathtt{member}}(N)\), \(\mathrm{Rel}_{\mathtt{member}}(C)\), \(\mathrm{Rel}_{\mathtt{natural}}(Q)\), \(\mathrm{Rel}_{\mathtt{raw\_add}}(Q,Q,Q_2)\) and one of the branches (i) \(N=Q\), \(C=Q_2\), or (ii) \(\mathrm{Rel}_{\mathtt{raw\_add}}(Q,G,Q_+)\), \(N=\operatorname{neg}(Q_+)\), \(\mathrm{Rel}_{\mathtt{raw\_add}}(Q_2,G,C)\).
(\(\Rightarrow\)) The natural-code predicate, with M from the multiplication template, gives \(Q=\iota(q)\) with \(q\in\mathbb N\), and raw addition on canonical codes gives \(Q_2=\iota(2q)\). In branch (i), \(N=\iota(q)\) and \(C=\iota(2q)=\iota(\operatorname{enc}q)\). In branch (ii), \(Q_+=\iota(q+1)\), \(N=\operatorname{neg}(\iota(q+1))=\iota(-(q+1))\) and \(C=\iota(2q+1)\); since \(-(q+1)<0\), \(\operatorname{enc}(-(q+1))=2q+1\).
(\(\Leftarrow\)) For \(m\ge0\) take \(Q=\iota(m)\), \(Q_2=\iota(2m)\) and branch (i). For \(m<0\) take \(Q=\iota(-m-1)\), \(Q_2=\iota(-2m-2)\), \(Q_+=\iota(-m)\) and branch (ii); then \(\operatorname{neg}(Q_+)=\iota(m)\) and the last raw addition gives \(\iota(-2m-1)=\iota(\operatorname{enc}m)\). The membership, natural and raw-addition relations hold by the accepted-indices statement, the natural-code predicate (with M from the multiplication template) and raw addition; an inactive branch takes arbitrary witnesses.
theorem signedEncode_rel_iff {I : Constructors E} {cstar ell T : ℤ}
(hM : MultiplicationExact I cstar ell T) (N C : Fin 5 → ℚ) :
(signedEncodeTemplate I cstar ell T).Rel (Fin.append N C) ↔
∃ m : ℤ, N = iota m ∧ C = iota (enc m)
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
def MultiplicationExact (I : Constructors E) (cstar ell T : ℤ) : Prop :=
∀ p q r : Fin 5 → ℚ, (multiplyTemplate I cstar ell T).Rel (Fin.append (Fin.append p q) r) ↔
∃ a b : ℤ, p = iota a ∧ q = iota b ∧ r = iota (a * b)
ZInQKernel/Compiler/Translation/NaturalCode.lean:30
noncomputable def signedEncodeTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
Build.template 10 (signedEncodeBuild I cstar ell T (varPoint 0) (varPoint 5))
ZInQKernel/Syntax/Templates/Value.lean:90
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def enc (n : ℤ) : ℕ := if 0 ≤ n then 2 * n.toNat else 2 * (-n).toNat - 1
ZInQKernel/Compiler/Precision/Encoding.lean:16
Uses 16 · Used by 1
The coordinate window
For nonzero \(a,l\) the coordinate-window template expresses the strict window \(|t-r(a,j)|<\epsilon_l\), with \(r(a,j)=\frac12\operatorname{Tr}(z_j/z_a)\) and \(\epsilon_l=|u_l|+|v_l|\).
TheoremSemantics of the coordinate window#✓
For all \(A,L,J\in\mathbb Q^5\) and \(t\in\mathbb Q\), \(\mathrm{Rel}_{\mathtt{value.close\_coordinates}}(A,L,J,t)\) holds exactly when there are \(a,l,j\in\mathbb Z\) with $\(A=\iota(a),\quad L=\iota(l),\quad J=\iota(j),\quad a\ne0,\quad l\ne0,\quad |t-r(a,j)|<\epsilon_l ,\)$ with \(r(a,j)=\frac12\operatorname{Tr}(z_j/z_a)\) and \(\epsilon_l\) formed from the local parameter \(z\) on multiples of the generator, extended by \(z_0=0\) (so \(r(a,0)=0\)); \(a,l\) and every nonzero \(j\) are admissible by the nonzero-multiples lemma.
Proof sketch. The template is \(\kappa(\varphi)^2\); its calls (\(\mathtt{member}\) three times, \(\mathtt{value.abs}\) three times) have disjoint blocks occurring in no parameter, so by the private-witness lemma the relation holds exactly when there are pairs \(\zeta_A,\zeta_L,\zeta_J,q\) and rationals \(v,a_0,a_1,\delta,u_\epsilon,z_1,\dots,z_4\) and inverse witnesses making the following true: \(A,L,J\) are accepted by membership, \(A[0]=L[0]=0\) (first code coordinates), the gadgets \(Z(A,\zeta_A)\), \(Z(L,\zeta_L)\), \(Z(J,\zeta_J)\), \(\operatorname N(\zeta_A)v=1\) and \(\zeta_A\cdot q=\zeta_J\), \(a_0=|(\zeta_L)_0|\), \(a_1=|(\zeta_L)_1|\), \((a_0+a_1)u_\epsilon=1\), \(\delta=|t-q_0|\) and \((a_0+a_1-\delta)(z_1^2+z_2^2+z_3^2+z_4^2)=1\).
By the accepted-indices statement, membership means \(A=\iota(a)\), \(L=\iota(l)\), \(J=\iota(j)\). The conditions \(A[0]=L[0]=0\) say \(a\ne0\) and \(l\ne0\) (first code coordinate). By the nonzero-multiples lemma, every nonzero multiple of \(P_0\) has nonzero abscissa and ordinate, so by pair arithmetic the gadget \(Z(\iota(m),\zeta)\) is satisfiable and forces \([\zeta]=z_m\) (also for \(m=0\), where \(z_0=0\)). Then \(\operatorname N(\zeta_A)\ne0\) holds because \(z_a\ne0\), and \([q]=z_j/z_a\), so \(q_0=r(a,j)\). The absolute-value template gives \(a_0+a_1=\epsilon_l\), which is nonzero because \(z_l\ne0\), so its inverse witness exists. Finally \(\delta=|t-r(a,j)|\), and the four-square positivity statement turns the last equation into \(\epsilon_l-|t-r(a,j)|>0\). Conversely, for \(a,l\ne0\) and the strict window, all these witnesses exist.
theorem closeCoordinates_rel_iff (A L J : Fin 5 → ℚ) (t : ℚ) :
closeTemplate.Rel (Fin.append (Fin.append (Fin.append A L) J) ![t]) ↔
∃ a l j : ℤ, A = iota a ∧ L = iota l ∧ J = iota j ∧ a ≠ 0 ∧ l ≠ 0 ∧
|t - rRatio a j| < epsIdx l
noncomputable def closeTemplate : ExPoly :=
Build.template 16 (closeBuild (varPoint 0) (varPoint 5) (varPoint 10) (X 15))
ZInQKernel/Syntax/Templates/Value.lean:188
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
noncomputable def rRatio (a j : ℤ) : ℚ := (zIdx j / zIdx a).re
ZInQKernel/Compiler/Precision/ZCoordinate.lean:66
noncomputable def epsIdx (k : ℤ) : ℚ := |(zIdx k).re| + |(zIdx k).im|
ZInQKernel/Compiler/Precision/ZCoordinate.lean:63
Sources
Uses 14 · Used by 1
The exceptional values
Double-and-add chains of raw additions, started at the literal origin and the fixed signed generator, produce the codes of the six contact values.
LemmaDouble-and-add chains#✓
Let \(m\in\mathbb Z\), \(k\in\mathbb N\), and consider the double-and-add chain for \(k\) on the point \(p=\iota(m)\), as defined for the exceptional-values template: starting from \(\mathrm{out}=O\), \(\mathrm{base}=p\), it takes for each odd bit a fresh point \(\sigma_i\) with the call \(\langle\mathtt{raw\_add}[\mathrm{out},\mathrm{base},\sigma_i]\rangle\) and for each further bit a fresh point \(\delta_i\) with \(\langle\mathtt{raw\_add}[\mathrm{base},\mathrm{base},\delta_i]\rangle\). Then:
- for every assignment of rational \(5\)-tuples to the fresh points such that all raw-addition relations of the chain hold, the value of the chain (its final \(\mathrm{out}\)) is \(\iota(km)\);
- there is such an assignment.
The number of raw additions is the number of one bits of \(k\) plus the bit length of \(k\) minus one (\(0\) for \(k=0\)). For \(k=0,15,20,24,30,60\) this gives \(0,7,6,6,8,9\).
Proof sketch. Induction along the chain with the invariant that after \(i\) steps \(\mathrm{base}=\iota(2^im)\) and \(\mathrm{out}=\iota(k_im)\), where \(k_i=k\bmod2^i\). Both inputs of every raw addition are then canonical codes, so raw addition forces the fresh output to be \(\iota(k_im+2^im)\) or \(\iota(2^{i+1}m)\), which preserves the invariant; at the end \(k_i=k\). For 2, assign each fresh point the code forced in this way; raw addition is complete on canonical codes. Initially \(\mathrm{out}=O=\iota(0)\) is the literal code. No property of \(P_0\) beyond lying on \(E\) is used.
theorem chain_value (ds : List Bool) :
∀ (out base : Code) (s : BuildState) (y : ℕ → ℚ) (a m : ℤ),
evCode y out = iota a → evCode y base = iota m →
(∀ φ ∈ (chainBuild out base ds s).1.2, φ.Lift y) →
evCode y (chainBuild out base ds s).1.1 = iota (a + binVal ds * m)
theorem chain_satisfiable (ds : List Bool) :
∀ (out base : Code) (s : BuildState) (y : ℕ → ℚ) (a m : ℤ),
(∀ i, VarsIn (out i) (· < s.next)) → (∀ i, VarsIn (base i) (· < s.next)) →
evCode y out = iota a → evCode y base = iota m →
∃ y' : ℕ → ℚ, (∀ i < s.next, y' i = y i) ∧
∀ φ ∈ (chainBuild out base ds s).1.2, φ.Lift y'
theorem chainBuild_binDigits_value (k : ℕ) (base : Code) (s : BuildState) (y : ℕ → ℚ) (m : ℤ)
(hb : evCode y base = iota m)
(h : ∀ φ ∈ (chainBuild Code.O base (binDigits k) s).1.2, φ.Lift y) :
evCode y (chainBuild Code.O base (binDigits k) s).1.1 = iota (k * m)
abbrev Code : Type := Fin 5 → Poly
ZInQKernel/Syntax/Language/Pairs.lean:98
structure BuildState where
/-- The next free variable. -/
next : ℕ
/-- The global equations of the rational constants. -/
globals : List (ℕ × ℤ × ℤ)
ZInQKernel/Syntax/Language/Build.lean:27
noncomputable def evCode (x : ℕ → ℚ) (p : Fin 5 → Poly) : Fin 5 → ℚ := fun i => ev x (p i)
ZInQKernel/Syntax/Language/PointRef.lean:47
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
noncomputable def chainBuild (out base : Code) : List Bool → Build (Code × List Formula)
| [] => pure (out, [])
| d :: ds => do
let ⟨out', fs⟩ ← (match d with
| true => do
let σ ← Build.point
let f ← Build.call rawAddTemplate (Fin.append (Fin.append out base) σ)
pure (σ, [f])
| false => pure (out, []) : Build (Code × List Formula))
match ds with
| [] => pure (out', fs)
| d' :: ds' => do
⋯
ZInQKernel/Syntax/Templates/Value.lean:413
def binVal : List Bool → ℕ
| [] => 0
| d :: ds => (if d then 1 else 0) + 2 * binVal ds
ZInQKernel/Assembly/Values/Chains.lean:23
def VarsIn (f : Poly) (P : ℕ → Prop) : Prop := ∀ i ∈ f.vars, P i
ZInQKernel/Syntax/Language/Basic.lean:50
noncomputable def Code.O : Code := ![1, 0, 0, 0, 0]
ZInQKernel/Syntax/Language/Pairs.lean:101
def binDigits (k : ℕ) : List Bool := binDigitsAux k k
ZInQKernel/Syntax/Templates/Value.lean:407
Uses 4 · Used by 1
TheoremSemantics of the exceptional values#✓
For all \(N\in\mathbb Q^5\) and \(t\in\mathbb Q\), $\(\mathrm{Rel}_{\mathtt{value.exceptions}}(N,t)\iff\exists\,c\in\mathcal C:\ N=\iota(c)\ \text{and}\ t=c,\)$ where \(\mathcal C=\{0,-15,-20,-24,-30,-60\}\).
Proof sketch. The polynomial is the sum of the squares of the three generator equations and of \(\kappa(\varphi)\) with \(\varphi=\bigwedge(\langle\mathtt{member}[N]\rangle,\bigvee_{c\in\mathcal C}\beta_c)\). The generator equations, outside the disjunction, force \(G=\iota(1)\), hence \(\operatorname{neg}(G)=\iota(-1)\). By the private-witness lemma the relation holds exactly when \(N\) is accepted by membership and, for some \(c\in\mathcal C\), the fresh points of the chain of \(\beta_c\) can be chosen with all its raw-addition relations, \(N\) equal to the chain value and \(t=c\). The chain of \(\beta_c\) is the chain for \(k=|c|\) on \(G\) (\(c=0\)) or on \(\operatorname{neg}(G)\) (\(c<0\)), so by the chain lemma its value is \(\iota(|c|)\) or \(\iota(-|c|)\), that is \(\iota(c)\) in both cases, and the chain is satisfiable. Hence a branch \(\beta_c\) holds exactly when \(N=\iota(c)\) and \(t=c\). Membership of \(\iota(c)\) holds by the accepted-indices statement; the witnesses of the inactive branches are arbitrary.
theorem exceptions_rel_iff (N : Fin 5 → ℚ) (t : ℚ) :
exceptionsTemplate.Rel (Fin.append N ![t]) ↔ ∃ c ∈ contacts, N = iota c ∧ t = c
noncomputable def exceptionsTemplate : ExPoly := Build.template 6 (exceptionsBuild (varPoint 0) (X 5))
ZInQKernel/Syntax/Templates/Value.lean:454
def contacts : Finset ℤ := {0, -15, -20, -24, -30, -60}
ZInQKernel/Compiler/Precision/HeightConstant.lean:92
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
Uses 10 · Used by 1
The value test
On indices, the value test is the relation \(\operatorname{Test}(n,\kappa,t)\) of the six local tests.
DefinitionThe six local tests#✓
For \(n,\kappa\in\mathbb Z\) and \(t\in\mathbb Q\), the relation \(\operatorname{Test}(n,\kappa,t)\) holds when \(\kappa\ne0\), \(t\notin\mathcal C\), and there are integers \(h,s_0\) and rationals \(\eta,q\) with the following properties. Put $\(H=[h]P_0,\qquad U=[s_0]P_0,\qquad V_0=[h-\kappa]P_0,\qquad V_1=[s_0-\kappa n]P_0,\)$ and require \(h\ne0\) and \(h\ne\kappa\) (that is, \(H\ne O\) and \(V_0\ne O\)). With \(z(Q)=-x/y\) and \(w(Q)=1/x\) for an affine point \(Q=(x,y)\) with \(xy\ne0\), \(z(O)=w(O)=0\), and \(\sigma\) the conjugation of \(K_0\), define the six tests $\(D_1=w(H),\quad D_2=w(U),\quad D_3=\sigma\bigl(w(V_0)\bigr),\quad D_4=\sigma\bigl(w(V_1)\bigr),\)$ $\(D_5=\frac{z(U)}{z(H)}-t,\qquad D_6=\sigma\Bigl(\frac{z(V_1)}{z(V_0)}\Bigr)-t\)$ in \(K_0\) (the denominators are nonzero because \(H,V_0\) are nonzero multiples of \(P_0\)), and $\(R_0=\eta\cdot2730^6\cdot F(t),\quad a_0=1-R_0q^2,\quad R=R_0a_0^2,\quad C_j=\frac{D_j}{F(t)},\quad W=\prod_{j=1}^6\bigl(1+RC_j^2\bigr)\in K_0 .\)$ The conditions are $\(\eta^2=1,\qquad a_0\ne0,\qquad W\ne0,\qquad \Theta:=\operatorname{Tr}(W^{-1})\ne0,\qquad \Phi\bigl(R/\Theta^2\bigr).\)$ Here \(2730^6=413976684737889000000\), \(F(t)\ne0\) because \(t\notin\mathcal C\), and \(\Phi\) is rational solubility of the pole polynomial. There is one common denominator \(F(t)\), one product \(W\), one trace and one pole instance. Write \(B_{\rm pole}=R/\Theta^2\).
The manuscript states \(\operatorname{Test}(N,\mathcal K,t)\) for codes \(N=\iota(n)\), \(\mathcal K=\iota(\kappa)\), with \(H=\iota(h)\), \(U=\iota(s_0)\) and the code of \(\kappa n\) formed by multiplication; this article states it on the indices, and the semantics of the value-test template connects the two.
This is a definition.
def Test (n κ : ℤ) (t : ℚ) : Prop :=
κ ≠ 0 ∧ t ∉ contactSet ∧ ∃ (h s₀ : ℤ) (η q : ℚ), h ≠ 0 ∧ h ≠ κ ∧ η ^ 2 = 1 ∧
1 - testR₀ η t * q ^ 2 ≠ 0 ∧ poleW (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
poleTheta (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
PoleSoluble (testR η q t / poleTheta (testR η q t) (testC n κ t h s₀) ^ 2)
theorem test_iff (n κ : ℤ) (t : ℚ) :
Test n κ t ↔ κ ≠ 0 ∧ t ∉ contactSet ∧ ∃ (h s₀ : ℤ) (η q : ℚ), h ≠ 0 ∧ h ≠ κ ∧ η ^ 2 = 1 ∧
vtA0 t η q ≠ 0 ∧ vtW n κ t h s₀ η q ≠ 0 ∧ vtTheta n κ t h s₀ η q ≠ 0 ∧
PoleSoluble (vtR t η q / vtTheta n κ t h s₀ η q ^ 2)
def contactSet : Finset ℚ := {0, -15, -20, -24, -30, -60}
ZInQKernel/Hypotheses/Height.lean:84
def testR₀ (η t : ℚ) : ℚ := η * 2730 ^ 6 * contactPoly t
ZInQKernel/Assembly/Local/SixLocalTests.lean:49
noncomputable def poleW (R : ℚ) (C : Fin 6 → K0) : K0 := ∏ j, (1 + (R : K0) * C j ^ 2)
ZInQKernel/Assembly/Local/SixLocalTests.lean:55
def testR (η q t : ℚ) : ℚ := testR₀ η t * (1 - testR₀ η t * q ^ 2) ^ 2
ZInQKernel/Assembly/Local/SixLocalTests.lean:52
noncomputable def testC (n κ : ℤ) (t : ℚ) (h s₀ : ℤ) (j : Fin 6) : K0 :=
testD n κ t h s₀ j / (contactPoly t : K0)
ZInQKernel/Assembly/Local/SixLocalTests.lean:62
noncomputable def poleTheta (R : ℚ) (C : Fin 6 → K0) : ℚ :=
QuadraticAlgebra.trace (poleW R C)⁻¹
ZInQKernel/Assembly/Local/SixLocalTests.lean:58
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
def Test (n κ : ℤ) (t : ℚ) : Prop :=
κ ≠ 0 ∧ t ∉ contactSet ∧ ∃ (h s₀ : ℤ) (η q : ℚ), h ≠ 0 ∧ h ≠ κ ∧ η ^ 2 = 1 ∧
1 - testR₀ η t * q ^ 2 ≠ 0 ∧ poleW (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
poleTheta (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
PoleSoluble (testR η q t / poleTheta (testR η q t) (testC n κ t h s₀) ^ 2)
ZInQKernel/Assembly/Local/SixLocalTests.lean:66
def vtA0 (t η q : ℚ) : ℚ := 1 - vtR0 t η * q ^ 2
ZInQKernel/Assembly/Values/Tests.lean:48
noncomputable def vtW (n κ : ℤ) (t : ℚ) (h s₀ : ℤ) (η q : ℚ) : K0 :=
∏ j : Fin 6, (1 + algebraMap ℚ K0 (vtR t η q) *
(vtD n κ t h s₀ j / algebraMap ℚ K0 (Mult.contactPoly t)) ^ 2)
ZInQKernel/Assembly/Values/Tests.lean:54
noncomputable def vtTheta (n κ : ℤ) (t : ℚ) (h s₀ : ℤ) (η q : ℚ) : ℚ :=
QuadraticAlgebra.trace (vtW n κ t h s₀ η q)⁻¹
ZInQKernel/Assembly/Values/Tests.lean:59
def vtR (t η q : ℚ) : ℚ := vtR0 t η * vtA0 t η q ^ 2
ZInQKernel/Assembly/Values/Tests.lean:51
Uses 4 · Used by 5
TheoremSemantics of the value-test template#✓
Assume the six-contact estimate, pole completeness and the twenty-two-prime pattern. Then for all \(N,K\in\mathbb Q^5\) and \(t\in\mathbb Q\), $\(\mathrm{Rel}_{\mathtt{value.test}}(N,K,t)\iff\exists\,n,\kappa\in\mathbb Z:\ N=\iota(n),\ K=\iota(\kappa),\ \operatorname{Test}(n,\kappa,t).\)$
Proof sketch. The template is \(\kappa(\varphi)^2\) for the conjunction \(\varphi\) listed in its definition; its calls (\(\mathtt{member}\) seven times, \(\mathtt{multiply}\), \(\mathtt{raw\_add}\) twice, \(\mathtt{pole}\)) have pairwise disjoint blocks occurring in no parameter, so by the private-witness lemma the relation holds exactly when the fresh variables can be chosen so that every conjunct holds with each call replaced by its relation. Read the conjuncts in order.
- Membership of \(N,K,C_1,H,U,V_0,V_1\) gives \(N=\iota(n)\), \(K=\iota(\kappa)\), \(H=\iota(h)\), \(U=\iota(s_0)\) and \(C_1,V_0,V_1\) canonical.
- The first coordinate of \(K\) is \(0\) (written \(K[0]=0\); not to be confused with the field \(K_0\)), so \(\kappa\ne0\). Statement M gives \(C_1=\iota(\kappa n)\). Since \(\operatorname{neg}(\iota(m))=\iota(-m)\), raw addition gives \(V_0=\iota(h-\kappa)\) and \(V_1=\iota(s_0-\kappa n)\). \(H[0]=0\) and \(V_0[0]=0\) give \(h\ne0\) and \(h\ne\kappa\).
- For each of \(H,U,V_0,V_1\) the gadgets \(I\!X\) and \(Z\) are satisfiable and force the pairs \(w_i\), \(\zeta_i\) to be \(w\) and \(z\) of the point (nonzero multiples have \(x,y\ne0\); the identity gives \(0\)).
- The two ratio conjuncts are satisfiable because \(z(H),z(V_0)\ne0\), and force \([\rho_0]=z(U)/z(H)\) and \([\rho_1]=z(V_1)/z(V_0)\). Hence the six pairs \(\Delta_i\) are \(D_1,\dots,D_6\) (conjugation is the pair conjugate).
- \(Fu_F=1\) says \(F(t)\ne0\), that is \(t\notin\mathcal C\); then \(\eta^2=1\), \(R_0\), \(a_0\ne0\) and \(R\) are as in the definition of the tests.
- \(F\,C'_i=\Delta_i\) forces \([C'_i]=C_{i+1}=D_{i+1}/F(t)\).
- The inverse conjunct for \(W\) says \(W\ne0\) and \([\omega]=W^{-1}\), so \(\Theta=2\omega_0=\operatorname{Tr}(W^{-1})\); \(\Theta u_\Theta=1\) says \(\Theta\ne0\); \(B\Theta^2=R\) gives \(B=R/\Theta^2\); and the pole relation is \(\Phi(B)\), since the pole template is \(Q_{\rm pole}^2\).
Conversely, given \(n,\kappa\) with \(\operatorname{Test}(n,\kappa,t)\) and its \(h,s_0,\eta,q\), assign the forced values; statement M (completeness), raw addition and membership supply the call relations.
theorem valueTest_rel_iff {I : Constructors E} {cstar ell T : ℤ}
(hM : MultiplicationExact I cstar ell T) (N K : Fin 5 → ℚ) (t : ℚ) :
(valueTestTemplate I cstar ell T).Rel (Fin.append (Fin.append N K) ![t]) ↔
∃ n κ : ℤ, N = iota n ∧ K = iota κ ∧ Test n κ 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
def MultiplicationExact (I : Constructors E) (cstar ell T : ℤ) : Prop :=
∀ p q r : Fin 5 → ℚ, (multiplyTemplate I cstar ell T).Rel (Fin.append (Fin.append p q) r) ↔
∃ a b : ℤ, p = iota a ∧ q = iota b ∧ r = iota (a * b)
ZInQKernel/Compiler/Translation/NaturalCode.lean:30
noncomputable def valueTestTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
Build.template 11 (valueTestBuild I cstar ell T (varPoint 0) (varPoint 5) (X 10))
ZInQKernel/Syntax/Templates/Value.lean:303
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def Test (n κ : ℤ) (t : ℚ) : Prop :=
κ ≠ 0 ∧ t ∉ contactSet ∧ ∃ (h s₀ : ℤ) (η q : ℚ), h ≠ 0 ∧ h ≠ κ ∧ η ^ 2 = 1 ∧
1 - testR₀ η t * q ^ 2 ≠ 0 ∧ poleW (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
poleTheta (testR η q t) (testC n κ t h s₀) ≠ 0 ∧
PoleSoluble (testR η q t / poleTheta (testR η q t) (testC n κ t h s₀) ^ 2)
ZInQKernel/Assembly/Local/SixLocalTests.lean:66
Uses 18 · Used by 1
The outer recipes
The composition recipes \(\mathtt{close}\), \(\mathtt{main}\), \(\mathtt{value\_union}\) and \(\mathtt{value}\) conjoin or multiply their calls; the shared shift appears in both calls of \(\mathtt{main}\).
TheoremRelations of the outer recipes#✓
For all \(N,K\in\mathbb Q^5\) and \(t\in\mathbb Q\):
- \(\mathrm{Rel}_{\mathtt{close}}(N,K,t)\) holds exactly when there are \(A,L,J,E_0,\dots,E_4\in\mathbb Q^5\) with \(\mathrm{Rel}_{\mathtt{value.signed\_encode}}(\Sigma_i,E_i)\) for \((\Sigma_0,\dots,\Sigma_4)=(N,K,A,L,J)\), \(\mathrm{Rel}_{\mathtt{precision}}(E_0,\dots,E_4)\) and \(\mathrm{Rel}_{\mathtt{value.close\_coordinates}}(A,L,J,t)\);
- \(\mathrm{Rel}_{\mathtt{main}}(N,t)\iff\exists\,K\in\mathbb Q^5:\ \mathrm{Rel}_{\mathtt{close}}(N,K,t)\wedge\mathrm{Rel}_{\mathtt{value.test}}(N,K,t)\);
- \(\mathrm{Rel}_{\mathtt{value\_union}}(N,t)\iff\mathrm{Rel}_{\mathtt{value.exceptions}}(N,t)\vee\mathrm{Rel}_{\mathtt{main}}(N,t)\);
- \(\mathrm{Rel}_{\mathtt{value}}(N,t)\iff\mathrm{Rel}_{\mathtt{member}}(N)\wedge\mathrm{Rel}_{\mathtt{value\_union}}(N,t)\).
In 2 the same five coordinates of \(K\) are passed to both calls: one shared shift.
Proof sketch. Each outer recipe is a composition recipe: its polynomial is the sum of the squares (for \(\mathtt{value\_union}\), the product) of its call polynomials, which is \(\kappa\) of the conjunction (disjunction) of the call atoms. By the witness accounting and the witness-scope theorem, the call blocks lie inside the recipe's variables, are pairwise disjoint, are disjoint from the fresh ranges, and occur in no parameter. The private-witness lemma then replaces each call by its callee relation, and the fresh ranges (\(A,L,J,E_0,\dots,E_4\) for \(\mathtt{close}\), \(K\) for \(\mathtt{main}\)) become existential quantifiers. For the product recipe, the block of an inactive factor takes arbitrary values; this does not discard any fixed equation of the active factor.
theorem close_rel_iff (w : ℕ) (h13 : (getEx T 13).WF) (h13w : (getEx T 13).witnesses = 140654)
(h15 : (getEx T 15).WF) (h15w : (getEx T 15).witnesses = 53) (h1 : (getEx R 1).WF)
(h1w : (getEx R 1).witnesses = w) (N K : Fin 5 → ℚ) (t : ℚ) :
ValRel ((Recipe.composition (closeRecipe w)).denote T R)
(List.ofFn N ++ (List.ofFn K ++ [t])) ↔
∃ A L J E₀ E₁ E₂ E₃ E₄ : Fin 5 → ℚ,
ValRel (getEx T 13) (List.ofFn N ++ List.ofFn E₀) ∧
ValRel (getEx T 13) (List.ofFn K ++ List.ofFn E₁) ∧
ValRel (getEx T 13) (List.ofFn A ++ List.ofFn E₂) ∧
ValRel (getEx T 13) (List.ofFn L ++ List.ofFn E₃) ∧
ValRel (getEx T 13) (List.ofFn J ++ List.ofFn E₄) ∧
ValRel (getEx R 1) (List.ofFn E₀ ++ List.ofFn E₁ ++ List.ofFn E₂ ++ List.ofFn E₃ ++
List.ofFn E₄) ∧
ValRel (getEx T 15) (List.ofFn A ++ List.ofFn L ++ List.ofFn J ++ [t])
theorem main_rel_iff (w : ℕ) (h16 : (getEx T 16).WF) (h16w : (getEx T 16).witnesses = 35282)
(h2 : (getEx R 2).WF) (h2w : (getEx R 2).witnesses = w) (N : Fin 5 → ℚ) (t : ℚ) :
ValRel ((Recipe.composition (mainRecipe w)).denote T R) (List.ofFn N ++ [t]) ↔
∃ K : Fin 5 → ℚ, ValRel (getEx R 2) (List.ofFn N ++ List.ofFn K ++ [t]) ∧
ValRel (getEx T 16) (List.ofFn N ++ List.ofFn K ++ [t])
theorem valueUnion_rel_iff (w : ℕ) (h17 : (getEx T 17).WF) (h17w : (getEx T 17).witnesses = 406)
(h3 : (getEx R 3).WF) (h3w : (getEx R 3).witnesses = w) (N : Fin 5 → ℚ) (t : ℚ) :
ValRel ((Recipe.composition (valueUnionRecipe w)).denote T R) (List.ofFn N ++ [t]) ↔
ValRel (getEx T 17) (List.ofFn N ++ [t]) ∨ ValRel (getEx R 3) (List.ofFn N ++ [t])
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
def ValRel (τ : ExPoly) (l : List ℚ) : Prop := τ.Rel fun k => l.getD k 0
ZInQKernel/Assembly/Values/Outer.lean:28
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
def closeRecipe (wPrec : ℕ) : CompositionRecipe := CompM.run .sumSq 11 do
let A ← CompM.fresh 5
let L ← CompM.fresh 5
let J ← CompM.fresh 5
let E0 ← CompM.fresh 5
let E1 ← CompM.fresh 5
let E2 ← CompM.fresh 5
let E3 ← CompM.fresh 5
let E4 ← CompM.fresh 5
CompM.call (.template 13) (point 0 ++ point E0) 140654
CompM.call (.template 13) (point 5 ++ point E1) 140654
CompM.call (.template 13) (point A ++ point E2) 140654
⋯
ZInQKernel/Syntax/Recipes/Outer.lean:67
def mainRecipe (wClose : ℕ) : CompositionRecipe := CompM.run .sumSq 6 do
let K ← CompM.fresh 5
CompM.call (.recipe 2) (point 0 ++ point K ++ [5]) wClose
CompM.call (.template 16) (point 0 ++ point K ++ [5]) 35282
ZInQKernel/Syntax/Recipes/Outer.lean:86
def valueUnionRecipe (wMain : ℕ) : CompositionRecipe := CompM.run .prod 6 do
CompM.call (.template 17) (point 0 ++ [5]) 406
CompM.call (.recipe 3) (point 0 ++ [5]) wMain
ZInQKernel/Syntax/Recipes/Outer.lean:93
Uses 7 · Used by 2
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.