\section{Generalization and open problems}\label{sec:remarks} \begin{remark}[Why linear size] The exponent in Proposition~\ref{prop:onequery} depends on the number of shared bits of one system, so the reduction must keep that number linear in $\beta$. This is why the logarithm is not computed by a circuit inside the network: it is replaced by $O(\beta)$ rational kernels of constant arithmetic complexity, whose linear combination is formed outside. The same reason forces the input to the engine to be padded only linearly. \end{remark} \subsection{A general theorem}\label{sec:general} The proofs of Theorems~A and~B use three features of the sums they evaluate: the summation runs over the solutions of an arithmetic description of constant size; the weight is a product of a bounded number of the variables; and each summand is a product of a bounded number of values of analytic functions at ratios of variables in $[1,2]$. We state the corresponding general result. Throughout, $\beta=b(N)+1$. \begin{definition}\label{def:admfamily} A sequence $(h_j)_{j\ge0}$ of functions is \emph{admissible} if there is a constant $c$ such that every $h_j$ is analytic on a neighbourhood of $D_R$ with $\abs{h_j}\le2^{c(j+1)}$ on $D_R$, and for all $\beta'$ and $j\le\beta'$ a certified table for $h_j$ at precision $\beta'$ (Definition~\ref{def:table}) can be computed from $\beta'$ and $j$, given in unary, in polynomial time. A single function is admissible if the constant sequence is. \end{definition} By Lemma~\ref{lem:three} and the proof of Theorem~\ref{thm:generator}, the sequences $(L_j)_{j\ge0}$ and $(I_j)_{j\ge1}$ (extended by $I_0=I_1$) and the function $E$ are admissible: the generator of Section~\ref{sec:coefficients} works at any precision $\beta'$ for every $j\le\beta'$. \begin{definition}\label{def:admsum} \emph{Admissible sum data} consist of constants $c,k,r$ and: \begin{enumerate} \item for each $N$, a leveled arithmetic description $D_N$ (Section~\ref{sec:packages}), computable from $N$ in polynomial time, with all objects at level~$0$, with at most $c$ variables, products, chains and comparisons, well formed at every size, such that all variables of every solution are below $2^{c\beta}$ and every solution is determined by its first $r$ variables; we write $V_N\subseteq\N^r$ for the set of these $r$-tuples and $x_s(v)$ for the variables of the solution with first variables $v$; \item a weight $\omega(v)=\prod_{t\in T}x_{s_t}(v)$ for a fixed finite list $(s_t)_{t\in T}$ of variable indices (possibly empty); \item for $i=1,\dots,k$ an admissible sequence $(h^{(i)}_j)_j$ and an \emph{evaluation rule}, which is either (a) a pair of variable indices $(s,s')$ with $1\le x_{s'}\le x_s\le2x_{s'}$ on every solution, giving the point $a_i/q_i=x_s/x_{s'}$ and the index $j_i=0$; or (b) one variable index $s$ with $x_s\ge1$ on every solution, giving $j_i=\floor{\log_2x_s}$ and the point $x_s/2^{j_i}$. \end{enumerate} The \emph{admissible sum} is \[ F(N)=\sum_{v\in V_N}\omega(v)\prod_{i=1}^kh^{(i)}_{j_i(v)} \Bigl(\frac{a_i(v)}{q_i(v)}\Bigr). \] \end{definition} \begin{theorem}\label{thm:general} Let $F=F_1+\dots+F_u$ be a sum of a fixed number of admissible sums, with $F(N)\in\Z$ for every $N$. Then there are a machine $M$ and a constant $C$ such that for every $N\in\N$, on input $N$ the machine $M$ halts within $T_C(N)$ steps with output $F(N)$ (in a fixed binary encoding of integers). \end{theorem} \begin{proof} We follow Sections~\ref{sec:rounding}--\ref{sec:machines}; only the constants change. It suffices to treat each $F_i$ as below and to collect the queries of all of them in one batch, adding the error bounds. Let $H=2^{c(c\beta+1)}$, which bounds every function $h^{(i)}_j$ with $j\le c\beta$ on $D_R$, and work at precision $\beta'=C_1\beta$ for a constant $C_1\ge c$ chosen below. Certified tables at precision $\beta'$ for all $h^{(i)}_j$ with $j\le c\beta$ are computed in polynomial time by admissibility. \emph{One factor.} The three steps of the proof of Theorem~\ref{thm:factor}, with $H$ in place of $H_h$ and without the inequalities that used $H_h\le\beta+2195$, give for every $h$ with $\abs h\le H$ on $D_R$ and every $y\in[1,2]$ \[ \abs{\mathcal F_{P,R}(y)-h(y)}\le49H\Bigl(\frac67\Bigr)^{M_{\beta'}} +(8+32H)\frac2{2^{p_{\beta'}}}+(H+1)\frac2{2^{t_{\beta'}}} \le C_0(H+1)\,2^{-7\beta'} \] for an absolute constant $C_0$, since $(6/7)^{M_{\beta'}}\le2^{-7\beta'}$. \emph{Exact rounding.} Each factor has absolute value at most $H$ and each approximation is within $\delta=C_0(H+1)2^{-7\beta'}\le1$ of it, so telescoping as in Lemma~\ref{lem:fourfactor} bounds the error of a product of $k$ factors by $k(H+1)^k\delta$. There are at most $2^{rc\beta}$ terms and $\omega\le2^{\abs Tc\beta}$, so the total error is at most $2^{c_1\beta}2^{-7\beta'}$ for a constant $c_1$, which is less than $\frac12$ once $7C_1>c_1$. Since $F(N)$ is an integer, rounding the real part of the approximation gives $F(N)$. \emph{Queries.} By Lemma~\ref{lem:kernel} every evaluator lies in $s^{-1}\Z[i]$. Split $V_N$ into bins according to the indices $j_i$ of the rules of kind (b), at most $(c\beta+1)^k$ bins, each cut out by the comparisons $2^{j_i}\le x_s<2^{j_i+1}$. Lemma~\ref{lem:components} and Lemma~\ref{lem:partition}, for $k$ factors instead of four, write the numerator of the approximation as an integer combination of at most $(c\beta+1)^k(2M_{\beta'})^k2^k$ counts, with coefficients computed from the tables in polynomial time. \emph{One query.} The description of a query is $D_N$ together with the comparisons of its bin, one block of $15$ variables per factor as in Table~\ref{tab:vars}, whose inputs are pinned to the parameters $U,\abs V,2^{p_{\beta'}},2^{t_{\beta'}}$ and to the variables or constants $q_i,a_i$, and one multiplicity variable $w_t2^{4C^2}$, so $N_0\approx2^{2^{4C^2}}$. \emph{Faster counting engines.} The reduction uses the algorithm of \cite{A} only through Proposition~\ref{prop:onequery}, on packages whose input words have length linear in $b(N)$. Suppose an engine computes $Q(w,\pi)$ for every counting package within time $T(\abs w)$, where $T$ is non-decreasing and $T(n)\ge n$. The proofs of Section~\ref{sec:batches} and Section~\ref{sec:machines} then give Theorems~A--C within $\mathrm{poly}(b)\cdot T(Lb)$ steps for a constant $L$. For instance, an engine with $T(n)=2^{O(n/\log n)}$ would give $N^{O(1/\log\log N)}$, and one with $T(n)=2^{n^{1-\varepsilon}}$ would give $2^{O((\log N)^{1-\varepsilon})}$. Is there an engine for counting packages that is faster than $2^{O(n/\sqrt{\log n})}$?