Finite counting toolkit #
Exact cardinality lemmas for the finite sample space Fin T → Bool used by the
probabilistic-machine semantics (NTM.acceptCount, NTM.acceptProb). These are
the reusable combinatorial facts underlying randomized classes, amplification,
and interactive proofs (roadmap track N2).
Main results #
card_finArrowBool—|Fin T → Bool| = 2 ^ TblockEquiv— the split of a length-a + brandom string into its length-aprefix and length-bsuffix, packaged as anEquiv(so the projection and concatenation maps are inverse by construction)card_filter_block— block independence: the count of seeds whose prefix and suffix satisfy given predicates is the product of the two countscard_filter_exists_le— the finite union bound: the number of sample points satisfying some predicate in a finite family is at most the sum of the per-predicate countsboolFunEquivFinset,card_filter_popCount_eq— Boolean vectors as true supports and their exact binomial weight countsfinCountP_eq_popCount— the bridge from the dependency-lightFin.countPused by circuit encoders to finite-set support countingblocksEquiv,card_blockEventCount_eq— a long machine seed as independent blocks and the exact weighted binomial count for any block eventrepeatRandomSeed,card_repeatRandomSeed_fiber— extract the actual simulation slots from a fixed-time repetition seed and count its ignored administrative bitscard_filter_of_constant_fibers— transfer an event count through a projection whose fibers all have the same power-of-two cardinalitycard_blockMajority_eq_false— the exact weighted lower-tail count for failure across an odd number of blocksblockEventCount_add_compl,blockMajority_compl_of_odd— event-complement symmetry for block counts and odd strict majoritiescard_majority_eq_true,card_majority_eq_false— exact binomial-tail counts for strict-majority success and failuremajority_not_of_odd— strict majority is antisymmetric under pointwise negation at odd length
Cardinality of the random-bit sample space #
The finite sample space of T random bits has 2 ^ T points. This is the
denominator in NTM.acceptProb.
There are exactly 2 ^ (2 ^ n) Boolean functions on n bits — the number of
distinct 2 ^ n-entry truth tables. The base fact for property density in
natural-proofs arguments.
There are exactly 2 ^ (n * n) directed graphs (adjacency matrices) on n
vertices — the number of n × n Boolean matrices. The size datum behind
adjacency-matrix encodings of graph languages such as CLIQUE.
An n-vertex adjacency matrix biject with n²-bit strings by row-major
serialization. Packaging this as an Equiv gives a canonical encode
(adjMatrixEquivBitVec) and decode (.symm) that are inverse by
construction — the codec behind graph-language encodings.
Equations
- Complexity.adjMatrixEquivBitVec n = (Equiv.curry (Fin n) (Fin n) Bool).symm.trans (finProdFinEquiv.arrowCongr (Equiv.refl Bool))
Instances For
Block projection and concatenation #
A length-a + b random string is equivalently its length-a prefix paired
with its length-b suffix. The forward map is the pair of projections; the
inverse is concatenation. Packaging this as an Equiv proves the projection
and concatenation maps are mutually inverse.
Equations
- Complexity.blockEquiv a b = (finSumFinEquiv.arrowCongr (Equiv.refl Bool)).symm.trans (Equiv.sumArrowEquivProdArrow (Fin a) (Fin b) Bool)
Instances For
The prefix projection of a length-a + b random string.
Equations
- Complexity.blockFst a b w = ((Complexity.blockEquiv a b) w).1
Instances For
The suffix projection of a length-a + b random string.
Equations
- Complexity.blockSnd a b w = ((Complexity.blockEquiv a b) w).2
Instances For
Block independence (exact counting form). The number of length-a + b seeds
whose prefix satisfies P and suffix satisfies Q is the product of the two
individual counts. Because blockEquiv is a bijection onto the product sample
space, the joint event factors — the exact-count statement of independence across
blocks, and the combinatorial heart of relating a repeated machine's acceptance to
its single-run acceptance (amplification, roadmap N2/M2).
Finite union bound #
The finite union bound: the number of sample points satisfying some
predicate p i for i in a finite index set s is at most the sum over s
of the per-predicate counts. The workhorse behind failure-probability bounds
over many bad events.
The probabilistic method: a perfect seed exists. If the total number of
"bad" seeds summed over all inputs is strictly less than the number of seeds,
then some single seed is good for every input simultaneously. This is the
machine-independent counting core of BPP ⊆ P/poly (hardwiring one random
string that works for all 2ⁿ inputs of a given length).
Majority #
Batteries' fold-based Boolean count agrees with the finite-set support count used by the randomized-counting layer.
Boolean-valued functions are equivalent to their true supports.
Equations
Instances For
Weighted event counts across blocks #
A length-k * T seed is equivalently a sequence of k blocks of length T.
The product equivalence fixes the row-major schedule consumed by repeated
randomized computations.
Equations
- Complexity.blocksEquiv k T = (finProdFinEquiv.arrowCongr (Equiv.refl Bool)).symm.trans (Equiv.curry (Fin k) (Fin T) Bool)
Instances For
Fixed-time repetition schedules #
Split a full stride seed into simulation and administrative choices.
Equations
- Complexity.repeatStrideSeedEquiv k T = ((Complexity.repeatStrideIndexEquiv k T).arrowCongr (Equiv.refl Bool)).symm.trans (Equiv.sumArrowEquivProdArrow (Fin (k * T)) (Fin (k * (T + 2))) Bool)
Instances For
Project a repetition stride onto its k * T genuine simulation choices.
Equations
- Complexity.repeatStrideRandomSeed k T w = ((Complexity.repeatStrideSeedEquiv k T) w).1
Instances For
Extract the k * T genuinely random simulation choices from a repetition
trace of length 2 + k * (2 * T + 2). The first two choices and the last
T + 2 choices of every repetition stride are administrative and ignored.
Equations
- Complexity.repeatRandomSeed k T w = Complexity.repeatStrideRandomSeed k T (Complexity.blockSnd 2 (k * (2 * T + 2)) w)
Instances For
The compact seed's (i,t) entry is the choice at simulation offset t in
repetition stride i, after the two initial setup choices.
Every compact repetition seed has exactly one freely chosen assignment to each administrative slot in its full-seed fiber.
If a finite Boolean-seed projection has constant fibers, then every event that factors through the projection gains exactly that common fiber factor.
An event depending only on the compact repetition seed has its count multiplied by the number of ignored administrative choice assignments.
Exact odd-majority failure count. For 2r + 1 independent T-bit
blocks, failure means at most r blocks lie in E; each summand is the
corresponding weighted binomial fiber.
The strict majority vote of a Boolean vector: true iff more than half the
positions are true.
Equations
- Complexity.majority f = decide (2 * Complexity.popCount f > k)