Syntax heights and the final comparison
The specified polynomial is a compact syntax, not an expanded monomial list: node lists share nodes, templates call earlier templates, and three constructors insert huge polynomials without expanding them. Its size is bounded by an induction on this syntax.
Heights and majorants
Variables have height zero, constants and fixed nodes height one, an operation or constructor one more than its highest argument, and a call one more than the callee's height plus its highest argument. Recipes add three levels for a substituted callee in a model-evaluation recipe, then two for the final sum of squares; composition recipes only rename variables, so they add two levels for a sum of squares and one for a product.
DefinitionSyntax heights#✓
Nodes and templates. For a template \(\tau\) with node list \(n_0,\dots,n_{k-1}\) in a library whose calls refer to earlier templates, the height \(h(n_j)\in\mathbb N\) is defined in node order:
- \(h(\mathrm{var}\ i)=0\);
- \(h(\mathrm{const}\ c)=1\) and \(h(\mathrm{fixed}\ e)=1\);
- \(h(\mathrm{add}\ j\ j')=h(\mathrm{mul}\ j\ j')=1+\max(h(n_j),h(n_{j'}))\);
- \(h(\mathrm{psi}\ e\ (a_0,\dots,a_3)\ c)=1+\max_ih(n_{a_i})\) and \(h(\mathrm{guard}\ e\ (a_1,\dots,a_{15}))=1+\max_ih(n_{a_i})\);
- \(h(\mathrm{call}\ \tau'\ (a_0,\dots,a_{p-1})\ w)=1+H(\tau')+\max\bigl(0,\max_ih(n_{a_i})\bigr)\).
The intrinsic height of \(\tau\) is \(H(\tau)=h(n_{\mathrm{root}})\).
Recipes. For a model-evaluation recipe \(\rho\) whose calls have callees \(\kappa\) (the natural, raw-addition, multiplication and fixed-scalar templates and the power recipe that actually occur), $\(H(\rho)=\max\Bigl(4,\ \max_\kappa\bigl(H(\kappa)+3\bigr)\Bigr)+2 .\)$ For a composition recipe with callees \(\kappa_1,\dots,\kappa_k\), \(H(\rho)=\max_iH(\kappa_i)+2\) for a sum of squares and \(H(\rho)=\max_iH(\kappa_i)+1\) for a product.
Majorant. For an integer \(B\ge2\), an integer polynomial \(P\) satisfies the height-\(h\) majorant, written \(\mathrm{Maj}_B(h,P)\), if $\(\deg P\le1\text{ and }\|P\|_1\le1\quad(h=0),\qquad \deg P\le B^{8h}\text{ and }\|P\|_1\le2^{B^{8h}}\quad(h\ge1).\)$
This is a definition. The height is a majorant for the compact syntax, not the depth of an expanded expression; it deliberately overestimates (shared nodes and unused nodes are counted). For the model-evaluation wrappers the safe value four bounds the generator equations and root differences, as in the manuscript, rather than the literal height two of the companion proof.
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
def nodeHeight (lib hs : List ℕ) : Node E → ℕ
| .var _ => 0
| .const _ => 1
| .fixed _ => 1
| .add j k => 1 + max (hs.getD j 0) (hs.getD k 0)
| .mul j k => 1 + max (hs.getD j 0) (hs.getD k 0)
| .psi _ a _ => 1 + listMax (List.ofFn fun i => hs.getD (a i) 0)
| .guard _ a => 1 + listMax (List.ofFn fun i => hs.getD (a i) 0)
| .call t args _ => 1 + lib.getD t 0 + listMax (args.map fun j => hs.getD j 0)
def nodeHeights (lib : List ℕ) (nodes : List (Node E)) : List ℕ :=
nodes.foldl (fun hs n => hs ++ [nodeHeight lib hs n]) []
def l1 (f : MvPolynomial σ ℤ) : ℕ := ∑ d ∈ f.support, (f.coeff d).natAbs
ZInQKernel/Syntax/Language/Size.lean:20
inductive Node (E : Type)
/-- The constant `c`. -/
| const (c : ℤ)
/-- The local variable `X_i`. -/
| var (i : ℕ)
/-- The sum of nodes `j` and `k`. -/
| add (j k : ℕ)
/-- The product of nodes `j` and `k`. -/
| mul (j k : ℕ)
/-- The call of template `t` on the parameter nodes `args` with witness start `w`. -/
| call (t : ℕ) (args : List ℕ) (w : ℕ)
/-- The constant `val(e)`. -/
⋯
ZInQKernel/Syntax/Language/Nodes.lean:38
def listMax (l : List ℕ) : ℕ := l.foldr max 0
ZInQKernel/Size/Majorants/Height.lean:33
def nodeHeight (lib hs : List ℕ) : Node E → ℕ
| .var _ => 0
| .const _ => 1
| .fixed _ => 1
| .add j k => 1 + max (hs.getD j 0) (hs.getD k 0)
| .mul j k => 1 + max (hs.getD j 0) (hs.getD k 0)
| .psi _ a _ => 1 + listMax (List.ofFn fun i => hs.getD (a i) 0)
| .guard _ a => 1 + listMax (List.ofFn fun i => hs.getD (a i) 0)
| .call t args _ => 1 + lib.getD t 0 + listMax (args.map fun j => hs.getD j 0)
ZInQKernel/Size/Majorants/Height.lean:51
Uses 2 · Used by 5
At height \(h\ge1\) a polynomial has degree and logarithmic norm at most \(B^{8h}\), provided \(B\ge2^{20}\) exceeds every occurring constant, constructor index and guard cutoff. The six closure rules (operations, substitution, constructors, renaming, sums of squares and products) carry this majorant through templates and recipes.
TheoremClosure rules for the height majorant#✓
Let \(B\ge2^{20}\) be an integer and write \(\mathrm{Maj}(h,P)\) for \(\mathrm{Maj}_B(h,P)\).
- Monotonicity and atoms. \(\mathrm{Maj}(h,P)\) and \(h\le h'\) imply \(\mathrm{Maj}(h',P)\). Every variable satisfies \(\mathrm{Maj}(0,X_i)\), and every integer constant \(c\) with \(|c|\le2^{B^8}\) satisfies \(\mathrm{Maj}(1,c)\).
- Operations. \(\mathrm{Maj}(h_1,P)\) and \(\mathrm{Maj}(h_2,Q)\) imply \(\mathrm{Maj}(1+\max(h_1,h_2),P+Q)\) and \(\mathrm{Maj}(1+\max(h_1,h_2),PQ)\).
- Substitution. If \(\mathrm{Maj}(H,P)\) and \(\mathrm{Maj}(k,Q_i)\) for every \(i\) such that \(X_i\) occurs in \(P\), then \(\mathrm{Maj}(H+k+1,P(Q))\).
- Constructors. If \(\deg C\le B^4\), \(\|C\|_1\le2^{B^8}\) and \(\mathrm{Maj}(k,Q_i)\) for all arguments, then \(\mathrm{Maj}(k+1,C(Q))\).
- Renaming. \(\mathrm{Maj}(h,P)\) implies \(\mathrm{Maj}(h,P(Y_\sigma))\) for every map \(\sigma\) of variables.
- Sums of squares. If \(1\le m\le B\) and \(\mathrm{Maj}(h,c_i)\) for \(i=1,\dots,m\), then \(\mathrm{Maj}(h+2,\sum_ic_i^2)\).
- Products. If \(1\le m\le B\) and \(\mathrm{Maj}(h,c_i)\) for \(i=1,\dots,m\), then \(\mathrm{Maj}(h+1,\prod_ic_i)\).
Proof sketch. Throughout, \(B^{8h}\ge B\ge2^{20}\) for \(h\ge1\), and the height-zero case has norm at most \(1\). (1) Degrees: \(\max\le B^{8m}\) and \(2B^{8m}\le B^{8m+8}\) for \(m=\max(h_1,h_2)\) (for \(m=0\), \(\deg\le2\le B^8\)). Norms: \(\|P+Q\|_1\le2\cdot2^{B^{8m}}\) and \(\|PQ\|_1\le2^{2B^{8m}}\), both at most \(2^{B^{8m+8}}\). (2) By the substitution bounds with \(d=B^{8k}\) (or \(1\)) and \(M=2^{B^{8k}}\) (or \(1\) when \(k=0\)): \(\deg\le B^{8H}B^{8k}\le B^{8(H+k+1)}\) and \(\log_2\|P(Q)\|_1\le B^{8H}+B^{8H}B^{8k}\le B^{8(H+k+1)}\); for \(k=0\) simply \(\|P(Q)\|_1\le\|P\|_1\). (3) Likewise \(\deg\le B^4B^{8k}\le B^{8k+8}\) and \(\log_2\|C(Q)\|_1\le B^8+B^4B^{8k}\le B^{8k+8}\) for \(k\ge1\); for \(k=0\) the arguments have norm at most \(1\) and \(\log_2\|C(Q)\|_1\le B^8\). (4) By the renaming bound. (5) \(\deg\le2B^{8h}\) and \(\|\sum c_i^2\|_1\le m\,2^{2B^{8h}}\le2^{B+2B^{8h}}\le2^{B^{8h+16}}\). (6) \(\deg\le mB^{8h}\le B^{8h+8}\) and \(\|\prod c_i\|_1\le2^{mB^{8h}}\le2^{B^{8h+8}}\) (for \(h=0\): degree at most \(m\le B^8\), norm at most \(1\)).
These are the manuscript's rules: positive height \(h\) gives degree and logarithmic norm at most \(B^{8h}\); a call charges one level beyond the callee and argument heights; and a renaming retains the callee's height.
theorem mono {h h' : ℕ} {P : MvPolynomial σ ℤ} (hP : Maj B h P) (hh : h ≤ h') (hB : 1 ≤ B) :
Maj B h' P
theorem X (i : σ) : Maj B 0 (X i : MvPolynomial σ ℤ)
theorem C {c : ℤ} (hc : c.natAbs ≤ 2 ^ B ^ 8) : Maj B 1 (MvPolynomial.C c : MvPolynomial σ ℤ)
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
Uses 3 · Used by 3
TheoremTemplates satisfy the height majorant#✓
Let \(B\ge2^{20}\) and let \(L\) be a template library, each call referring to an earlier template, such that, in every template of \(L\):
- every node \(\mathrm{const}\ c\) has \(|c|\le B-1\);
- every node \(\mathrm{fixed}\ e\) has \(|\mathrm{val}(e)|\le B-1\);
- every node \(\mathrm{psi}\ e\ a\ c\) has \(|\mathrm{val}(e)|+1\le B\);
- every node \(\mathrm{guard}\ e\ a\) has \(0\le\mathrm{val}(e)\le B-1\).
Suppose moreover that the constructors satisfy the uniform bounds at \(B\): \(\deg\Psi_{n,c}\le B^4\) and \(\|\Psi_{n,c}\|_1\le2^{B^8}\) whenever \(|n|+1\le B\), and \(\deg G_T\le B^4\) and \(\|G_T\|_1\le2^{B^8}\) whenever \(0\le T\le B-1\). (The constructors of the specification satisfy them at every \(B\ge2^{20}\).)
Then for every template \(\tau\) of \(L\) and every node \(n_j\) of \(\tau\), \(\mathrm{Maj}_B\bigl(h(n_j),[\![n_j]\!]\bigr)\); in particular \(\mathrm{Maj}_B\bigl(H(\tau),[\![\tau]\!]\bigr)\).
Proof sketch. Induction over the library in stored order and, within a template, over the nodes in stored order. Variables: rule (0). Constants and fixed nodes: rule (0), since \(|c|\le B\le2^{B^8}\). Additions and multiplications: rule (1). Constructor nodes: the hypothesis on the constructors gives \(\deg\le B^4\) and \(\|\cdot\|_1\le2^{B^8}\) for \(\Psi_{\mathrm{val}(e),c}\) and \(G_{\mathrm{val}(e)}\); apply rule (3) with \(k\) the maximum argument height. Calls: the call polynomial is \([\![\tau']\!]\) with parameters replaced by the argument polynomials (height at most \(k=\max(0,\max_ih(n_{a_i}))\)) and witnesses by fresh variables (height \(0\le k\)); the induction hypothesis for the earlier template \(\tau'\) gives \(\mathrm{Maj}_B(H(\tau'),[\![\tau']\!])\), and rule (2) gives \(\mathrm{Maj}_B(H(\tau')+k+1,\cdot)\). The values \(\mathrm{val}(e)\) enter only through the four hypotheses and are never computed.
structure ConstructorBounds (I : Constructors E) (B : ℕ) : Prop where
psi : ∀ n : ℤ, n.natAbs + 1 ≤ B → ∀ c,
(I.psi n c).totalDegree ≤ B ^ 4 ∧ l1 (I.psi n c) ≤ 2 ^ B ^ 8
guard : ∀ T : ℤ, 0 ≤ T → T.natAbs + 1 ≤ B →
(I.guard T).totalDegree ≤ B ^ 4 ∧ l1 (I.guard T) ≤ 2 ^ B ^ 8
def NodeAdmissible (I : Constructors E) (B : ℕ) : Node E → Prop
| .const c => c.natAbs + 1 ≤ B
| .fixed e => (I.val e).natAbs + 1 ≤ B
| .psi e _ _ => (I.val e).natAbs + 1 ≤ B
| .guard e _ => 0 ≤ I.val e ∧ (I.val e).natAbs + 1 ≤ B
| _ => True
theorem nodes_majorant (hB : 2 ^ 20 ≤ B) (hI : ConstructorBounds I B) {lib : List ExPoly}
{lH : List ℕ} (hlib : ∀ t, Maj B (lH.getD t 0) (getEx lib t).poly) (nodes : List (Node E))
(hadm : ∀ n ∈ nodes, NodeAdmissible I B n) :
∀ j, Maj B ((nodeHeights lH nodes).getD j 0) (getPoly (denoteNodes I lib nodes) j)
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 l1 (f : MvPolynomial σ ℤ) : ℕ := ∑ d ∈ f.support, (f.coeff d).natAbs
ZInQKernel/Syntax/Language/Size.lean:20
inductive Node (E : Type)
/-- The constant `c`. -/
| const (c : ℤ)
/-- The local variable `X_i`. -/
| var (i : ℕ)
/-- The sum of nodes `j` and `k`. -/
| add (j k : ℕ)
/-- The product of nodes `j` and `k`. -/
| mul (j k : ℕ)
/-- The call of template `t` on the parameter nodes `args` with witness start `w`. -/
| call (t : ℕ) (args : List ℕ) (w : ℕ)
/-- The constant `val(e)`. -/
⋯
ZInQKernel/Syntax/Language/Nodes.lean:38
structure ConstructorBounds (I : Constructors E) (B : ℕ) : Prop where
psi : ∀ n : ℤ, n.natAbs + 1 ≤ B → ∀ c,
(I.psi n c).totalDegree ≤ B ^ 4 ∧ l1 (I.psi n c) ≤ 2 ^ B ^ 8
guard : ∀ T : ℤ, 0 ≤ T → T.natAbs + 1 ≤ B →
(I.guard T).totalDegree ≤ B ^ 4 ∧ l1 (I.guard T) ≤ 2 ^ B ^ 8
ZInQKernel/Size/Majorants/NodeMajorant.lean:28
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
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
def NodeAdmissible (I : Constructors E) (B : ℕ) : Node E → Prop
| .const c => c.natAbs + 1 ≤ B
| .fixed e => (I.val e).natAbs + 1 ≤ B
| .psi e _ _ => (I.val e).natAbs + 1 ≤ B
| .guard e _ => 0 ≤ I.val e ∧ (I.val e).natAbs + 1 ≤ B
| _ => True
ZInQKernel/Size/Majorants/NodeMajorant.lean:37
def nodeHeights (lib : List ℕ) (nodes : List (Node E)) : List ℕ :=
nodes.foldl (fun hs n => hs ++ [nodeHeight lib hs n]) []
ZInQKernel/Size/Majorants/Height.lean:62
noncomputable def getPoly (vals : List Poly) (j : ℕ) : Poly := vals.getD j 0
ZInQKernel/Syntax/Language/Nodes.lean:71
noncomputable def denoteNodes (I : Constructors E) (lib : List ExPoly) (nodes : List (Node E)) :
List Poly :=
nodes.foldl (fun vals n => vals ++ [n.denote I lib vals]) []
ZInQKernel/Syntax/Language/Nodes.lean:96
Uses 4 · Used by 2
TheoremRecipes satisfy the height majorant#✓
Let \(B\ge2^{20}\).
- Let \(\rho\) be a model-evaluation recipe with at most \(B\) constraints, and suppose every callee \(\kappa\) occurring in its calls satisfies \(\mathrm{Maj}_B(h_\kappa,[\![\kappa]\!])\) with \(h_\kappa\ge1\). Then \(\mathrm{Maj}_B\bigl(\max(4,\max_\kappa(h_\kappa+3))+2,\ [\![\rho]\!]\bigr)\).
- Let \(\rho\) be a composition recipe with \(m\) calls, \(1\le m\le B\), whose callees satisfy \(\mathrm{Maj}_B(h_i,[\![\kappa_i]\!])\). Then \(\mathrm{Maj}_B(\max_ih_i+2,[\![\rho]\!])\) if \(\rho\) is a sum of squares and \(\mathrm{Maj}_B(\max_ih_i+1,[\![\rho]\!])\) if it is a product.
Proof sketch. (1) The constraints are the three generator equations \(8X_{g_0}-1641\), \(4X_{g_1}+15465\), \(32X_{g_2}-87483\), the calls, and the five root differences. Every point reference is a variable, a constant \(0\), \(1\) or \(-145\), or the negative of a variable, so each argument polynomial has degree at most \(1\) and norm at most \(145\), and satisfies \(\mathrm{Maj}_B(2,\cdot)\). A call is a substitution of such arguments (and fresh variables) into \([\![\kappa]\!]\), so it satisfies \(\mathrm{Maj}_B(h_\kappa+3,\cdot)\) by rule (2). The generator equations and root differences have degree at most \(1\) and norm at most \(87515\), so they satisfy \(\mathrm{Maj}_B(4,\cdot)\). By monotonicity every constraint satisfies the majorant at \(\max(4,\max_\kappa(h_\kappa+3))\), and rule (5) for the sum of at most \(B\) squares adds two. (2) The arguments of every call are coordinate variables, so each constraint is a renaming of \([\![\kappa_i]\!]\) followed by moving witnesses to fresh variables, again a renaming: rule (4) keeps \(h_i\); then rule (5) or rule (6).
The manuscript calls the renaming case the reason why composition calls retain the callee's height, and charges the model wrappers the safe height four.
theorem model_majorant (hB : 2 ^ 20 ≤ B) (templates recipes : List ExPoly) (tH rH : List ℕ)
(r : ModelRecipe) (hlen : (r.conjuncts templates recipes).length ≤ B)
(hsrc : ∀ row ∈ r.sources, row.2.isSome →
Maj B (tH.getD r.natural 0) (getEx templates r.natural).poly)
(hconst : ∀ d ∈ r.constants, Maj B (tH.getD d.1 0) (getEx templates d.1).poly)
(hops : ∀ op ∈ r.operations, Maj B (opHeight tH rH r op) (opCallee templates recipes r op).poly) :
Maj B (recipeHeight tH rH (.model r)) ((Recipe.model r).denote templates recipes).poly
theorem composition_majorant (hB : 2 ^ 20 ≤ B) (templates recipes : List ExPoly)
(tH rH : List ℕ) (r : CompositionRecipe) (hlen : r.calls.length ≤ B)
(hcall : ∀ c ∈ r.calls,
Maj B (callTargetHeight tH rH c.target) (c.target.resolve templates recipes).poly) :
Maj B (recipeHeight tH rH (.composition r))
((Recipe.composition r).denote templates recipes).poly
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
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 Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
def opHeight (tH rH : List ℕ) (r : ModelRecipe) : Operation → ℕ
| .add .. => tH.getD r.addition 0
| .mul .. => tH.getD r.multiplication 0
| .power .. => match r.power with
| some i => rH.getD i 0
| none => 0
ZInQKernel/Size/Majorants/RecipeMajorant.lean:95
noncomputable def opCallee (templates recipes : List ExPoly) (r : ModelRecipe) :
Operation → ExPoly
| .add .. => getEx templates r.addition
| .mul .. => getEx templates r.multiplication
| .power .. => match r.power with
| some i => getEx recipes i
| none => ExPoly.empty
ZInQKernel/Size/Majorants/RecipeMajorant.lean:86
def recipeHeight (tH rH : List ℕ) : Recipe → ℕ
| .model r => max 4 (listMax ((modelCalleeHeights tH rH r).map (· + 3))) + 2
| .composition r =>
listMax (r.calls.map fun c => callTargetHeight tH rH c.target) +
match r.connective with
| .sumSq => 2
| .prod => 1
ZInQKernel/Size/Majorants/Height.lean:117
inductive Recipe
/-- A composition recipe. -/
| composition (r : CompositionRecipe)
/-- A model-evaluation recipe. -/
| model (r : ModelRecipe)
ZInQKernel/Syntax/Language/Nodes.lean:231
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 callTargetHeight (tH rH : List ℕ) : CallTarget → ℕ
| .template i => tH.getD i 0
| .recipe i => rH.getD i 0
ZInQKernel/Size/Majorants/Height.lean:110
Uses 4 · Used by 1
The specified library
One traversal of the constructed library computes the twenty-three template heights and checks the constants and constructor indices that occur. The recipe rules then give the seven recipe heights \(228,233,235,251,252,254,256\), using the constraint counts from the shape of the natural circuit.
TheoremTemplate heights#✓
Let \(B\ge2^{20}\), and suppose that the constructors satisfy the uniform bounds at \(B\), that every index \(n\) of a division-polynomial constructor of the library satisfies \(|n|+1\le B\), and that \(|\ell|+1\le B\) and \(0\le T\), \(T+1\le B\). Then the polynomial of every template of the constructed library has a majorant of order \(B\) at the following height:
| Template | Height | Template | Height |
|---|---|---|---|
| member | 18 | multiply.guard | 4 |
| raw_add | 21 | multiply | 214 |
| raw_z | 12 | natural | 223 |
| raw_inverse_x | 12 | value.signed_encode | 230 |
| log25 | 25 | value.abs | 9 |
| pole | 24 | value.close_coordinates | 34 |
| test_group | 79 | value.test | 249 |
| slope | 169 | value.exceptions | 43 |
| height_certificate | 207 | scalar.integer_constant_\(k\) (\(k=0,\dots,4\)) | 17 |
| multiply.scalar | 17 |
The division-polynomial constructors of the library occur only in the fixed-scalar templates \(S_\varepsilon\), with indices \(\varepsilon\), \(\varepsilon+1\), \(\varepsilon-1\) and \(2\varepsilon\) for \(\varepsilon\in\{c_*,4,2,3,c_3,1399\}\); the guard constructor occurs at \(T\), and the fixed constant \(\ell\) only in multiply. Every other constant of the library is an explicit integer literal and needs no hypothesis.
The manuscript states the table for the intrinsic heights of the node lists of the saved specification, with \(173\) constant nodes below \(2^{69}\) and \(50\) constructor nodes. The templates here are explicit constructions without node lists, so the statement is made for their polynomials.
Proof sketch. Apply the majorant rules to each template in library order, along its construction, with the bounds of the templates it calls and the constructor bounds. Each literal constant \(c\) is bounded as \(|c|\le2^{2^k}\) for a small explicit \(k\), and \(B\ge2^{20}\) absorbs these bounds; no fixed value is computed. The construction gives much smaller heights, at most \(8\) (\(1\) for the templates without calls, \(6\) for multiply); the tabulated heights follow by monotonicity.
def templateHeightTable : List ℕ :=
[18, 21, 12, 12, 25, 24, 79, 169, 207, 17, 4, 214, 223, 230, 9, 34, 249, 43, 17, 17, 17, 17, 17]
structure LibraryAdmissible (B : ℕ) (I : Constructors E) (cstar ell T c3 : ℤ) : Prop where
two_pow_le : 2 ^ 20 ≤ B
constructors : ConstructorBounds I B
psi : ∀ n ∈ psiIndices cstar c3, n.natAbs + 1 ≤ B
fixed : ell.natAbs + 1 ≤ B
guard : 0 ≤ T ∧ T.natAbs + 1 ≤ B
theorem templateLibrary_maj {I : Constructors E} {cstar ell T c3 : ℤ}
(h : LibraryAdmissible B I cstar ell T c3) :
∀ i < 23, Maj B (templateHeightTable.getD i 0) (getEx (templateLibrary I cstar ell T c3) i).poly
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 ConstructorBounds (I : Constructors E) (B : ℕ) : Prop where
psi : ∀ n : ℤ, n.natAbs + 1 ≤ B → ∀ c,
(I.psi n c).totalDegree ≤ B ^ 4 ∧ l1 (I.psi n c) ≤ 2 ^ B ^ 8
guard : ∀ T : ℤ, 0 ≤ T → T.natAbs + 1 ≤ B →
(I.guard T).totalDegree ≤ B ^ 4 ∧ l1 (I.guard T) ≤ 2 ^ B ^ 8
ZInQKernel/Size/Majorants/NodeMajorant.lean:28
def psiIndices (cstar c3 : ℤ) : List ℤ :=
(cstar :: integerConstants c3).flatMap fun ε => [ε, ε + 1, ε + -1, 2 * ε]
ZInQKernel/Size/Majorants/TemplateHeights.lean:46
structure LibraryAdmissible (B : ℕ) (I : Constructors E) (cstar ell T c3 : ℤ) : Prop where
two_pow_le : 2 ^ 20 ≤ B
constructors : ConstructorBounds I B
psi : ∀ n ∈ psiIndices cstar c3, n.natAbs + 1 ≤ B
fixed : ell.natAbs + 1 ≤ B
guard : 0 ≤ T ∧ T.natAbs + 1 ≤ B
ZInQKernel/Size/Majorants/TemplateHeights.lean:50
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
def templateHeightTable : List ℕ :=
[18, 21, 12, 12, 25, 24, 79, 169, 207, 17, 4, 214, 223, 230, 9, 34, 249, 43, 17, 17, 17, 17, 17]
ZInQKernel/Size/Majorants/TemplateHeights.lean:37
noncomputable def getEx (lib : List ExPoly) (t : ℕ) : ExPoly := lib.getD t ExPoly.empty
ZInQKernel/Syntax/Language/Nodes.lean:74
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
Uses 4 · Used by 2
TheoremRecipe heights#✓
Let \(B\) satisfy the hypotheses of the template heights: \(B\ge2^{20}\), the constructors satisfy the uniform bounds at \(B\), every index \(n\) of a division-polynomial constructor of the library satisfies \(|n|+1\le B\), \(|\ell|+1\le B\), and \(0\le T\), \(T+1\le B\). Let the natural precision circuit have the shape of the compiler chapter, in the form of upper bounds: five inputs, at most \(54{,}056\) explicit variables of which at least five are inputs, at most \(125{,}327\) additions, \(98{,}382\) multiplications and \(15{,}845\) calls, and constants among \(0,1,-1,c_3,2,4,1399\). Then $\(\mathrm{Maj}_B(228,[\![\mathtt{power\_value}]\!]),\quad\mathrm{Maj}_B(233,[\![\mathtt{precision}]\!]),\quad \mathrm{Maj}_B(235,[\![\mathtt{close}]\!]),\quad\mathrm{Maj}_B(251,[\![\mathtt{main}]\!]),\)$ $\(\mathrm{Maj}_B(252,[\![\mathtt{value\_union}]\!]),\quad\mathrm{Maj}_B(254,[\![\mathtt{value}]\!]),\quad \mathrm{Maj}_B(256,[\![\mathtt{integers}]\!]).\)$
Proof sketch. By the template majorant and the template heights (with monotonicity), every template satisfies the majorant at its tabulated height. Then apply the recipe rules in recipe order.
- \(\mathtt{power\_value}\) has \(3+79+3+196+190+5=476\) constraints (generator equations, natural rows for the \(79\) witnesses, three constant definitions, \(196\) additions, \(190\) multiplications, root differences); its callees are \(\mathtt{natural}\) (\(223\)), \(\mathtt{raw\_add}\) (\(21\)), \(\mathtt{multiply}\) (\(214\)) and three fixed-scalar templates (\(17\)): height \(\max(4,223+3)+2=228\).
- \(\mathtt{precision}\) has at most \(3+54056+4+125327+98382+15845+5=293622\le2^{20}\) constraints; its callees add the power recipe (\(228\)): height \(228+3+2=233\).
- \(\mathtt{close}\) (sum of squares, \(7\) calls: five signed encodings (\(230\)), the precision recipe (\(233\)), the coordinate window (\(34\))): \(233+2=235\).
- \(\mathtt{main}\) (sum of squares, \(\mathtt{close}\) and \(\mathtt{value.test}\) (\(249\))): \(249+2=251\).
- \(\mathtt{value\_union}\) (product, \(\mathtt{value.exceptions}\) (\(43\)) and \(\mathtt{main}\)): \(251+1=252\).
- \(\mathtt{value}\) (sum of squares, \(\mathtt{member}\) (\(18\)) and \(\mathtt{value\_union}\)): \(252+2=254\).
- \(\mathtt{integers}\) (sum of squares, one call of \(\mathtt{value}\)): \(254+2=256\).
All constraint counts are at most \(2^{20}\le B\). The counts for the two model-evaluation recipes come from the translation and the shape of the natural circuit.
theorem recipe_heights (h : LibraryAdmissible B I cstar ell T c3) (hN : PrecisionShape N c3) :
Maj B 228 (getEx (specLib I cstar ell T c3 N) 0).poly ∧
Maj B 233 (getEx (specLib I cstar ell T c3 N) 1).poly ∧
Maj B 235 (getEx (specLib I cstar ell T c3 N) 2).poly ∧
Maj B 251 (getEx (specLib I cstar ell T c3 N) 3).poly ∧
Maj B 252 (getEx (specLib I cstar ell T c3 N) 4).poly ∧
Maj B 254 (getEx (specLib I cstar ell T c3 N) 5).poly ∧
Maj B 256 (getEx (specLib I cstar ell T c3 N) 6).poly
structure LibraryAdmissible (B : ℕ) (I : Constructors E) (cstar ell T c3 : ℤ) : Prop where
two_pow_le : 2 ^ 20 ≤ B
constructors : ConstructorBounds I B
psi : ∀ n ∈ psiIndices cstar c3, n.natAbs + 1 ≤ B
fixed : ell.natAbs + 1 ≤ B
guard : 0 ≤ T ∧ T.natAbs + 1 ≤ B
ZInQKernel/Size/Majorants/TemplateHeights.lean:50
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
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
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
Uses 11 · Used by 1
The cutoff \(B=T+1\) is admissible: every occurring constant and index is far below \(D\le T\). The root height \(256\) gives degree at most \((T+1)^{2048}\) and coefficients at most \(2^{(T+1)^{2048}}\).
TheoremThe cutoff is an admissible bound#✓
Assume the catalogue bound, and let the program literal satisfy \(|c_3|<2^{2^{24}}\) (as it does, by the size of the program literal). Then \(B=T+1\) satisfies the hypotheses of the template heights for the constructed library with the constructors of the specification:
- \(B\ge2^{20}\), and the division-polynomial and guard constructors satisfy the uniform bounds at \(B\);
- the fixed constant \(\ell\) satisfies \(1\le\ell\le T\), so \(|\ell|+1\le B\);
- every index \(n\) of a division-polynomial constructor of the library has \(|n|+1\le T+1\);
- the guard constructor has cutoff \(T\), and \(0\le T\le B-1\).
Moreover \(D\le T\). The literal constants of the templates need no hypothesis.
Proof sketch. By the definitions, \(D\le R\le Q\le Q^{17}\le A_{\rm ht}\le T\), and \(D>2^{2^{8008}}\), so \(B\ge2^{20}\). (1) The uniform constructor bounds hold at every \(B\ge2^{20}\). For (2), \(\ell\ge1\) since \(P_s,H_{\rm cat}\ge1\), and \(\ell<2^{2^{4623}}<D\le T\). For (3), by construction every index is \(\varepsilon\), \(\varepsilon\pm1\) or \(2\varepsilon\) with \(\varepsilon\in\{c_*,4,2,3,c_3,1399\}\) (the values of \(\mathrm{integer\_constant}_0,\dots,\mathrm{integer\_constant}_4\) are \(4,2,3,c_3,1399\)), so \(|n|+1\le2|\varepsilon|+2\). Here \(c_*<2^{2^{4617}}\) and \(|c_3|<2^{2^{24}}\), so \(|n|+1\le2\cdot2^{2^{4617}}\le2^{2^{4618}}<D\le T\). (4) is immediate. Nothing is evaluated: each comparison is between symbolic bounds.
The manuscript lists "the absolute values of all literal fixed constants and all occurring division-polynomial indices are at most \(T\)" among the checked facts. The indices and the fixed value \(\ell\) (used by the companion proof) are bounded symbolically here. The literal constants of the templates need no bound, since the majorant rules absorb them at every \(B\ge2^{20}\); for comparison with the manuscript's constant nodes, \(2^{69}<T\).
theorem admissible_cutoff (hCAT : CatalogueBound8) {c3 : ℤ} (hc3 : c3.natAbs < 2 ^ 2 ^ 24) :
LibraryAdmissible (Syntax.T + 1) specConstructors FixedConst.cstar.value FixedConst.ell.value
FixedConst.T.value c3
theorem D_le_T : Syntax.D ≤ Syntax.T
def CatalogueBound8 : Prop :=
∀ r : ℕ, r < catalogueModulus → Nat.Coprime r catalogueModulus →
22 ≤ ({p ∈ Finset.Ioo 324 (2 ^ catalogueModulus ^ 8) |
p.Prime ∧ p % catalogueModulus = r}).card
ZInQKernel/Hypotheses/PrimePattern.lean:190
structure LibraryAdmissible (B : ℕ) (I : Constructors E) (cstar ell T c3 : ℤ) : Prop where
two_pow_le : 2 ^ 20 ≤ B
constructors : ConstructorBounds I B
psi : ∀ n ∈ psiIndices cstar c3, n.natAbs + 1 ≤ B
fixed : ell.natAbs + 1 ≤ B
guard : 0 ≤ T ∧ T.natAbs + 1 ≤ B
ZInQKernel/Size/Majorants/TemplateHeights.lean:50
noncomputable def T : ℕ := FixedFormula.T Aht
ZInQKernel/Syntax/Constants/Fixed.lean:118
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
def D : ℕ := FixedFormula.D F
ZInQKernel/Syntax/Constants/Fixed.lean:102
Uses 13 · Used by 1
TheoremDegree and coefficient bounds for the specified polynomial#✓
Assume the catalogue bound. Then $\(\deg P_*\le(T+1)^{2048},\qquad|[X^\alpha]P_*|\le\|P_*\|_1\le2^{(T+1)^{2048}}\ \text{ for every monomial }X^\alpha .\)$
Proof sketch. \(B=T+1\) is admissible, so the recipe heights give \(\mathrm{Maj}_{T+1}(256,[\![\mathtt{integers}]\!])\): degree at most \((T+1)^{8\cdot256}\) and norm at most \(2^{(T+1)^{2048}}\). By the witness accounting \(P_*\) is \([\![\mathtt{integers}]\!]\) with its variables \(X_0,\dots,X_{292890231904}\) kept and nothing replaced, so it has the same degree and coefficients. Each coefficient is bounded by the \(\ell^1\) norm.
theorem Pstar_degree_coeff (hCAT : CatalogueBound8) (hB : Compiler.NodeCheck.HaltingAddMulBound) {c3 : ℤ}
(hc3 : c3.natAbs < 2 ^ 2 ^ 24) :
(specPstar c3).totalDegree ≤ (Syntax.T + 1) ^ 2048 ∧
l1 (specPstar c3) ≤ 2 ^ (Syntax.T + 1) ^ 2048 ∧
∀ m, ((specPstar c3).coeff m).natAbs ≤ l1 (specPstar c3)
theorem PstarNat_maj (hCAT : CatalogueBound8) (hB : Compiler.NodeCheck.HaltingAddMulBound) {c3 : ℤ}
(hc3 : c3.natAbs < 2 ^ 2 ^ 24) :
Maj (Syntax.T + 1) 256 (PstarNat (precisionCircuitOf c3) c3)
def CatalogueBound8 : Prop :=
∀ r : ℕ, r < catalogueModulus → Nat.Coprime r catalogueModulus →
22 ≤ ({p ∈ Finset.Ioo 324 (2 ^ catalogueModulus ^ 8) |
p.Prime ∧ p % catalogueModulus = r}).card
ZInQKernel/Hypotheses/PrimePattern.lean:190
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 T : ℕ := FixedFormula.T Aht
ZInQKernel/Syntax/Constants/Fixed.lean:118
def l1 (f : MvPolynomial σ ℤ) : ℕ := ∑ d ∈ f.support, (f.coeff d).natAbs
ZInQKernel/Syntax/Language/Size.lean:20
def Maj (B h : ℕ) (P : MvPolynomial σ ℤ) : Prop :=
if h = 0 then P.totalDegree ≤ 1 ∧ l1 P ≤ 1
else P.totalDegree ≤ B ^ (8 * h) ∧ l1 P ≤ 2 ^ B ^ (8 * h)
ZInQKernel/Size/Majorants/Basic.lean:43
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 7 · Used by 1
The towers
Since \(T<2^{2^{2^{9013}}}\), \((T+1)^{2048}<2^{2^{2^{9014}}}\), and \(9014<65536=2\uparrow\uparrow4\) gives the comparisons with \(2\uparrow\uparrow7\) and \(2\uparrow\uparrow8\), by monotonicity of exponentiation alone.
TheoremComparison with the towers#✓
Let \(2\uparrow\uparrow0=1\) and \(2\uparrow\uparrow(n+1)=2^{2\uparrow\uparrow n}\), so \(2\uparrow\uparrow1=2\) and \(2\uparrow\uparrow4=65536\). For every natural number \(T<2^{2^{2^{9013}}}\), $\((T+1)^{2048}<2^{2^{2^{9014}}}<2\uparrow\uparrow7\qquad\text{and}\qquad 2^{(T+1)^{2048}}<2\uparrow\uparrow8 .\)$
Proof sketch. \(T+1\le U=2^{2^{2^{9013}}}\), so \((T+1)^{2048}\le U^{2048}=2^{2^{2^{9013}}\cdot2^{11}}=2^{2^{2^{9013}+11}}\), and \(2^{9013}+11<2^{9014}\); thus \((T+1)^{2048}<2^{2^{2^{9014}}}\). Next \(2\uparrow\uparrow7=2^{2^{2^{2\uparrow\uparrow4}}}=2^{2^{2^{65536}}}\), and \(9014<65536\) with strict monotonicity of \(k\mapsto2^{2^{2^k}}\) gives the first chain. The second follows by applying \(k\mapsto2^k\): \(2^{(T+1)^{2048}}<2^{2\uparrow\uparrow7}=2\uparrow\uparrow8\). Only monotonicity of exponentiation and the value \(2\uparrow\uparrow4=65536\) are used.
theorem tower_bounds (T : ℕ) (hT : T < 2 ^ 2 ^ 2 ^ 9013) :
(T + 1) ^ 2048 < 2 ^ 2 ^ 2 ^ 9014 ∧ 2 ^ 2 ^ 2 ^ 9014 < hyperoperation 4 2 7 ∧
2 ^ (T + 1) ^ 2048 < hyperoperation 4 2 8
theorem degree_lt_tower_seven (T : ℕ) (hT : T < 2 ^ 2 ^ 2 ^ 9013) :
(T + 1) ^ 2048 < hyperoperation 4 2 7
theorem coefficient_lt_tower_eight (T : ℕ) (hT : T < 2 ^ 2 ^ 2 ^ 9013) :
2 ^ (T + 1) ^ 2048 < hyperoperation 4 2 8
Used by 1
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.