Counting words #
Counting the words List.ofFn v, for v : Fin n → Bool, that pass a test: the counting arguments
of parity and counting classes, which count accepted certificates. A word of length m + n is a
prefix of length m followed by a word of length n
(Cslib.BitString.card_filter_ofFn_add); a word of length n + 1 is a first bit followed by a
word of length n (Cslib.BitString.card_filter_ofFn_succ); a word of T rows of B bits
whose rows pass independent tests is counted by a product
(Cslib.BitString.card_filter_listRows_all). Exactly one word has no bit true, and exactly one
has no bit false (Cslib.BitString.card_filter_not_any, Cslib.BitString.card_filter_all).
The lexicographic order on words of equal length (Cslib.BitString.wordLt) is the order of
Lex (Fin n → Bool) (Cslib.BitString.wordLt_ofFn_iff), so strictly increasing lists of words
represent sets of words.
Main definitions #
Cslib.BitString.wordLt: the lexicographic order on words of equal length.
Main results #
Cslib.BitString.card_filter_binaryValue_lt: exact counts below a binary threshold.Cslib.BitString.card_filter_ofFn_add,Cslib.BitString.card_filter_ofFn_succ: counting words by a prefix or by their first bit.Cslib.BitString.card_filter_take: counting words by a condition on a prefix.Cslib.BitString.card_filter_take_drop: independent prefix/suffix tests give a product.Cslib.BitString.two_mul_two_pow_le_of_four_mul_card_filter_not_le: a quarter of failures leaves two thirds of successes.Cslib.BitString.two_pow_mul_card_filter_card_filter_block_le: majority votes of12 eblocks err on at most a2 ^ (-e)fraction.Cslib.BitString.card_filter_listRows_all: counting words by a condition on each row.Cslib.BitString.card_filter_not_any,Cslib.BitString.card_filter_all: the constant words.Cslib.BitString.ofFn_decide_lt: the unary word ofkbitstrueamongK.Cslib.BitString.wordLt_ofFn_iff:wordLtis the lexicographic order.Cslib.BitString.odd_prod_iff,Cslib.BitString.odd_one_add_prod_one_add: parity of products and the parity form of a disjunction.Cslib.BitString.card_filter_forall_apply_mem: counting functions with restricted values on an injective family of points.Cslib.BitString.two_pow_mul_card_filter_exists_le: union bound for random strings.Cslib.BitString.sum_range_neg_two_pow_mul_choose,Cslib.BitString.sum_range_neg_two_pow_mul_choose_zmod: the parity ofcfrom binomial coefficients, overℤand modulo2 ^ K.Cslib.BitString.card_filter_strictMono,Cslib.BitString.strictMono_of_lt_succ: strictly increasing tuples count subsets.
Counting words #
Counting words by a prefix. For k ≤ K, the words of K bits whose prefix of length k
satisfies g are 2 ^ (K - k) times as many as the words of k bits satisfying g.
Counting words of length m by a condition on their first a bits and a condition on the
remaining bits gives the product of the two counts.
Error at most 1 / 4 is error at most 1 / 3: if at most a quarter of the strings of m
bits fail g, at least two thirds of them satisfy it.
Majority votes of blocks. If at least two thirds of the strings of m bits satisfy g,
then at most a 2 ^ (-e) fraction of the strings of 2 R = 12 e blocks of m bits have at most
R blocks satisfying g: the exponential-moment bound Cslib.card_filter_card_filter_le_le, with
2 * 8 ^ 6 ≤ 9 ^ 6.
The unary word of k ≤ K bits true followed by falses.
The lexicographic order #
The lexicographic order on words of equal length: x is below y at the first position
where they differ.
Instances For
Parity, subsets, and binomial amplification #
The functions s : ι → X whose values at the t distinct points f i lie in F: F is
chosen at those points and anything elsewhere.
The union bound for random strings: if each x is bad for at most a 2 ^ (-e') fraction
of the random strings, some x of length M is bad for at most a 2 ^ (M - e') fraction.
Strictly increasing tuples count subsets: the strictly increasing k-tuples of elements
of A are as many as the k-element subsets of A.