A
D
V
E
R
T
I
S
E
M
E
N
T
ADVERTISEMENT
An FPRAS for Cell-Bounded Contingency Tables
expertly designed by an internal OpenAI model  ·  released 2026-09-24  ·  original PDF
Theorems: 1 Lemmas: 15 Proofs: 22
Formulas: 1,532 Words: 21,285 Play time: ~2 hours

>>> How to Play <<<
We give a fully polynomial randomized approximation scheme for counting nonnegative integer matrices with prescribed row sums, column sums, and individual entry bounds. Both dimensions vary, all numerical data are encoded in binary, and zero bounds are allowed. The algorithm uses only unbiased random bits and has a polynomial bound on its bit operations on every execution.

>>> Level Map <<<
  1. Introduction
  2. History and significance
  3. From tables to weighted transversals
  4. Organization and conventions
  5. Tight capacities and two scales
  6. Integer signatures and the softened count
  7. A projection fact for quadratic forms
  8. Integer coordinates and balanced summation
  9. Application to the softened table weights
  10. Tree marginals and contamination
  11. Paired binary states and two factorial lifts
  12. The paired encoding and its weights
  13. Binary signatures and their closure properties
  14. Defect masses and pair inequalities
  15. Transport, observable variance, and trace mixing
  16. The enlarged Metropolis chain
  17. A transport inequality on one-hole states
  18. Variance on transversals
  19. Defect means and observable variance
  20. Trajectory averages of the controlled observables
  21. The transversal trace and its return cost
  22. A bounded approximation procedure for the weights
  23. Bins and a comparable continuous density
  24. The estimator and its population correction
  25. Interpolation and conductance
  26. Sample counts and error allocations
  27. Correction arithmetic and a bound on every execution
  28. The annealing algorithm and its implementation
  29. Initialization and comparison of adjacent parameters
  30. A reference experiment with exact transition probabilities
  31. A bounded implementation using fair bits
  32. Relative error and amplification
  33. Counting and sampling bounded integral flows

Introduction

A cell-bounded contingency table is a nonnegative integer matrix whose row sums, column sums, and individual entry bounds are prescribed. For positive integers \(m,n\), margins \(r\in\mathbb Z_{\ge0}^m\) and \(c\in\mathbb Z_{\ge0}^n\) with equal total, and bounds \(b\in\mathbb Z_{\ge0}^{m\times n}\), write \[ \begin{aligned} \Omega(r,c,b)&=\left\{X\in\mathbb Z_{\ge0}^{m\times n}: \sum_{j=1}^n X_{ij}=r_i,\quad \sum_{i=1}^m X_{ij}=c_j,\quad X_{ij}\le b_{ij}\right\},\\ Z(r,c,b)&=|\Omega(r,c,b)|. \end{aligned} \tag{1}\] Each table is counted once. In particular, \(b_{ij}=0\) forbids an entry; no positivity condition is imposed on the support or margins. Our concern is the binary encoding model, in which a capacity can be exponentially larger than its description. Both \(m\) and \(n\) are part of the input.

Theorem 1. There is one randomized algorithm with the following guarantee. Given \((r,c,b)\) as above and rational \(\varepsilon,\delta\in(0,1)\), it outputs a nonnegative rational \(\widehat Z\) such that \[\mathbb P\bigl((1-\varepsilon)Z(r,c,b)\le \widehat Z \le(1+\varepsilon)Z(r,c,b)\bigr)\ge1-\delta.\] If \(\Omega(r,c,b)\) is empty, the output is zero on every execution. The algorithm uses independent unbiased bits, and one fixed polynomial in \(L\), \(\varepsilon^{-1}\), and \(\log(\delta^{-1})\) bounds its total bit operations on every execution, where \(L\) is the total binary input length, including the accuracy parameters. No counting or sampling oracle is required.

The theorem allows arbitrary cell bounds and margins without a fixed number of rows or columns, a lower bound on positive capacities, or a density or balance assumption. Its running-time guarantee includes preprocessing, random-bit generation, rational arithmetic, and output, even on executions in the failure event. The polynomial bounds in the proof are deliberately generous; the result is a uniform complexity guarantee rather than a practical running-time estimate.

History and significance

