The outer recipes and their translation
This chapter assembles the specified polynomial \(P_*\) from the recipes of the specification and the natural circuits of the compiler, and proves that the translation of natural-number constraints into rational point-code constraints is exact. Its statements use both the specification and the compiler, which is why they form a chapter after both; the narrative of the translation is in translation to rational point codes.
Throughout, \(\iota(n)\) is the code of \([n]P_0\) and \(\mathrm{Rel}_\tau\) is the rational relation of a template or recipe.
The natural-code predicate
The four square products and three additions of \(\mathtt{natural}\), typed by globally typed multiplication, give exactly the codes of the natural numbers.
TheoremThe natural-code predicate#✓
Assume the multiplication statement M in its all-input form: for all \(p,q,r\in\mathbb Q^5\), $\(\mathrm{Rel}_{\mathtt{multiply}}(p,q,r)\iff\exists\,a,b\in\mathbb Z:\ p=\iota(a),\ q=\iota(b),\ r=\iota(ab).\)$ Then for every \(A\in\mathbb Q^5\) (an arbitrary rational \(5\)-tuple, not assumed to be a code) $\(\mathrm{Rel}_{\mathtt{natural}}(A)\iff A=\iota(n)\ \text{for some }n\in\mathbb N .\)$ In words: the natural-code template accepts exactly the codes of the nonnegative indices. Its four square roots are typed by the multiplication calls before their squares are added, so the three raw additions only ever receive canonical codes.
Proof sketch. The polynomial of \(\mathtt{natural}\) is the square of the compilation of a conjunction of seven calls with pairwise disjoint private blocks; the points \(\sigma_0,\dots,\sigma_3,\Sigma_0,\dots,\Sigma_3,\pi_1,\pi_2\) are fresh variables occurring in no block. By the private-block theorem, \(\mathrm{Rel}_{\mathtt{natural}}(A)\) holds exactly when there are \(\sigma_i,\Sigma_i,\pi_1,\pi_2\in\mathbb Q^5\) with $\(\mathrm{Rel}_{\mathtt{multiply}}(\sigma_i,\sigma_i,\Sigma_i)\ (i=0,\dots,3),\quad \mathrm{Add}_{\rm raw}(\Sigma_0,\Sigma_1,\pi_1),\quad\mathrm{Add}_{\rm raw}(\pi_1,\Sigma_2,\pi_2),\quad \mathrm{Add}_{\rm raw}(\pi_2,\Sigma_3,A).\)$
(\(\Rightarrow\)) By M, \(\sigma_i=\iota(a_i)=\iota(b_i)\) and \(\Sigma_i=\iota(a_ib_i)\) for integers \(a_i,b_i\). Since \(\iota\) is injective (generator certificate), \(a_i=b_i\) and \(\Sigma_i=\iota(a_i^2)\). (Injectivity can be avoided: codes are injective on points, so \([a_i]P_0=[b_i]P_0\) and \([a_ib_i]P_0=[a_i]([b_i]P_0)=[a_i]([a_i]P_0)=[a_i^2]P_0\).) The three raw additions now have canonical inputs, so by the raw-addition contract \(\pi_1=\iota(a_0^2+a_1^2)\), \(\pi_2=\iota(a_0^2+a_1^2+a_2^2)\) and \(A=\iota(a_0^2+a_1^2+a_2^2+a_3^2)\), and \(n=\sum_ia_i^2\in\mathbb N\).
(\(\Leftarrow\)) Write \(n=\sum_ia_i^2\) with \(a_i\in\mathbb N\) by Lagrange's theorem and put \(\sigma_i=\iota(a_i)\), \(\Sigma_i=\iota(a_i^2)\), \(\pi_1=\iota(a_0^2+a_1^2)\), \(\pi_2=\iota(a_0^2+a_1^2+a_2^2)\). The multiplication relations hold by M (with \(a=b=a_i\)) and the three additions by the raw-addition contract; the private-block theorem supplies the witnesses of the seven calls.
The completeness half of M is essential here; the generator certificate alone does not give this predicate.
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)
theorem natural_rel_iff {I : Constructors E} {cstar ell T : ℤ}
(hM : MultiplicationExact I cstar ell T) (A : Fin 5 → ℚ) :
(naturalTemplate I cstar ell T).Rel A ↔ ∃ n : ℕ, A = iota n
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 multiplyTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
Build.template 15 (multiplyBuild I cstar ell T (varPoint 0) (varPoint 5) (varPoint 10))
ZInQKernel/Syntax/Templates/Multiply.lean:209
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
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 naturalTemplate (I : Constructors E) (cstar ell T : ℤ) : ExPoly :=
Build.template 5 (naturalBuild I cstar ell T (varPoint 0))
ZInQKernel/Syntax/Templates/Multiply.lean:299
Uses 9 · Used by 3
The power-value and precision recipes
A natural circuit is translated into a model-evaluation recipe: every variable and node gets a point code, natural variables get the natural template, constants get fixed-scalar templates, and additions, multiplications and power calls get the corresponding templates.
DefinitionThe power-value recipe#✓
The recipe \(\mathtt{power\_value}\) is the translation of the power template of the natural precision polynomial (\(3\) inputs, \(79\) witnesses) in value mode, without natural constraints on the inputs and without a power recipe. It has \(20\) parameters (three signed input codes at \(X_0,\dots,X_{14}\) and the output code at \(X_{15},\dots,X_{19}\)), generator indices \(20,21,22\), and every one of the \(79\) witnesses of the power template receives a fresh point and a natural block. Its constants are \(4,2,3\), which become \(\mathrm{integer\_constant}_0,\mathrm{integer\_constant}_1,\mathrm{integer\_constant}_2\). Its root equality equates the point of the root node with the output code; the value of the power-template polynomial is not required to vanish here.
This is a definition. With the natural circuit statistics it has \(17{,}786{,}698\) witnesses and \(17{,}786{,}718\) variables.
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
theorem powerValueRecipe_variableCount : powerValueRecipe.variableCount = 17786718
structure ModelRecipe where
/-- The parameter count. -/
parameterCount : ℕ
/-- The variable count. -/
variableCount : ℕ
/-- The generator variable indices `g₀, g₁, g₂`. -/
generator : Fin 3 → ℕ
/-- Source variable rows `(r, s)`: a point reference and a natural start or none. -/
sources : List (ℤ × Option ℕ)
/-- Constant definitions `(σ, r, s)`: a scalar template, a point reference, a start. -/
constants : List (ℕ × ℤ × ℕ)
/-- The operations. -/
⋯
ZInQKernel/Syntax/Language/Nodes.lean:206
def translate (consts : List ℤ) (N : NatCircuit) (mode : OutputMode) (natInputs : Bool)
(power : Option (ℕ × ℕ)) : ModelRecipe :=
let p := trParams N.inputCount mode
let s := trState consts N mode natInputs power
{ parameterCount := p
variableCount := s.next
generator := ![p, p + 1, p + 2]
sources := s.sources
constants := s.constants
operations := s.operations
rootEq := (s.nodePts.getD N.root (-4),
match mode with
⋯
ZInQKernel/Syntax/Recipes/Translate.lean:152
def powerConstants : List ℤ := [4, 2, 3]
ZInQKernel/Syntax/Recipes/PowerValue.lean:25
def powerTemplateCircuit : NatCircuit := powerTemplateConstruction.toCircuit 3
ZInQKernel/Compiler/Circuits/PowerTemplate.lean:31
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
ZInQKernel/Syntax/Recipes/PowerValue.lean:28
Uses 2 · Used by 5
DefinitionThe precision recipe#✓
The recipe \(\mathtt{precision}\) is the translation of the five-input natural precision polynomial in zero mode, with natural constraints on the inputs and with power recipe \(\mathtt{power\_value}\), performed after the translation of the power template (so the constants \(4,2,3\) keep their indices \(0,1,2\)). It has \(25\) parameters (the five input codes \(X_{5i},\dots,X_{5i+4}\), \(i=0,\dots,4\), in the input order \((n,\kappa,a,l,j)\)), generator indices \(25,26,27\), a natural block for every explicit variable including the inputs, and its root equality equates the point of the root node with \(\mathrm{ref}(-1)\), the code of \(O\). Its nontrivial constants, in order of first occurrence, are \(c_3\), \(2\), \(4\), \(1399\); \(c_3\) and \(1399\) become \(\mathrm{integer\_constant}_3\) and \(\mathrm{integer\_constant}_4\).
This is a definition. If the natural circuit has \(5\) inputs, listed first among at most \(54056\) explicit variables, at most \(125327\) addition, \(98382\) multiplication and \(15845\) call nodes, and nontrivial constants among \(c_3,2,4,1399\) (the shape given by the natural circuit statistics), then \(\mathtt{precision}\) has at most \(292{,}889{,}492{,}836\) witnesses and at most \(292{,}889{,}492{,}861\) variables.
noncomputable def precisionRecipe (N : NatCircuit) (c3 : ℤ) : ModelRecipe :=
translate (integerConstants c3) N .zero true
(some (0, powerValueRecipe.variableCount - powerValueRecipe.parameterCount))
theorem precisionRecipe_variableCount_le {N : NatCircuit} {c3 : ℤ} (hN : PrecisionShape N c3) :
(precisionRecipe N c3).variableCount ≤ 292889492861
structure NatCircuit where
/-- The number `k` of inputs. -/
inputCount : ℕ
/-- The explicit variables (index and kind), the inputs first. -/
explicitVars : List (ℕ × VarKind)
/-- The node list. -/
nodes : List NatNode
/-- The root node. -/
root : ℕ
/-- The variable count `V`. -/
varCount : ℕ
ZInQKernel/Compiler/Circuits/Circuit.lean:33
structure ModelRecipe where
/-- The parameter count. -/
parameterCount : ℕ
/-- The variable count. -/
variableCount : ℕ
/-- The generator variable indices `g₀, g₁, g₂`. -/
generator : Fin 3 → ℕ
/-- Source variable rows `(r, s)`: a point reference and a natural start or none. -/
sources : List (ℤ × Option ℕ)
/-- Constant definitions `(σ, r, s)`: a scalar template, a point reference, a start. -/
constants : List (ℕ × ℤ × ℕ)
/-- The operations. -/
⋯
ZInQKernel/Syntax/Language/Nodes.lean:206
def translate (consts : List ℤ) (N : NatCircuit) (mode : OutputMode) (natInputs : Bool)
(power : Option (ℕ × ℕ)) : ModelRecipe :=
let p := trParams N.inputCount mode
let s := trState consts N mode natInputs power
{ parameterCount := p
variableCount := s.next
generator := ![p, p + 1, p + 2]
sources := s.sources
constants := s.constants
operations := s.operations
rootEq := (s.nodePts.getD N.root (-4),
match mode with
⋯
ZInQKernel/Syntax/Recipes/Translate.lean:152
def integerConstants (c3 : ℤ) : List ℤ := [4, 2, 3, c3, 1399]
ZInQKernel/Syntax/Templates/Library.lean:18
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
ZInQKernel/Syntax/Recipes/PowerValue.lean:28
structure PrecisionShape (N : NatCircuit) (c3 : ℤ) : Prop where
inputCount : N.inputCount = 5
explicitVars_length : N.explicitVars.length ≤ 54056
inputs : 5 ≤ N.explicitVars.countP fun v => decide (IsInputVar 5 v)
adds : N.nodes.countP NatNode.isAdd ≤ 125327
muls : N.nodes.countP NatNode.isMul ≤ 98382
calls : N.nodes.countP NatNode.isCall ≤ 15845
consts : ∀ c ∈ N.nodes.filterMap nontrivialConst, c = c3 ∨ c = 2 ∨ c = 4 ∨ c = 1399
ZInQKernel/Syntax/Recipes/Precision.lean:46
noncomputable def precisionRecipe (N : NatCircuit) (c3 : ℤ) : ModelRecipe :=
translate (integerConstants c3) N .zero true
(some (0, powerValueRecipe.variableCount - powerValueRecipe.parameterCount))
ZInQKernel/Syntax/Recipes/Precision.lean:27
Uses 3 · Used by 4
Translation soundness and completeness
Induction along the source DAG gives every node point the code of the node's signed integer value. Conversely, a natural solution provides rational witnesses for every call.
TheoremEvery node point is the code of the node's value#✓
Assume the multiplication statement M in its all-input form. Let \(\mathcal N\) be a natural circuit with \(k\) inputs that is well-formed with some bound, with power template \(\mathcal P\) if it has call nodes, and let \(\rho\) be its translation in some mode, with or without natural constraints on the inputs, with power recipe \(\pi\) if \(\mathcal N\) has call nodes. If \(\mathcal N\) has call nodes, assume that \(\pi\) computes the power template on canonical codes: $\((\mathrm{PV})\qquad\mathrm{Rel}_\pi(\iota(a),\iota(b),\iota(c),r)\iff\exists\,w\in\mathbb N^{V_{\mathcal P}-3}:\ r=\iota\bigl(T_{\mathcal P}(a,b,c,w)\bigr)\qquad(a,b,c\in\mathbb Z,\ r\in\mathbb Q^5).\)$ Let \(x:\mathbb N\to\mathbb Q\) satisfy conditions 1-4 of the relational form of \(\rho\) (all conditions except the root equality), and assume that either the inputs carry natural constraints, or the input points are canonical: \(\mathrm{ref}(5i)(x)=\iota(c_i)\) with \(c_i\in\mathbb Z\) for \(i<k\).
Then there is an assignment \(\theta\), admissible for \(\mathcal N\), such that
- \(\mathrm{ref}(5i)(x)=\iota(\theta_i)\) for every input \(i<k\), with \(\theta_i\in\mathbb N\) when the inputs carry natural constraints and \(\theta_i=c_i\) otherwise;
- \(\mathrm{ref}(r_v)(x)=\iota(\theta_v)\) for every explicit variable \(v\) with point \(r_v\);
- \(\mathrm{ref}(\mathrm{pt}(j))(x)=\iota(\mathrm{val}_\theta(j))\) for every node \(j\).
In particular the point of the root is \(\iota(\mathcal N(\theta))\); if moreover the root equality of zero mode holds then \(\mathcal N(\theta)=0\), and in value mode the output point \(\mathrm{ref}(5k)(x)\) is \(\iota(\mathcal N(\theta))\).
Proof sketch. Inputs and explicit witnesses: a row with a natural start gives \(\mathrm{Rel}_{\mathtt{natural}}(\mathrm{ref}(r_v)(x))\), hence \(\mathrm{ref}(r_v)(x)=\iota(n_v)\) with \(n_v\in\mathbb N\) by the natural-code predicate; put \(\theta_v=n_v\). Unconstrained inputs are canonical by hypothesis; put \(\theta_i=c_i\). Nodes: induction along the node list, defining \(\theta\) on the block of each call node when that node is reached.
- \(\mathrm{var}\ i\): \(\mathrm{pt}=r_i\) and item 2 applies (well-formedness 3).
- \(\mathrm{const}\ 0,1,-1\): the references \(-1,-2,-3\) have values \(\iota(0),\iota(1),\iota(-1)\) by the generator equations.
- \(\mathrm{const}\ c\) with \(c\ge2\): its point is the point \(r\) of the constant definition made at the first occurrence of \(c\); the scalar template \(S_h\) has \(\mathrm{val}=c\ge1\) and \(\mathrm{Rel}_{S_h}(\iota(1),\mathrm{ref}(r)(x))\), so \(\mathrm{ref}(r)(x)=\iota(c\cdot1)\) by the semantics of the fixed-scalar templates (here \(\iota(1)\) is the code of \(P_0\in2E(K_0)\)).
- \(\mathrm{add}\ j_1\ j_2\): by induction the operand points are \(\iota(\mathrm{val}(j_1))\) and \(\iota(\mathrm{val}(j_2))\), canonical codes, so the raw-addition contract gives \(\iota(\mathrm{val}(j_1)+\mathrm{val}(j_2))\).
- \(\mathrm{mul}\ j_1\ j_2\): M gives \(\iota(a)=\iota(\mathrm{val}(j_1))\), \(\iota(b)=\iota(\mathrm{val}(j_2))\) and output \(\iota(ab)\); injectivity of \(\iota\) gives \(\iota(\mathrm{val}(j_1)\mathrm{val}(j_2))\).
- \(\mathrm{call}\ (a,b,c)\ w\): the three argument points are canonical by induction, so (PV) gives \(w'\in\mathbb N^{V_{\mathcal P}-3}\) with output \(\iota(T_{\mathcal P}(\mathrm{val}(a),\mathrm{val}(b),\mathrm{val}(c),w'))\); set \(\theta\) to \(w'\) on the block of this call. By well-formedness 5 this block is used by no other call and by no explicit variable, and the values of earlier nodes do not depend on it, so the definition is consistent and keeps items 1-3 for earlier nodes.
The root equality of zero mode says that the root point equals \(\mathrm{ref}(-1)(x)=\iota(0)\), so \(\iota(\mathcal N(\theta))=\iota(0)\) and \(\mathcal N(\theta)=0\) by injectivity of \(\iota\). Raw addition only ever receives canonical codes here: this is the induction order of the manuscript's typing argument, and the natural guards constrain the explicit variables only, never intermediate sums or products, whose values may be negative.
theorem translate_sound (S : TranslationShape templates recipes scalarOf r P N value natIn)
(hwf : WellFormed P N V) (hsem : CalleeSemantics (getEx templates r.natural)
(getEx templates r.addition) (getEx templates r.multiplication) scalarOf)
(hπ : HasCall N → PowerValueSpec (powerCallee recipes r) P)
{x : ℕ → ℚ} (hx : ModelHoldsExceptRoot templates recipes r x)
(hin : natIn = false → ∀ i < N.inputCount, ∃ c : ℤ, refVal r.generator x (5 * i) = iota c) :
∃ θ : ℕ → ℤ, Admissible P N θ ∧
(∀ i < N.inputCount, refVal r.generator x (5 * i) = iota (θ i) ∧
(natIn = true → 0 ≤ θ i)) ∧
(∀ v ∈ N.explicitVars, refVal r.generator x (S.vref v.1) = iota (θ v.1)) ∧
∀ j < N.nodes.length, refVal r.generator x (S.pt j) = iota (nodeVal P N θ j)
structure TranslationShape (templates recipes : List ExPoly) (scalarOf : ℤ → ExPoly)
(r : ModelRecipe) (P N : NatCircuit) (value natIn : Bool) where
/-- The point reference of the explicit variable with index `i`. -/
vref : ℕ → ℤ
/-- The point reference of node `j`. -/
pt : ℕ → ℤ
/-- The parameters are the input codes and, in value mode, the output code. -/
params : r.parameterCount = 5 * (N.inputCount + if value then 1 else 0)
/-- The input `i` is the parameter point `5i`. -/
vref_input : ∀ i < N.inputCount, vref i = 5 * i
/-- Natural rows: every explicit variable except an unconstrained input. -/
row : ∀ v ∈ N.explicitVars, (natIn = true ∨ v.2 = VarKind.witness) →
⋯
ZInQKernel/Compiler/Translation/Spec.lean:77
structure WellFormed (P N : NatCircuit) (V : ℕ) : Prop where
/-- Conditions 1–6, with call blocks of length `V_𝒫 - 3`. -/
core : WellFormedCore N (P.varCount - 3) V
/-- Condition 7. -/
power : HasCall N → P.inputCount = 3 ∧ (∀ a b c w, NatNode.call a b c w ∉ P.nodes) ∧
WellFormedCore P 0 P.varCount ∧ P.explicitVars.map Prod.fst = List.range P.varCount
ZInQKernel/Compiler/Translation/WellFormed.lean:67
structure CalleeSemantics (ν α μ : ExPoly) (scalarOf : ℤ → ExPoly) : Prop where
natural : ∀ A, CodeRel ν [A] ↔ ∃ n : ℕ, A = iota n
add : ∀ (a b : ℤ) (R : Fin 5 → ℚ), CodeRel α [iota a, iota b, R] ↔ R = iota (a + b)
mul : ∀ (a b : ℤ) (R : Fin 5 → ℚ), CodeRel μ [iota a, iota b, R] ↔ R = iota (a * b)
scalar : ∀ c : ℤ, 2 ≤ c → ∀ R : Fin 5 → ℚ, CodeRel (scalarOf c) [iota 1, R] ↔ R = iota c
ZInQKernel/Compiler/Translation/Spec.lean:54
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
def HasCall (N : NatCircuit) : Prop := ∃ a b c w, NatNode.call a b c w ∈ N.nodes
ZInQKernel/Compiler/Translation/WellFormed.lean:64
def PowerValueSpec (π : ExPoly) (P : NatCircuit) : Prop :=
∀ (a b c : ℤ) (r : Fin 5 → ℚ), CodeRel π [iota a, iota b, iota c, r] ↔
∃ w : Fin (P.varCount - 3) → ℕ, r = iota (templateValue P (blockAssign P a b c w))
ZInQKernel/Compiler/Translation/Spec.lean:45
noncomputable def powerCallee (recipes : List ExPoly) (r : ModelRecipe) : ExPoly :=
match r.power with
| some i => getEx recipes i
| none => ExPoly.empty
ZInQKernel/Compiler/Translation/RecipeRelation.lean:84
structure ModelHoldsExceptRoot (templates recipes : List ExPoly) (r : ModelRecipe)
(x : ℕ → ℚ) : Prop where
/-- The generator equations. -/
generator : x (r.generator 0) = 1641 / 8 ∧ x (r.generator 1) = -15465 / 4 ∧
x (r.generator 2) = 87483 / 32
/-- The natural calls of the source rows with a natural start. -/
natural : ∀ row ∈ r.sources, ∀ s, row.2 = some s →
CodeRel (getEx templates r.natural) [refVal r.generator x row.1]
/-- The constant definitions. -/
constants : ∀ d ∈ r.constants,
CodeRel (getEx templates d.1) [refVal r.generator x (-2), refVal r.generator x d.2.1]
/-- The operations. -/
⋯
ZInQKernel/Compiler/Translation/RecipeRelation.lean:96
noncomputable def refVal (g : Fin 3 → ℕ) (x : ℕ → ℚ) (r : ℤ) : Fin 5 → ℚ :=
evCode x (pointRef g r)
ZInQKernel/Compiler/Translation/RecipeRelation.lean:43
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def Admissible (P N : NatCircuit) (θ : ℕ → ℤ) : Prop :=
(∀ v ∈ N.explicitVars, v.2 = VarKind.witness → 0 ≤ θ v.1) ∧
∀ w ∈ N.blocks, ∀ i < P.varCount - 3, 0 ≤ θ (w + i)
ZInQKernel/Compiler/Translation/Values.lean:79
def nodeVal (P N : NatCircuit) (θ : ℕ → ℤ) (j : ℕ) : ℤ := (nodeVals P N θ).getD j 0
ZInQKernel/Compiler/Translation/Values.lean:63
Uses 10 · Used by 2
TheoremNatural solutions give rational witnesses#✓
Assume the multiplication statement M in its all-input form. Let \(\mathcal N\), \(\mathcal P\), \(\rho\) and \(\pi\) be as in the soundness statement, with (PV) for \(\pi\) if \(\mathcal N\) has call nodes. Let \(\theta\) be admissible for \(\mathcal N\), with \(\theta_i\in\mathbb N\) for every input \(i<k\) if the inputs carry natural constraints. Then the assignment \(x\) defined by
- \(\mathrm{ref}(5i)(x)=\iota(\theta_i)\) for the inputs \(i<k\), and in value mode \(\mathrm{ref}(5k)(x)=\iota(\mathcal N(\theta))\);
- \(x_{g_0}=1641/8\), \(x_{g_1}=-15465/4\), \(x_{g_2}=87483/32\);
- \(\mathrm{ref}(r_v)(x)=\iota(\theta_v)\) for the fresh point \(r_v\) of every explicit witness variable \(v\);
- \(\mathrm{ref}(\mathrm{pt}(j))(x)=\iota(\mathrm{val}_\theta(j))\) for every node \(j\) whose point is fresh (a constant node at the first occurrence of its value, an addition, multiplication or call node);
- \(0\) elsewhere,
is well defined and satisfies conditions 1-4 of the relational form of \(\rho\), and also the root equality in value mode, and in zero mode whenever \(\mathcal N(\theta)=0\). Consequently, in zero mode with \(\mathcal N(\theta)=0\), \(\mathrm{Rel}_\rho(\iota(\theta_0),\dots,\iota(\theta_{k-1}))\) holds, and in value mode \(\mathrm{Rel}_\rho(\iota(\theta_0),\dots,\iota(\theta_{k-1}),\iota(\mathcal N(\theta)))\) holds.
Proof sketch. The fresh points of distinct explicit variables and nodes are distinct allocations, and all occurrences of one nontrivial constant share one point and one value, so \(x\) is well defined; then \(\mathrm{ref}(\mathrm{pt}(j))(x)=\iota(\mathrm{val}_\theta(j))\) for every node, including variable nodes and the constants \(0,\pm1\). Each condition holds by the completeness half of the corresponding statement: the natural rows by the natural-code predicate (\(\theta_v\in\mathbb N\) by admissibility, or by hypothesis for inputs); the constant definitions by the fixed-scalar semantics, \(\mathrm{Rel}_{S_h}(\iota(1),\iota(c))\) for \(c\ge2\); additions by the raw-addition contract; multiplications by M; calls by (PV), with the block values \((\theta_w,\dots,\theta_{w+V_{\mathcal P}-4})\in\mathbb N^{V_{\mathcal P}-3}\) supplied by admissibility. The root equality is \(\iota(\mathcal N(\theta))=\iota(0)=\mathrm{ref}(-1)(x)\) in zero mode and holds by the choice of the output point in value mode. The relational form then gives \(\mathrm{Rel}_\rho\).
theorem translate_complete (S : TranslationShape templates recipes scalarOf r P N value natIn)
(hwf : WellFormed P N V) (hsem : CalleeSemantics (getEx templates r.natural)
(getEx templates r.addition) (getEx templates r.multiplication) scalarOf)
(hπ : HasCall N → PowerValueSpec (powerCallee recipes r) P)
{θ : ℕ → ℤ} (hθ : Admissible P N θ) (hin : natIn = true → ∀ i < N.inputCount, 0 ≤ θ i) :
(∀ i < N.inputCount, refVal r.generator (S.witness θ) (5 * i) = iota (θ i)) ∧
(value = true →
refVal r.generator (S.witness θ) (5 * N.inputCount) = iota (circuitValue P N θ)) ∧
(∀ j < N.nodes.length, refVal r.generator (S.witness θ) (S.pt j) = iota (nodeVal P N θ j)) ∧
ModelHoldsExceptRoot templates recipes r (S.witness θ) ∧
(value = true ∨ circuitValue P N θ = 0 →
ModelHolds templates recipes r (S.witness θ))
structure TranslationShape (templates recipes : List ExPoly) (scalarOf : ℤ → ExPoly)
(r : ModelRecipe) (P N : NatCircuit) (value natIn : Bool) where
/-- The point reference of the explicit variable with index `i`. -/
vref : ℕ → ℤ
/-- The point reference of node `j`. -/
pt : ℕ → ℤ
/-- The parameters are the input codes and, in value mode, the output code. -/
params : r.parameterCount = 5 * (N.inputCount + if value then 1 else 0)
/-- The input `i` is the parameter point `5i`. -/
vref_input : ∀ i < N.inputCount, vref i = 5 * i
/-- Natural rows: every explicit variable except an unconstrained input. -/
row : ∀ v ∈ N.explicitVars, (natIn = true ∨ v.2 = VarKind.witness) →
⋯
ZInQKernel/Compiler/Translation/Spec.lean:77
structure WellFormed (P N : NatCircuit) (V : ℕ) : Prop where
/-- Conditions 1–6, with call blocks of length `V_𝒫 - 3`. -/
core : WellFormedCore N (P.varCount - 3) V
/-- Condition 7. -/
power : HasCall N → P.inputCount = 3 ∧ (∀ a b c w, NatNode.call a b c w ∉ P.nodes) ∧
WellFormedCore P 0 P.varCount ∧ P.explicitVars.map Prod.fst = List.range P.varCount
ZInQKernel/Compiler/Translation/WellFormed.lean:67
structure CalleeSemantics (ν α μ : ExPoly) (scalarOf : ℤ → ExPoly) : Prop where
natural : ∀ A, CodeRel ν [A] ↔ ∃ n : ℕ, A = iota n
add : ∀ (a b : ℤ) (R : Fin 5 → ℚ), CodeRel α [iota a, iota b, R] ↔ R = iota (a + b)
mul : ∀ (a b : ℤ) (R : Fin 5 → ℚ), CodeRel μ [iota a, iota b, R] ↔ R = iota (a * b)
scalar : ∀ c : ℤ, 2 ≤ c → ∀ R : Fin 5 → ℚ, CodeRel (scalarOf c) [iota 1, R] ↔ R = iota c
ZInQKernel/Compiler/Translation/Spec.lean:54
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
def HasCall (N : NatCircuit) : Prop := ∃ a b c w, NatNode.call a b c w ∈ N.nodes
ZInQKernel/Compiler/Translation/WellFormed.lean:64
def PowerValueSpec (π : ExPoly) (P : NatCircuit) : Prop :=
∀ (a b c : ℤ) (r : Fin 5 → ℚ), CodeRel π [iota a, iota b, iota c, r] ↔
∃ w : Fin (P.varCount - 3) → ℕ, r = iota (templateValue P (blockAssign P a b c w))
ZInQKernel/Compiler/Translation/Spec.lean:45
noncomputable def powerCallee (recipes : List ExPoly) (r : ModelRecipe) : ExPoly :=
match r.power with
| some i => getEx recipes i
| none => ExPoly.empty
ZInQKernel/Compiler/Translation/RecipeRelation.lean:84
def Admissible (P N : NatCircuit) (θ : ℕ → ℤ) : Prop :=
(∀ v ∈ N.explicitVars, v.2 = VarKind.witness → 0 ≤ θ v.1) ∧
∀ w ∈ N.blocks, ∀ i < P.varCount - 3, 0 ≤ θ (w + i)
ZInQKernel/Compiler/Translation/Values.lean:79
noncomputable def refVal (g : Fin 3 → ℕ) (x : ℕ → ℚ) (r : ℤ) : Fin 5 → ℚ :=
evCode x (pointRef g r)
ZInQKernel/Compiler/Translation/RecipeRelation.lean:43
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def circuitValue (P N : NatCircuit) (θ : ℕ → ℤ) : ℤ := nodeVal P N θ N.root
ZInQKernel/Compiler/Translation/Values.lean:66
def nodeVal (P N : NatCircuit) (θ : ℕ → ℤ) (j : ℕ) : ℤ := (nodeVals P N θ).getD j 0
ZInQKernel/Compiler/Translation/Values.lean:63
structure ModelHoldsExceptRoot (templates recipes : List ExPoly) (r : ModelRecipe)
(x : ℕ → ℚ) : Prop where
/-- The generator equations. -/
generator : x (r.generator 0) = 1641 / 8 ∧ x (r.generator 1) = -15465 / 4 ∧
x (r.generator 2) = 87483 / 32
/-- The natural calls of the source rows with a natural start. -/
natural : ∀ row ∈ r.sources, ∀ s, row.2 = some s →
CodeRel (getEx templates r.natural) [refVal r.generator x row.1]
/-- The constant definitions. -/
constants : ∀ d ∈ r.constants,
CodeRel (getEx templates d.1) [refVal r.generator x (-2), refVal r.generator x d.2.1]
/-- The operations. -/
⋯
ZInQKernel/Compiler/Translation/RecipeRelation.lean:96
structure ModelHolds (templates recipes : List ExPoly) (r : ModelRecipe) (x : ℕ → ℚ) : Prop
extends ModelHoldsExceptRoot templates recipes r x where
/-- The root equality. -/
root : refVal r.generator x r.rootEq.1 = refVal r.generator x r.rootEq.2
ZInQKernel/Compiler/Translation/RecipeRelation.lean:112
Uses 8 · Used by 1
TheoremSemantics of the model-evaluation translation#✓
Assume the multiplication statement M in its all-input form. Let \(\mathcal N\) be a natural circuit with \(k\) inputs that is well-formed with some bound, with power template \(\mathcal P\) and a well-formed power recipe \(\pi\) satisfying (PV) if it has call nodes, and let \(\rho\) be its translation, with a table of nontrivial constants that is a prefix of \((4,2,3,c_3,1399)\) containing the constants of \(\mathcal N\).
- Zero mode, natural inputs. For all \(E_0,\dots,E_{k-1}\in\mathbb Q^5\), $\(\mathrm{Rel}_\rho(E_0,\dots,E_{k-1})\iff\exists\,\theta\ \text{admissible for }\mathcal N\text{ with } \theta_0,\dots,\theta_{k-1}\in\mathbb N,\ E_i=\iota(\theta_i)\ (i<k)\ \text{and}\ \mathcal N(\theta)=0 .\)$
- Value mode, unconstrained inputs. For all \(c_0,\dots,c_{k-1}\in\mathbb Z\) and \(r\in\mathbb Q^5\), $\(\mathrm{Rel}_\rho(\iota(c_0),\dots,\iota(c_{k-1}),r)\iff\exists\,\theta\ \text{admissible for }\mathcal N\text{ with } \theta_i=c_i\ (i<k)\ \text{and}\ r=\iota(\mathcal N(\theta)) .\)$
In the first case the input points need not be assumed to be codes: the natural calls on the inputs type them. In the second case nothing is claimed for non-canonical inputs.
Proof sketch. By the relational form, \(\mathrm{Rel}_\rho\) is the existence of \(x\) with the prescribed parameters satisfying conditions 1-5. (\(\Rightarrow\)) The soundness statement applies (in case 1 the inputs carry natural constraints; in case 2 they are canonical by assumption) and gives \(\theta\); the root equality yields \(\mathcal N(\theta)=0\), respectively \(r=\iota(\mathcal N(\theta))\). (\(\Leftarrow\)) The completeness statement gives \(x\).
theorem translate_rel_iff_zero (hI : I.psi = psiComponent) (hM : MultiplicationExact I cstar ell T)
(hwf : WellFormed P N V) (hcons : consts <+: integerConstants c3)
(hcmem : ∀ c, NatNode.const c ∈ N.nodes → Nontrivial c → c ∈ consts)
(hpow : PowerSetup recipes power P N)
(a : Fin (translate consts N .zero true power).parameterCount → ℚ) :
((Recipe.model (translate consts N .zero true power)).denote
(templateLibrary I cstar ell T c3) recipes).Rel a ↔
∃ θ : ℕ → ℤ, Admissible P N θ ∧
(∀ i < N.inputCount, 0 ≤ θ i ∧ paramCode a i = iota (θ i)) ∧ circuitValue P N θ = 0
theorem translate_rel_iff_value (hI : I.psi = psiComponent) (hM : MultiplicationExact I cstar ell T)
(hwf : WellFormed P N V) (hcons : consts <+: integerConstants c3)
(hcmem : ∀ c, NatNode.const c ∈ N.nodes → Nontrivial c → c ∈ consts)
(hpow : PowerSetup recipes power P N)
(c : ℕ → ℤ) (R : Fin 5 → ℚ) (a : Fin (translate consts N .value false power).parameterCount → ℚ)
(ha : ∀ i < N.inputCount, paramCode a i = iota (c i)) (hR : paramCode a N.inputCount = R) :
((Recipe.model (translate consts N .value false power)).denote
(templateLibrary I cstar ell T c3) recipes).Rel a ↔
∃ θ : ℕ → ℤ, Admissible P N θ ∧ (∀ i < N.inputCount, θ i = c i) ∧
R = iota (circuitValue P N θ)
noncomputable def psiComponent (n : ℤ) (c : Fin 2) : MvPolynomial (Fin 4) ℤ :=
let v : ComponentRing := psiEval componentA n ⟨.X 0, .X 1⟩ ⟨.X 2, .X 3⟩
![v.re, v.im] c
ZInQKernel/Model/DivisionPolynomials/Defs.lean:124
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
structure WellFormed (P N : NatCircuit) (V : ℕ) : Prop where
/-- Conditions 1–6, with call blocks of length `V_𝒫 - 3`. -/
core : WellFormedCore N (P.varCount - 3) V
/-- Condition 7. -/
power : HasCall N → P.inputCount = 3 ∧ (∀ a b c w, NatNode.call a b c w ∉ P.nodes) ∧
WellFormedCore P 0 P.varCount ∧ P.explicitVars.map Prod.fst = List.range P.varCount
ZInQKernel/Compiler/Translation/WellFormed.lean:67
def integerConstants (c3 : ℤ) : List ℤ := [4, 2, 3, c3, 1399]
ZInQKernel/Syntax/Templates/Library.lean:18
inductive NatNode
| const (c : ℤ)
| var (i : ℕ)
| add (j k : ℕ)
| mul (j k : ℕ)
| call (a b c w : ℕ)
deriving DecidableEq, Repr
ZInQKernel/Compiler/Circuits/Construction.lean:43
def Nontrivial (c : ℤ) : Prop := c ≠ 0 ∧ c ≠ 1 ∧ c ≠ -1
ZInQKernel/Compiler/Translation/Spec.lean:72
structure PowerSetup (recipes : List ExPoly) (power : Option (ℕ × ℕ)) (P N : NatCircuit) :
Prop where
wf : ∀ i w, power = some (i, w) → (getEx recipes i).WF
witnesses : ∀ i w, power = some (i, w) → (getEx recipes i).witnesses = w
present : HasCall N → power.isSome
spec : ∀ i w, power = some (i, w) → HasCall N → PowerValueSpec (getEx recipes i) P
ZInQKernel/Compiler/Translation/TranslateSemantics.lean:34
def translate (consts : List ℤ) (N : NatCircuit) (mode : OutputMode) (natInputs : Bool)
(power : Option (ℕ × ℕ)) : ModelRecipe :=
let p := trParams N.inputCount mode
let s := trState consts N mode natInputs power
{ parameterCount := p
variableCount := s.next
generator := ![p, p + 1, p + 2]
sources := s.sources
constants := s.constants
operations := s.operations
rootEq := (s.nodePts.getD N.root (-4),
match mode with
⋯
ZInQKernel/Syntax/Recipes/Translate.lean:152
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
noncomputable def templateLibrary (I : Constructors E) (cstar ell T c3 : ℤ) : List ExPoly :=
[memberTemplate, rawAddTemplate, rawZTemplate, rawInverseXTemplate, log25Template, poleTemplate,
testGroupTemplate, slopeTemplate, heightTemplate, scalarTemplate I cstar, guardTemplate I T,
multiplyTemplate I cstar ell T, naturalTemplate I cstar ell T,
signedEncodeTemplate I cstar ell T, absTemplate, closeTemplate,
valueTestTemplate I cstar ell T, exceptionsTemplate] ++
(integerConstants c3).map (scalarTemplate I)
ZInQKernel/Syntax/Templates/Library.lean:25
def Admissible (P N : NatCircuit) (θ : ℕ → ℤ) : Prop :=
(∀ v ∈ N.explicitVars, v.2 = VarKind.witness → 0 ≤ θ v.1) ∧
∀ w ∈ N.blocks, ∀ i < P.varCount - 3, 0 ≤ θ (w + i)
ZInQKernel/Compiler/Translation/Values.lean:79
def paramCode {p : ℕ} (a : Fin p → ℚ) (i : ℕ) : Fin 5 → ℚ :=
fun m => if h : 5 * i + m < p then a ⟨5 * i + m, h⟩ else 0
ZInQKernel/Compiler/Translation/ModelSemantics.lean:26
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
def circuitValue (P N : NatCircuit) (θ : ℕ → ℤ) : ℤ := nodeVal P N θ N.root
ZInQKernel/Compiler/Translation/Values.lean:66
The power-value recipe has three signed code inputs, seventy-nine private natural witnesses and an output code for the value of the power-template polynomial. Replacing each private block of the precision parent by its private power-value call preserves the existential assignment, and only the final root is equated to the identity; this is input C on the rational side.
TheoremSemantics of the power-value recipe#✓
Assume the multiplication statement M in its all-input form. Let \(T=T_{\mathcal P}\) be the polynomial function of the power template, of the \(82\) variables \(y_0,\dots,y_{81}\) (\(y_0,y_1,y_2\) its inputs). For all \(a,b,c\in\mathbb Z\) and every \(r\in\mathbb Q^5\), $\(\mathrm{Rel}_{\mathtt{power\_value}}(\iota(a),\iota(b),\iota(c),r)\iff \exists\,w\in\mathbb N^{79}:\ r=\iota\bigl(T(a,b,c,w_0,\dots,w_{78})\bigr).\)$ So \(\mathtt{power\_value}\) satisfies (PV): on three canonical input codes of signed integers it relates exactly the codes of the values of the power-template polynomial at those integers and natural witnesses. The value is not required to vanish; nothing is claimed for non-canonical input tuples.
Proof sketch. \(\mathtt{power\_value}\) is the translation of \(\mathcal P\) in value mode, without natural constraints on the inputs and without a power recipe, and \(\mathcal P\) is well-formed with bound \(82\) and has no call nodes. Case 2 of the semantics of the model-evaluation translation gives: the relation holds iff \(r=\iota(\mathcal P(\theta))\) for some \(\theta\) admissible for \(\mathcal P\) with \(\theta_0,\theta_1,\theta_2=a,b,c\). Admissibility says exactly \(w=(\theta_3,\dots,\theta_{81})\in\mathbb N^{79}\), and \(\mathcal P(\theta)=T(a,b,c,w)\) depends on no other value of \(\theta\).
theorem powerValue_rel_iff (hI : I.psi = psiComponent) (hM : MultiplicationExact I cstar ell T)
(recipes : List ExPoly) (a b c : ℤ) (r : Fin 5 → ℚ) :
((Recipe.model powerValueRecipe).denote (templateLibrary I cstar ell T c3) recipes).Rel
(Fin.append (Fin.append (Fin.append (iota a) (iota b)) (iota c)) r) ↔
∃ w : Fin 79 → ℕ, r = iota (powerValueT a b c w)
theorem powerValue_spec (hI : I.psi = psiComponent) (hM : MultiplicationExact I cstar ell T)
(recipes : List ExPoly) :
PowerValueSpec ((Recipe.model powerValueRecipe).denote (templateLibrary I cstar ell T c3) recipes)
powerTemplateCircuit
noncomputable def psiComponent (n : ℤ) (c : Fin 2) : MvPolynomial (Fin 4) ℤ :=
let v : ComponentRing := psiEval componentA n ⟨.X 0, .X 1⟩ ⟨.X 2, .X 3⟩
![v.re, v.im] c
ZInQKernel/Model/DivisionPolynomials/Defs.lean:124
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
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
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
ZInQKernel/Syntax/Recipes/PowerValue.lean:28
noncomputable def templateLibrary (I : Constructors E) (cstar ell T c3 : ℤ) : List ExPoly :=
[memberTemplate, rawAddTemplate, rawZTemplate, rawInverseXTemplate, log25Template, poleTemplate,
testGroupTemplate, slopeTemplate, heightTemplate, scalarTemplate I cstar, guardTemplate I T,
multiplyTemplate I cstar ell T, naturalTemplate I cstar ell T,
signedEncodeTemplate I cstar ell T, absTemplate, closeTemplate,
valueTestTemplate I cstar ell T, exceptionsTemplate] ++
(integerConstants c3).map (scalarTemplate I)
ZInQKernel/Syntax/Templates/Library.lean:25
noncomputable def iota (n : ℤ) : Fin 5 → ℚ := pointCode (n • genP0)
ZInQKernel/Model/Field/Codes.lean:27
noncomputable def powerValueT (a b c : ℤ) (w : Fin 79 → ℕ) : ℤ :=
templateValue powerTemplateCircuit fun i =>
if i < 3 then [a, b, c].getD i 0 else if h : i - 3 < 79 then (w ⟨i - 3, h⟩ : ℤ) else 0
ZInQKernel/Compiler/Translation/PowerValue.lean:24
def PowerValueSpec (π : ExPoly) (P : NatCircuit) : Prop :=
∀ (a b c : ℤ) (r : Fin 5 → ℚ), CodeRel π [iota a, iota b, iota c, r] ↔
∃ w : Fin (P.varCount - 3) → ℕ, r = iota (templateValue P (blockAssign P a b c w))
ZInQKernel/Compiler/Translation/Spec.lean:45
def powerTemplateCircuit : NatCircuit := powerTemplateConstruction.toCircuit 3
ZInQKernel/Compiler/Circuits/PowerTemplate.lean:31
Uses 6 · Used by 1
TheoremSemantics of the rational translation#✓
Assume the multiplication statement M in its all-input form: \(\mathrm{Rel}_{\mathtt{multiply}}(p,q,r)\iff\exists a,b\in\mathbb Z,\ p=\iota(a),\ q=\iota(b),\ r=\iota(ab)\) for all \(p,q,r\in\mathbb Q^5\). Let \(C\in\mathbb Z[X_0,\dots,X_{1305810}]\) be the natural precision polynomial, with inputs \(X_0,\dots,X_4\) in the order \((n,\kappa,a,l,j)\). Then for all \(E_0,\dots,E_4\in\mathbb Q^5\) (arbitrary rational \(5\)-tuples), $\(\mathrm{Rel}_{\mathtt{precision}}(E_0,\dots,E_4)\iff \exists\,\mathbf c\in\mathbb N^5:\ E_i=\iota(c_i)\ (0\le i\le4)\ \text{and}\ \exists\,\mathbf z\in\mathbb N^{1305806}:\ C(\mathbf c,\mathbf z)=0 .\)$
Thus the precision recipe has rational witnesses exactly at the codes \(\iota(c_0),\dots,\iota(c_4)\) of natural numbers \(c_0,\dots,c_4\) at which the natural polynomial has a natural zero. Together with equation (C.4) this is input C of the assembly lemma. The multiplication statement holds under the six-contact estimate, pole completeness and the twenty-two-prime pattern by the multiplication chapter.
Proof sketch. The semantics of the power-value recipe is the (PV) property of the power recipe used by \(\mathtt{precision}\). The precision recipe is the translation of the natural precision circuit \(\mathcal N\) in zero mode with natural constraints on its five inputs, and \(\mathcal N\) is well-formed with bound \(1305811\). Case 1 of the semantics of the model-evaluation translation gives: \(\mathrm{Rel}_{\mathtt{precision}}(E)\) iff \(E_i=\iota(\theta_i)\) and \(\mathcal N(\theta)=0\) for some \(\theta\) admissible for \(\mathcal N\) with \(\theta_0,\dots,\theta_4\in\mathbb N\). Every explicit variable and every block variable of \(\mathcal N\) is below \(1305811\), so \(\mathcal N(\theta)=C(\theta_0,\dots,\theta_{1305810})\). Given such \(\theta\), put \(c_i=\theta_i\) and let \(z_v=\theta_v\) when \(v\) is an explicit witness or a block variable, \(z_v=0\) otherwise; then \(\mathbf z\in\mathbb N^{1305806}\) and \(C(\mathbf c,\mathbf z)=\mathcal N(\theta)=0\). Conversely \(\theta=(\mathbf c,\mathbf z,0,0,\dots)\) is admissible. Replacing each private block of the parent by its private power-value call therefore preserves the full existential assignment, and only the final root is equated to the identity.
theorem precision_rel_iff (hI : I.psi = psiComponent) (hM : MultiplicationExact I cstar ell T)
(recipes : List ExPoly) (hrec : ∃ rs, getEx recipes 0 =
(Recipe.model powerValueRecipe).denote (templateLibrary I cstar ell T c3) rs)
(E : Fin 5 → Fin 5 → ℚ) :
((Recipe.model (precisionRecipe precisionCircuit c3)).denote
(templateLibrary I cstar ell T c3) recipes).Rel
(fun k : Fin 25 => E ⟨k / 5, by omega⟩ ⟨k % 5, by omega⟩) ↔
∃ c : Fin 5 → ℕ, (∀ i, E i = iota (c i)) ∧ ∃ z : Fin 1305806 → ℕ,
MvPolynomial.eval (fun i => (NatCircuit.natPoint 5 1305806 c z i : ℤ))
(precisionCircuit.poly powerTemplate) = 0
theorem precision_rel_iff_accepts_of (hI : I.psi = psiComponent)
(hM : MultiplicationExact I cstar ell T)
(hC4 : ∀ c : Fin 5 → ℕ, (∃ z : Fin 1305806 → ℕ,
MvPolynomial.eval (fun i => (NatCircuit.natPoint 5 1305806 c z i : ℤ))
(precisionCircuit.poly powerTemplate) = 0) ↔ Compiler.Precision.accepts c)
(recipes : List ExPoly) (hrec : ∃ rs, getEx recipes 0 =
(Recipe.model powerValueRecipe).denote (templateLibrary I cstar ell T c3) rs)
(E : Fin 5 → Fin 5 → ℚ) :
((Recipe.model (precisionRecipe precisionCircuit c3)).denote
(templateLibrary I cstar ell T c3) recipes).Rel
(fun k : Fin 25 => E ⟨k / 5, by omega⟩ ⟨k % 5, by omega⟩) ↔
∃ c : Fin 5 → ℕ, (∀ i, E i = iota (c i)) ∧ Compiler.Precision.accepts c
noncomputable def psiComponent (n : ℤ) (c : Fin 2) : MvPolynomial (Fin 4) ℤ :=
let v : ComponentRing := psiEval componentA n ⟨.X 0, .X 1⟩ ⟨.X 2, .X 3⟩
![v.re, v.im] c
ZInQKernel/Model/DivisionPolynomials/Defs.lean:124
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
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 getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
ZInQKernel/Syntax/Recipes/PowerValue.lean:28
noncomputable def templateLibrary (I : Constructors E) (cstar ell T c3 : ℤ) : List ExPoly :=
[memberTemplate, rawAddTemplate, rawZTemplate, rawInverseXTemplate, log25Template, poleTemplate,
testGroupTemplate, slopeTemplate, heightTemplate, scalarTemplate I cstar, guardTemplate I T,
multiplyTemplate I cstar ell T, naturalTemplate I cstar ell T,
signedEncodeTemplate I cstar ell T, absTemplate, closeTemplate,
valueTestTemplate I cstar ell T, exceptionsTemplate] ++
(integerConstants c3).map (scalarTemplate I)
ZInQKernel/Syntax/Templates/Library.lean:25
irreducible_def c3 : ℕ := code wrapper
ZInQKernel/Compiler/Universal/WrapperCode.lean:27
noncomputable def precisionRecipe (N : NatCircuit) (c3 : ℤ) : ModelRecipe :=
translate (integerConstants c3) N .zero true
(some (0, powerValueRecipe.variableCount - powerValueRecipe.parameterCount))
ZInQKernel/Syntax/Recipes/Precision.lean:27
def precisionCircuit : NatCircuit := precisionCircuitOf c3
ZInQKernel/Compiler/Universal/WrapperCode.lean:42
def natPoint (k m : ℕ) (c : Fin k → ℕ) (z : Fin m → ℕ) (i : ℕ) : ℕ :=
if h : i < k then c ⟨i, h⟩ else if h' : i - k < m then z ⟨i - k, h'⟩ else 0
ZInQKernel/Compiler/Circuits/Circuit.lean:64
def powerTemplate : ExPoly := ⟨3, 79, powerTemplatePoly⟩
ZInQKernel/Compiler/Circuits/PowerTemplate.lean:40
def accepts (c : Fin 5 → ℕ) : Prop :=
acceptsInt (dec (c 0)) (dec (c 1)) (dec (c 2)) (dec (c 3)) (dec (c 4))
ZInQKernel/Compiler/Precision/Relation.lean:44
Sources
Uses 9 · Used by 1 · Informal links 1
The specified polynomial
Five composition recipes assemble the value relation and the root; \(P_*\) is the polynomial of the root
recipe integers.
DefinitionThe outer composition recipes#✓
Five composition recipes assemble the ordinary-value relation; each is built with one allocation counter starting at its parameter count, fresh ranges first, then the calls in order. Write \(\mathbf X_a=(X_a,\dots,X_{a+4})\).
- \(\mathtt{close}\) (sum of squares), parameters \(N=\mathbf X_0\), \(K=\mathbf X_5\), \(t=X_{10}\). Fresh points \(A=\mathbf X_{11}\), \(L=\mathbf X_{16}\), \(J=\mathbf X_{21}\) and \(E_0,\dots,E_4=\mathbf X_{26},\mathbf X_{31},\dots,\mathbf X_{46}\). Calls: \(\mathtt{value.signed\_encode}[\Sigma_i,E_i]\) for \((\Sigma_0,\dots,\Sigma_4)=(N,K,A,L,J)\) (starts \(51+140654i\)); \(\mathtt{precision}[E_0,\dots,E_4]\) (start \(703321\)); \(\mathtt{value.close\_coordinates}[A,L,J,t]\) (start \(292890196157\)). \(11\) parameters, \(292890196199\) witnesses.
- \(\mathtt{main}\) (sum of squares), parameters \(N=\mathbf X_0\), \(t=X_5\). Fresh point \(K=\mathbf X_6\). Calls: \(\mathtt{close}[N,K,t]\) (start \(11\)) and \(\mathtt{value.test}[N,K,t]\) (start \(292890196210\)). \(6\) parameters, \(292890231486\) witnesses.
- \(\mathtt{value\_union}\) (product), parameters \(N=\mathbf X_0\), \(t=X_5\). Calls: \(\mathtt{value.exceptions}[N,t]\) (start \(6\)) and \(\mathtt{main}[N,t]\) (start \(412\)). \(6\) parameters, \(292890231892\) witnesses.
- \(\mathtt{value}\) (sum of squares), parameters \(N=\mathbf X_0\), \(t=X_5\). Calls: \(\mathtt{member}[N]\) (start \(6\)) and \(\mathtt{value\_union}[N,t]\) (start \(13\)). \(6\) parameters, \(292890231899\) witnesses.
- \(\mathtt{integers}\) (sum of squares), parameter \(t=X_0\). Fresh point \(N=\mathbf X_1\). Call: \(\mathtt{value}[N,t]\) (start \(6\)). \(1\) parameter, \(292890231904\) witnesses.
Thus, with call polynomials as in the semantics of recipes, $\([\![\mathtt{integers}]\!]=\mathtt{value}[X_1,\dots,X_5,X_0;6]^2,\qquad [\![\mathtt{value}]\!]=\mathtt{member}[\mathbf X_0;6]^2+\mathtt{value\_union}[\mathbf X_0,X_5;13]^2,\)$ $\([\![\mathtt{value\_union}]\!]=\mathtt{value.exceptions}[\mathbf X_0,X_5;6]\cdot\mathtt{main}[\mathbf X_0,X_5;412],\)$ and similarly for \(\mathtt{main}\) and \(\mathtt{close}\). The same coordinates of \(K\) occur in \(\mathtt{close}\) and \(\mathtt{value.test}\); the exceptional branch and the main branch have disjoint private blocks.
The starts and witness counts from the precision call on are those for a precision recipe with \(292{,}889{,}492{,}836\) witnesses, the bound of the precision recipe; in general each of them shifts with the witness count of the recipe called (for instance \(\mathtt{close}\) has \(703310+w+53\) witnesses when precision has \(w\)), so the displayed values are upper bounds.
This is a definition.
ZInQ.Syntax.closeRecipe · 16 lines
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
CompM.call (.template 13) (point L ++ point E3) 140654
CompM.call (.template 13) (point J ++ point E4) 140654
CompM.call (.recipe 1) (point E0 ++ point E1 ++ point E2 ++ point E3 ++ point E4) wPrec
CompM.call (.template 15) (point A ++ point L ++ point J ++ [10]) 53
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
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
structure CompositionRecipe where
/-- Sum of squares or product. -/
connective : Connective
/-- The parameter count. -/
parameterCount : ℕ
/-- The variable count. -/
variableCount : ℕ
/-- The calls. -/
calls : List RecipeCall
/-- Ranges `(start, length)` of fresh variables; they add no constraint. -/
fresh : List (ℕ × ℕ)
ZInQKernel/Syntax/Language/Nodes.lean:184
def run (k : Connective) (p : ℕ) (b : CompM Unit) : CompositionRecipe :=
let s := (b ⟨p, [], []⟩).2
⟨k, p, s.next, s.calls, s.fresh⟩
ZInQKernel/Syntax/Recipes/Outer.lean:55
def fresh (n : ℕ) : CompM ℕ := fun s => (s.next, ⟨s.next + n, s.calls, s.fresh ++ [(s.next, n)]⟩)
ZInQKernel/Syntax/Recipes/Outer.lean:48
def call (target : CallTarget) (args : List ℕ) (m : ℕ) : CompM Unit := fun s =>
((), ⟨s.next + m, s.calls ++ [⟨target, args, s.next⟩], s.fresh⟩)
ZInQKernel/Syntax/Recipes/Outer.lean:51
def point (a : ℕ) : List ℕ := List.range' a 5
ZInQKernel/Syntax/Recipes/Outer.lean:62
Uses 7 · Used by 10
DefinitionThe specified polynomial#✓
The specified polynomial is $\(P_*\in\mathbb Z[X_0,X_1,\dots,X_{292890231904}],\)$ the polynomial \([\![\mathtt{integers}]\!]\) of the root recipe of the construction, with every variable of index above \(292890231904\) replaced by \(0\) (by the witness accounting, no such variable occurs, so nothing is replaced). Unfolding the root, $\(P_*=\mathtt{value}[X_1,X_2,X_3,X_4,X_5,X_0;6]^2 ,\)$ where \(\mathtt{value}\) is the composition \(\mathtt{member}\) and \(\mathtt{value.exceptions}\times\mathtt{main}\), \(\mathtt{main}\) combines \(\mathtt{close}\) and \(\mathtt{value.test}\), and \(\mathtt{close}\) combines five signed encodings, the precision recipe and the coordinate window. Variable \(X_0\) is the external rational input; the code \((X_1,\dots,X_5)\) and all further variables are its rational witnesses.
\(P_*\) is defined in this blueprint by construction: every template, recipe, fixed constant and constructor is the term described in this chapter, and the natural precision circuit is the output of the compiler chapter. The manuscript's saved specification is compared with this construction by an external script and is not used in the proof. Its constants are kept symbolic: the polynomial is never expanded, and the constants \(c_*\), \(\ell\), \(T\), \(D\) and the program literal \(c_3\) occur only through their defining expressions.
This is a definition.
noncomputable def PstarNatOf : Poly := (getEx (specLib I cstar ell T c3 N) 6).poly
noncomputable def PstarOf : MvPolynomial (Fin 292890231905) ℤ :=
killCompl Fin.val_injective (PstarNatOf I cstar ell T c3 N)
noncomputable def Pstar : MvPolynomial (Fin 292890231905) ℤ :=
PstarOf specConstructors FixedConst.cstar.value FixedConst.ell.value FixedConst.T.value c3 N
abbrev Poly : Type := MvPolynomial ℕ ℤ
ZInQKernel/Syntax/Language/Basic.lean:25
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
noncomputable def specLib : List ExPoly :=
denoteRecipes (templateLibrary I cstar ell T c3) (specRecipes N c3)
ZInQKernel/Syntax/Recipes/Accounting.lean:275
noncomputable def PstarNatOf : Poly := (getEx (specLib I cstar ell T c3 N) 6).poly
ZInQKernel/Syntax/Recipes/Polynomial.lean:46
noncomputable def PstarOf : MvPolynomial (Fin 292890231905) ℤ :=
killCompl Fin.val_injective (PstarNatOf I cstar ell T c3 N)
ZInQKernel/Syntax/Recipes/Polynomial.lean:50
noncomputable def specConstructors : Constructors (FixedExpr FixedConst) :=
⟨FixedConst.fixedVal, psiComponent, guardPoly⟩
ZInQKernel/Syntax/Recipes/Polynomial.lean:35
inductive FixedConst
| P0 | W | Hproduct | Hmax | Ns | M | cstar | ell | F | D | G0 | E0 | R | Q | Bcm | Ccm
| Aheight | T
deriving DecidableEq, Repr
ZInQKernel/Syntax/Constants/Fixed.lean:149
Uses 2 · Used by 6
The witness counts follow from the template counts, the shape of the natural circuit and explicit arithmetic; the root has one input and \(292{,}890{,}231{,}904\) witnesses. In the variable format of the target statement, the rational zero projection of \(P_*\) is the set of \(q\) for which the value relation has a code.
TheoremWitness accounting of the specified polynomial#✓
The seven recipes have the following parameter counts, and at most the following witness and variable counts:
| Recipe | Parameters | Witnesses | Variables |
|---|---|---|---|
| power_value | 20 | 17,786,698 | 17,786,718 |
| precision | 25 | 292,889,492,836 | 292,889,492,861 |
| close | 11 | 292,890,196,199 | 292,890,196,210 |
| main | 6 | 292,890,231,486 | 292,890,231,492 |
| value_union | 6 | 292,890,231,892 | 292,890,231,898 |
| value | 6 | 292,890,231,899 | 292,890,231,905 |
| integers | 1 | 292,890,231,904 | 292,890,231,905 |
The row of power_value is exact, and so are the differences between consecutive rows from precision on; in particular integers has exactly \(739{,}069\) variables more than precision has witnesses.
Every variable occurring in the polynomial of a template or recipe has index below its variable count. In particular every variable of \([\![\mathtt{integers}]\!]\) is among \(X_0,\dots,X_{292890231904}\), so \(P_*\), which is \([\![\mathtt{integers}]\!]\) read in these variables, has input \(X_0\) and its witness variables among \(X_1,\dots,X_{292890231904}\), the variables allowed by the target statement, which need not all occur.
The manuscript states the table as exact counts, and the private blocks of every template and recipe as pairwise disjoint and disjoint from the variables used outside them. The exact counts follow in the same way from the exact node statistics. The variable format of the target needs neither; the relational statements of the compiler and assembly chapters prove the separation of blocks they use.
Proof sketch. For the composition recipes the witness count is the sum of the fresh ranges and the callee witness counts, read off the recipe definitions. For a model-evaluation translation it is \(3\) (generator) plus, for each explicit witness variable, \(5+140604\); for each constrained input, \(140604\); for each distinct nontrivial constant, \(5+1\); for each addition, multiplication and call node, \(5+6\), \(5+35134\) and \(5+17786698\). Inserting the template counts and the bounds of the circuit shape gives the table, through the witness-count arithmetic. The variable bounds are the witness-scope theorem applied to every template and recipe, by induction along the library and recipe order.
noncomputable def specRecipes : List Recipe :=
[.model powerValueRecipe, specPrecision N c3, specClose N c3, specMain N c3,
specValueUnion N c3, specValue N c3, specIntegers N c3]
noncomputable def specLib : List ExPoly :=
denoteRecipes (templateLibrary I cstar ell T c3) (specRecipes N c3)
theorem specLib_wf : ∀ τ ∈ specLib I cstar ell T c3 N, τ.WF
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
noncomputable def powerValueRecipe : ModelRecipe :=
translate powerConstants powerTemplateCircuit .value false none
ZInQKernel/Syntax/Recipes/PowerValue.lean:28
noncomputable def specPrecision : Recipe := .model (precisionRecipe N c3)
ZInQKernel/Syntax/Recipes/Accounting.lean:50
noncomputable def specClose : Recipe := .composition (closeRecipe (specPrecision N c3).witnessCount)
ZInQKernel/Syntax/Recipes/Accounting.lean:53
noncomputable def specMain : Recipe := .composition (mainRecipe (specClose N c3).witnessCount)
ZInQKernel/Syntax/Recipes/Accounting.lean:56
noncomputable def specValueUnion : Recipe :=
.composition (valueUnionRecipe (specMain N c3).witnessCount)
ZInQKernel/Syntax/Recipes/Accounting.lean:59
noncomputable def specValue : Recipe := .composition (valueRecipe (specValueUnion N c3).witnessCount)
ZInQKernel/Syntax/Recipes/Accounting.lean:63
noncomputable def specIntegers : Recipe :=
.composition (integersRecipe (specValue N c3).witnessCount)
ZInQKernel/Syntax/Recipes/Accounting.lean:66
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 denoteRecipes (templates : List ExPoly) (rs : List Recipe) : List ExPoly :=
rs.foldl (fun recipes ρ => recipes ++ [ρ.denote templates recipes]) []
ZInQKernel/Syntax/Language/Nodes.lean:325
noncomputable def templateLibrary (I : Constructors E) (cstar ell T c3 : ℤ) : List ExPoly :=
[memberTemplate, rawAddTemplate, rawZTemplate, rawInverseXTemplate, log25Template, poleTemplate,
testGroupTemplate, slopeTemplate, heightTemplate, scalarTemplate I cstar, guardTemplate I T,
multiplyTemplate I cstar ell T, naturalTemplate I cstar ell T,
signedEncodeTemplate I cstar ell T, absTemplate, closeTemplate,
valueTestTemplate I cstar ell T, exceptionsTemplate] ++
(integerConstants c3).map (scalarTemplate I)
ZInQKernel/Syntax/Templates/Library.lean:25
noncomputable def specRecipes : List Recipe :=
[.model powerValueRecipe, specPrecision N c3, specClose N c3, specMain N c3,
specValueUnion N c3, specValue N c3, specIntegers N c3]
ZInQKernel/Syntax/Recipes/Accounting.lean:70
noncomputable def specLib : List ExPoly :=
denoteRecipes (templateLibrary I cstar ell T c3) (specRecipes N c3)
ZInQKernel/Syntax/Recipes/Accounting.lean:275
Uses 8 · Used by 5
TheoremThe rational zero projection of the specified polynomial#✓
For every \(q\in\mathbb Q\) the following are equivalent:
- there is \(w=(w_1,\dots,w_{292890231904})\in\mathbb Q^{292890231904}\) with \(P_*(q,w_1,\dots,w_{292890231904})=0\);
- \(\mathrm{Rel}_{\mathtt{integers}}(q)\);
- there is \(x:\mathbb N\to\mathbb Q\) with \(x_0=q\) and \([\![\mathtt{integers}]\!]\,(x)=0\);
- there are \(N\in\mathbb Q^5\) and rational values of the witnesses of \(\mathtt{value}\) making \([\![\mathtt{value}]\!]\) vanish at \((N,q)\), that is, \(\mathrm{Rel}_{\mathtt{value}}(N,q)\) for some \(N\in\mathbb Q^5\).
Moreover \(P_*\) is \([\![\mathtt{integers}]\!]\) read in the variables indexed by \(\{0,\dots,292890231904\}\): \(\mathrm{rename}(\iota)\,P_*=[\![\mathtt{integers}]\!]\) for the inclusion \(\iota\) of the indices into \(\mathbb N\). Hence \(P_*\) has total degree at most that of \([\![\mathtt{integers}]\!]\) and the same coefficients, \(\mathrm{coeff}_d(P_*)=\mathrm{coeff}_{\iota_*d}([\![\mathtt{integers}]\!])\) for every exponent vector \(d\), and \(P_*(v)=[\![\mathtt{integers}]\!](\bar v)\) for every \(v\in\mathbb Q^{292890231905}\), where \(\bar v\) extends \(v\) by zeros.
So the rational zero projection of \(P_*\) to its first variable is \(\{q:\exists N,\ \mathrm{Rel}_{\mathtt{value}}(N,q)\}\), which the assembly chapter identifies with \(\mathbb Z\).
Proof sketch. By the witness accounting, \([\![\mathtt{integers}]\!]\) involves only \(X_0,\dots,X_{292890231904}\), so its value at \(x\) depends only on \(x_0,\dots,x_{292890231904}\) and equals \(P_*(x_0,\dots,x_{292890231904})\); this gives \(1\iff2\iff3\) (unused variables take arbitrary values, for instance \(0\)). For \(3\iff4\): \([\![\mathtt{integers}]\!]\) is the square of one call of \(\mathtt{value}\) with parameters \(X_1,\dots,X_5,X_0\) and block \([6,292890231905)\), which is disjoint from \(X_0,\dots,X_5\); apply the evaluation of a call and the compilation theorem.
theorem PstarOf_spec (hN : PrecisionShape N c3) :
rename Fin.val (PstarOf I cstar ell T c3 N) = PstarNatOf I cstar ell T c3 N ∧
(∀ d, (PstarOf I cstar ell T c3 N).coeff d =
(PstarNatOf I cstar ell T c3 N).coeff (d.mapDomain Fin.val)) ∧
(PstarOf I cstar ell T c3 N).totalDegree ≤ (PstarNatOf I cstar ell T c3 N).totalDegree ∧
∀ v : Fin 292890231905 → ℚ, eval₂ (Int.castRingHom ℚ) v (PstarOf I cstar ell T c3 N) =
ev (extendFin v) (PstarNatOf I cstar ell T c3 N)
theorem PstarOf_zero_projection (hN : PrecisionShape N c3) (q : ℚ) :
((∃ w : Fin 292890231904 → ℚ,
eval₂ (Int.castRingHom ℚ) (Fin.cons q w) (PstarOf I cstar ell T c3 N) = 0) ↔
(integersExPoly I cstar ell T c3 N).Rel (fun _ => q)) ∧
((integersExPoly I cstar ell T c3 N).Rel (fun _ => q) ↔
∃ x : ℕ → ℚ, x 0 = q ∧ ev x (PstarNatOf I cstar ell T c3 N) = 0) ∧
((∃ x : ℕ → ℚ, x 0 = q ∧ ev x (PstarNatOf I cstar ell T c3 N) = 0) ↔
∃ M : Fin 5 → ℚ, (valueExPoly I cstar ell T c3 N).Rel
(fun i => Fin.append M ![q] (Fin.cast (valueExPoly_params I cstar ell T c3 N) i)))
theorem specPstar_spec (hB : Compiler.NodeCheck.HaltingAddMulBound) :
MvPolynomial.rename Fin.val (specPstar c3) = PstarNat (precisionCircuitOf c3) c3 ∧
(∀ d, (specPstar c3).coeff d =
(PstarNat (precisionCircuitOf c3) c3).coeff (d.mapDomain Fin.val)) ∧
(specPstar c3).totalDegree ≤ (PstarNat (precisionCircuitOf c3) c3).totalDegree ∧
∀ v : Fin 292890231905 → ℚ, MvPolynomial.eval₂ (Int.castRingHom ℚ) v (specPstar c3) =
ev (extendFin v) (PstarNat (precisionCircuitOf c3) c3)
structure PrecisionShape (N : NatCircuit) (c3 : ℤ) : Prop where
inputCount : N.inputCount = 5
explicitVars_length : N.explicitVars.length ≤ 54056
inputs : 5 ≤ N.explicitVars.countP fun v => decide (IsInputVar 5 v)
adds : N.nodes.countP NatNode.isAdd ≤ 125327
muls : N.nodes.countP NatNode.isMul ≤ 98382
calls : N.nodes.countP NatNode.isCall ≤ 15845
consts : ∀ c ∈ N.nodes.filterMap nontrivialConst, c = c3 ∨ c = 2 ∨ c = 4 ∨ c = 1399
ZInQKernel/Syntax/Recipes/Precision.lean:46
noncomputable def PstarOf : MvPolynomial (Fin 292890231905) ℤ :=
killCompl Fin.val_injective (PstarNatOf I cstar ell T c3 N)
ZInQKernel/Syntax/Recipes/Polynomial.lean:50
noncomputable def PstarNatOf : Poly := (getEx (specLib I cstar ell T c3 N) 6).poly
ZInQKernel/Syntax/Recipes/Polynomial.lean:46
noncomputable def ev (x : ℕ → ℚ) : Poly →+* ℚ := eval₂Hom (Int.castRingHom ℚ) x
ZInQKernel/Syntax/Language/Basic.lean:30
def extendFin {N : ℕ} (v : Fin N → ℚ) (i : ℕ) : ℚ := if h : i < N then v ⟨i, h⟩ else 0
ZInQKernel/Syntax/Language/Basic.lean:351
noncomputable def integersExPoly : ExPoly := getEx (specLib I cstar ell T c3 N) 6
ZInQKernel/Syntax/Recipes/Polynomial.lean:57
noncomputable def valueExPoly : ExPoly := getEx (specLib I cstar ell T c3 N) 5
ZInQKernel/Syntax/Recipes/Polynomial.lean:54
theorem valueExPoly_params : (valueExPoly I cstar ell T c3 N).params = 6
ZInQKernel/Syntax/Recipes/Polynomial.lean:59
def HaltingAddMulBound : Prop :=
countKind .add haltingCircuit.nodes ≤ 125307 ∧ countKind .mul haltingCircuit.nodes ≤ 98361
ZInQKernel/Compiler/NodeBound/Defs.lean:19
noncomputable def specPstar : MvPolynomial (Fin 292890231905) ℤ := Pstar (precisionCircuitOf c3) c3
ZInQKernel/Syntax/Recipes/Literal.lean:93
noncomputable def PstarNat : Poly :=
PstarNatOf specConstructors FixedConst.cstar.value FixedConst.ell.value FixedConst.T.value c3 N
ZInQKernel/Syntax/Recipes/Polynomial.lean:237
def precisionCircuitOf (code : ℤ) : NatCircuit := specialize haltingCircuit code
ZInQKernel/Compiler/Universal/PrecisionCircuit.lean:33
Uses 5 · Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.