Combinatorial subset-pair unranking and streaming folds #
For Boolean Möbius reconstruction of low-degree polynomials ([OAI26k], Lemma 3.3, eq. (3.10)
and Proposition 3.4, pp. 24–26), the outer loop visits all subset pairs (E, U) of Fin n with
#E ≤ q and U ⊆ E, weighted by (-1) ^ (#E - #U), in C_q = ∑ s ≤ min q n, 2 ^ s * n.choose s
steps without materializing exponentially many subsets.
Main definitions #
Cslib.GenericRAM.SubsetPairFold.pascalTable,Cslib.GenericRAM.SubsetPairFold.subsetPairCount: dynamic-programming Pascal table and executable countC_q.Cslib.GenericRAM.SubsetPairFold.DecodedPair,Cslib.GenericRAM.SubsetPairFold.unrankSubsetPair,Cslib.GenericRAM.SubsetPairFold.ValidSubsetPair,Cslib.GenericRAM.SubsetPairFold.unrankValidSubsetPair,Cslib.GenericRAM.SubsetPairFold.validSubsetPairEquiv:(E, U)unranker and bijection (viaCslib.BitString.supportOfList).Cslib.GenericRAM.SubsetPairFold.pascalTableCertificate,Cslib.GenericRAM.SubsetPairFold.subsetPairCountCertificate,Cslib.GenericRAM.SubsetPairFold.unrankSubsetPairCertificate,Cslib.GenericRAM.SubsetPairFold.indexBody,Cslib.GenericRAM.SubsetPairFold.runPrefix,Cslib.GenericRAM.SubsetPairFold.run,Cslib.GenericRAM.SubsetPairFold.certificate: native resource certificates and streaming fold built onCslib.GenericRAM.IndexFold.run.
Main results #
Cslib.GenericRAM.SubsetPairFold.getD_pascalTable_eq_choose,Cslib.GenericRAM.SubsetPairFold.length_encNat_mem_pascalTable_le,Cslib.GenericRAM.SubsetPairFold.subsetPairCount_eq_sum,Cslib.GenericRAM.SubsetPairFold.subsetPairCount_eq,Cslib.GenericRAM.SubsetPairFold.subsetPairCount_pos,Cslib.GenericRAM.SubsetPairFold.subsetPairCount_le_three_pow,Cslib.GenericRAM.SubsetPairFold.length_encNat_subsetPairCount_le: DP table,C_qrefinement withCslib.subsetPairCount, and binary-length bounds.Cslib.GenericRAM.SubsetPairFold.bijective_unrankValidSubsetPair,Cslib.GenericRAM.SubsetPairFold.nodup_map_unrankSubsetPair,Cslib.GenericRAM.SubsetPairFold.existsUnique_unrankSubsetPair,Cslib.GenericRAM.SubsetPairFold.pascalTable_polyTime,Cslib.GenericRAM.SubsetPairFold.subsetPairCount_polyTime,Cslib.GenericRAM.SubsetPairFold.unrankSubsetPair_polyTime: bijection andfun_proppolytime.Cslib.GenericRAM.SubsetPairFold.run_eq_foldl_map,Cslib.GenericRAM.SubsetPairFold.run_mobius_eq_sum_restricted_subsets,Cslib.GenericRAM.SubsetPairFold.computableInO,Cslib.GenericRAM.SubsetPairFold.polyBounded_space_of_polyBounded: streaming fold and space.
References #
- OpenAI, The Exponential Time Hypothesis is False, Section 3.4 (Lemma 3.3, eq. (3.10)) and Section 3.5 (eq. (3.14) and Proposition 3.4), printed pp. 24–26.
State ((k, r), bits) of combinatorial unranking unrankCombStep.
Remaining weight and rank pair (k, r) of UnrankCombState.
Remaining weight k of UnrankCombState.
Remaining rank r of UnrankCombState.
Accumulated indicator bit list bits of UnrankCombState.
One step of combinatorial unranking of rank r < C(n, k) into an n-bit indicator.
Section 1: Dynamic-programming Pascal table and exact binary clock C_q #
pascalTable n has n + 1 rows.
In-bounds lookup in pascalTable n returns i.choose s.
Defaulted lookup in row i ≤ n of pascalTable n equals i.choose s for every s : ℕ.
Every binomial coefficient i.choose s for i ≤ n has binary length at most n + 1.
Every entry stored in pascalTable n has binary encoding length at most n + 1.
Executable subset-pair count C_q = ∑ s ≤ min q n, 2 ^ s * n.choose s ([OAI26k]).
subsetPairCount n q equals ∑ s ∈ Finset.range (min q n + 1), 2 ^ s * n.choose s.
Refinement equality equating the DP subsetPairCount to Cslib.subsetPairCount.
subsetPairCount n q is strictly positive for all n, q (since (∅, ∅) is always valid).
When n ≤ q, subsetPairCount n q = 3 ^ n ([OAI26k], eq. (3.14)).
subsetPairCount n q ≤ 3 ^ n for all n, q : ℕ.
The binary index bound subsetPairCount n q occupies at most 2 * n + 1 bits in encNat.
Section 2: Polynomial-time combinatorial (E, U) unranker and bijection #
Decoded (indE, indU, negSign) triple: length-n indicators and Odd (#E - #U) flag.
First indicator list indE of a DecodedPair.
Inner indicator and sign pair (indU, negSign) of a DecodedPair.
Second indicator list indU of a DecodedPair.
Parity sign flag negSign of a DecodedPair.
Combinatorial (E, U) unranker: decodes j < subsetPairCount n q into (indE, indU, negSign)
without materializing subsets, with deterministic empty-pair fallback for j ≥ C_q.
The table-driven unranker computes Cslib.BitString.unrankCombination.
Out-of-range indices j ≥ subsetPairCount n q return the empty-pair fallback.
The first indicator indE returned by unrankSubsetPair n q j has exact length n.
The second indicator indU returned by unrankSubsetPair n q j has exact length n.
Weight bound: indE has at most min q n (hence at most q) true entries.
The third component negSign is decide (Odd (indE.count true - indU.count true)).
Every decoded unrankSubsetPair n q j has #E ≤ q.
Every decoded unrankSubsetPair n q j satisfies U ⊆ E.
Map a valid index j : Fin (subsetPairCount n q) to its ValidSubsetPair n q.
unrankValidSubsetPair n q is injective on Fin (subsetPairCount n q).
Summing 2 ^ #E over all E ⊆ Fin n with #E ≤ q yields subsetPairCount n q.
The finite type ValidSubsetPair n q has exact cardinality subsetPairCount n q.
unrankValidSubsetPair n q is a bijection onto ValidSubsetPair n q.
Equivalence between binary indices Fin (subsetPairCount n q) and ValidSubsetPair n q.
Mapping unrankSubsetPair n q over List.range (subsetPairCount n q) has no duplicates.
Exact completeness: every valid pair (E, U) with #E ≤ q and U ⊆ E is decoded at a
unique index j < subsetPairCount n q.
Section 3: Plain ComputableInPolyTime and NativeCertificate witnesses #
Input tuple ((n, q), j) for unrankSubsetPair.
Dimension/degree pair (n, q) of a SubsetPairQuery.
Dimension n of a SubsetPairQuery.
Degree bound q of a SubsetPairQuery.
Binary rank index j of a SubsetPairQuery.
Encoding for decoded (indE, indU, negSign) triples.
Pascal tables of binomial coefficients, such as pascalTable n, as lists of rows with entries
in binary: the concatenation of the framed rows, each row the concatenation of its framed entries,
each encoded by encNat. This is the layout encList (encList encNat) that other modules name by
their own roles, such as Cslib.Complexity.encSparseEquation; the name records the role.
pascalTable is computable in polynomial time from n in unary.
subsetPairCount is computable in polynomial time from (n, q) in unary.
The table-driven unranker is polynomial-time, from (n, k) in unary, the rank in binary and
the table.
unrankSubsetPair is computable in polynomial time from (n, q) in unary and j in binary.
Unranking combinations is polynomial-time, from (m, k) in unary and the rank in
binary.
Native certificate for pascalTable, selected via NativeCertificate.ofPolyTime.
pascalTableCertificate has polynomial time and workspace bounds.
Native certificate for subsetPairCount, selected via NativeCertificate.ofPolyTime.
subsetPairCountCertificate has polynomial time and workspace bounds.
Native certificate for unrankSubsetPair, selected via NativeCertificate.ofPolyTime.
unrankSubsetPairCertificate has polynomial time and workspace bounds.
Section 4: Streaming IndexFold combinator (SubsetPairFold.run & computableInO) #
Persistent streaming state (index, ((n, q), acc)) of SubsetPairFold.
Stream all subsetPairCount n q valid (E, U) subset pairs through IndexFold.run.
The retained unary parameter pair (n, q) is invariant across all streaming prefixes.
Every prefix accumulator equals the ordered range fold over decoded indices 0, …, m - 1.
SubsetPairFold.run agrees with folding over List.range (subsetPairCount n q).
SubsetPairFold.run agrees with folding over the mapped list of decoded pairs.
Signed Möbius accumulation via run computes ∑_{#E ≤ q} ∑_{U ⊆ E} (-1) ^ (#E - #U) * g E U
over any commutative ring R ([OAI26k], Lemma 3.3 eq. (3.10), Proposition 3.4).
Native certificate for one indexBody round, retaining (n, q) in unary.
Native certificate for SubsetPairFold.run, built on IndexFold.certificate.
Polynomial overhead in n + q for subsetPairCount, unranking, and index maintenance.
decodeOverhead is polynomially bounded in n + q.
Streaming resource bound for SubsetPairFold.run via IndexFold.computableInO: time scales
with subsetPairCount (dim a) (deg a) + 1 while live workspace is independent of C_q.
When dim, deg, and initial have polynomial certificates and B and Q are polynomially
bounded in the input length, the live workspace of SubsetPairFold.computableInO is polynomial.