The enumeration of fixed-margin arrays has long been studied in statistics and combinatorics; Diaconis and Gangolli (Diaconis and Gangolli 1995) survey its applications and exact and approximate methods. Ordinary contingency tables are a special case of (1), since the margins imply \(X_{ij}\le\min\{r_i,c_j\}\). Even their exact enumeration is difficult: Dyer, Kannan, and Mount (Dyer et al. 1997, Theorem 1) proved \(\#\mathrm P\)-completeness for tables with only two rows. Approximate counting can nevertheless be efficient under much broader conditions than exact counting.

For ordinary tables, Dyer, Kannan, and Mount (Dyer et al. 1997) developed geometric sampling and counting methods for sufficiently large margins. Morris (Morris 2002) weakened the required margin bounds by refining the expanded-polytope and rounding argument. Dyer and Greenhill (Dyer and Greenhill 2000) gave polynomial-time approximate counting and sampling for arbitrary two-row margins. Cryan and Dyer (Cryan and Dyer 2003) obtained an FPRAS for any fixed number of rows by combining dynamic programming and volume estimation; Dyer (Dyer 2003) subsequently improved the fixed-row algorithm using dynamic programming. Gopalan, Klivans, Meka, Štefankovič, Vempala, and Vigoda (Gopalan et al. 2011, Theorem 1.3) later gave a deterministic FPTAS for a fixed number of rows. These results already permit binary-encoded margins. Their restrictions concern the number of rows or the sizes of the margins, rather than a unary encoding convention.

Individual caps connect the problem to several other counting models. When all caps are zero or one, a table is a subgraph of the allowed bipartite graph with prescribed vertex degrees. Jerrum, Sinclair, and Vigoda (Jerrum et al. 2004, Corollary 8.1) give an FPRAS for this entire special case as a consequence of their permanent algorithm; all-one margins give perfect matchings. Bezáková, Bhatnagar, and Vigoda (Bezáková et al. 2007) developed a direct annealing algorithm for binary tables, also allowing arbitrary forbidden cells. More generally, capped tables are integer flows in a bipartite network. Cryan, Dyer, and Randall (Cryan et al. 2010) gave an FPRAS for integral flows with sufficiently large tight capacities, and for cell-bounded tables with a fixed number of rows and arbitrary positive margins and caps. They identified unrestricted approximation as an open problem in their 2010 paper. Their tight-capacity reduction and maximum-capacity spanning-tree representation are direct antecedents of our large-cell construction. Here a forest and soft constraints accommodate arbitrary mixtures of small and large bounds, with both dimensions variable and zero bounds permitted.

Convex optimization gives a complementary family of estimates. Barvinok (Barvinok 2009, Theorem 1.3) bounds ordinary weighted table counts, including forbidden cells, within a factor \(N^{O(m+n)}\), where \(N\) is the total margin. Barvinok, Luria, Samorodnitsky, and Yong (Barvinok et al. 2010) obtain randomized relative approximations with complexity \(N^{O(\log N)}\) for specified smooth-margin classes. This scale is quasipolynomial in the numerical total, rather than in its binary length. Brändén, Leake, and Pak (Brändén et al. 2023, Theorem 2.1) give capacity bounds for arbitrary individual caps, with explicit multiplicative factors depending on the margins and dimensions. Their bounds extend earlier estimates using Lorentzian polynomials. A subsequent preprint of September 30, 2026, by Leake and Mohammadi Yekta (Leake and Mohammadi Yekta 2026, Theorems 1.1 and 1.3) extends capacity-based estimates to finite nonnegative integer fibers of totally unimodular systems, retaining an explicit multiplicative factor depending on the system’s dimensions and right-hand side. Theorem 1 supplies any requested relative tolerance in polynomial binary time, without a smoothness assumption.

The geometric problem here is to count all integer points of a transportation polytope. These need not all be vertices: the \(2\times2\) tables with every margin equal to two form a segment with three integer points and two vertices. Guo and Jerrum (Guo and Jerrum 2023, Proposition 4.2) give an FPRAS for the vertices of promised \(0/1\) polytopes \(\{x:0\le Ax\le1\}\) defined by network matrices; this unit-bound vertex result has a different scope.

Counting also provides approximate sampling through the self-reduction principle of Jerrum, Valiant, and Vazirani (Jerrum et al. 1986, Theorem 6.3). Section 8 implements this principle by bisecting cell intervals, with exact feasibility tests at every branch. For an explicitly given directed multigraph with finite integer arc bounds and prescribed vertex balances, it yields both an FPRAS for integer arc-value vectors and a sampler that always returns a feasible vector when one exists. The latter has total-variation error at most \(\tau\) and an all-execution cost polynomial in the input length and \(\tau^{-1}\). A separate companion (OpenAI 2026b, Theorem 1.1) proves exact uniform sampling in polynomial expected bit time for ordinary tables with arbitrary margins and no input cell bounds or forbidden positions. Its bounded approximate sampler has cost polynomial in the input length and the number of accuracy bits. Those stronger sampling guarantees concern the uncapped setting; the flow consequence here has the total-variation and cost bounds just stated.

From tables to weighted transversals

The proof separates numerical size from combinatorial complexity. Large binary bounds cannot be expanded into that many binary choices. We instead sum over large coordinates through a weighted completion problem, and expand only coordinates with polynomially bounded ranges. The resulting finite-state argument must preserve one unit of mass per table despite the multiplicities introduced by this expansion.

Large entries and two views of a small entry.

Flow feasibility first tightens each cell to its attainable interval. Subtract its minimum, so that the new endpoints are \(0\) and \(b_s\); each endpoint is attained by some feasible table. Remove zero-width cells and separate the remaining cells at a polynomial threshold \(W\). In the bipartite graph of large cells, choose a maximum-capacity spanning forest and one root in each component. The large cells outside the forest are free coordinates. Once their values and the contributions of small cells to each incident margin have been specified, leaf elimination uniquely determines the tree entries from the nonroot margin equations.

For a small cell \(s\), temporarily allow two counts \(x_s,y_s\) between \(0\) and \(b_s\): its row contribution is \(x_s\), and its column contribution is \(b_s-y_s\). The views agree when \(x_s+y_s=b_s\). Writing \(p=\sum_{s\text{ small}}b_s\), we also consider unbalanced profiles satisfying only \(\sum_s(x_s+y_s)=p\). Extending the weights to these profiles supplies the auxiliary states and algebraic tests used below. For every such profile, sum over the free large entries in their integer intervals. Penalize the resulting deviations from root margins and violations of tree-cell bounds by a nonnegative quantity \(D\). This penalty vanishes exactly when those remaining constraints hold. A maximum-capacity forest bounds its slopes in normalized free coordinates independently of the numerical large capacities.

For a polynomially bounded integer \(H\), let \(h_j(x,y)\) be the sum of \(2^{-jD/H}\) over these free assignments, for \(0\le j\le H\), and let \(C(j)\) be the sum of \(h_j\) over balanced small profiles. Thus \(C(0)\) is an explicit product of interval sizes. Every feasible table contributes one to \(C(H)\), while invalid completions contribute additional positive mass. Log-concavity of each tree-coordinate marginal, together with its attainable endpoints, controls violations close to a tree boundary; exponential decay controls more distant violations. This proves \(Z\le C(H)\le(1+\varepsilon/32)Z\). The use of scaled free coordinates and soft constraints builds on the geometric table methods of Dyer, Kannan, and Mount and Morris (Dyer et al. 1997; Morris 2002).

Binary encodings and two extensions of their weights.

Replace a small cell of bound \(b_s\) by \(b_s\) labeled pairs, each containing a row element and a column element. There are \(p\) pairs altogether. A transversal selects one element from each pair. Its selected row and column counts give a balanced profile \((x,y)\). The number of transversals with that profile is \(\prod_s\binom{b_s}{x_s}\), so assigning each the weight \(h_j(x,y)/\prod_s\binom{b_s}{x_s}\) gives mass \(h_j(x,y)\) to that profile and total mass \(C(j)\) to all transversals.

The transport argument uses an enlarged chain that also permits \(p\)-element sets with one empty pair and one full pair. Such a state has defect type \((i,l)\) when pair \(i\) is empty and pair \(l\) is full. Two factorial formulas extend the transversal weights to positive weights \(f_j\) and \(\widetilde f_j\) on all \(p\)-element sets. They agree on transversals and are within a polynomial factor of each other on the permitted defect types. Their algebraic roles differ. For \(f_j\), matrices of weights obtained by omitting two elements from a fixed \((p+2)\)-element set have at most one positive eigenvalue. For \(\widetilde f_j\), the corresponding statement holds when adding two elements to a fixed \((p-2)\)-element set. These quadratic tests belong to the Lorentzian framework of Brändén and Huh (Brändén and Huh 2020); we prove the specific integer summation and binary contraction statements needed here. The omission property controls transport between conditional transversal laws. The addition property compares defect masses. Passing the latter inequalities between the two weights incurs only polynomial losses.

The chain, its observables, and bounded computation.

We simulate exchanges of one selected and one unselected element, using \(f_j\) and a multiplier for each defect type. As in the permanent algorithm of Jerrum, Sinclair, and Vigoda (Jerrum et al. 2004, sec. 3), the multipliers balance the type masses and are learned from observed type frequencies during annealing. The paired transport, variance, and trace analysis adapts the common-bases construction of (OpenAI 2026a, secs. 4–6), with the two distinct weights supplying its two signature inputs.

The quantities to estimate are the adjacent ratios \(C(j+1)/C(j)\) and the defect-type probabilities. A variance bound controls these observables even though it does not bound arbitrary fluctuations within each defect type. Restricted variance estimates also underlie the permanent algorithm of Chen, Vigoda, and Yang (Chen et al. 2026). Here we additionally control the chain’s transversal trace, which records successive returns to the transversal class. Its mixing and return-cost bounds provide fresh starts for estimating the ratios; their product recovers \(C(H)\) from \(C(0)\).

Finally, the completion weights \(h_j\) are evaluated approximately by a walk on polynomially many bins per free coordinate, with a correction for the different numbers of integers in the bins. The product grid itself can be exponentially large; only polynomially many transitions are simulated. Fresh weight estimates and finite-bit choices are coupled to the exact-weight analysis at each adaptive request. Caps on trace restarts and all numerical subroutines give a polynomial work bound on every execution, while the accuracy analysis bounds the probability of an inaccurate estimate or a capped restart.

Organization and conventions

Section 2 constructs the forest coordinates and softened counts. Section 3 proves the integer summation properties and controls contamination by invalid completions. Section 4 introduces the binary weights and proves their signatures and defect inequalities. Section 5 derives transport, observable variance, and trace estimates. Section 6 implements approximate evaluation of the completion weights. Section 7 specifies annealing, implements it using fair bits, and proves Theorem 1. Section 8 gives the counting and total-variation sampling consequences for bounded integral network flows.

All logarithms with a subscript \(2\) are binary; \(\log\) in exponential estimates is natural. Sums over edges in Dirichlet forms are over unordered edges unless stated otherwise. A symmetric matrix has at most one positive eigenvalue when its positive inertia index is at most one, with multiplicity. This property concerns quadratic forms and is preserved by restriction and limits; preservation under pair summation will be proved, not assumed. The large matrices, conditioning trees, and transport flows used in these proofs are not constructed by the algorithm.

Tight capacities and two scales

We first reduce the input to one in which every coordinate bound is attained. The use of tight capacities and a maximum-capacity spanning forest follows the representation of integral flows in (Cryan et al. 2010). The estimates below allow both dimensions and all capacities to vary.

For feasibility, form a directed network with a source, the row and column vertices, and a sink. Give the source-to-row arcs capacities \(r_i\), the row-to-column arcs capacities \(b_{ij}\), and the column-to-sink arcs capacities \(c_j\). An integral flow of value \(N=\sum_i r_i=\sum_j c_j\) is exactly a feasible table: at that value every arc incident to the source or sink is saturated. The shortest-augmenting-path algorithm of Edmonds and Karp (Edmonds and Karp 1972, Theorem 1) uses \(O(VE)\) augmentations, where \(V\) and \(E\) are the numbers of vertices and arcs. The present network is simple, so \(E=O(V^2)\) and the bound is \(O(V^3)\), independently of the numerical capacities. Each augmenting path is found by breadth-first search in \(O(V+E)\) operations. Starting at zero, augmentation by the minimum residual capacity preserves integrality. All flow and residual-capacity values have polynomial binary length, so this gives a deterministic polynomial-bit feasibility test for the present network.

Return zero if the input is infeasible. For a feasible input, let \(\ell_s\) and \(u_s\) be the minimum and maximum feasible integer values of cell \(s\). Each extremum is computable by binary search using flow feasibility with one additional upper or lower bound. A lower bound is subtracted from its cell and the two incident margins before applying the flow test; if a residual margin or capacity is negative, reject that tested bound immediately. The searches use polynomially many operations on integers of polynomial binary length.

Replace each cell value \(X_s\) by \(X_s-\ell_s\), replace its upper bound by \(b_s=u_s-\ell_s\), and subtract all incident minima from each margin. This is a bijection between the original and the new feasible sets: every original feasible table satisfies all its individual extremum bounds, and adding back the minima is the inverse map. In the new instance, each endpoint \(0\) and \(b_s\) is attained by a feasible table, possibly a different table for each endpoint and cell. Delete cells with \(b_s=0\). A deleted cell contributes no choice. Retain all row and column vertices, including isolated vertices, and write \(r,c\) for the new margins and \(Z\) for the unchanged count.

Let \(L\) be the binary input length from Theorem 1, and retain the original dimensions \(m,n\). Fix \[ \begin{gathered} d=mn+m+n+2,\qquad K=20\bigl(L+d+\lceil\log_2(1/\varepsilon)\rceil+1\bigr), \qquad \gamma=\frac{\varepsilon}{512dK},\\ A=\left\lceil\frac{4K}{\gamma}\right\rceil,\qquad B=16Ad^2,\qquad W=100dB,\qquad H=10Ad^2(W+1). \end{gathered} \tag{2}\] All these parameters except \(\gamma\) are positive integers. Here \(K\) bounds the logarithmic counting scales, \(\gamma\) is a relative width near a tree boundary, and \(A\) sets the penalty strength. The parameter \(B\) is the number of bins per free coordinate, \(W\) separates small and large capacities, and \(H\) bounds the penalty and is the final annealing index. Binary encoding and the fact that tightened capacities never increase give \[ \prod_{s\text{ remaining}}(b_s+1)\le 2^L\le 2^K, \qquad 2^{-3K}\le\frac{\varepsilon}{128}. \tag{3}\] Indeed, a nonnegative integer written with \(\ell\) binary digits has at most \(2^\ell\) possible values between zero and itself. For the second inequality, the definition of \(K\) gives \(3K\ge\log_2(128/\varepsilon)\). Call a remaining cell small if \(b_s<W\), and large otherwise. Write \(\mathcal S\) for the small cells and set \[p=\sum_{s\in\mathcal S}b_s.\] There are at most \(mn<d\) remaining cells and \(m+n<d\) vertices, so \(p\le dW\). In particular the number of binary slots introduced later is polynomial. More explicitly, \(d,K=O(L)\) and \[A=O(L^3\varepsilon^{-1}),\quad B=O(L^5\varepsilon^{-1}),\quad W=O(L^6\varepsilon^{-1}),\quad H=O(L^{11}\varepsilon^{-2}).\] Here \(L\) includes the encoding of \(\varepsilon\), so \(\lceil\log_2(1/\varepsilon)\rceil=O(L)\). These bounds concern the numerical values of the auxiliary parameters; the retained capacities themselves continue to have polynomial binary length.

Form the bipartite graph whose vertices are the rows and columns and whose edges are the large cells. In each connected component choose a spanning tree of maximum total capacity, and choose a root. An isolated vertex constitutes a component with an empty tree. The union of these trees is denoted by \(\mathcal T\); the large cells outside \(\mathcal T\) form the set \(\mathcal F\) of free cells. Sorting large cells by decreasing capacity and adding an edge whenever it joins two current components constructs such a forest in polynomial time.

The small cells will have separate row and column coordinates. The small-cell contributions to row and column equations will therefore use disjoint coordinate sets. We recover an actual table by requiring the two physical values of each small cell to agree.

For each small cell \(s\), take integer counts \(x_s,y_s\in\{0,\ldots,b_s\}\). Its contribution to its row margin is \(x_s\), and its contribution to its column margin is \(b_s-y_s\). Thus the two contributions agree precisely when \(x_s+y_s=b_s\). For example, when \(b_s=3\), the profile \((x_s,y_s)=(2,1)\) gives physical value two at both endpoints, whereas \((2,2)\) gives row value two and column value one. For a large cell there is a single value at both endpoints. Given free values \((z_e)_{e\in\mathcal F}\), impose the prescribed margin at every nonroot vertex and solve for the values \((z_t)_{t\in\mathcal T}\). As proved below, this has a unique real solution, which is integral when the free values are integral. For a root \(v\), let \(\delta_v\) be its resulting actual incident sum minus its prescribed margin. Define \[ D(x,y,z)=A\left( \sum_{v\text{ a root}}|\delta_v| +\sum_{t\in\mathcal T} \frac{\mathop{\mathrm{dist}}(z_t,[0,b_t])}{b_t} \right). \tag{4}\] In this expression \(z\) denotes the free vector; the tree values and root deviations are its determined functions. The denominators \(b_t\) are positive because every tree cell is large.

Lemma 2 (Forest estimates). For a free cell \(e\), every tree cell \(t\) on the path joining its endpoints satisfies \(b_e\le b_t\). For every box-valid integer small profile \((x,y)\) and every real free vector \(z\in\prod_{e\in\mathcal F}[0,b_e+1]\), the nonroot equations have a unique solution. This solution is integral for integral \(z\), and the root deviations are independent of \(z\).

For any fixed feasible table \(X^*\) of the tightened instance, \[ |z_t-X^*_t|\le4db_t\quad(t\in\mathcal T), \qquad \sum_{v\text{ a root}}|\delta_v|\le2dW. \tag{5}\] Consequently, throughout the extended free box, \[0\le D\le H,\qquad z_t\in[-10db_t,10db_t]\quad(t\in\mathcal T).\] For fixed \((x,y)\), set \(u_e=z_e/(b_e+1)\). As a function of \(u\), the penalty \(D\) is convex on \([0,1]^{\mathcal F}\) and satisfies \[ |D(x,y,u)-D(x,y,u')| \le2Ad^2\|u-u'\|_\infty. \tag{6}\] For an empty free set the domain is a singleton and the last bound has its usual vacuous interpretation.

Proof. If a free edge had larger capacity than a tree edge on its path, exchanging those two edges would increase the total tree capacity. This proves the path inequality. Leaf elimination proves existence and uniqueness of the nonroot solution: at a nonroot leaf its margin equation determines the edge to its parent, after which that vertex can be removed. The same procedure proves integrality and that all tree values are affine functions of the free values. No equation is imposed at the last, root vertex. For a singleton component there are no unknown tree values and no nonroot equations.

Changing a free value affects tree values along its tree path. Small-cell profiles need more care: their two physical views need not agree, so their contributions must be counted by incidences rather than cancelled as an ordinary flow. The following cut identities keep both effects explicit. Give a row vertex sign \(\sigma_v=1\) and a column vertex sign \(\sigma_v=-1\). For a small-cell incidence \((v,s)\), let \[a_{v,s}=\begin{cases} x_s,&v\text{ is the row of }s,\\ b_s-y_s,&v\text{ is the column of }s, \end{cases} \qquad \Delta a_{v,s}=a_{v,s}-X^*_s.\] For a large cell write \(\Delta z_e=z_e-X^*_e\), including solved tree cells in this notation. Remove a tree edge \(t\), and let \(U_t\) be the vertex set on the side away from the root; let \(v_t\) be the endpoint of \(t\) in \(U_t\). Sum the differences of the nonroot margin equations over \(U_t\), with signs \(\sigma_v\). Internal large edges cancel. If \(v(e,U_t)\) is the unique endpoint in \(U_t\) of a free edge crossing the cut, the result is \[ \sigma_{v_t}\Delta z_t =-\sum_{\substack{e\in\mathcal F\\e\text{ crosses }U_t}} \sigma_{v(e,U_t)}\Delta z_e -\sum_{\substack{s\in\mathcal S,\ v\in U_t\\v\text{ incident to }s}} \sigma_v\Delta a_{v,s}. \tag{7}\] The last sum is over incidences, including both incidences when a small edge has both endpoints in \(U_t\); its two values can differ for an unbalanced profile.

Each crossing free edge has \(t\) on its tree path. Hence \(|\Delta z_e|\le b_e+1\le2b_t\) even on the extended real free box. Every small incidence satisfies \(|\Delta a_{v,s}|\le b_s<W\le b_t\). There are at most \(d\) free edges and \(2d\) small incidences. Equation (7) therefore gives \(|\Delta z_t|\le4db_t\).

For a whole large-cell component \(U\) with root \(v_0\), the analogous signed sum cancels every large-cell contribution and gives \[\sigma_{v_0}\delta_{v_0} =\sum_{\substack{s\in\mathcal S,\ v\in U\\v\text{ incident to }s}} \sigma_v\Delta a_{v,s}.\] This proves independence from all free values, also for a singleton component. Summing absolute values over components yields \(\sum_{v_0}|\delta_{v_0}|\le2\sum_{s\in\mathcal S}b_s\le2dW\). Since \(X^*_t\in[0,b_t]\), the displacement bound now implies \[0\le D\le A(2dW+4d^2)\le10Ad^2(W+1)=H.\] It also places \(z_t\) in \([-4db_t,(4d+1)b_t]\subseteq[-10db_t,10db_t]\).

Finally, subtract (7) for two free vectors with the same small profile. Each coefficient in normalized coordinates is \(\pm(b_e+1)\) for an edge crossing the cut, and its absolute value divided by \(b_t\) is at most two. Thus \[\frac{|z_t(u)-z_t(u')|}{b_t} \le2d\|u-u'\|_\infty.\] Distance from an interval is convex and is 1-Lipschitz. Composing with the affine tree values and summing at most \(d\) tree terms proves convexity and (6); the root terms are constant in the free coordinates. ◻

Define the small-profile domain \[\mathcal P=\left\{(x,y)\in\prod_{s\in\mathcal S} \{0,\ldots,b_s\}^2: \sum_{s\in\mathcal S}(x_s+y_s)=p\right\}.\] For each integer \(j\in\{0,\ldots,H\}\), set \[ h_j(x,y)= \sum_{z\in\prod_{e\in\mathcal F}\{0,\ldots,b_e\}} 2^{-jD(x,y,z)/H},\qquad (x,y)\in\mathcal P. \tag{8}\] When needed, extend \(h_j\) by zero outside \(\mathcal P\). On \(\mathcal P\) it is strictly positive, including at unbalanced profiles. With the empty-product convention, put \(M_f=\prod_{e\in\mathcal F}(b_e+1)\). Lemma 2 gives \[M_f2^{-j}\le h_j(x,y)\le M_f.\] An empty free block contributes one term, of value \(2^{-jD(x,y)/H}\). If there are no small cells, then \(p=0\) and \(\mathcal P\) contains only the empty profile.

The partition functions of interest are \[ C(j)=\sum_{\substack{(x,y)\in\mathcal P\\ x_s+y_s=b_s\ (s\in\mathcal S)}}h_j(x,y). \tag{9}\] In particular, \(C(0)=M_f\prod_{s\in\mathcal S}(b_s+1)\) is explicitly computable. Equations (8) and (9) define finite mathematical sums. Section 6 and the subsequent annealing algorithm estimate them using polynomially many operations on binary representations, without enumerating the free ranges or the small-profile domain. The outer counting algorithm in Section 7 estimates the adjacent ratios in the identity \[C(H)=C(0)\prod_{j=0}^{H-1}\frac{C(j+1)}{C(j)}.\]

Proposition 3 (Contamination bound). For the feasible tightened instance, \[Z\le C(H)\le(1+\varepsilon/32)Z.\]

The lower bound counts each feasible table with weight one. For the upper bound, strong penalties immediately control root violations and large tree violations; tree values just outside their intervals require a marginal estimate. We prove that estimate and complete the proof of Proposition 3 in Section 3.

Integer signatures and the softened count

We will use the two-view encoding for all retained cells to obtain two properties of the softened count. First, after summing the large cells, the count weight \(h_j\) must satisfy quadratic inequalities that will pass to the binary encoding. Second, a tree-value marginal in \(C(H)\) must be log-concave, so that attainable endpoints control the near-boundary violations left in Proposition 3. Both follow from the same integer balanced-summation argument.

The one-positive-eigenvalue tests are closely related to the Lorentzian-polynomial framework of Brändén and Huh (Brändén and Huh 2020). The laminar decomposition and balanced-summation argument for widths at least two appear in (OpenAI 2026b, Lemmas 3.2–3.3 and Proposition 3.4). We prove the closure statement in the form needed here, including pairs of width one.

A projection fact for quadratic forms

We first record an elementary fact that will be used repeatedly. If a real symmetric matrix \(Q\) has at most one positive eigenvalue and \(u^{\mathsf T}Qu>0\), then \(Q\) is nonpositive on \[\{v:v^{\mathsf T}Qu=0\}.\] Indeed, a positive-square vector in this subspace, together with \(u\), would span a two-dimensional positive-definite subspace. Subtracting the projection of an arbitrary vector \(v\) onto \(u\) therefore gives \[ v^{\mathsf T}Qv \le \frac{(v^{\mathsf T}Qu)^2}{u^{\mathsf T}Qu}. \tag{10}\] Conversely, a symmetric form that is nonpositive on a subspace of codimension at most one has at most one positive eigenvalue. The latter property is preserved by restriction, by congruence, and by entrywise limits of matrices of a fixed size. For limits, this follows from continuity of the ordered eigenvalues.

We also need the boundary case of the projection inequality. If \(e^{\mathsf T}Qe=0\) but \(Qe\ne0\), then \(Q\) is nonpositive on \(\{v:v^{\mathsf T}Qe=0\}\). Indeed, choose \(w=Qe\), so \(e^{\mathsf T}Qw=\|Qe\|^2>0\). For sufficiently small \(t>0\), \(u=e+tw\) has positive square. For \(v^{\mathsf T}Qe=0\), (10) gives \[v^{\mathsf T}Qv \le \frac{t^2(v^{\mathsf T}Qw)^2} {2t e^{\mathsf T}Qw+t^2w^{\mathsf T}Qw}\longrightarrow0.\]

Integer coordinates and balanced summation

Let \(I\) be a finite coordinate set, let \(m_i\) be nonnegative integers, and let \(\mathcal L\) be a laminar family of subsets of \(I\): any two members are nested or disjoint. For \(G\in\mathcal L\), let \(\psi_G:\mathbb Z\longrightarrow(0,\infty)\) be log-concave, meaning \[\psi_G(a)^2\ge \psi_G(a-1)\psi_G(a+1) \qquad(a\in\mathbb Z).\] Fix an integer \(R\). On the total slice of size \(R\), define \[ F(z)= \prod_{G\in\mathcal L} \psi_G\left(\sum_{i\in G}z_i\right) \quad\text{if }0\le z_i\le m_i\text{ and }\sum_i z_i=R, \tag{11}\] and set \(F(z)=0\) otherwise. All coordinates and displays in this subsection are integral. Coincident members of a laminar family may be combined by multiplying their factors.

Choose disjoint coordinate pairs \(\{a_t,b_t\}\), \(t\in J\), with \(m_{a_t}=m_{b_t}=M_t\). Summing such a pair at balance means summing its profiles \((k,M_t-k)\), \(0\le k\le M_t\). Let \(\Phi\) be the weight on the remaining coordinates after summing all pairs in \(J\) at balance. Its required total is \[r=R-\sum_{t\in J}M_t.\]

Lemma 4 (Integer signature under balanced summation). Suppose \(M_t\ge1\) for every pair that is summed. For every box-valid display \(z\) on the remaining coordinates with \(\sum_i z_i=r+2\), the symmetric matrix \[ \bigl(\Phi(z-e_i-e_h)\bigr)_{i,h} \quad\text{has at most one positive eigenvalue}. \tag{12}\] The diagonal entries in this matrix are the weights after two removals from the same coordinate; invalid removals have weight zero. The corresponding assertion for two additions holds for every box-valid display of total \(r-2\).

Proof. We first prove the removal assertion without summation. Coordinates with \(z_i=0\) give zero rows and columns and may be discarded. Temporarily evaluate all remaining entries using the product of factors, even when a repeated removal would give a negative coordinate. This evaluation is well-defined because the factors are defined on all integers. Write \[l_G=\sum_{i\in G}z_i, \qquad \gamma_G= \frac{\psi_G(l_G)\psi_G(l_G-2)} {\psi_G(l_G-1)^2}.\] Log-concavity gives \(0<\gamma_G\le1\). Factor out the value of the product at the display and, from each matrix index \(i\), the positive single-removal ratio \[\prod_{G\ni i}\frac{\psi_G(l_G-1)}{\psi_G(l_G)}.\] Thus, up to a positive scalar and a positive diagonal congruence, the entry at \(i,h\) is \(\prod_{G\supseteq\{i,h\}}\gamma_G\). Restrict the factor sets to the retained coordinates and combine duplicates if necessary. Laminarity then gives the matrix identity \[ \left(\prod_{G\supseteq\{i,h\}}\gamma_G\right)_{i,h} = \mathbf 1\mathbf 1^{\mathsf T} - \sum_{G\in\mathcal L} (1-\gamma_G) \left(\prod_{\substack{G'\in\mathcal L\\G'\supsetneq G}} \gamma_{G'}\right) \mathbf 1_G\mathbf 1_G^{\mathsf T}. \tag{13}\] For each entry the identity telescopes along the chain of sets containing both indices. The right-hand side is a rank-one positive semidefinite matrix minus a positive semidefinite matrix, so it has at most one positive eigenvalue. The only invalid removals still present are repeated removals from a coordinate with displayed value one. Their positive diagonal entries must be replaced by zero, which subtracts a nonnegative diagonal matrix. This cannot increase the number of positive eigenvalues.

We now induct on the number of summed pairs. Suppose some pairs have already been summed, and let \(\Psi\) denote the resulting weight before the next pair of capacity \(M\ge1\) is summed. Fix a box-valid display \(z\) on the other coordinates, two above their new required total. For \(0\le k\le M\), apply the induction hypothesis to the display \((z,k,M-k)\). The resulting matrix, with the two pair coordinates listed last, is \[ N_k= \begin{pmatrix} V_k&S(k-1)&S(k)\\ S(k-1)^{\mathsf T}&u_{k-1}&u_k\\ S(k)^{\mathsf T}&u_k&u_{k+1} \end{pmatrix}, \tag{14}\] where \[\begin{align*} (V_k)_{ih}&=\Psi(z-e_i-e_h,k,M-k), \\ S(l)_i&=\Psi(z-e_i,l,M-1-l), \\ u_k&=\Psi(z,k-1,M-1-k). \tag{15}\end{align*}\] Every \(N_k\) has at most one positive eigenvalue. As usual, all out-of-box terms are zero. In particular, \(S(-1)=S(M)=0\), and \(u_k=0\) outside \(1\le k\le M-1\). The matrix after summation is \(\sum_{k=0}^M V_k\). We must find one common subspace of codimension at most one on which this sum is nonpositive; simply adding the matrices \(N_k\) would not establish that property.

If \(M=1\), put \(S=S(0)\). After deleting their zero pair axis, \(N_0\) and \(N_1\) have the respective forms \[\begin{pmatrix}V_0&S\\S^{\mathsf T}&0\end{pmatrix}, \qquad \begin{pmatrix}V_1&S\\S^{\mathsf T}&0\end{pmatrix}.\] When \(S\ne0\), the null-axis projection just proved shows that both \(V_0\) and \(V_1\) are nonpositive on \(\{a:a^{\mathsf T}S=0\}\). Their sum therefore has at most one positive eigenvalue. If any displayed coordinate \(z_i\) is positive, then \(S_i=\Psi(z-e_i,0,0)>0\): the profile has the required total and every previously summed pair supplies a positive balanced term. Thus \(S=0\) can occur only when \(z=0\), in which case all removals are invalid and \(V_0=V_1=0\). This proves the width-one case.

Assume henceforth that \(M\ge2\). For each interior index \(k\), \(u_k>0\): the displayed coordinates are box-valid and have the correct total, and any balanced profile on each previously summed pair supplies a positive term in the original positive-factor model.

For larger widths the common subspace is determined by the sum of the one-removal vectors \(S(l)\). Cumulative sums provide auxiliary coordinates whose contributions will telescope. Consider an old-index vector \(a\) satisfying the single linear condition \[a^{\mathsf T}\sum_{l=0}^{M-1}S(l)=0.\] Define \[g_k= \frac{a^{\mathsf T}\sum_{l=0}^{k-1}S(l)}{u_k} \quad(1\le k\le M-1), \qquad g_k=0\quad\text{otherwise}.\] The endpoint condition on \(a\), as well as the cumulative-sum definition at interior indices, gives \[ a^{\mathsf T}S(l)=u_{l+1}g_{l+1}-u_lg_l \qquad(0\le l\le M-1). \tag{16}\] For \(v_k=(a,g_k,-g_k)\), its products under the form \(N_k\) with the first and second new coordinate axes are, respectively, \[u_{k-1}(g_k-g_{k-1}), \qquad u_{k+1}(g_{k+1}-g_k).\] If either of those axes has positive square, applying (10) to that axis and adding the other nonnegative term gives \[ v_k^{\mathsf T}N_kv_k \le u_{k-1}(g_k-g_{k-1})^2+ u_{k+1}(g_k-g_{k+1})^2. \tag{17}\] If both axis squares vanish, their diagonal entries \(u_{k-1},u_{k+1}\) are zero. The endpoint cases \(k=0,M\) have a positive other diagonal because \(M\ge2\); hence in the remaining case \(u_k>0\). The sum of the two axes then has square \(2u_k>0\) and product zero with \(v_k\). Applying (10) to this sum again gives (17), whose right-hand side is now zero. This includes the case \(M=2,k=1\).

Substitute (16) into (17) and expand. The terms involving \(g_kg_{k-1}\) and \(g_kg_{k+1}\) cancel, leaving \[ a^{\mathsf T}V_ka +2u_kg_k^2 -u_{k-1}g_{k-1}^2 -u_{k+1}g_{k+1}^2 \le0. \tag{18}\] Sum this inequality over \(0\le k\le M\). Every interior \(u_kg_k^2\) cancels, and all exterior terms are zero. Consequently \(\sum_kV_k\), which is the desired matrix after summing the next pair, is nonpositive on the kernel of one linear functional. Its number of positive eigenvalues is therefore at most one. This completes the induction.

Finally reflect every coordinate in its box: \(z_i\mapsto m_i-z_i\). A factor on a set \(G\) remains a positive log-concave sequence in the sum on \(G\), with its argument reversed and translated. A balanced pair of capacity \(M\) remains balanced under this reflection, so reflection commutes with balanced summation. The reflected remaining weight is \(\Phi^\vee(z)=\Phi(m-z)\). A display two below the original total becomes a display two above the reflected total, and \[\Phi^\vee(m-z-e_i-e_h)=\Phi(z+e_i+e_h).\] The removal assertion for the reflected model is precisely the addition assertion for the original model. ◻

The conclusion of Lemma 4 also holds for entrywise limits of these weights. All sums used in this section are finite, so such limits commute with the summations. For a member \(G\) of the laminar family, an exact equality \(\sum_{i\in G}z_i=l\) can be imposed by multiplying its factor by the positive log-concave sequence \[u^{|\sum_{i\in G}z_i-l|}, \qquad 0<u<1,\] followed by \(u\downarrow0\). We will take limits only after applying the positive-factor argument, including all divisions in its proof.

Application to the softened table weights

Recall the weights \(h_j(x,y)\) from (8), on small-cell counts of total \[p=\sum_{s\ \mathrm{small}}b_s.\] Here and below each small cell contributes two count coordinates, one for its row view and one for its column view.

Corollary 5. For \(0\le j\le H\), the matrix of two-removal weights of \(h_j\) at every box-valid display of total \(p+2\) has at most one positive eigenvalue. The corresponding two-addition matrix at every box-valid display of total \(p-2\) has the same property.

Proof. Introduce a finite physical interval \([\ell_s,\ell_s+M_s]\) for every retained cell. For small and free cells take \([0,b_s]\), and for a tree cell take \[[\ell_s,\ell_s+M_s]=[-10db_s,10db_s].\] Lemma 2 shows that these tree intervals contain every completion required by the definition of \(h_j\). Represent a physical row-view value as \(\ell_s+x_s\) and a physical column-view value as \(\ell_s+M_s-y_s\), where \(0\le x_s,y_s\le M_s\). The two views agree when \(x_s+y_s=M_s\). Use the full total slice \[\sum_s(x_s+y_s)=\sum_sM_s.\]

For a row or column vertex \(v\), let \(\kappa_v\) be its prescribed margin and write its physical line sum as \[L_v(x,y)= \begin{cases} \sum_{s\ni v}(\ell_s+x_s),&v\text{ is a row},\\ \sum_{s\ni v}(\ell_s+M_s-y_s),&v\text{ is a column}. \end{cases}\] For \(0<\alpha<1\), give each box-valid profile on the full total slice the positive weight \[ \alpha^{\sum_{v\text{ nonroot}}|L_v-\kappa_v|} 2^{-\frac{jA}{H}\left( \sum_{v\text{ root}}|L_v-\kappa_v| +\sum_{t\in\mathcal T} \frac{\mathop{\mathrm{dist}}(\ell_t+x_t,[0,b_t])}{b_t}\right)}. \tag{19}\] Each factor is log-concave in its indicated coordinate sum. Row factors use disjoint groups of \(x\) coordinates, and column factors use disjoint groups of \(y\) coordinates. These two collections are also disjoint from one another. The only additional factors are unary tree factors, each nested in its row group. Thus the entire family is laminar. Letting \(\alpha\downarrow0\) imposes every nonroot equation exactly while retaining the root and tree penalties.

Sum every large-cell pair at balance. The widths of all summed pairs are positive. The remaining total is \(p\). For every small count profile on that slice and every free-cell assignment, the exact nonroot equations have a unique tree completion, and it lies in the chosen intervals by Lemma 2. Therefore, in the equality limit, each free assignment contributes exactly one term, with precisely the root and tree penalty defining \(h_j\); there is no multiplicity from tree coordinates. The removal assertion follows from Lemma 4 and passage to a finite limit. Reflecting all coordinates, including those that are summed, gives the addition assertion by the same lemma. ◻

Tree marginals and contamination

For a tree cell \(t\), let \(a_t(k)\) be the unnormalized marginal mass of its physical value \(k\) under the final weighted sum \(C(H)\). Explicitly, \[ a_t(k)= \sum_{\substack{x_s+y_s=b_s\ \text{for every small }s\\ 0\le z_e\le b_e\ \text{for every free }e\\ z_t(x,y,z)=k}} 2^{-D(x,y,z)}. \tag{20}\] The sums are over integer profiles, and the tree value in the constraint is the unique nonroot completion. In particular \(\sum_k a_t(k)=C(H)\).

Lemma 6 (Log-concave tree marginals). For integers \(v<k<w\) such that \(a_t(v),a_t(w)>0\), \[ a_t(k)\ge a_t(v)^{(w-k)/(w-v)} a_t(w)^{(k-v)/(w-v)}. \tag{21}\] Consequently the positive support of \(a_t\) is an integer interval.

Proof. Use the finite interval representation and positive weight (19) at \(j=H\), with \(0<\alpha<1\). Sum every cell pair except \(t\) at balance. All retained cells have positive width, including small cells of bound one, so Lemma 4 applies. The remaining required total is \(M_t\). Let \(a_{t;\alpha}(k)\) be the resulting weight of the retained balanced pair with physical value \(k\), for \(\ell_t\le k\le\ell_t+M_t\). It is positive throughout this integer interval: after fixing the retained pair, any balanced choices for all other pairs satisfy the boxes and total slice, and every factor is positive. Exact nonroot equations are not required before taking the limit.

At an interior value \(k\), the retained profile is \[(k-\ell_t,\ \ell_t+M_t-k).\] Adding one to both coordinates gives a box-valid display two above its required total. Lemma 4 applied to the two remaining coordinates gives the matrix \[\begin{pmatrix} a_{t;\alpha}(k-1)&a_{t;\alpha}(k)\\ a_{t;\alpha}(k)&a_{t;\alpha}(k+1) \end{pmatrix}\] with at most one positive eigenvalue. Its positive trace implies a nonpositive determinant, so \[a_{t;\alpha}(k)^2 \ge a_{t;\alpha}(k-1)a_{t;\alpha}(k+1).\] All these marginal masses are positive. Their logarithms therefore have nonincreasing successive differences, which proves global interpolation between any two values in the interval.

Now let \(\alpha\downarrow0\). The sums are finite, and the surviving profiles satisfy every nonroot equation. For each balanced small profile and free assignment those equations have exactly one tree completion, contained in the chosen intervals by Lemma 2. The surviving weight is exactly \(2^{-D}\). Consequently, term by term, \[a_{t;\alpha}(k)\longrightarrow a_t(k).\] Pass the global interpolation inequality to this limit. For positive limiting endpoint masses its right-hand side is positive, giving (21) and ruling out any internal support gap. No inference from adjacent inequalities alone after the limit is needed. ◻

We can now finish the comparison between the softened count and the number of feasible tables. The endpoint attainability obtained by tightening supplies the two positive marginal masses needed below.

Proof of Proposition 3. Expand \(C(H)\) over balanced small profiles and free integer vectors, giving each assignment mass \(2^{-D}\). The forest equations determine one tree vector for each such assignment. It represents a feasible table exactly when every root deviation is zero and every tree value belongs to its allowed interval. These assignments each have mass one, so \(C(H)\ge Z\ge1\). The total number of assignments is \(\prod_{s\in\mathcal S}(b_s+1)\prod_{e\in\mathcal F}(b_e+1)\le2^K\), and every mass is at most one.

Call an assignment far if a root deviation is nonzero or a tree value has distance at least \(\gamma b_t\) from \([0,b_t]\). A nonzero root deviation is an integer of absolute value at least one. Since \(\gamma<1\) and \(A\gamma\ge4K\), every far assignment has \(D\ge4K\). The total mass of all far assignments is therefore at most \(2^K2^{-4K}=2^{-3K}\le\varepsilon/128\). Because \(C(H)\ge1\), this also bounds its fraction of the total mass.

For each tree cell \(t\), its marginal satisfies \[\sum_{k\in\mathbb Z}a_t(k)=C(H),\qquad 0\le a_t(k)\le2^K,\qquad a_t(0),a_t(b_t)\ge1.\] The endpoint inequalities follow from endpoint attainability after tightening and the unit mass of each feasible table. If \(k<0\) and \(a_t(k)>0\), use (21) from \(k\) toward \(b_t\). For every integer \(0\le r\le\lfloor(b_t-k)/K\rfloor\), writing \(\alpha=r/(b_t-k)\le1/K\), the endpoint cases and interpolation give \[a_t(k+r)\ge a_t(k)^{1-\alpha}a_t(b_t)^\alpha \ge a_t(k)\,2^{-K\alpha}\ge\frac{a_t(k)}2.\] All these integers lie between \(k\) and \(b_t\). Their number is \(\lfloor(b_t-k)/K\rfloor+1\ge b_t/K\), and hence \(a_t(k)/C(H)\le2K/b_t\).

For the other exterior side, let \(k>b_t\) with \(a_t(k)>0\) and interpolate toward zero. Every integer \(0\le r\le\lfloor k/K\rfloor\) satisfies \[a_t(k-r)\ge a_t(k)^{1-r/k}a_t(0)^{r/k} \ge a_t(k)\,2^{-Kr/k}\ge\frac{a_t(k)}2.\] There are \(\lfloor k/K\rfloor+1\ge b_t/K\) such integers, giving the same bound \(a_t(k)/C(H)\le2K/b_t\). The bound also holds when \(a_t(k)=0\).

On either exterior side of \([0,b_t]\), the number of integers at positive distance strictly less than \(\gamma b_t\) is \(\max\{\lceil\gamma b_t\rceil-1,0\}<\gamma b_t\). Consequently the fraction of mass with \(0<\mathop{\mathrm{dist}}(z_t,[0,b_t])<\gamma b_t\) is at most \(4\gamma K\). A union bound over at most \(d\) tree cells bounds all these near violations by \(4d\gamma K=\varepsilon/128\). Every infeasible assignment is far or has such a near tree violation. We conclude that \[\frac{C(H)-Z}{C(H)}\le\frac{\varepsilon}{64}.\] Finally, \(C(H)\le Z/(1-\varepsilon/64)\le(1+\varepsilon/32)Z\) for \(0<\varepsilon<1\), as claimed. ◻

Paired binary states and two factorial lifts

We now encode the small-cell counts by subsets of a polynomial-size binary ground set. The intended subsets select one element from each labeled pair. Several such transversals represent the same balanced count profile, so a factorial normalization is needed to recover \(C(j)\) as their total mass. Two normalizations agree on transversals but have different quadratic signatures. The first will support transport; the second will compare the masses of the defect classes through which the transport passes.

The paired encoding and its weights

Assume in the rest of this section that \(p\ge1\); the case \(p=0\) will be handled directly by the weight evaluator. For each small cell \(s\), introduce \(b_s\) labeled pairs, each with a row element and a column element. Number the pairs \(1,\ldots,p\), and let \(E\) be their \(2p\) elements. For a \(p\)-subset \(S\subseteq E\), write \(x_s(S),y_s(S)\) for its row and column counts in cell \(s\). For \(0\le j\le H\), define positive weights on all \(p\)-subsets by \[\begin{align*} f_j(S) &=h_j(x,y)\prod_{s\ \mathrm{small}}\frac{x_s!\,y_s!}{b_s!}, \\ \widetilde f_j(S) &=h_j(x,y)\prod_{s\ \mathrm{small}} \frac{(b_s-x_s)!\,(b_s-y_s)!}{b_s!}. \tag{22}\end{align*}\] All factorial arguments lie between zero and \(b_s\). We suppress \(j\) when it is fixed.

Let \(\mathcal A\) be the transversals, consisting of exactly one element from each labeled pair. For distinct pair labels \(i,l\), let \(\mathcal A_{il}\) consist of sets with pair \(i\) empty, pair \(l\) full, and every other pair singly occupied. On a transversal \(x_s+y_s=b_s\), so both lifts have the same factorial multiplier \(1/\binom{b_s}{x_s}\) in cell \(s\). There are exactly \(\prod_s\binom{b_s}{x_s}\) transversals with a given balanced count profile. Consequently \[ \sum_{S\in\mathcal A}f(S) =\sum_{S\in\mathcal A}\widetilde f(S) =C(j). \tag{23}\]

For example, in a cell of bound three, the balanced counts \((2,1)\) are represented by the three choices of which labeled pair uses its column element. Each transversal has factorial factor \(2!1!/3!=1/3\), so their total contribution is exactly the original count weight. This cancels the multiplicity among transversals; it does not count all subsets with the same coordinate counts. For instance, these counts also occur in subsets with one empty pair and one full pair.

Put \(q=W^2\). On the enlarged state space used later, \[ q^{-1}f(S)\le\widetilde f(S)\le qf(S), \qquad S\in\mathcal A\cup\bigcup_{i\ne l}\mathcal A_{il}. \tag{24}\] To see this, first suppose the empty and full pairs lie in the same cell. Every cell remains balanced, and the ratio is one. Otherwise one cell has count sum \(b_s-1\), contributing \((x_s+1)(y_s+1)\) to \(\widetilde f/f\), and another has count sum \(b_s+1\), contributing \(1/(x_sy_s)\). Both positive integer products in this quotient lie between one and \(W^2\), since the small bounds are less than \(W\). Their quotient is therefore in \([W^{-2},W^2]\). We do not assert (24) outside this enlarged state space; the signature properties below, in contrast, hold on the full \(p\)-subset domain.

Binary signatures and their closure properties

For a positive weight \(F\) on all \(k\)-subsets of a finite set, the addition property means the following. After fixing any \(k-2\) included elements, the symmetric matrix whose off-diagonal \(i,h\) entry is the weight obtained by including the two further distinct elements \(i,h\), and whose diagonal is zero, has at most one positive eigenvalue. For \(k<2\) the property is vacuous. The omission property is the addition property of the complement-set weight.

For a positive weight on every \(k\)-subset, the addition property is the Lorentzian criterion for the multiaffine generating polynomial \(\sum_S F(S)\prod_{i\in S}z_i\); the omission property applies to the complement-set polynomial (Brändén and Huh 2020, Theorem 2.25). Summing a pair \(\{a,b\}\) at occupancy one corresponds to applying \(\partial_a+\partial_b\) and then setting \(z_a=z_b=0\). Both operations preserve the Lorentzian property by (Brändén and Huh 2020, Theorem 2.10 and Corollary 2.11). The matrix proof below also keeps track of the full index set before that specialization, as required for the three-pair defect inequality.

Lemma 7 (Binary contractions). The addition property, with positivity on the entire valid-degree domain, is preserved by fixing elements included or excluded and by summing a two-element group at occupancy one. The same assertions hold for the omission property. In addition, the cubic contraction used to sum a pair has at most one positive eigenvalue on its full remaining index set, before the contracted pair’s indices are removed.

Proof. Fixing inclusions enlarges the set of fixed elements in the quadratic test, and fixing exclusions restricts that test to a principal submatrix. Positivity is retained whenever the residual degree is valid.

We prove the contraction assertion through a symmetric cubic tensor. Suppose \(T_{iuh}\) is positive on triples of distinct indices and zero on repetitions, and every slice \(T_i=(T_{iuh})_{u,h}\) has at most one positive eigenvalue. There are at least three indices. For a vector \(a\) with all entries positive, set \[M=\sum_i a_iT_i.\] Tensor symmetry gives \[a^{\mathsf T}T_i a=(Ma)_i>0, \qquad h^{\mathsf T}T_i a=(Mh)_i.\] The strict inequality holds even with exactly three indices: the two indices other than \(i\) give a strictly positive term. Applying (10) to every slice and then summing with coefficients \(a_i\) yields \[ h^{\mathsf T}Mh \le \sum_i\frac{a_i(Mh)_i^2}{(Ma)_i} =h^{\mathsf T}MD_*^{-1}Mh, \qquad D_*=\operatorname{diag}\left(\frac{(Ma)_i}{a_i}\right). \tag{25}\] Thus the symmetric matrix \(M'=D_*^{-1/2}MD_*^{-1/2}\) satisfies \(M'\preceq(M')^2\). It has the positive eigenvector \(u=D_*^{1/2}a\) with eigenvalue one. Every off-diagonal entry of \(M\), and hence of \(M'\), is strictly positive, because a third distinct index contributes a positive term. The matrix with entries \(M'_{ih}u_h/u_i\) is therefore irreducible and row-stochastic. The maximum principle bounds the absolute values of its real eigenvalues by one and shows that its eigenvalue-one eigenspace consists of the constant vectors. Since \(M'\) is symmetric, eigenvalue one is simple. On the other hand, (25) requires every eigenvalue \(\lambda\) of \(M'\) to satisfy \(\lambda\le\lambda^2\), so a positive eigenvalue must be at least one. There can consequently be only one positive eigenvalue. Positive diagonal congruence gives the same conclusion for \(M\). For nonnegative \(a\), replace it by \(a+\varepsilon\mathbf 1\) and pass to the matrix limit as \(\varepsilon\downarrow0\). This establishes the full-matrix contraction assertion.

Now sum a pair \(\{\alpha,\beta\}\) at occupancy one in a positive weight \(F\) on \(k\)-subsets: \[F^\downarrow(U)=F(U\cup\{\alpha\})+F(U\cup\{\beta\}), \qquad |U|=k-1,\quad U\cap\{\alpha,\beta\}=\varnothing.\] If \(k-1<2\), the desired addition property is vacuous. Otherwise fix \(k-3\) included elements outside the pair. The remaining three-element weights form a tensor \(T\) of the kind just considered. Each slice is an addition matrix of \(F\), with a zero row and column at its fixed index. Contract with the indicator of \(\{\alpha,\beta\}\). Restricting the resulting full matrix to the other indices gives exactly the addition matrix of \(F^\downarrow\). The result is therefore valid. Every valid residual weight is a sum of positive terms, so positivity also persists.

Finally, complementation interchanges fixed inclusions with fixed exclusions and preserves occupancy one in a two-element pair. Applying the addition argument to complement weights proves all the omission assertions. ◻

Lemma 8 (Signatures of the two lifts). The weight \(f_j\) has the omission property, and \(\widetilde f_j\) has the addition property. These properties and positivity remain valid after fixing any included or excluded elements and summing any disjoint labeled pairs at occupancy one, whenever the residual degree is valid. All assertions concern the full valid-degree subset domain.

Proof. The case \(p=1\) is immediate for the original two properties, so consider a quadratic test when it is nonvacuous. For the omission property of \(f\), fix \(p-2\) omitted elements. This leaves a display of \(p+2\) elements from which two must be removed. Group its elements by small-cell row or column coordinate, and write \(n_u\) for the number in group \(u\).

Within a group, all distinct-copy matrix entries are equal, and the diagonal entries are zero. Vectors whose entries sum to zero in each group have nonpositive square: in each group the form is a nonnegative multiple of \(\mathbf 1\mathbf 1^{\mathsf T}-I\). These vectors have no coupling to vectors that are constant within each group. It remains to examine the latter subspace.

Let its value on group \(u\) be \(t_u\). For distinct groups \(u,v\), the \(n_un_v\) ordered-copy multiplicity cancels the two factorial reductions when passing from displayed counts \(n\) to \(n-e_u-e_v\). For a single group \(u\), the multiplicity \(n_u(n_u-1)\) similarly cancels the factorial reduction for two removals. If \(n_u<2\) this term is zero. The resulting quadratic form is exactly \[\frac{\prod_u n_u!}{\prod_s b_s!} \sum_{u,v} h_j(n-e_u-e_v)t_ut_v,\] with zero entries for invalid removals. By Corollary 5, it has at most one positive eigenvalue. Together with the nonpositive group-sum-zero subspace, this proves the omission property of \(f\).

For the addition property of \(\widetilde f\), fix \(p-2\) included elements, with coordinate counts \(r_u\). There are \(n_u=b_u-r_u\) available elements in coordinate group \(u\), where \(b_u=b_s\) for either coordinate of cell \(s\). After adding two elements, the factorial numerator of \(\widetilde f\) is the product of the remaining-capacity factorials. The same group decomposition and the same multiplicity cancellation therefore give, up to a common positive scalar, the form \[\sum_{u,v}h_j(r+e_u+e_v)t_ut_v.\] Invalid additions give zero entries. The addition assertion of Corollary 5 proves that this form has at most one positive eigenvalue. The group-sum-zero subspace again contributes only nonpositive squares. This proves the addition property of \(\widetilde f\).

All \(p\)-subset weights in (22) are strictly positive. The closure assertions now follow from Lemma 7, applied respectively in omission and addition variables. ◻

Remark 9 (The two signature roles are distinct). Even with a constant count weight, the factorial construction need not give \(f\) the addition property. For example, take two small cells with bounds \(3\) and \(2\), with base weight \(h\equiv1\), so the binary ground set has ten elements and \(p=5\). Fix as included the three row elements of the first cell. The seven remaining elements are its three column elements and the four elements of the second cell. In the addition matrix of \(f\), restrict to vectors with common value \(a\) on the first group of three and common value \(b\) on the second group of four. Direct substitution in (22) gives the quadratic form \[6a^2+12ab+8b^2.\] Its coefficient matrix \(\left(\begin{smallmatrix}6&6\\6&8\end{smallmatrix}\right)\) is positive definite, with determinant \(12\). Thus this addition matrix has at least two positive eigenvalues. The omission property of \(f\) and the addition property of \(\widetilde f\) are the respective assertions needed below.

Figure 1 illustrates the paired state space, the agreement of the lifts on transversals, and their distinct signature roles.

The paired state space and the two factorial lifts, illustrated with four pairs. The lifts agree on transversals. Their comparison within a factor \(q\) is used only on transversals and one-defect types. The distinct signature properties support the two different parts of the argument shown below the states.

Defect masses and pair inequalities

Fix \(j\), put \(C=C(j)\), and suppress the parameter on both lifts. A partial transversal assignment \(\sigma\) specifies one chosen element in each of a collection of labeled pairs. A set respects \(\sigma\) when its intersection with every assigned pair is precisely that chosen element. For unassigned distinct pair labels \(i,l\), define \[\begin{align*} z_\sigma &=\sum_{\substack{S\in\mathcal A\\S\text{ respects }\sigma}}f(S) =\sum_{\substack{S\in\mathcal A\\S\text{ respects }\sigma}} \widetilde f(S),\\ c_{il}^{\sigma} &=\sum_{\substack{S\in\mathcal A_{il}\\ S\text{ respects }\sigma}}f(S), \qquad \widetilde c_{il}^{\sigma} =\sum_{\substack{S\in\mathcal A_{il}\\ S\text{ respects }\sigma}}\widetilde f(S). \end{align*}\] These masses are positive. For the empty assignment we write \(c_{il},\widetilde c_{il}\) without a superscript and have \(z_\varnothing=C\).

Lemma 10 (Pair inequalities for defect masses). For every partial assignment \(\sigma\) and distinct unassigned labels \(i,l\), \[ 4\widetilde c_{il}^{\sigma}\widetilde c_{li}^{\sigma} \le z_\sigma^2. \tag{26}\] For three distinct unassigned labels \(i,l,k\), \[ \widetilde c_{il}^{\sigma}\widetilde c_{lk}^{\sigma} \le z_\sigma\widetilde c_{ik}^{\sigma}. \tag{27}\]

Proof. Fix the inclusions and exclusions specified by \(\sigma\). For (26), sum every other unassigned pair at occupancy one, leaving only \(i,l\). By Lemma 8, the remaining positive two-element weight has an addition matrix with at most one positive eigenvalue. Restrict its quadratic form to vectors constant on each of the two pairs. The resulting matrix is \[\begin{pmatrix} 2\widetilde c_{li}^{\sigma}&z_\sigma\\ z_\sigma&2\widetilde c_{il}^{\sigma} \end{pmatrix}.\] The diagonal factor two counts the two orders of the elements in a full pair; the off-diagonal sums exactly the transversals. The matrix has positive trace and at most one positive eigenvalue, so its determinant is nonpositive. This proves (26).

For (27), sum every other unassigned pair at occupancy one, leaving the six elements in \(i,l,k\) and a positive weight on their three-element subsets. Form its symmetric cubic tensor, zero on repeated indices. Contract it along the indicator of the two elements of pair \(k\). By the full-matrix assertion of Lemma 7, the resulting matrix has at most one positive eigenvalue even while the two contracted indices are retained. Restrict its form to vectors constant on each pair, and call the resulting three-by-three matrix \(N\), indexed by \(i,l,k\). Its relevant entries are \[ N_{ll}=2\widetilde c_{il}^{\sigma}, \qquad N_{ik}=2\widetilde c_{lk}^{\sigma}, \qquad N_{il}=z_\sigma, \qquad N_{lk}=2\widetilde c_{ik}^{\sigma}. \tag{28}\] For example, in \(N_{ik}\) the full pair \(k\) can contribute either of its elements to the contraction and the other to the matrix index, explaining the factor two. All entries of \(N\) are nonnegative, and \(N_{ll}>0\).

By (10), the Schur complement against the \(l,l\) entry is negative semidefinite. Its two remaining coordinates \(i,k\) therefore satisfy \[\begin{align*} N_{ik} &\le \frac{N_{il}N_{lk}}{N_{ll}} +\sqrt{ \left(\frac{N_{il}^2}{N_{ll}}-N_{ii}\right) \left(\frac{N_{lk}^2}{N_{ll}}-N_{kk}\right)}\\ &\le \frac{2N_{il}N_{lk}}{N_{ll}}. \end{align*}\] The square-root factors are nonnegative by the same Schur complement condition. The second inequality uses \(N_{ii},N_{kk}\ge0\) and the nonnegativity of the off-diagonal entries. Substituting (28) gives (27). ◻

The omission property of \(f\) is the input to the one-hole transport argument in Section 5; it applies even to auxiliary completions outside the enlarged state space. The two addition-based inequalities just proved control the conditional and unconditional one-defect masses used to bound transversal variance and defect means. The comparison of the lifts is used only on the actual transversal and one-defect classes where (24) holds.

The matrices and balanced sums used to prove the signature properties are analytic devices. The algorithm will neither form these matrices nor enumerate their underlying coordinate boxes.

Transport, observable variance, and trace mixing

Fix an annealing parameter \(j\) and suppose that \(p\geq 1\). Write \(f=f_j\), \(\widetilde f=\widetilde f_j\), and \(C=C(j)\). We use the paired ground set, transversal class \(\mathcal A\), defect classes \(\mathcal A_{il}\), and their conditional masses from Section 4. In particular, \(f\) is positive on all \(p\)-subsets of the \(2p\) elements, and has the omission property. The second lift \(\widetilde f\) has the addition property. They agree on transversals and satisfy the comparison (24), with \(q=W^2\), on the state space \[\mathcal X=\mathcal A\,\cup\! \bigcup_{\substack{1\leq i,l\leq p\\i\ne l}}\mathcal A_{il}.\] We give signed-flow, observable-variance, and trace arguments for these two lifts, keeping track of the comparison factors and of the domains on which they are needed. The flow-energy and trace viewpoints are classical; see Aldous and Fill (Aldous and Fill 2002, sec. 2.7.1 and 3.7.1). The transport inequality first bounds transversal variance and defect means; together these control the particular trajectory averages used by the algorithm. The transversal variance bound also gives mixing of the transversal trace, whose return-time analysis bounds its cost.

We adapt the paired-transversal transport and observable/trace analysis for counting common bases of two matroids in (OpenAI 2026a, secs. 4–6). Here the two required signature properties belong to separate lifts. Their comparison contributes the factors \(q^2\) and \(q^3\) in the transversal-variance and defect-mean bounds below. We give the complete argument for these weights.

The enlarged Metropolis chain

For each ordered pair \(i\ne l\), choose a positive multiplier \(w_{il}\), and put \[\lambda(S)= \begin{cases} f(S),&S\in\mathcal A,\\ w_{il}f(S),&S\in\mathcal A_{il}. \end{cases} \qquad \Lambda=\sum_{S\in\mathcal X}\lambda(S), \qquad \pi(S)=\frac{\lambda(S)}{\Lambda}.\] Call the multipliers good if \[ \frac{C}{4c_{il}}\leq w_{il}\leq\frac{4C}{c_{il}} \qquad(i\ne l). \tag{29}\] For good multipliers, \[ \Lambda\leq \bigl(1+4p(p-1)\bigr)C\leq 5p^2C, \qquad \pi(\mathcal A)\geq\frac{1}{5p^2}, \qquad \pi(\mathcal A_{il})\geq\frac{1}{20p^2}. \tag{30}\] Indeed, a defect type has total multiplied mass between \(C/4\) and \(4C\), and the transversal mass is \(C\). When \(p=1\) there are no defect types; all assertions concerning them are omitted.

The chain holds with probability \(1/2\). Otherwise it independently chooses one uniform element of \(S\) and one uniform element of its complement and proposes to exchange them. A proposal outside \(\mathcal X\) is rejected. A proposal \(S'\) in \(\mathcal X\) is accepted with probability \(\min\{1,\lambda(S')/\lambda(S)\}\). Denote its transition operator by \(P\). Every defect state can reach a transversal by moving one element of its full pair to its empty pair. Transversals are connected by flips within individual pairs. Positivity of \(\lambda\) therefore makes the chain irreducible. Its holding probability is at least \(1/2\). For distinct exchange neighbors, \[\pi(S)P(S,S')= \frac{\min\{\lambda(S),\lambda(S')\}}{2p^2\Lambda},\] so \(P\) is reversible with stationary law \(\pi\). For a real function \(g\) on \(\mathcal X\), define \[\begin{align*} \mathfrak D(g) &=\sum_{\{S,S'\}} \min\{\lambda(S),\lambda(S')\} \bigl(g(S)-g(S')\bigr)^2, \\ \mathcal E(g) &=\langle g,(I-P)g\rangle_\pi =\frac{\mathfrak D(g)}{2p^2\Lambda}. \tag{31}\end{align*}\] The sum is over unordered exchange edges in \(\mathcal X\). This convention will be used throughout the section.

A transport inequality on one-hole states

The next lemma uses the omission property of \(f\) on its full domain. Some configurations contributing to its auxiliary masses need not belong to \(\mathcal X\). Its applications will identify the one-hole states and their conductances with actual states and conductances of the Metropolis chain.

Lemma 11 (One-hole transport). Fix disjoint sets of included and excluded elements. Let \(F\) be the set of fixed inclusions, and partition the remaining elements into two singleton slots \(P_0,P_1\) and \(s\) ordinary slots of two elements each. Assume \(|F|+s+1=p\). Let \(\mathcal X_{\mathrm{sl}}\) consist of the sets that respect the fixed assignments and select one element from every slot except one hole slot, from which they select nothing. Give a state with hole slot \(i\) weight \(W_i f(S)\), where every \(W_i\) is positive. For a real function \(g\) on \(\mathcal X_{\mathrm{sl}}\), let \(D_{\mathrm{sl}}(g)\) be the unordered-edge energy on its single-exchange graph, with conductance equal to the minimum of the two endpoint weights.

Let \(s_0,s_1\) be the unmultiplied \(f\)-masses of the states with hole \(P_0,P_1\), and let \(\bar g_0,\bar g_1\) be their respective \(f\)-weighted means. For each ordinary slot \(t\), let \(v_t\) be the unmultiplied mass of sets that omit both singleton slots, select both elements of \(t\), and select one element from every other ordinary slot, while respecting the fixed assignments. Then \[ (\bar g_0-\bar g_1)^2 \leq \left( \frac{1}{s_0W_{P_0}}+\frac{1}{s_1W_{P_1}} +\frac{2}{s_0s_1}\sum_t\frac{v_t}{W_t} \right)D_{\mathrm{sl}}(g). \tag{32}\] The notation \(W_i\) here denotes slot multipliers, independently of the capacity threshold \(W\).

Proof. We seek a signed edge current whose divergence is \(f(S)/s_0\) at states with hole \(P_0\), \(-f(S)/s_1\) at states with hole \(P_1\), and zero at all ordinary-hole states. Orient each edge once, write \(I_{SS'}\) for its signed current, and write \(c_{SS'}\) for its conductance. Such a current satisfies, by summation by parts and Cauchy–Schwarz, \[ \begin{split} (\bar g_0-\bar g_1)^2 &=\left(\sum_{\{S,S'\}} I_{SS'}\bigl(g(S)-g(S')\bigr)\right)^2\\ &\leq \left(\sum_{\{S,S'\}}\frac{I_{SS'}^2}{c_{SS'}}\right) D_{\mathrm{sl}}(g). \end{split} \tag{33}\] It therefore suffices to bound its flow energy by the coefficient in (32).

The local routing step explains the energy quantity we will use. A complete display \(R\) contains the two singleton elements and one chosen element from every ordinary slot. Its one-hole sets \(S_i=F\cup(R\setminus\{i\})\), \(i\in R\), form a clique of exchange edges. For an element \(i\), write \(W_i\) for its slot’s multiplier. Put \(m_i=f(S_i)\). For any coefficients \(h_i\) with \(\sum_i m_i h_i=0\), regard \(m_i h_i\) as the prescribed signed divergence at \(S_i\). Choose a hub \(h_*\) maximizing \(W_i m_i\), and send current \(m_i h_i\) from each nonhub \(S_i\) to the hub. Balance gives the prescribed divergence at the hub as well. Each used edge has conductance \(W_i m_i\) at its nonhub endpoint, so this routing has energy at most \[\sum_{i\ne h_*}\frac{(m_i h_i)^2}{W_i m_i} \leq\sum_{i\in R}\frac{m_i h_i^2}{W_i}.\] We now assign these balanced demands recursively. Their sum over complete displays will have the required source and sink divergences; the recursion will also bound the sum of their routing energies.

Fix an order of the ordinary slots. Initially display the two singleton elements. Expose ordinary slots in that order, branching into two children according to which element of the next slot is added to the display. At a node write \(R\) for its displayed elements, excluding \(F\). For \(i\in R\), let \(m_i\) be the sum of \(f\) over sets that contain \(F\cup(R\setminus\{i\})\), omit the nondisplayed mates in already processed slots, and have single occupancy in every unprocessed ordinary slot. These sets all have size \(p\), and \(m_i>0\). At a complete display this definition reduces to \(m_i=f(S_i)\). Maintain coefficients \(h_i\), interpreted as demand per unit unmultiplied weight, satisfying \[ \sum_{i\in R}m_i h_i=0. \tag{34}\] At the root their values are \(1/s_0\) and \(-1/s_1\) at the elements of \(P_0\) and \(P_1\), respectively. Assign the node the potential \[\Psi(R,h)=\sum_{i\in R}\frac{m_i h_i^2}{W_i}.\] At a leaf this potential bounds the routing energy just computed. Each \(W_i\) is fixed by its slot throughout the recursion. These multipliers enter the energy bound and the eventual hub choice, but not the recursive coefficients or prescribed divergences.

Suppose the next slot \(t\) has elements \(a,b\). For an old hole \(i\in R\), let \(m_i^a,m_i^b\) be its masses in the two children. Then \(m_i^a+m_i^b=m_i\). The mass of the newly introduced hole, at \(a\) in the first child and at \(b\) in the second, is the same positive number \(u\): in either case the entire slot \(t\) is empty. Put \(X=\sum_{i\in R}h_i m_i^a\). Retain every old coefficient unchanged, and give the new hole coefficient \(-X/u\) in the \(a\) child and \(X/u\) in the \(b\) child. Equation (34) holds in both children because \(\sum_i h_i m_i^b=-X\). The sum of their potentials exceeds the parent potential by exactly \[ \frac{2X^2}{uW_t}. \tag{35}\]

We bound these increments using the omission signature. At any node, and for any unprocessed ordinary slot \(t\), define a symmetric matrix \(V_t(R)\) on the displayed elements, with zero diagonal. For distinct \(i,k\in R\), its entry is the sum of \(f\) over configurations with holes at \(i,k\) in the display, double occupancy in slot \(t\), and single occupancy in every other unprocessed slot. Fixed inclusions, exclusions, and previously excluded mates remain in force. All these configurations have size \(p\).

When \(t=\{a,b\}\) is the next slot, \(V_t(R)\) is the old block of \[N=\begin{pmatrix} V_t(R)&(m_i^b)_{i\in R}&(m_i^a)_{i\in R}\\ (m_i^b)_{i\in R}^{\mathsf T}&0&u\\ (m_i^a)_{i\in R}^{\mathsf T}&u&0 \end{pmatrix}.\] This form has at most one positive eigenvalue. To see the precise application, fix the context and exclude the nondisplayed mates of processed slots. Sum all unprocessed ordinary slots other than \(t\) at occupancy one. On the remaining ground set \(R\cup\{a,b\}\) the resulting degree is \(|R|\), so \(N\) is its two-omission matrix. Lemmas 8 and 7 give the asserted signature. In particular, this argument uses the full-domain weight \(f\) even when an entry of \(V_t(R)\) describes multiple empty and full original pairs. No comparison with \(\widetilde f\) is made here.

Extend \(h\) by zero at \(a,b\) and put \(d_{ab}=e_a-e_b\). The vector \(e_a+e_b\) has square \(2u>0\) under \(N\). Both \(h\) and \(d_{ab}\) are orthogonal to it in this form, since (34) holds and the two new diagonal entries are zero. A symmetric form with at most one positive eigenvalue is nonpositive on the form-orthogonal complement of a positive-square vector: another positive-square vector in that complement would span a positive definite plane with the first vector. On the complement, Cauchy–Schwarz for the negative of the form applies. Here \[h^{\mathsf T}N d_{ab}=-2X, \qquad d_{ab}^{\mathsf T}N d_{ab}=-2u, \qquad h^{\mathsf T}Nh=h^{\mathsf T}V_t(R)h.\] Consequently \[ \frac{2X^2}{u}\leq -h^{\mathsf T}V_t(R)h. \tag{36}\]

Fix now a slot \(t\) to be processed at a later level. When a preceding slot is split, the sum of the two child quantities \(h^{\mathsf T}V_t(R)h\) equals the parent quantity. The old entries split additively. A cross entry involving the new hole represents a configuration in which the split slot is empty, so it is identical in the two children. Its contributions cancel because the new coefficients are opposite and all old coefficients are retained. There is no new diagonal contribution. Iterating this identity shows that, immediately before processing \(t\), the sum of these quadratic quantities over the whole level is their value at the root. The root matrix has off-diagonal entry \(v_t\) and zero diagonal, so that value is \(-2v_t/(s_0s_1)\). By (35) and (36), the total potential increase at the level of slot \(t\) is at most \(2v_t/(s_0s_1W_t)\). The root potential is \(1/(s_0W_{P_0})+1/(s_1W_{P_1})\). Thus the sum of all leaf potentials is bounded by the parenthetical coefficient in (32).

Route the prescribed demands at every leaf by the clique construction above. Its energy is at most \(\Psi(R,h)\). Different leaves cannot use the same edge: the union of two distinct endpoints of a leaf edge is exactly \(F\cup R\), and so determines the entire display and its unique sequence of choices. Hence the assembled flow has energy at most the sum of the leaf potentials.

It remains to identify the divergence after summing the leaf flows. A state with a singleton hole has one leaf representation; its divergence is \(f(S)/s_0\) or \(-f(S)/s_1\). A state \(S\) with an ordinary hole at slot \(t\) has exactly two representations, obtained by adjoining either element of \(t\) to \(S\setminus F\). Every other displayed ordinary choice is fixed by \(S\). The two histories agree before processing \(t\), so the same \(X,u\) create opposite coefficients there. Those coefficients remain unchanged at every later branch, regardless of the later masses and new coefficients. At the leaves both masses are exactly \(f(S)\), and their divergences cancel. This reasoning also applies if the state is a hub in either leaf, since its net divergence is still \(m_i h_i\). The assembled flow therefore has the required divergence, and (33) together with the leaf-potential bound proves (32). If \(s=0\), the root is already a complete display and the same clique argument applies directly. ◻

Variance on transversals

Assume henceforth that the multipliers are good, and write \[\mu(S)=\frac{f(S)}{C}\quad(S\in\mathcal A), \qquad C_{\mathrm p}=p(1+8pq^2).\] The variance under \(\mu\) of a function on \(\mathcal X\) refers to its restriction to \(\mathcal A\).

Proposition 12. Suppose the multipliers satisfy (29). For every real function \(g\) on \(\mathcal X\), \[ C\mathop{\mathrm{Var}}_\mu(g)\leq C_{\mathrm p}\mathfrak D(g). \tag{37}\]

Proof. We decompose the transversal variance along a tree of partial assignments, choosing the next pair as a function of the current assignment. Let \(\sigma\) fix some pairs to specified single choices. For distinct unassigned labels define \[a_{il}= \frac{\widetilde c_{il}^{\sigma}}{z_\sigma} \frac{\widetilde c_{li}}{C}.\] Lemma 10 gives \[ a_{il}a_{li}\leq\frac1{16}, \qquad a_{il}a_{lk}\leq a_{ik} \quad\text{for distinct }i,l,k. \tag{38}\] For the second inequality, use the conditional defect inequality on the first factors and the unconditioned inequality with indices \(k,l,i\) on the second factors. Form a directed graph with arc \(i\to l\) when \(a_{il}>1\). It has no directed two-cycle. A shortest longer directed cycle could be shortened using the second inequality in (38), also a contradiction. Thus this graph has a sink \(k\), for which \(a_{kt}\leq1\) at every other unassigned label \(t\). If only one label remains, choose it as \(k\).

Branch on the two choices in pair \(k\). Apply Lemma 11 with the two elements of \(k\) as singleton slots, both of multiplier one, and with the other unassigned pairs as ordinary slots. Keep \(\sigma\) fixed. A singleton-hole state is a transversal respecting \(\sigma\); an ordinary-hole state at \(t\) has type \(tk\) and multiplier \(W_t=w_{tk}\). The auxiliary doubled-slot mass is exactly \(v_t=c_{kt}^\sigma\). Thus every one-hole state in this application belongs to \(\mathcal X\) with precisely its weight \(\lambda\). The good-multiplier bound, followed by two uses of (24), gives \[\begin{align*} \frac{v_t}{W_t} =\frac{c_{kt}^\sigma}{w_{tk}} &\leq\frac{4c_{kt}^\sigma c_{tk}}{C} \leq\frac{4q^2\widetilde c_{kt}^\sigma \widetilde c_{tk}}{C} \\ &=4q^2z_\sigma a_{kt}\leq4q^2z_\sigma. \tag{39}\end{align*}\] These comparisons involve only actual defect types.

Let \(s_0,s_1\) and \(\bar g_0,\bar g_1\) be the masses and means of the two transversal children, so \(s_0+s_1=z_\sigma\). Their unnormalized between-means variance contribution is \[\frac{s_0s_1}{z_\sigma}(\bar g_0-\bar g_1)^2.\] Let \(\mathfrak D_\sigma(g)\) be the sum in (31) restricted to edges whose two endpoints respect \(\sigma\). The slot energy in this application is a subgraph energy, so it is at most \(\mathfrak D_\sigma(g)\). Multiplying (32) by \(s_0s_1/z_\sigma\) and using (39) yields \[ \frac{s_0s_1}{z_\sigma}(\bar g_0-\bar g_1)^2 \leq (1+8pq^2)\mathfrak D_\sigma(g). \tag{40}\] The first two terms in the transport coefficient contribute exactly \((s_0+s_1)/z_\sigma=1\); the ordinary slots contribute at most \(8pq^2\).

Iterate this branching until every pair is fixed. The conditional variance identity decomposes \(C\mathop{\mathrm{Var}}_\mu(g)\) as the sum of the between-means contributions over the internal nodes. At any depth, two distinct nodes disagree on the choice of the pair fixed at their first divergence. Their restricted state sets are disjoint, even if subsequent pairs were chosen in different orders. Consequently their internal edge sets are disjoint and \[\sum_{\sigma\text{ at a fixed depth}}\mathfrak D_\sigma(g) \leq\mathfrak D(g).\] An edge crossing a fixed-pair choice is internal to neither of the two resulting restrictions; it does not create a duplicate charge. There are \(p\) possible branching depths. Summing (40) proves (37). The conditioning tree and sink choices are used only in this proof. ◻

Defect means and observable variance

Set \[C_{\mathrm d}=8+32pq^3.\] For \(i\ne l\), let \(\bar g_{il}=c_{il}^{-1}\sum_{S\in\mathcal A_{il}}f(S)g(S)\).

Lemma 13. Suppose the multipliers satisfy (29), and let \(g\) be a real function on \(\mathcal X\). For each defect type \(il\) there is a conditional transversal mean \(\bar g'\) such that \[ (\bar g_{il}-\bar g')^2 \leq \frac{C_{\mathrm d}}{C}\mathfrak D(g), \qquad (\bar g'-\mathbb E_\mu g)^2\leq4\mathop{\mathrm{Var}}_\mu(g). \tag{41}\]

Proof. Of the four possible joint choices in pairs \(i,l\), choose one whose transversal mass is at least \(C/4\). Denote the selected elements by \(a_i,a_l\) and their mates by \(b_i',b_l'\). In Lemma 11, fix \(a_l\) included and \(b_i'\) excluded, and take \(P_0=\{a_i\}\), \(P_1=\{b_l'\}\). All other pairs are ordinary slots. A hole at \(P_0\) gives the entire defect type \(il\), whereas a hole at \(P_1\) gives the selected conditional transversal class. Thus \[s_0=c_{il},\quad W_{P_0}=w_{il},\qquad s_1\geq C/4,\quad W_{P_1}=1.\] An ordinary hole at \(t\) has type \(tl\), restricted to the choice \(a_i\) in pair \(i\), and has multiplier \(W_t=w_{tl}\). A doubled ordinary slot with both singleton slots empty is a subset of type \(it\), so \(v_t\leq c_{it}\). All one-hole states and their exchange edges are therefore genuine states and edges of the chain, with the same endpoint weights. Their energy is at most \(\mathfrak D(g)\).

The lift comparison and Lemma 10 give, for each ordinary slot \(t\), \[ c_{it}c_{tl} \leq q^2\widetilde c_{it}\widetilde c_{tl} \leq q^2C\widetilde c_{il} \leq q^3C c_{il}. \tag{42}\] The first two terms in the coefficient of (32) are at most \(4/C+4/C\). For its last term, (29) and (42) give \[\frac{2}{s_0s_1}\sum_t\frac{v_t}{W_t} \leq\frac{8}{c_{il}s_1C}\sum_t c_{it}c_{tl} \leq\frac{8pq^3}{s_1} \leq\frac{32pq^3}{C}.\] This proves the first inequality of (41) with \(\bar g'\) the selected conditional mean. The conditioning event has \(\mu\)-probability at least \(1/4\); conditional Cauchy–Schwarz gives \[(\bar g'-\mathbb E_\mu g)^2 \leq \mathbb E_\mu\bigl[(g-\mathbb E_\mu g)^2 \mid\text{selected choices}\bigr] \leq4\mathop{\mathrm{Var}}_\mu(g),\] which proves the second inequality. ◻

Define \(\mathcal Q\) on real functions on \(\mathcal X\) by retaining all values on \(\mathcal A\) and replacing the values on each defect type by their mean within that type. Since its multiplier is constant, the conditional \(\pi\)-mean on \(\mathcal A_{il}\) is \(\bar g_{il}\). Hence \(\mathcal Q\) is the orthogonal projection in \(L^2(\pi)\) associated with the partition into individual transversal states and entire defect types. Its range consists of functions that are arbitrary on \(\mathcal A\) and constant within each defect type. This includes type indicators and every function supported on \(\mathcal A\), the two kinds of observables used in Section 7. It preserves constants and means.

Chen, Vigoda, and Yang use a restricted variance bound for hole-pattern frequencies in permanent approximation (Chen et al. 2026, Theorem 5 and Lemma 12). Their partition pools the perfect matchings; here each transversal is retained separately, while each defect type is averaged. The inequality below controls this projection without requiring a bound on all fluctuations within a defect type. Put \[ K_{\mathrm{obs}}=10p^4(9C_{\mathrm p}+2C_{\mathrm d}). \tag{43}\]

Proposition 14 (Observable variance). Suppose the multipliers satisfy (29). For every real \(g\) on \(\mathcal X\), \[ \mathop{\mathrm{Var}}_\pi(\mathcal Qg) \leq(9C_{\mathrm p}+2C_{\mathrm d})\frac{\mathfrak D(g)}{C} \leq K_{\mathrm{obs}}\mathcal E(g). \tag{44}\]

Proof. Let \(m=\mathbb E_\mu g\). Lemma 13 and \((a+b)^2\leq2a^2+2b^2\) give \[(\bar g_{il}-m)^2 \leq\frac{2C_{\mathrm d}}{C}\mathfrak D(g) +8\mathop{\mathrm{Var}}_\mu(g).\] Variance is no larger than squared deviation about any fixed constant. Therefore \[\begin{align*} \mathop{\mathrm{Var}}_\pi(\mathcal Qg) &\leq\mathbb E_\pi[(\mathcal Qg-m)^2]\\ &=\pi(\mathcal A)\mathop{\mathrm{Var}}_\mu(g) +\sum_{i\ne l}\pi(\mathcal A_{il})(\bar g_{il}-m)^2\\ &\leq9\mathop{\mathrm{Var}}_\mu(g)+\frac{2C_{\mathrm d}}{C}\mathfrak D(g)\\ &\leq(9C_{\mathrm p}+2C_{\mathrm d})\frac{\mathfrak D(g)}{C}, \end{align*}\] using Proposition 12 in the last step. Finally, (31) and (30) give \(\mathfrak D(g)/C\leq10p^4\mathcal E(g)\). When \(p=1\) the defect sum is empty and \(\mathcal Q=I\); the same inequalities apply. ◻

Trajectory averages of the controlled observables

The covariance-sum viewpoint is classical; see Aldous and Fill (Aldous and Fill 2002, sec. 2.3). Here we derive the needed finite-time bound from the restricted observable inequality.

Lemma 15 (Time averages from a dominated initial law). Suppose the multipliers satisfy (29). Let \(G\) be a real function on \(\mathcal X\) with \(\mathcal QG=G\). Suppose \(S_0\) has law \(\nu\) satisfying \(\nu(S)\leq U\pi(S)\) for every state. For \(N\geq1\) consecutive observations of the chain, \[ \mathbb E_\nu\left[ \left(\frac1N\sum_{t=0}^{N-1}G(S_t)-\mathbb E_\pi G\right)^2 \right] \leq\frac{2UK_{\mathrm{obs}}}{N}\mathop{\mathrm{Var}}_\pi(G). \tag{45}\]

Proof. Write \(G_c=G-\mathbb E_\pi G\) and \(v=\mathop{\mathrm{Var}}_\pi(G)\). Because \(\mathcal Q\) is an orthogonal projection fixing constants, for every \(g\), \[\begin{align*} |\langle G_c,g\rangle_\pi|^2 &=|\langle G_c,\mathcal Qg-\mathbb E_\pi g\rangle_\pi|^2\\ &\leq v\mathop{\mathrm{Var}}_\pi(\mathcal Qg) \leq K_{\mathrm{obs}}v\mathcal E(g). \end{align*}\] On the mean-zero subspace, \(I-P\) is positive definite and invertible: reversibility makes \(P\) self-adjoint, and finite irreducibility makes its eigenvalue one simple. Take \(g=(I-P)^{-1}G_c\) on this subspace and put \[a=\langle G_c,(I-P)^{-1}G_c\rangle_\pi=\mathcal E(g)\geq0.\] The previous inequality gives \(a^2\leq K_{\mathrm{obs}}va\), and hence \(a\leq K_{\mathrm{obs}}v\), also when \(a=0\).

Laziness puts the spectrum of \(P\) in \([0,1]\): the operator \(2P-I\) is itself a reversible stochastic contraction. Thus the stationary covariances \(c_t=\langle G_c,P^tG_c\rangle_\pi\) are nonnegative, and finite spectral decomposition on the mean-zero subspace gives \[\sum_{t=0}^{\infty}c_t =\langle G_c,(I-P)^{-1}G_c\rangle_\pi=a.\] For a stationary trajectory the mean squared error of the average is \[\frac{Nv+2\sum_{t=1}^{N-1}(N-t)c_t}{N^2} \leq\frac{2a}{N} \leq\frac{2K_{\mathrm{obs}}v}{N}.\] Finally, the law of an entire trajectory started from \(\nu\) is bounded by \(U\) times the corresponding stationary trajectory law: only the initial factor changes in the product of transition probabilities. Applying this domination to the nonnegative squared error proves (45). ◻

The transversal trace and its return cost

Starting from \(x\in\mathcal A\), let \[T_{\mathcal A}^+=\inf\{t\geq1:S_t\in\mathcal A\}, \qquad P_{\mathrm{tr}}(x,y) =\mathbb P_x(S_{T_{\mathcal A}^+}=y).\] The trace makes one transition for each strictly positive return to \(\mathcal A\); consecutive visits and original holding steps count as returns. The mean return identity used below is the finite-state form of Kac’s formula (Aldous and Fill 2002, Corollary 2.24).

Lemma 16 (Trace mixing and return cost). Suppose the multipliers satisfy (29). The trace kernel \(P_{\mathrm{tr}}\) is irreducible, reversible with stationary law \(\mu\), and has holding probability at least \(1/2\). Its inverse spectral gap is at most \(2p^2C_{\mathrm p}\leq K_{\mathrm{obs}}\). In particular, with \(\mu_{\min}=\min_{x\in\mathcal A}\mu(x)>0\), for every integer \(s\geq0\), \[ \left|\frac{P_{\mathrm{tr}}^s(x,y)}{\mu(y)}-1\right| \leq\mu_{\min}^{-1}\exp(-s/K_{\mathrm{obs}}) \qquad(x,y\in\mathcal A). \tag{46}\] If the initial trace law satisfies \(\nu\leq U\mu\) pointwise, then \[ \mathbb E_\nu T_{\mathcal A}^+ \leq\frac{U}{\pi(\mathcal A)}. \tag{47}\] Furthermore, at every deterministic trace-step index the law remains bounded by \(U\mu\). The expected total number of underlying transitions for \(s\) trace steps is at most \(sU/\pi(\mathcal A)\).

Proof. Finite irreducibility ensures finite expected hitting and return times to \(\mathcal A\). Explicitly, from each state choose a finite positive-probability path to \(\mathcal A\). Finiteness of the state space gives a common bound on path length and a positive lower bound on these path probabilities. The Markov property then gives a geometric bound in blocks on the hitting-time tail. Applying this after the first transition also bounds the strictly positive return time. These qualitative bounds justify the harmonic extensions and occupation sums below; no polynomial estimate is assumed at this point.

For a function \(h\) on \(\mathcal A\), let \(\widehat h\) be its harmonic extension \[\widehat h(x)=\mathbb E_x h(S_{T_{\mathcal A}}), \qquad T_{\mathcal A}=\inf\{t\geq0:S_t\in\mathcal A\}.\] Then \(\widehat h=h\) on \(\mathcal A\), \((I-P)\widehat h=0\) off \(\mathcal A\), and \((I-P)\widehat h=(I-P_{\mathrm{tr}})h\) on \(\mathcal A\) by conditioning on the first transition. For harmonic extensions \(\widehat h,\widehat k\) of \(h,k\), it follows that \[ \langle \widehat h,(I-P)\widehat k\rangle_\pi =\frac{C}{\Lambda} \langle h,(I-P_{\mathrm{tr}})k\rangle_\mu. \tag{48}\] Symmetry of the left side proves reversibility of the stochastic kernel \(P_{\mathrm{tr}}\) with respect to \(\mu\), and thus stationarity. Tracing positive-probability paths of \(P\) proves irreducibility. Also \(P_{\mathrm{tr}}(x,x)\geq P(x,x)\geq1/2\).

Let \(\mathcal E_{\mathrm{tr}}(h) =\langle h,(I-P_{\mathrm{tr}})h\rangle_\mu\). Taking \(k=h\) in (48) gives the exact normalization \[\mathfrak D(\widehat h) =2p^2\Lambda\mathcal E(\widehat h) =2p^2C\mathcal E_{\mathrm{tr}}(h).\] Proposition 12 therefore implies \[\mathop{\mathrm{Var}}_\mu(h)\leq2p^2C_{\mathrm p}\mathcal E_{\mathrm{tr}}(h).\] This is the stated inverse-gap bound. The inequality \(2p^2C_{\mathrm p}\leq K_{\mathrm{obs}}\) follows immediately from (43) and \(p\geq1\).

For the pointwise estimate put \(e_x(z)=\mathbf 1_{\{x\}}(z)/\mu(x)-1\). Reversibility and spectral contraction on mean-zero functions give \[\begin{align*} \left|\frac{P_{\mathrm{tr}}^s(x,y)}{\mu(y)}-1\right| &=|\langle e_x,P_{\mathrm{tr}}^s e_y\rangle_\mu|\\ &\leq\exp(-s/K_{\mathrm{obs}}) \sqrt{\bigl(\mu(x)^{-1}-1\bigr) \bigl(\mu(y)^{-1}-1\bigr)}\\ &\leq\mu_{\min}^{-1}\exp(-s/K_{\mathrm{obs}}), \end{align*}\] which proves (46).

To compute the mean return cost, start the underlying chain with law \(\mu\) on \(\mathcal A\) and define the finite occupation measure \[m(z)=\mathbb E_\mu \sum_{t=0}^{T_{\mathcal A}^+-1}\mathbf 1_{\{S_t=z\}}.\] Shifting the sum by one transition removes the initial law and adds the return law. Both are \(\mu\), since the trace is stationary. Thus \(mP=m\). Uniqueness of the stationary probability measure for the finite irreducible chain implies \(m=c\pi\) for some positive constant \(c\). Before the return, the only visit to \(\mathcal A\) is at time zero, so \(m\) restricted to \(\mathcal A\) is exactly \(\mu\). Consequently \(c\pi(\mathcal A)=1\) and \[\mathbb E_\mu T_{\mathcal A}^+ =\sum_zm(z)=\frac{1}{\pi(\mathcal A)}.\] Pointwise domination of the starting law proves (47). Since \(\mu\) is stationary for the trace, \(\nu P_{\mathrm{tr}}^r\leq U\mu\) for every deterministic integer \(r\geq0\). Applying (47) to each of these laws and using the Markov property at return times bounds the expected sum of \(s\) excursion lengths by \(sU/\pi(\mathcal A)\). This last bound is unconditional at the deterministic trace indices; it does not assert domination after conditioning on an arbitrary past event or on meeting a running-time cap.

When \(p=1\), every state is a transversal, \(P_{\mathrm{tr}}=P\), and every return costs exactly one underlying transition. The stated bounds include this case. ◻

The flows, auxiliary matrices, and adaptive conditioning trees in this section certify the estimates but are not constructed by the algorithm. Section 7 uses the directly simulated Metropolis chain, the controlled observables, and capped trace restarts, together with the bounded weight evaluator from Proposition 17.

A bounded approximation procedure for the weights

The free large coordinates in (8) cannot be enumerated in polynomial time. We instead partition their ranges into polynomially many intervals per coordinate and sample the resulting product grid. Scaled free coordinates, softened constraints, and grid walks appear in the dense-table methods of Dyer, Kannan, and Mount (Dyer et al. 1997); Morris (Morris 2002) further developed the associated geometric rounding approach. The weighted bin construction below includes its geometric estimate, population correction, and finite-bit implementation in full.

Proposition 17 (Weight evaluation). Fix a box-valid small-count profile \((x,y)\) with total \(p\), an integer \(0\le j\le H\), and rational parameters \(0<\xi_{\mathrm{in}},\theta<1/4\). There is a randomized procedure returning a positive rational \(\widehat h\) such that \[\mathbb P\left[ (1-\xi_{\mathrm{in}})h_j(x,y)\le\widehat h \le(1+\xi_{\mathrm{in}})h_j(x,y) \right]\ge1-\theta.\] On every execution its bit cost is bounded by a fixed polynomial in \(L,\varepsilon^{-1},\xi_{\mathrm{in}}^{-1},\theta^{-1}\) and the encoding lengths of the parameters. If \(M_f=\prod_{s\ \mathrm{free}}(b_s+1)\), every returned value satisfies \[ \frac{M_f2^{-j}}{16}\le\widehat h\le8M_f. \tag{49}\] In particular, positivity and the representation-length bound do not depend on the statistical success event.

Bins and a comparable continuous density

Throughout the construction, fix \((x,y)\). Let \(e\) be the number of free cells. We first describe the positive-dimensional case; the case \(e=0\) is addressed below. On \([0,B]^e\), write \(D(v)\) for the penalty of the free values \(z_s=(b_s+1)v_s/B\). Lemma 2 gives \[ 0\le D(v)\le H, \qquad |D(v)-D(w)|\le\frac{2Ad^2}{B}\|v-w\|_\infty =\frac18\|v-w\|_\infty. \tag{50}\] The function \(D\) is convex.

Let \(\mathcal V=\{0,\ldots,B-1\}^e\) be the bin indices. Assign an integer free vector \(z\) to the bin whose coordinates are \(\lfloor Bz_s/(b_s+1)\rfloor\). Denote the resulting Cartesian product of integer intervals by \(I_v\). In a coordinate with \(N=b_s+1\), the interval for bin index \(v_s\) is \[\left\{\left\lceil\frac{Nv_s}{B}\right\rceil, \ldots, \left\lceil\frac{N(v_s+1)}{B}\right\rceil-1\right\}.\] Its cardinality differs from \(N/B\) by at most one. Since a free cell is large, \(N\ge W=100dB\), so every interval is nonempty. Define \[\alpha_v=\frac{B^e|I_v|}{M_f}.\] Each coordinate contributes a factor in \([1-1/(100d),1+1/(100d)]\). There are at most \(d\) coordinates, and hence \[ \frac12\le\alpha_v\le2. \tag{51}\] The intervals and \(\alpha_v\) are computed by integer arithmetic.

For an integer \(0\le a\le j\), put \[V_a(v)=2^{-\lfloor aD(v)/H\rfloor}, \qquad \varrho_a(w)=2^{-aD(w)/H}\quad(w\in[0,B]^e).\] The density \(\varrho_a\) is positive and log-concave. Its base-two logarithm has sup-norm Lipschitz constant at most \(1/8\), and therefore also at most one. Combining this weaker bound with the floor gives, on the unit bin with lower corner \(v\), \[ \frac{V_a(v)}4\le\varrho_a(w)\le2V_a(v). \tag{52}\] The same inequalities hold at boundary points by continuity.

The estimator and its population correction

For \(0\le a\le j\), define the bin partition function and law \[S_a=\sum_{v\in\mathcal V}V_a(v),\qquad \pi_a(v)=\frac{V_a(v)}{S_a}.\] The dyadic weights \(V_a\) will permit exact finite-bit Metropolis acceptance. Their normalizing constants can be estimated through adjacent ratios. For \(0\le a<j\), the observable \[R_a(v)=\frac{V_{a+1}(v)}{V_a(v)}\] has expectation \(S_{a+1}/S_a\) under \(\pi_a\). Its values are \(1/2\) or one: \(0\le D/H\le1\) makes the increment of the floor exponent zero or one.

For the final correction, draw \(v\) from \(\pi_j\), then a uniform integer point \(z\in I_v\), and let \(s\) be its cube coordinates \(s_u=Bz_u/(b_u+1)\). Use \[ T(v,z)=\alpha_v\frac{2^{-jD(s)/H}}{V_j(v)}. \tag{53}\] Equations (51) and (52) show \(1/8\le T\le4\). The factor \(\alpha_v\) corrects for the number of integer points in the selected bin. The correction therefore has exact expectation \[\mathbb E T =\frac{1}{S_j}\sum_v\frac{\alpha_v}{|I_v|} \sum_{z\in I_v}2^{-jD(s)/H} =\frac{B^eh_j(x,y)}{M_fS_j}.\] As \(S_0=B^e\), the identity \[ M_f\left(\prod_{a=0}^{j-1}\mathbb E_{\pi_a}R_a\right) \mathbb E T=h_j(x,y) \tag{54}\] specifies the estimator. We approximate each expectation by an average of independent fresh samples and multiply the \(j+1\) averages by \(M_f\).

Interpolation and conductance

It remains to sample the bin laws \(\pi_a\) with controlled error and bounded work. We use a local Metropolis walk. The continuous density \(\varrho_a\) supplies the cut expansion estimate that bounds its mixing time; it is not itself sampled. We first establish the finite-box form of the Prékopa–Leindler interpolation inequality (Leindler 1972; Prékopa 1973) used in the geometric argument. All integrals in the following lemma are with respect to Lebesgue measure.

Lemma 18 (Integral interpolation). Let \(S_0,S_1,S_2\) be finite unions of bounded open axis-aligned boxes contained in a common compact box. Let \(0<t<1\) and suppose \((1-t)S_1+tS_2\subseteq S_0\). Let \(f_0,f_1,f_2\) be positive continuous functions on the ambient compact box such that \[f_0((1-t)x+ty)\ge f_1(x)^{1-t}f_2(y)^t \qquad(x\in S_1,\ y\in S_2).\] Then \[\int_{S_0}f_0\ge \left(\int_{S_1}f_1\right)^{1-t} \left(\int_{S_2}f_2\right)^t.\]

Proof. In dimension one, write \(A_i=\int_{S_i}f_i\) for \(i=1,2\); zero source mass makes the conclusion immediate. Let \(x(u),y(u)\) be the increasing quantiles of the two normalized source densities, \(0<u<1\). Away from finitely many subdivision parameters they are continuously differentiable, with \[x'(u)=\frac{A_1}{f_1(x(u))}, \qquad y'(u)=\frac{A_2}{f_2(y(u))}.\] The map \(z(u)=(1-t)x(u)+ty(u)\) is increasing. Its smooth pieces have disjoint images contained in \(S_0\); jumps merely omit nonnegative contributions to the target integral. Change of variables on these pieces, followed by the weighted arithmetic–geometric mean inequality, gives \[\begin{align*} \int_{S_0}f_0 &\ge\int_0^1 f_0(z(u)) \left((1-t)\frac{A_1}{f_1(x(u))} +t\frac{A_2}{f_2(y(u))}\right)\,du\\ &\ge\int_0^1 A_1^{1-t}A_2^t\,du =A_1^{1-t}A_2^t. \end{align*}\] This argument also permits nonnegative piecewise-continuous densities with finitely many zero intervals, provided each nonzero piece is bounded above and bounded away from zero.

For the induction on dimension, fix first coordinates \(x_1,y_1\) of the two sources and put \(z_1=(1-t)x_1+ty_1\). The corresponding slices satisfy the same set inclusion and interpolation hypothesis in one lower dimension. The induction hypothesis therefore gives the one-dimensional interpolation inequality for the three marginal integrals over slices. Subdivide the first-coordinate axis at the finitely many box endpoints. On each resulting interval every slice domain is constant; positivity and continuity on the ambient compact box make each nonzero marginal continuous, bounded, and bounded away from zero there. Thus the one-dimensional argument just proved applies to the marginals. Iterated integration proves the claim. ◻

On \(\mathcal V\), use the Metropolis chain with weights \(V_a\). Each signed coordinate direction is proposed with probability \(2^{-\lceil\log_2(4d)\rceil}\). Hold for unused proposal outcomes or for proposals outside \(\mathcal V\), and accept a valid proposal with probability \(\min\{1,V_a(w)/V_a(v)\}\). The chain is reversible for \(\pi_a\) and is lazy, since the total probability of directional proposals is at most \(1/2\).

Lemma 19 (Bin conductance). For \(e\ge1\), every nontrivial cut of this chain has stationary flow divided by its smaller stationary side mass at least \[\kappa=\frac{1}{10^4d^2B}.\]

Proof. Write \(\mu\) for unnormalized integration against \(\varrho_a\) on \(D_0=(0,B)^e\). For a fixed cut, let \(S\) be the union of the open unit bins on the side of smaller continuous mass. Grid hyperplanes have zero mass, so \(\mu(S)\le\mu(D_0)/2\). Set \[t=\frac{1}{4dB},\qquad r=tB=\frac{1}{4d}, \qquad M=(1-t)S+tD_0.\] The set \(M\) is a finite union of open boxes and contains \(S\). Lemma 18, applied with all three functions equal to \(\varrho_a\), gives \[ \mu(M\setminus S)\ge(2^t-1)\mu(S)\ge\frac t2\mu(S). \tag{55}\]

We cover the added mass by neighborhoods of cut faces. Consider a point \(z\in M\setminus S\) off the grid hyperplanes, and choose \(x\in S\), \(y\in D_0\) with \(z=(1-t)x+ty\). The segment from \(x\) to \(z\) has sup-norm length less than \(r\). At some grid-crossing event its entering and exiting bins have different cut membership. If several coordinates cross simultaneously, flip those coordinates one at a time between the entering and exiting bins. All intermediate bins are incident to the crossing point and lie in the cube. At least one consecutive pair belongs to opposite sides of the cut. Its closed common face contains the crossing point, so \(z\) is within sup distance \(r\) of an actual axis-adjacent cut face.

This proves containment, up to the null set of grid hyperplanes, in the union of the radius-\(r\) neighborhoods of the cut faces. It does not charge a multiplicity for the number of incident bins. Disconnectedness of \(S\) causes no change in the argument. The segment stays in the open ambient cube, and intersecting a face neighborhood with that cube only reduces its volume.

Each face neighborhood has volume at most \[2r(1+2r)^{e-1} =\frac{1}{2d}\left(1+\frac{1}{2d}\right)^{e-1}\le1.\] Every point in it is within sup distance \(1+r\) of either adjacent lower corner. The logarithmic Lipschitz bound and \(\varrho_a(v)\le V_a(v)\) therefore bound its density by \(2^{1+r}V_a(v)\le4V_a(v)\) for each of the two adjacent corners separately. Thus, if \(F\) is the sum of \(\min\{V_a(v),V_a(w)\}\) over cut edges, the covering gives \(\mu(M\setminus S)\le4F\).

Let \(m\) be the smaller of the two unnormalized discrete side masses. By (52), \[\mu(S)\ge\frac14\sum_{v:\,v+(0,1)^e\subset S}V_a(v)\ge\frac m4.\] This remains true if the smaller continuous side is the larger discrete side. Combining with (55) yields \(F\ge tm/32\). The directional proposal probability is at least \(1/(8d)\), so the normalized conductance is at least \[\frac{t}{256d}=\frac{1}{1024d^2B}\ge\kappa.\] ◻

For completeness, this cut bound supplies a quantitative mixing time without an additional sampling theorem. For a finite reversible kernel \(P\) with stationary law \(\pi\), write \[\mathcal E_P(g)=\frac12\sum_{v,w}\pi(v)P(v,w)(g(v)-g(w))^2.\] For nonnegative \(g\) supported on stationary mass at most \(1/2\), integration over superlevel sets of \(g^2\) gives \[\kappa\mathbb E_\pi g^2 \le\sum_{\{v,w\}}\pi(v)P(v,w)|g(v)^2-g(w)^2| \le\bigl(2\mathcal E_P(g)\mathbb E_\pi g^2\bigr)^{1/2}.\] Here the sum is over unordered distinct pairs, and the last inequality uses Cauchy–Schwarz and \((g(v)+g(w))^2\le2g(v)^2+2g(w)^2\). Apply the resulting inequality to the positive and negative parts about a median of an arbitrary function. Their energies sum to at most its energy, and their squared norms sum to at least its variance. Hence the inverse spectral gap is at most \[K_{\mathrm{bin}}=\frac{2}{\kappa^2} =2(10^4d^2B)^2.\] Laziness puts the spectrum in \([0,1]\): \(2P-I\) is a reversible stochastic contraction. Since \(2^{-H}\le V_a\le1\), \(\pi_{a,\min}^{-1}\le2^HB^e\). Spectral contraction of the centered density of an initial point, followed by Cauchy–Schwarz, therefore gives the following convenient loose bound after \(\ell\) steps: \[ \|P_a^\ell(v,\cdot)-\pi_a\|_{\mathrm{TV}} \le 2^{H+dB}\exp(-\ell/K_{\mathrm{bin}}). \tag{56}\]

Sample counts and error allocations

We now implement the estimator in (54). Each occurrence of a bin sample uses a fresh walk; each offset sample uses fresh bits conditional on its bin.

Set \[ \sigma=\frac{\xi_{\mathrm{in}}}{50(H+1)},\qquad N_{\mathrm{in}}= \left\lceil\frac{10^6(H+1)}{\theta\sigma^2}\right\rceil, \qquad Q_{\mathrm{in}}=(d+1)(H+1)N_{\mathrm{in}}. \tag{57}\] Use \(N_{\mathrm{in}}\) samples for every average. Each exact observable has variance divided by squared mean at most \(1024\). Chebyshev’s inequality and a union bound over at most \(H+1\) averages imply that all ideal averages have relative error at most \(\sigma\), except with probability at most \[\frac{1024(H+1)}{N_{\mathrm{in}}\sigma^2}<\frac\theta4.\]

Each bin sample is obtained by an independent walk, started at a fixed bin, of length \[ \ell_{\mathrm{in}}= \left\lceil K_{\mathrm{bin}} \left(H+dB+\frac{16Q_{\mathrm{in}}}{\theta}+2\right)\right\rceil. \tag{58}\] Equation (56) bounds its total-variation error by \(\theta/(8Q_{\mathrm{in}})\). This deliberately conservative length is polynomial in the allowed inverse failure parameter.

Lemma 20 (Finite-bit uniform integer draw). For a positive integer \(M\) and \(0<\zeta<1\), choose the smallest nonnegative integer \(k\) with \(M2^{-k}\le\zeta\). If \(Y\) is uniform on \(\{0,\ldots,2^k-1\}\), then \(\lfloor MY/2^k\rfloor\) has total-variation distance at most \(\zeta\) from the uniform law on \(\{0,\ldots,M-1\}\). The draw uses exactly \(k\) fair bits and bounded integer arithmetic.

Proof. Each output has either \(\lfloor2^k/M\rfloor\) or \(\lceil2^k/M\rceil\) preimages. Summing its deviation from probability \(1/M\) gives a total-variation bound at most \(M2^{-k}\). Computing the displayed integer quotient needs no rejection step. ◻

Apply Lemma 20 separately to every scalar offset interval, with \(\zeta=\theta/(8Q_{\mathrm{in}})\), and translate by its lower endpoint. There are at most \(Q_{\mathrm{in}}\) bin draws and scalar offset draws together. Couple each bin draw to a stationary one, and, conditional on a matching bin, couple the offsets to exact uniform offsets in that bin. On a bin mismatch retain the correct conditional offset marginals on both sides; its failure is already charged. Use independent fresh randomness for different samples. The resulting ideal pairs \((v,z)\) are independent across samples with joint law \(\pi_j(v)\operatorname{Unif}(I_v)\), although bin and offset within a pair need not be independent. The probability of any draw discrepancy is at most \(\theta/8\), in particular less than \(\theta/4\).

Correction arithmetic and a bound on every execution

The floors defining \(V_a\) are evaluated by exact rational arithmetic. All these weights are dyadic. Bin proposals can be made with \(\lceil\log_2(4d)\rceil\) bits, with unused outcomes interpreted as holds. Each Metropolis acceptance is an exact dyadic trial with at most \(H\) additional bits. Thus the walk length (58) is also a deterministic bound on the number of transitions; no random-time rejection procedure is used.

Only the power of two in (53) needs numerical approximation. Its exponent is the rational number \[\beta=\left\lfloor\frac{jD(v)}H\right\rfloor -\frac{jD(s)}H\in[-2,2].\] Indeed the floor loses less than one and the exponent changes by at most one inside a bin. Choose a power-of-two integer \(s'\) with \(32/\sigma\le s'\le64/\sigma\), and round \(\beta\) to its nearest grid point \(h/s'\). Since \(-2\) and \(2\) are grid points, \(|h|\le2s'\), and \(|\beta-h/s'|\le\sigma/64\). If \(T_0=2^\beta\), then \[\left|\frac{2^{h/s'}}{T_0}-1\right| \le e^{\sigma/64}-1\le\frac\sigma{32}, \qquad T_0\ge\frac14.\] Here \(\sigma<1/200\). Bisect the interval \([0,8]\), comparing the \(s'\)-th power of a rational midpoint with \(2^h\), for a fixed number of iterations sufficient to make the absolute error at most \(\sigma/64\). The returned rational \(R\) then satisfies \[\left|\frac R{T_0}-1\right| \le\frac\sigma{32}+\frac\sigma{16}<\sigma, \qquad R\ge\frac14-\frac\sigma{64}>0.\] Here the rounded exponent \(h/s'\) still belongs to \([-2,2]\), so its exact power is at least \(1/4\) before the bisection error is applied. Negative \(h\) causes no difficulty: \(2^h\) is an exact dyadic rational with \(O(|h|)\) bits. For example, a depth of \(\lceil\log_2(512/\sigma)\rceil\) and the final interval midpoint suffice. The bisection depth is \(O(\log(1/\sigma))\), and the exact powers being compared have \(O(s'\log(1/\sigma))\) bits. Since \(s'=O(\sigma^{-1})\), all these operations have polynomial bit cost. Multiply \(R\) by the exact \(\alpha_v\) to approximate the correction with deterministic pointwise relative error at most \(\sigma\).

On the coupled event in which every ideal empirical mean is accurate, there are \(j+1\) empirical multiplicative errors of at most \(\sigma\) and one further such error from rounding the correction. The bound \(|\log(1\pm\sigma)|\le2\sigma\) gives total absolute logarithmic error at most \[2\sigma(j+2)\le4\sigma(H+1)=\frac{2\xi_{\mathrm{in}}}{25}.\] For \(0<\xi_{\mathrm{in}}<1/4\), this implies the relative interval \([1-\xi_{\mathrm{in}},1+\xi_{\mathrm{in}}]\) in Proposition 17. The exceptional probability is less than \(\theta/2\), and hence at most \(\theta\).

These statistical estimates are not needed for termination or output size. On every execution, the ratio averages lie in \([1/2,1]\). The exact correction lies in \([1/8,4]\), and its computed value lies in \([(1-\sigma)/8,4(1+\sigma)]\subset[1/16,8]\). Its average has the same bounds. This proves (49) on every path, including paths where all empirical means are inaccurate.

To check bit complexity, every loop is bounded by (57) and (58). The parameters \(A,B,W,H\) are polynomial in \(L\) and \(\varepsilon^{-1}\), and these loop bounds are fixed polynomials in those parameters, \(\xi_{\mathrm{in}}^{-1}\), and \(\theta^{-1}\). Bin indices have \(O(\log B)\) bits, and rational cube coordinates used in the correction have \(O(L+\log B)\) bits. Integer offsets have the binary lengths of the input capacities; a scalar offset of interval length \(M\) needs only \(O(\log M+\log(Q_{\mathrm{in}}/\theta))\) bits in Lemma 20. The tree values are affine sums of input margins and the current coordinates. Divisions by tree capacities in \(D\) produce rational denominators whose total binary length is polynomial, since only polynomially many input integers occur. The quantities \(M_f\), \(B^e\), \(|I_v|\), and \(\alpha_v\) likewise have polynomial-length representations. Finally, sums and products of polynomially many rationals of polynomial length have polynomial length even without cancellation. This includes all empirical means and the product forming \(\widehat h\). Thus no numerical large capacity enters a loop bound.

If \(e=0\), take \(\mathcal V\) to consist of the empty vector and use the empty-product conventions \(M_f=B^e=\alpha_v=1\). There is no offset draw and no bin walk. The same ratios and correction telescope to the single summand \(2^{-jD/H}\); the deterministic rounding and all stated bounds remain valid. If \(j=0\), there are no ratio averages and \(V_0=1\). The unrounded correction is \(\alpha_v\), whose expectation under uniform bins is exactly one. Its numerical approximation has the already allocated pointwise tolerance, so the procedure estimates \(h_0=M_f\) within the claimed error. These observations complete the proof of Proposition 17.

The annealing algorithm and its implementation

We now combine the preceding estimates into a single algorithm. The transversal distribution at parameter \(j\) is denoted by \(\mu_j=f_j/C(j)\). It does not depend on the defect multipliers. The underlying Metropolis kernel with parameter \(j\) and multiplier collection \(w\) is denoted by \(P_{j,w}\). We use the warm trace restarts of Section 5 to estimate successive partition function ratios while learning the defect multipliers. Balancing defect classes by estimated weights during annealing is an important feature of the permanent approximation algorithm of Jerrum, Sinclair, and Vigoda (Jerrum et al. 2004, sec. 3). Here the observable-variance and trace bounds needed for the two-lift weights were proved in Section 5.

The feasibility test and tightening from Section 2 are performed first. An infeasible instance returns zero. Throughout this section the instance is feasible, so \(Z\geq 1\). Recall that \[p=\sum_{s\ {\rm small}}b_s, \qquad M_f=\prod_{s\ {\rm free}}(b_s+1).\] An empty product equals one. If \(p=0\), we call Proposition 17 once to estimate \(h_H(\varnothing)=C(H)\), with relative tolerance \(\varepsilon/32\) and failure probability \(1/16\). This branch, including the case of an empty retained cell graph, is completed in the proof of Theorem 1 below. Until then suppose that \(p\geq 1\). All logarithms without a subscript are natural logarithms.

Initialization and comparison of adjacent parameters

Lemma 21 (Exact initialization). For every state of the enlarged binary state space and \(0\leq j<H\), \[ \frac12\leq\frac{f_{j+1}}{f_j}\leq 1. \tag{59}\] Consequently the ideal multiplier \(C(j)/c_{il}(j)\) changes by a factor in \([1/2,2]\) between consecutive parameters, and \(\mu_j\leq 2\mu_{j+1}\) pointwise. Moreover, \[ \min_{S\in\mathcal A}\mu_j(S) \geq 2^{-(H+p+K)} \qquad (0\leq j\leq H). \tag{60}\] The values \(C(0)\) and \(c_{il}(0)\), and hence all initial ideal multipliers, are computable exactly in polynomial bit time. The law \(\mu_0\) has the following finite-choice description: independently for each small cell \(s\), choose a uniform integer \(k_s\in\{0,\ldots,b_s\}\), and then a uniform \(k_s\)-element subset of its \(b_s\) labeled pairs to use their row elements.

Proof. Lemma 2 gives \(0\leq D\leq H\). Each summand in \(h_{j+1}\) is therefore between one half and one times the corresponding summand in \(h_j\), proving (59). The factorial factor in \(f_j\) is independent of \(j\). Summing the same inequalities over any type gives \[\frac12\leq \frac{C(j+1)}{C(j)}\leq 1, \qquad \frac12\leq \frac{c_{il}(j+1)}{c_{il}(j)}\leq 1.\] These bounds imply the multiplier comparison and \(\mu_j\leq 2\mu_{j+1}\).

On a transversal the factorial factor is \(\prod_s\binom{b_s}{x_s}^{-1}\geq 2^{-p}\). Also \(h_j(x,y)\geq M_f2^{-H}\), while \[C(j)\leq M_f\prod_{s\ {\rm small}}(b_s+1) \leq M_f2^K.\] Their quotient proves (60).

At parameter zero, \(h_0=M_f\), so \[ C(0)=M_f\prod_{s\ {\rm small}}(b_s+1). \tag{61}\] We give an explicit formula for every defect total. Fix distinct pair labels \(i,l\), with \(i\) empty and \(l\) full. For each small cell \(s\), let \[u_s=\mathbf 1_{\{i\text{ belongs to }s\}},\qquad v_s=\mathbf 1_{\{l\text{ belongs to }s\}},\qquad n_s=b_s-u_s-v_s.\] There are \(n_s\) singly occupied pairs left in that cell. If exactly \(k\) of these use their row elements, then \(x_s=k+v_s\), \(y_s=n_s-k+v_s\), with multiplicity \(\binom{n_s}{k}\). Hence \[ c_{il}(0) =M_f\prod_{s\ {\rm small}} \left[ \frac{1}{b_s!} \sum_{k=0}^{n_s} \binom{n_s}{k}(k+v_s)!(n_s-k+v_s)! \right]. \tag{62}\] This includes the case in which \(i,l\) lie in the same cell: then \(u_s=v_s=1\) and \(n_s=b_s-2\geq 0\). All factorial arguments are at most \(p\), and all sums have at most \(p+1\) terms. Using the common denominator \(b_s!\) within each bracket, the numerators and denominators in (62) have \(O(L+p\log(p+1))\) bits. There are at most \(p(p-1)\) such totals. The multipliers \[w_{il}^{(0)}=\frac{C(0)}{c_{il}(0)}\] are therefore positive rationals of polynomial bit length and are computable by bounded integer arithmetic. In fact the local bracket in (62) equals \(b_s+1\), \(1\), \((b_s+1)(b_s+2)/6\), or \((b_s+1)/6\), according as the cell contains neither designated pair, only the hole, only the full pair, or both. If \(s(i)\) denotes the cell containing pair \(i\), the equivalent initializer is \[w_{il}^{(0)} = \begin{cases} 6,&s(i)=s(l),\\[2mm] \displaystyle\frac{6(b_{s(i)}+1)}{b_{s(l)}+2}, &s(i)\ne s(l). \end{cases}\]

Finally, the asserted sampler assigns any particular transversal probability \[\prod_{s\ {\rm small}} \frac{1}{(b_s+1)\binom{b_s}{x_s}} =\frac{f_0(S)}{C(0)}.\] This proves its distribution. The finite-choice description will be implemented with bounded fair-bit draws below. ◻

A reference experiment with exact transition probabilities

We first analyze a reference experiment using exact weights and probabilities. It is an auxiliary probability model; the implemented algorithm in the next subsection uses only the explicit weight evaluation procedure and independent fair bits.

To see which statistics a phase must collect, fix a parameter \(0\le j<H\) and positive multipliers \(w\), and let \(\pi\) be the stationary law of \(P_{j,w}\). Write \(p_T\) for the stationary probability of type \(T\), where \(T=0\) denotes \(\mathcal A\) and \(T=(i,l)\) denotes \(\mathcal A_{il}\). Define \[G_j(S)=\mathbf 1_{\mathcal A}(S)\frac{f_{j+1}(S)}{f_j(S)}, \qquad u=\mathbb E_\pi G_j.\] The transversal mass is \(C(j)\), and the multiplied mass of defect type \(il\) is \(w_{il}c_{il}(j)\). Therefore \[ \frac{u}{p_0}=\frac{C(j+1)}{C(j)},\qquad w_{il}\frac{p_0}{p_{il}}=\frac{C(j)}{c_{il}(j)}. \tag{63}\] Thus one trajectory can estimate both the next counting ratio and the multipliers needed to balance the next phase. The type indicators are constant on each defect class, and \(G_j\) vanishes there; all these observables are fixed by \(\mathcal Q\), so the time-average bound of Lemma 15 applies when the multipliers are good and the initial law is dominated by \(\pi\).

The stored multipliers depend on earlier trajectories. We therefore start each phase with fresh randomness, using a new \(\mu_0\) draw and trace stages at parameters \(1,\ldots,j\) with the multipliers already learned. The actual restart has a deterministic transition budget. For analysis we also consider the same restart without that budget. Conditional on a past history in which the learned multipliers are good, adjacent-parameter comparison and trace mixing give the required domination for this virtual restart. Its cap failure is bounded separately, without conditioning the endpoint law on meeting the cap.

Let \(C_{\rm p},C_{\rm d},K_{\rm obs}\) have the values in Section 5, so in particular \[K_{\rm obs}=10p^4(9C_{\rm p}+2C_{\rm d}).\] Choose the following integer time bounds and relative tolerance: \[ \begin{split} \eta&=\frac{\varepsilon}{200(H+1)},\\ \tau&=2K_{\rm obs}(H+p+K+5),\\ B_{\rm ret}&=2000p^2(H+1)^2\tau,\\ N_{\rm av} &=\left\lceil \frac{10^8p^8K_{\rm obs}(H+1)}{\eta^2} \right\rceil. \end{split} \tag{64}\] The quantities defining \(\tau\) and \(B_{\rm ret}\) are integers. Initialize \(w^{(0)}\) by Lemma 21. For \(j=0,\ldots,H-1\), carry out the following phase.

  1. Restart on transversals. Draw a fresh state from \(\mu_0\). For \(a=1,\ldots,j\), run \(\tau\) successive trace steps of \(P_{a,w^{(a)}}\), continuing from the transversal reached at the preceding stage. A trace step ends at the next transversal after a strictly positive number of underlying transitions. Across this entire restart, allow at most \(B_{\rm ret}\) underlying transitions. If another transition is needed after that budget is exhausted, abort the run and output zero. For \(j=0\), the fresh \(\mu_0\) draw is the restart endpoint.

  2. Observe the current chain. From this endpoint, run \(P_{j,w^{(j)}}\) for \(N_{\rm av}\) consecutive observed states, including the starting state. For each type \(T\), let \(n_T\) be its number of occurrences and \(\widehat p_T=n_T/N_{\rm av}\). Also form the empirical mean \(\widehat u\) of \(G_j\). If any type count is zero, abort the run and output zero.

  3. Estimate the ratio and update the multipliers. Set \[ \widehat R_j=\frac{\widehat u}{\widehat p_0}. \tag{65}\] If \(j+1<H\), store \[ w_{il}^{(j+1)} =w_{il}^{(j)}\frac{\widehat p_0}{\widehat p_{il}} =w_{il}^{(j)}\frac{n_0}{n_{il}}. \tag{66}\]

If no abort occurs, the reference output is \[Z_{\rm ref}=C(0)\prod_{j=0}^{H-1}\widehat R_j.\] Every phase uses fresh randomness. In particular, its initial \(\mu_0\) sample and its chains do not reuse the final state of an earlier observation trajectory.

Proposition 22 (Accuracy of the reference experiment). With probability at least \(1-1/50\), the reference experiment does not abort, every stored multiplier collection is good at its own parameter in the sense of (29), and \[ \left|\log\frac{Z_{\rm ref}}{C(H)}\right| \leq 4H\eta. \tag{67}\]

Proof. We make the conditioning in the argument explicit. Let \(\mathcal F_j\) be the sigma-field generated by the completed trajectories, transition decisions, and counts of phases before \(j\) in the capped reference experiment. The stored multipliers and the event that all these earlier phases were successful are \(\mathcal F_j\)-measurable. Fix a past history on that event. The multipliers \(w^{(0)},\ldots,w^{(j)}\) are now fixed and good; this will follow inductively from the update calculation below. The current phase uses independent fresh randomness.

For analysis of this one phase, define a virtual experiment that continues its restart without a transition cap, and then takes its \(N_{\rm av}\) observations using fresh randomness. Write \(M=H+p+K\). Lemma 16 and (60) imply that, from any starting transversal, a stage of \(\tau\) trace steps has pointwise relative error at most \[2^M\exp(-\tau/K_{\rm obs}) =2^M\exp(-2(M+5))<1.\] Its endpoint law is consequently at most \(2\mu_a\). At the entrance to stage \(a=1\), the law is \(\mu_0\leq 2\mu_1\). At every later stage it is at most \(2\mu_{a-1}\leq 4\mu_a\). Invariance of the trace law preserves the bound \(4\mu_a\) throughout that stage.

For good multipliers, \(\pi(\mathcal A)\geq 1/(5p^2)\). The warm return-cost bound of Lemma 16 therefore bounds the expected number of underlying transitions in each trace step by \(20p^2\). The virtual restart uses at most \(H\tau\) trace steps, so its expected total cost is at most \(20p^2H\tau\). Markov’s inequality gives \[ \mathbb P\{\text{virtual restart cost}>B_{\rm ret} \mid\mathcal F_j\} \leq \frac{H}{100(H+1)^2} \leq \frac{1}{100(H+1)}. \tag{68}\] For \(j=0\), the cost is zero and the same upper bound holds.

The virtual restart endpoint is at most \(2\mu_j\), including \(j=0\). Since \(\mu_j\) is the conditional law of the current stationary distribution \(\pi\) on \(\mathcal A\), this endpoint law is at most \(10p^2\pi\) on the full state space. Each type indicator and \(G_j\) is fixed by the projection \(\mathcal Q\) of Section 5. They take values in \([0,1]\). Their stationary means \(p_T,u\), given by (63), are at least \(1/(20p^2)\): this is the type probability bound for defect types, while \(p_0\geq 1/(5p^2)\) and \(C(j+1)/C(j)\geq 1/2\).

By Lemma 15, each empirical mean in the virtual observation trajectory has mean squared error about its stationary mean at most \[\frac{20p^2K_{\rm obs}}{N_{\rm av}}.\] There are \(p(p-1)+2\leq 2p^2\) observables. Markov’s inequality and a union bound therefore give \[ \begin{split} &\mathbb P\{\text{some virtual empirical mean has relative error greater than }\eta \mid\mathcal F_j\}\\ &\hspace{12mm}\leq \frac{16000p^8K_{\rm obs}}{N_{\rm av}\eta^2} \leq\frac{1}{100(H+1)}. \end{split} \tag{69}\] These bounds concern the virtual, uncapped current phase. Whenever its restart cost is at most \(B_{\rm ret}\), it agrees with the actual capped phase. Thus failure of the capped phase is contained in the union of the two virtual failure events in (68) and (69). In particular, we never condition the endpoint law on surviving the cap.

It remains to check that empirical success maintains the induction and controls the output. Because \(\eta<1/4\), empirical success makes every type count positive. By (63), the exact ratio \(w_{il}^{(j)}p_0/p_{il}\) is the current ideal multiplier \(C(j)/c_{il}(j)\). The relative errors in \(\widehat p_0,\widehat p_{il}\) change this value by a factor between \((1-\eta)/(1+\eta)\) and its reciprocal, both lying in \([1/2,2]\). Lemma 21 changes the ideal multiplier by at most another factor two at the next parameter. Equation (66) therefore satisfies (29) for \(j+1\). The update estimates the current ideal multiplier directly; its error does not multiply the earlier error in \(w^{(j)}\).

The same empirical bounds, and \(u/p_0=C(j+1)/C(j)\), give \[\left|\log\frac{\widehat R_j}{C(j+1)/C(j)}\right| \leq 4\eta.\] Initialization is good by Lemma 21. For every successful fixed past, the conditional probability of a current failure is at most \(2/[100(H+1)]\). Summing the probabilities of the first failing phase gives total failure probability at most \[\frac{2H}{100(H+1)}<\frac1{50}.\] On the complementary event, the ratio product telescopes and its logarithmic errors sum to (67). ◻

A bounded implementation using fair bits

All parameters and counters below are represented exactly. Set \[ J_*=100(H+1)(B_{\rm ret}+N_{\rm av}+p+d+1), \qquad \xi=\frac{\eta}{1000J_*}. \tag{70}\] To evaluate any individual \(f_j(S)\), call Proposition 17 with \(\xi_{\rm in}=\theta=\xi\) and the small-count profile of \(S\), using fresh bits on every call, and multiply by the exact factorial factor in (22). The evaluation is positive on every execution. For a valid proposed move, compute the ratio of the two resulting rational \(\lambda\)-weights, clip it at one, and use a dyadic acceptance threshold. Use the analogous ratio of fresh evaluations in each nonzero observation of \(G_j\). Type counts and the updates (66) remain exact integer and rational computations. The restart transition caps are unchanged.

For every finite-choice draw from \(\{0,\ldots,v-1\}\), apply Lemma 20 with \(M=v\) and \(\zeta=\xi\). This uses a fixed number of fair bits and has total variation error at most \(\xi\). For the subset draw in Lemma 21, take \(v=\binom{b_s}{k_s}\) and decode an index in a fixed order of the subsets. Successive binomial inclusion/exclusion counts do this with at most \(b_s\) decisions. Thus the initial sampler uses at most two finite-choice draws per small cell. The choices of a current element and a complementary element in a Metropolis proposal likewise require only two scalar draws.

If \(\alpha\in[0,1]\) is a computed rational acceptance probability, use \(\lceil\log_2(1/\xi)\rceil\) fair bits and the downward-rounded dyadic threshold for \(\alpha\). Its probability differs from \(\alpha\) by at most \(\xi\). A single fair bit implements the half hold exactly. These procedures use fixed bit counts at their requested resolutions and no rejection loop.

Lemma 23 (Coupling and bounded computation). The implemented run uses a number of bit operations bounded, on every execution, by a fixed polynomial in \(L\) and \(\varepsilon^{-1}\). It returns a nonnegative rational of polynomial bit length. It can be coupled to the capped reference experiment so that, except on an event of probability at most \(10J_*\xi\), all state trajectories, type counts, cap decisions, and stored multipliers agree, every requested weight evaluation meets its relative tolerance, and each positive observed term of \(G_j\) differs from its reference value by a factor whose logarithm has absolute value at most \(4\xi\).

Proof. We first bound the number of outer random actions. Let \(s_{\rm sm}\) be the number of positive small cells, so \(s_{\rm sm}\leq\min(p,d)\), and put \[T_{\max}=H(B_{\rm ret}+N_{\rm av}).\] This bounds all underlying transitions in the capped run. Each transition needs at most two weight evaluations, four outer draws (a hold coin, two element choices, and an acceptance threshold), and one transition count. Each of at most \(HN_{\rm av}\) observations needs at most two additional weight evaluations. Initial sampling needs at most \(2s_{\rm sm}\) outer draws per phase. Consequently \[ \begin{split} &\#\{\text{evaluation calls, outer draws, and transitions}\}\\ &\quad\leq 7T_{\max}+2HN_{\rm av}+2Hs_{\rm sm}\\ &\quad\leq 9H(B_{\rm ret}+N_{\rm av})+2H(p+d)<J_*. \end{split} \tag{71}\] A visited state has a single type, whose counter is incremented. There is no separate sampling for each defect type. Initializing the \(p(p-1)\) counters and computing their updates are additional deterministic polynomial computations.

For the coupling, expose the completed joint history of both processes immediately before each requested evaluation or draw. The event that the processes have matched so far, and the current evaluation input, are measurable in this history. A new evaluation uses a fresh bit stream independent of that history. Its conditional failure probability is therefore at most \(\xi\), uniformly over the requested profile. This conclusion remains valid after earlier matching and accuracy events, because they concern only already exposed randomness.

Before a discrepancy, both runs have the same state and stored multipliers. Couple their initial and proposal draws at total variation cost at most \(\xi\) per finite choice. Conditional on matching proposals and accurate evaluations, let \(r\) be the reference acceptance ratio before clipping and \(r'\) the computed ratio. The exact factorial and multiplier factors are the same in both runs, and hence \[\frac{1-\xi}{1+\xi}\leq\frac{r'}r \leq\frac{1+\xi}{1-\xi}.\] It follows, regardless of the magnitude or quality of the multipliers, that \[\big|\min(1,r')-\min(1,r)\big| \leq \frac{2\xi}{1-\xi}<4\xi.\] The dyadic threshold adds at most \(\xi\) to this absolute probability difference. To realize a common-uniform coupling, let \(Y\) be the actual fresh uniform \(k\)-bit integer used for the acceptance decision, and write its dyadic threshold as \(m/2^k\). In the proof alone, introduce \(V\) uniform on \([0,1)\), independent of \(Y\), the completed joint past, and the current weight evaluations. Then \(U=(Y+V)/2^k\) is uniform on \([0,1)\), and the implemented test \(Y<m\) is exactly \(U<m/2^k\). Use \(U<\min(1,r)\) for the reference decision. Their mismatch probability is the absolute difference of these thresholds, with the bound just obtained. The auxiliary variable \(V\) is never sampled by the algorithm.

The coupling preserves the reference transition marginal conditional on the completed joint past. We do not condition the reference process on the event that the entire coupling eventually succeeds. Matching paths have exactly the same integer type counts, and the update (66) depends only on those counts. Thus their stored multipliers remain exactly equal, even though their observations of \(G_j\) need not be equal. Trace return times and cap decisions are functions of the matched state paths, so they also agree. A union bound over (71), charging evaluation failures and draw or acceptance discrepancies, is at most \(10J_*\xi\). On the remaining event, each positive observed weight ratio has logarithmic relative error at most \(4\xi\). Zero observations are zero in both runs.

We next prove the unconditional resource bound. Since all input cells are listed explicitly and the parameters are included in the input length, \(d,K=O(L)\). The definitions in (2) give, for example, \[A=O(L^3\varepsilon^{-1}),\quad B=O(L^5\varepsilon^{-1}),\quad W=O(L^6\varepsilon^{-1}),\quad H=O(L^{11}\varepsilon^{-2}),\quad p\leq dW.\] All quantities in (64) and (70), including \(\xi^{-1}\), are therefore bounded by fixed polynomials in \(L,\varepsilon^{-1}\). Their rational encodings have polynomial length. The state can be stored using \(2p\) membership bits or \(p\) element labels; the small counts and state type can be recovered by bounded scans.

There is also a uniform size bound for stored multipliers on unsuccessful histories. Let \(B_0=O(L+p\log(p+1))\) bound the initial numerator and denominator lengths obtained from (62). On every nonaborting history, \[w_{il}^{(a)} =w_{il}^{(0)} \prod_{r=0}^{a-1}\frac{n_0^{(r)}}{n_{il}^{(r)}}, \qquad 1\leq n_0^{(r)},n_{il}^{(r)}\leq N_{\rm av}.\] Thus, even without fraction reduction, its numerator and denominator each have at most \[ B_0+H\left\lceil\log_2(N_{\rm av}+1)\right\rceil \tag{72}\] bits, up to a fixed additive constant. A zero count causes an abort before any such division. This bound does not assume good multipliers or accurate weight calls.

Proposition 17 supplies a deterministic polynomial bound on the work and output length of each evaluation, including its statistically unsuccessful executions. More explicitly, its ratio averages always lie in \([1/2,1]\) and its rounded correction average always lies in \([1/16,8]\), so every call at parameter \(j\) returns a number in \[[\,M_f2^{-j}/16,\ 8M_f\,].\] Its bounded dyadic precision and bounded numbers of rational operations give a polynomial representation length as well. The inputs of this subroutine are \(j\), a valid small-count profile, and the fixed tolerances; multiplier values are not subroutine inputs. Multiplication by the exact factorial factor adds only \(O(p\log(p+1))\) bits. Combining this bound with (72) proves that every Metropolis ratio and threshold comparison has polynomial-sized operands.

For the output arithmetic, let \(B_f\) be an unconditional polynomial bound on the lengths of evaluated \(f\)-weights. Each observation ratio has \(O(B_f)\)-bit numerator and denominator. Adding \(N_{\rm av}\) such rationals using their product as a common denominator requires \(O(N_{\rm av}B_f+\log(N_{\rm av}+1))\) bits. Dividing by a nonzero empirical type probability adds only \(O(\log(N_{\rm av}+1))\) bits. The product of the \(H\) phase estimates and \(C(0)\) therefore has polynomial bit length. Ordinary integer arithmetic on these bounded operands, including the output operation, has polynomial cost.

Finally, every outer loop has its displayed deterministic cap, and the evaluation subroutine itself has bounded loops and finite bit draws. Initialization and counter updates add at most polynomially many operations on the bounded integers just described. No part of this resource argument conditions on empirical accuracy, on successful coupling, or on survival of a restart. An abort outputs the rational zero; otherwise all estimates are positive rationals. This proves the claim on every execution. ◻

Relative error and amplification

Proof of Theorem 1. For an infeasible input the preliminary deterministic test returns zero on every execution, as required. Suppose that the input is feasible.

First let \(p\geq 1\). Combine Proposition 22 with Lemma 23. Except on an event of probability at most \(1/50+10J_*\xi\), there is no abort, reference and implemented paths agree, and every positive observation differs from its reference counterpart by a factor between \(\exp(-4\xi)\) and \(\exp(4\xi)\). The same bounds hold for sums of these positive observations. Since type counts agree exactly, each implemented ratio estimate differs from its reference ratio by at most that same logarithmic amount. The implemented output \(\widehat Z\) consequently satisfies \[ \left|\log\frac{\widehat Z}{C(H)}\right| \leq H(4\eta+4\xi)\leq\frac{\varepsilon}{16}. \tag{73}\] The failure bound is less than \(1/4\), since \(10J_*\xi=\eta/100\).

Proposition 3 gives \[Z\leq C(H)\leq (1+\varepsilon/32)Z.\] Together with (73), this implies the desired relative inequalities. Indeed, \(e^{-\varepsilon/16}\geq 1-\varepsilon/16\), and for \(0<\varepsilon<1\), \[e^{\varepsilon/16}(1+\varepsilon/32) \leq (1+\varepsilon/8)(1+\varepsilon/32) \leq 1+\varepsilon.\] Thus a single implemented run succeeds with probability greater than \(3/4\).

The case \(p=1\) is already included in this argument. The enlarged state space then consists of the two transversals, the defect-type family and multiplier updates are empty, and \(\pi(\mathcal A)=1\). Only the type-zero indicator and \(G_j\) are observed. All denominators and time bounds used above remain defined.

If \(p=0\), there is a single small-count profile and \(C(H)=h_H(\varnothing)\). The call specified at the start of this section returns a positive rational satisfying \[(1-\varepsilon/32)C(H) \leq \widehat Z \leq (1+\varepsilon/32)C(H)\] with probability at least \(15/16\). The contamination bound again places this interval inside \([(1-\varepsilon)Z,(1+\varepsilon)Z]\). The evaluation procedure covers zero free coordinates as well, in which case its sum and bin space each have one element. This branch invokes none of the \(p\)-dependent chain parameters and has the same required polynomial bit bound.

It remains to obtain the requested failure probability. Put \[s=\left\lceil\log_2(\delta^{-1})\right\rceil,\qquad R=10s+1,\] run the appropriate constant-success algorithm independently \(R\) times, and return the median of its nonnegative rational outputs. Let \(F\) be the number of runs outside the desired relative interval. Independence and the single-run failure bound \(1/4\) give \[\mathbb E\,2^F\leq(5/4)^R.\] A bad median requires at least half the runs to fail, so \[\mathbb P\{\text{bad median}\} \leq \left(\frac{5}{4\sqrt2}\right)^{10s+1} \leq 2^{-s}\leq\delta.\] The middle inequality follows, for example, from \((5/(4\sqrt2))^{10}<1/2\).

Lemma 23, or Proposition 17 for \(p=0\), bounds the work and output length of every run by one fixed polynomial in \(L,\varepsilon^{-1}\). The number of repetitions is \(O(\log(\delta^{-1}))\); exact comparisons and median selection on their polynomial-length rational outputs also have polynomial bit cost. Ceilings of binary logarithms used for the parameters and bit counts are computable by integer shifts and comparisons. All randomness in the implemented procedure consists of independent unbiased bits. Partition functions, defect totals away from parameter zero, proof-only conditioning trees, and transport flows are never queried or enumerated. The only weight evaluation used is the bounded procedure proved in Proposition 17. This establishes a uniform FPRAS with the stated bound on every execution. ◻

Counting and sampling bounded integral flows

The table theorem also applies to integral single-commodity flows in arbitrary explicitly listed finite directed networks. Let \(G=(V,E)\) be a directed multigraph, allowing loops, and give each arc finite bounds \(\ell_e,u_e\in\mathbb Z\) and each vertex a balance \(\beta_v\in\mathbb Z\), all encoded in binary. With the convention “outflow minus inflow equals balance,” define \[ \begin{aligned} \mathcal F=\bigl\{f\in\mathbb Z^E:\;& \ell_e\le f_e\le u_e\quad(e\in E),\\ & \sum_{e:\,\mathrm{tail}(e)=v}f_e- \sum_{e:\,\mathrm{head}(e)=v}f_e=\beta_v\quad(v\in V)\bigr\}. \end{aligned} \tag{74}\] A loop occurs once in each sum and cancels from the balance. Each arc-value vector is counted once, not each path or cycle decomposition. Circulations have \(\beta=0\); for distinct \(s,t\), prescribed value \(k\) from \(s\) to \(t\) is expressed by balances \(k,-k,0\) at \(s,t\), and the other vertices, respectively.

Corollary 24 (Bounded integral flows). For the network data above, there are algorithms with these guarantees.

  1. Given rational \(\varepsilon,\delta\in(0,1)\), the counting algorithm outputs a nonnegative rational \(\widehat Z_{\mathrm{flow}}\) satisfying \[\mathbb P\bigl((1-\varepsilon)|\mathcal F|\le\widehat Z_{\mathrm{flow}} \le(1+\varepsilon)|\mathcal F|\bigr)\ge1-\delta.\] If \(\mathcal F\) is empty, it outputs zero on every execution.

  2. Given rational \(\tau\in(0,1)\), the sampling algorithm reports infeasibility exactly when \(\mathcal F\) is empty. Otherwise it outputs \(\widehat f\in\mathcal F\) on every execution, with \[\mathop{\mathrm{TV}}\bigl(\mathcal L(\widehat f),\operatorname{Unif}(\mathcal F)\bigr) =\frac12\sum_{f\in\mathcal F} \left|\mathbb P(\widehat f=f)-\frac1{|\mathcal F|}\right|\le\tau.\]

Both algorithms use independent unbiased bits. Let \(L\) denote the total binary input length, including the corresponding accuracy parameters. Fixed polynomials in \(L,\varepsilon^{-1},\log(\delta^{-1})\) for counting and in \(L,\tau^{-1}\) for sampling bound the total bit operations on every execution.

Proof. The flow-to-table bijection. If some \(\ell_e>u_e\), or if \(\sum_v\beta_v\ne0\), the flow set is empty; return zero for counting and report infeasibility for sampling. The second test is necessary because every arc cancels in the sum of the balance equations. If \(V=E=\varnothing\), there is one empty flow, which can be counted and returned directly. In all other cases, shift the lower bounds by putting \[\begin{aligned} x_e&=f_e-\ell_e,\qquad c_e=u_e-\ell_e,\\ \beta'_v&=\beta_v-\sum_{e:\,\mathrm{tail}(e)=v}\ell_e +\sum_{e:\,\mathrm{head}(e)=v}\ell_e. \end{aligned}\] Then \(0\le x_e\le c_e\) and the new balance is \(\beta'_v\).

For each original arc \(e=(u,v)\) introduce a private new vertex \(w_e\) and replace the arc by \(u\to w_e\to v\), giving both arcs cap \(c_e\) and giving \(w_e\) balance zero. The two arc values must agree at \(w_e\), so this is a bijection on flows, including when \(u=v\). The private vertices make all subdivided arc cells distinct and off-diagonal, also for parallel arcs. Write \(W=V\cup\{w_e:e\in E\}\) and \(E'\) for the subdivided vertices and arcs, and let \(c_a\) be the inherited cap of \(a\in E'\). Extend \(\beta'\) by zero at the new vertices. For \(q=|W|=|V|+|E|>0\), put \[\begin{gathered} K=1+\sum_{a\in E'}c_a+\sum_{w\in W}|\beta'_w|,\\ R_w=K+(\beta'_w)^+,\qquad C_w=K+(\beta'_w)^-, \end{gathered}\] where \(h^+=\max\{h,0\}\) and \(h^-=\max\{-h,0\}\). Index a \(q\times q\) table by \(W\) in both coordinates, use row margins \(R\) and column margins \(C\), and set \[b_{st}=\begin{cases} c_a,&a=(s,t)\in E',\\ K,&s=t,\\ 0,&\text{otherwise}. \end{cases}\] The cases are disjoint, and the margin totals agree because \(\sum_w\beta'_w=0\).

Given a subdivided flow \(z\), put its arc values in the arc cells. At vertex \(w\) the unique possible diagonal entry is \[y_w=R_w-\operatorname{out}_w(z) =C_w-\operatorname{in}_w(z).\] It is nonnegative since \(K\) dominates every incident capacity sum. If \(\beta'_w\ge0\), then \(y_w=K-\operatorname{in}_w(z)\); if \(\beta'_w\le0\), then \(y_w=K-\operatorname{out}_w(z)\). Thus \(y_w\le K\), so the table is feasible. Conversely, subtracting a table’s column equation from its row equation gives the subdivided balance at every vertex. The private-vertex balances equate the two copies of each original arc, and the diagonal entries are forced by the displayed formula. Adding back \(\ell\) gives the unique original flow. This proves a bijection with \(\Omega(R,C,b)\).

The table has \(q^2\) explicitly written caps. Its parameters are sums and differences of polynomially many binary integers, so their bit lengths and the total table-data length \(L_{\mathrm{tab}}\) are polynomial in the network-data length. Both directions of the bijection use only polynomially many operations on such integers; no capacity is expanded in unary. The deterministic feasibility test in Section 2 handles all remaining infeasibility, including edgeless and zero-capacity cases. If the table is infeasible, return zero for counting and report infeasibility for sampling. Otherwise Theorem 1 on the table gives the counting assertion with the stated bit bound.

Sampling by conditional counts. We use the self-reduction principle connecting approximate counting and almost-uniform generation (Jerrum et al. 1986, Theorem 6.3), implemented here by bisecting binary cell intervals. The argument below gives the required feasibility, total-variation, and bounded-bit guarantees.

After this root feasibility test, write \(\Omega(r,c,b)=\Omega(R,C,b)\) for the constructed feasible table set and initialize each cell interval to \([0,b_{ij}]\). At a reached node, let \([a_{ij},d_{ij}]\subseteq[0,b_{ij}]\) be the current integer interval for cell \((i,j)\). Shifting \(X_{ij}\) by \(a_{ij}\) is a bijection to a bounded-table instance with \[b'_{ij}=d_{ij}-a_{ij},\qquad r'_i=r_i-\sum_j a_{ij},\qquad c'_j=c_j-\sum_i a_{ij}.\] Reject negative residual data before applying the feasibility test. Process the cells in a fixed order. For a nonsingleton interval \([a,d]\), put \(m=\lfloor(a+d)/2\rfloor\) and use the disjoint children \([a,m]\) and \([m+1,d]\), continuing until every interval is a singleton. A path has at most \[D=\sum_{i,j}\left\lceil\log_2(b_{ij}+1)\right\rceil \le L_{\mathrm{tab}}\] decisions, and every conditioned input has polynomial binary length. If \(D=0\), the already-tested feasible table is unique and is returned directly. No assumption that attainable cell values form an interval is used.

At a reached node, test both children for feasibility. Their feasible sets partition the parent’s feasible set, so at least one is feasible. If exactly one is feasible, take it. If both are feasible, let their positive counts be \(N_0,N_1\) and call Theorem 1 separately on the two child instances with relative error \(\eta\) and failure probability \(\gamma\), using fresh independent bits. Write the nonnegative outputs as \(\widehat N_0,\widehat N_1\). If their sum is zero, take child zero, which is known to be feasible. Otherwise put \(\widehat p=\widehat N_0/(\widehat N_0+\widehat N_1)\). Using \(t\) further fresh bits, draw \(U\) uniformly from \(\{0,\ldots,2^t-1\}\) and take child zero exactly when \(U<\lfloor2^t\widehat p\rfloor\). This implements probability \(p_t=2^{-t}\lfloor2^t\widehat p\rfloor\), with \(|p_t-\widehat p|\le2^{-t}\), in bounded bit time. In particular, a zero estimate is never used as an infeasibility certificate, and every reached child is feasible.

For exact counts the branch probability is \(p=N_0/(N_0+N_1)\), and these exact conditional probabilities telescope to the uniform law on feasible singleton leaves. On successful estimates, write \(\widehat N_i=N_i(1+e_i)\) with \(|e_i|\le\eta\). Then \[|\widehat p-p|=\frac{p(1-p)|e_0-e_1|}{1+pe_0+(1-p)e_1} \le\frac{\eta}{2(1-\eta)}.\] At each reached history, the fresh count calls fail with probability at most \(2\gamma\) in total. Averaging over them and the fresh branch bits, the conditional total-variation error of the implemented branch choice relative to the exact one is therefore at most \[a=\frac{\eta}{2(1-\eta)}+2\gamma+2^{-t}.\] This bound also covers the zero-sum fallback; a one-feasible-child node has zero error. Couple the two branch choices whenever their prefixes agree. The probability of any mismatch is at most \(Da\), so the output total-variation distance from the uniform table law is at most \(Da\). This averages failures at each adaptive history, without conditioning on a path-dependent event that all count calls succeed.

Set \(D_+=\max\{1,D\}\) and choose \[\eta=\gamma=\frac{\tau}{8D_+},\qquad t=\left\lceil\log_2\frac{8D_+}{\tau}\right\rceil.\] Since \(\eta<1/2\), the preceding bound gives \(Da\le\tau/2\le\tau\). There are at most \(2D\) count calls and \(2D+1\) feasibility tests. Their input lengths are polynomial in \(L\), including the binary encoding of \(\tau\), while \(\eta^{-1}=8D_+/\tau\) and \(\log(\gamma^{-1})=\log(8D_+/\tau)\). Theorem 1 bounds both the work and the output lengths of every count call, including failed ones. Thus exact ratio arithmetic and the \(t\)-bit threshold draw also have polynomial cost on every execution; the ceiling defining \(t\) is computable by integer shifts and comparisons. The inverse bijection returns a feasible flow and preserves the total-variation distance. This proves the sampling and runtime assertions. ◻

The sampling conclusion is the stated total-variation approximation with polynomial dependence on \(\tau^{-1}\). It asserts neither exact sampling nor a polynomial-in-\(\log(\tau^{-1})\) error dependence.

Aldous, David, and James Allen Fill. 2002. Reversible Markov Chains and Random Walks on Graphs.
Barvinok, Alexander. 2009. “Asymptotic Estimates for the Number of Contingency Tables, Integer Flows, and Volumes of Transportation Polytopes.” International Mathematics Research Notices 2009 (2): 348–85. https://doi.org/10.1093/imrn/rnn133.
Barvinok, Alexander, Zur Luria, Alex Samorodnitsky, and Alexander Yong. 2010. “An Approximation Algorithm for Counting Contingency Tables.” Random Structures & Algorithms 37 (1): 25–66. https://doi.org/10.1002/rsa.20301.
Bezáková, Ivona, Nayantara Bhatnagar, and Eric Vigoda. 2007. “Sampling Binary Contingency Tables with a Greedy Start.” Random Structures & Algorithms 30 (1–2): 168–205. https://doi.org/10.1002/rsa.20155.
Brändén, Petter, and June Huh. 2020. “Lorentzian Polynomials.” Annals of Mathematics, 2nd series, vol. 192 (3): 821–91. https://doi.org/10.4007/annals.2020.192.3.4.
Brändén, Petter, Jonathan Leake, and Igor Pak. 2023. “Lower Bounds for Contingency Tables via Lorentzian Polynomials.” Israel Journal of Mathematics 253: 43–90. https://doi.org/10.1007/s11856-022-2364-9.
Chen, Xiaoyu, Eric Vigoda, and Xiongxin Yang. 2026. Faster FPRAS for the Permanent via Restricted Poincaré Inequalities and Coupled Flows. https://arxiv.org/abs/2608.26599.
Cryan, Mary, and Martin Dyer. 2003. “A Polynomial-Time Algorithm to Approximately Count Contingency Tables When the Number of Rows Is Constant.” Journal of Computer and System Sciences 67 (2): 291–310. https://doi.org/10.1016/S0022-0000(03)00014-X.
Cryan, Mary, Martin Dyer, and Dana Randall. 2010. “Approximately Counting Integral Flows and Cell-Bounded Contingency Tables.” SIAM Journal on Computing 39 (7): 2683–703. https://doi.org/10.1137/060650544.
Diaconis, Persi, and Anil Gangolli. 1995. “Rectangular Arrays with Fixed Margins.” In Discrete Probability and Algorithms, edited by David Aldous, Persi Diaconis, Joel Spencer, and J. Michael Steele, vol. 72. The IMA Volumes in Mathematics and Its Applications. Springer. https://doi.org/10.1007/978-1-4612-0801-3_3.
Dyer, Martin. 2003. “Approximate Counting by Dynamic Programming.” Proceedings of the Thirty-Fifth Annual ACM Symposium on Theory of Computing, 693–99. https://doi.org/10.1145/780542.780643.
Dyer, Martin, and Catherine Greenhill. 2000. “Polynomial-Time Counting and Sampling of Two-Rowed Contingency Tables.” Theoretical Computer Science 246 (1–2): 265–78. https://doi.org/10.1016/S0304-3975(99)00136-X.
Dyer, Martin, Ravi Kannan, and John Mount. 1997. “Sampling Contingency Tables.” Random Structures & Algorithms 10 (4): 487–506.
Edmonds, Jack, and Richard M. Karp. 1972. “Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems.” Journal of the ACM 19 (2): 248–64.
Gopalan, Parikshit, Adam Klivans, Raghu Meka, Daniel Štefankovič, Santosh Vempala, and Eric Vigoda. 2011. “An FPTAS for #Knapsack and Related Counting Problems.” Proceedings of the 52nd Annual IEEE Symposium on Foundations of Computer Science, 817–26. https://doi.org/10.1109/FOCS.2011.32.
Guo, Heng, and Mark Jerrum. 2023. “Counting Vertices of Integral Polytopes Defined by Facets.” Discrete & Computational Geometry 70 (3): 975–90. https://doi.org/10.1007/s00454-022-00406-8.
Jerrum, Mark R., Leslie G. Valiant, and Vijay V. Vazirani. 1986. “Random Generation of Combinatorial Structures from a Uniform Distribution.” Theoretical Computer Science 43: 169–88. https://doi.org/10.1016/0304-3975(86)90174-X.
Jerrum, Mark, Alistair Sinclair, and Eric Vigoda. 2004. “A Polynomial-Time Approximation Algorithm for the Permanent of a Matrix with Nonnegative Entries.” Journal of the ACM 51 (4): 671–97. https://doi.org/10.1145/1008731.1008738.
Leake, Jonathan, and Maryam Mohammadi Yekta. 2026. Log-Concavity and Approximate Counting for Totally Unimodular Polytopes. https://arxiv.org/abs/2609.39917.
Leindler, László. 1972. “On a Certain Converse of Hölder’s Inequality. II.” Acta Scientiarum Mathematicarum 33 (3–4): 217–23.
Morris, Ben. 2002. “Improved Bounds for Sampling Contingency Tables.” Random Structures & Algorithms 21 (2): 135–46. https://doi.org/10.1002/rsa.10049.
OpenAI. 2026a. Approximate counting of common bases of two matroids. OpenAI Math Release preprint OAI:Approximate-counting-of-common-bases-of-two-matroids-September-23-2026.
OpenAI. 2026b. Exact Uniform Sampling of Contingency Tables with Arbitrary Margins. OpenAI Math Release preprint OAI:Exact-Uniform-Sampling-of-Contingency-Tables-with-Arbitrary-Margins-September-24-2026.
Prékopa, András. 1973. “On Logarithmic Concave Measures and Functions.” Acta Scientiarum Mathematicarum (Szeged) 34: 335–43.
LEVEL 2 COMPLETE!
You read 21,285 words and 1,532 formulas. Your math teacher would be proud.
Converted from the LaTeX source. Something look off? The original PDF is the real thing.

Cool Links: openai/math   Lean   Mathlib   arXiv   the real Coolmath Games