∑math20

Theoretical computer science · Result 115

Sampling and counting contingency tables with arbitrary margins

2 papersLean

For nonnegative integer matrices with prescribed row and column sums, gives exact uniform sampling in expected polynomial bit time and almost-uniform sampling in worst-case polynomial bit time. The dimensions and binary-encoded margins are unrestricted. Also gives a fully polynomial randomized approximation scheme for counting such tables with arbitrary individual cell bounds, including structural zeros, with polynomial cost on every execution.

Watch

▶Introduction: the problem and why it mattersin preparation
▶The presented solutionin preparation

Papers 2

First page of Exact Uniform Sampling of Contingency Tables with Arbitrary Margins

Exact Uniform Sampling of Contingency Tables with Arbitrary Margins

OpenAI · September 24, 2026

We give an exact uniform sampler for nonnegative integer contingency tables with arbitrary prescribed margins. It terminates almost surely and has expected bit complexity polynomial in both dimensions and the binary length of the margins. No positivity, balance, sparsity, or fixed-dimension assumption is required.

Read PDF Download Source

Cite
@misc{OAI:Exact-Uniform-Sampling-of-Contingency-Tables-with-Arbitrary-Margins-September-24-2026,
  author = {{OpenAI}},
  title = {{Exact Uniform Sampling of Contingency Tables with Arbitrary Margins}},
  howpublished = {OpenAI Math Release preprint
                  \href{https://github.com/openai/math/blob/main/preprints/Exact-Uniform-Sampling-of-Contingency-Tables-with-Arbitrary-Margins-September-24-2026/main.pdf}{OAI:Exact-Uniform-Sampling-of-Contingency-Tables-with-Arbitrary-Margins-September-24-2026}},
  year = {2026}
}
First page of An FPRAS for Cell-Bounded Contingency Tables

An FPRAS for Cell-Bounded Contingency Tables

OpenAI · September 24, 2026

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.

Read PDF Download Source

Cite
@misc{OAI:An-FPRAS-for-Cell-Bounded-Contingency-Tables-September-24-2026,
  author = {{OpenAI}},
  title = {{An FPRAS for Cell-Bounded Contingency Tables}},
  howpublished = {OpenAI Math Release preprint
                  \href{https://github.com/openai/math/blob/main/preprints/An-FPRAS-for-Cell-Bounded-Contingency-Tables-September-24-2026/main.pdf}{OAI:An-FPRAS-for-Cell-Bounded-Contingency-Tables-September-24-2026}},
  year = {2026}
}

What was formalized in Lean

The following describes the scope of the Lean formalization related to the following accompanying paper(s):

Scope

The formalization gives an exact uniform sampler for nonnegative integer contingency tables with arbitrary prescribed row and column sums having equal totals. It terminates almost surely, every halted output is feasible, and each table has exactly the uniform limiting probability. Expected bit complexity is polynomial in the dimensions and the binary length of the margins.

It also gives a sampler with a fixed polynomial time bound on every execution whose total-variation error is at most \(2^{-k}\) for requested precision \(k\ge1\). The same Comparator file includes the companion approximation scheme for counting tables with individual cell bounds.

The formalization gives a fully polynomial randomized approximation scheme for counting nonnegative integer matrices with prescribed row sums, column sums, and individual entry bounds. Both dimensions may vary, the margins and bounds are binary encoded, and zero entry bounds are allowed. For rational \(0<\varepsilon,\delta<1\), the algorithm returns a nonnegative estimate with relative error at most \(\varepsilon\) with probability at least \(1-\delta\), and returns zero on every execution when no table exists.

The running time is polynomial in the encoded input size, \(\varepsilon^{-1}\), and \(\log(\delta^{-1})\) on every random tape. The same Comparator file also contains the companion sampling results for tables without cell bounds.

Comparator links

ResultComparator statement
Exact and bounded-time sampling of contingency tablesContingencyTables.lean
Randomized approximate counting of cell-bounded contingency tablesContingencyTables.lean

Scope note on GitHub →