Documentation

CslibFrontier.Computability.MCSP.AntiChecker.Threshold

A deterministic greedy anti-checker against a threshold oracle #

Let G be a finite family of descriptions, each evaluating to a Boolean function on α, and let f : α → Bool. After labelled samples P, the descriptions still consistent are those that agree with every sample (Cslib.MCSP.AntiChecker.consistent). A threshold oracle with power ℓ answers queries (P, u) and separates #consistent ^ ℓ from 2 ^ u up to a factor 2 (u + 1) (Cslib.MCSP.AntiChecker.IsThresholdOracle): a yes-answer guarantees fewer than 2 ^ (u + 1), at threshold 0 it guarantees that no description is consistent, and fewer than 2 ^ u / (u + 1) forces a yes-answer.

The greedy (Cslib.MCSP.AntiChecker.greedy) runs R rounds with thresholds R - 1, …, 0. In the round with threshold u it appends the first candidate y, labelled f y, on which the oracle answers yes, or a default candidate if there is none (Cslib.MCSP.AntiChecker.select). Suppose every nonempty subfamily of G is refuted on a sixteenth of its members by some candidate, as for circuits of bounded size against a function needing more gates than their strict majorities (Cslib.MCSP.exists_card_le_sixteen_mul_validCertificates). If #G ≤ 2 ^ L and 4 (L ℓ + 1) 15 ^ ℓ ≤ 16 ^ ℓ, then after R = L ℓ + 1 rounds no description is consistent (Cslib.MCSP.AntiChecker.consistent_greedy_eq_empty). Before the round with threshold u, #consistent ^ ℓ < 2 ^ (u + 2). A refuting candidate leaves at most 15 / 16 of the consistent descriptions, so the oracle must answer yes on it: the factor (15 / 16) ^ ℓ absorbs the slack 4 (u + 1), which is why the oracle measures a power of the count. The choice ℓ = L + 200 meets the condition for every L (Cslib.MCSP.AntiChecker.four_mul_mul_add_one_mul_fifteen_pow_le_sixteen_pow).

A threshold oracle comes from covering by pairwise independent hashing (Cslib.Probability.IsPairwiseIndependentHash.exists_covers_of_card). The ℓ-th Cartesian power of the consistent set is large at threshold u if u + 1 affine hash functions to strings of u bits are jointly surjective on it (Cslib.MCSP.AntiChecker.IsLarge). The oracle answering whether the power is not large (Cslib.MCSP.AntiChecker.hashOracle) is a threshold oracle for every ℓ > 0 (Cslib.MCSP.AntiChecker.isThresholdOracle_hashOracle). With the valid circuit descriptions this gives an explicit anti-checker of L (L + 200) + 1 inputs, where L is the certificate length (Cslib.MCSP.AntiChecker.isAntiChecker_hashAntiChecker).

This is the library's deterministic greedy against a counting oracle, not the proof of Oliveira, Pich and Santhanam, Lemma 4.1. Their proof counts with Stockmeyer's randomized approximate counting, fixes the randomness non-uniformly, and lists the few surviving circuits at the end. Here the greedy drives the count to zero, so no listing step is needed, and the oracle is deterministic. Raising the consistent set to a Cartesian power before hashing it with linear hash functions follows the approximate counting in [Chen, Hirahara, Oliveira, Pich, Rajgopal and Santhanam, proof of Lemma 27 and Claim 28] [CHO+20]. There, linear maps that are injective on pieces certify an upper bound on the count. Here, jointly surjective maps certify a lower bound. The efficient generator, which needs circuits for the oracle and for the selection, is not formalized here.

Main definitions #

Main results #

References #

Consistent descriptions #

def Cslib.MCSP.AntiChecker.consistent {α : Type u_1} {β : Type u_2} (G : Finset β) (eval : β → α → Bool) (P : List (α × Bool)) :

The descriptions in G that agree with every labelled sample (y, b) of P: eval g y = b.

theorem Cslib.MCSP.AntiChecker.mem_consistent {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} {P : List (α × Bool)} {g : β} :
g ∈ consistent G eval P ↔ g ∈ G ∧ ∀ q ∈ P, eval g q.1 = q.2

A description is consistent with P when it lies in G and agrees with every sample.

@[simp]
theorem Cslib.MCSP.AntiChecker.consistent_nil {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} :
consistent G eval [] = G

Every description is consistent with no samples.

theorem Cslib.MCSP.AntiChecker.consistent_subset {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} (P : List (α × Bool)) :
consistent G eval P ⊆ G

The consistent descriptions lie in G.

theorem Cslib.MCSP.AntiChecker.consistent_anti {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} {P Q : List (α × Bool)} (h : P <+: Q) :
consistent G eval Q ⊆ consistent G eval P

More samples leave fewer consistent descriptions.

theorem Cslib.MCSP.AntiChecker.consistent_append_singleton {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} (P : List (α × Bool)) (y : α) (b : Bool) :
consistent G eval (P ++ [(y, b)]) = {g ∈ consistent G eval P | eval g y = b}

A further sample (y, b) keeps the consistent descriptions with eval g y = b.

theorem Cslib.MCSP.AntiChecker.exists_mem_ne_of_consistent_eq_empty {α : Type u_1} {β : Type u_2} {G : Finset β} {eval : β → α → Bool} {P : List (α × Bool)} (h : consistent G eval P = ∅) {g : β} (hg : g ∈ G) :
∃ q ∈ P, eval g q.1 ≠ q.2

If no description is consistent with P, every description in G errs on a sample of P.

Threshold oracles #

structure Cslib.MCSP.AntiChecker.IsThresholdOracle {α : Type u_1} {β : Type u_2} (G : Finset β) (eval : β → α → Bool) (ℓ : ℕ) (O : List (α × Bool) → ℕ → Bool) :

An oracle answering queries (P, u) is a threshold oracle with power ℓ for the descriptions G if a yes-answer guarantees #consistent ^ ℓ < 2 ^ (u + 1), a yes-answer at threshold 0 guarantees that no description is consistent, and (u + 1) #consistent ^ ℓ < 2 ^ u forces a yes-answer.

The greedy #

def Cslib.MCSP.AntiChecker.select {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (u : ℕ) (P : List (α × Bool)) :
α

The candidate chosen after the samples P in the round with threshold u: the first candidate y on which the oracle answers yes to (P ++ [(y, f y)], u), or the default if there is none.

def Cslib.MCSP.AntiChecker.step {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (u : ℕ) (P : List (α × Bool)) :
List (α × Bool)

The round with threshold u: append the selected candidate with its label.

def Cslib.MCSP.AntiChecker.greedy {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) :
ℕ → List (α × Bool) → List (α × Bool)

The greedy: k rounds after the samples P, with thresholds k - 1, …, 0.

@[simp]
theorem Cslib.MCSP.AntiChecker.greedy_zero {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (P : List (α × Bool)) :
greedy O f cands 0 P = P
theorem Cslib.MCSP.AntiChecker.greedy_succ {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (k : ℕ) (P : List (α × Bool)) :
greedy O f cands (k + 1) P = greedy O f cands k (step O f cands k P)
@[simp]
theorem Cslib.MCSP.AntiChecker.length_greedy {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (k : ℕ) (P : List (α × Bool)) :
(greedy O f cands k P).length = P.length + k

The greedy appends one sample per round.

theorem Cslib.MCSP.AntiChecker.prefix_greedy {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) (k : ℕ) (P : List (α × Bool)) :
P <+: greedy O f cands k P

The greedy extends its initial samples.

theorem Cslib.MCSP.AntiChecker.forall_mem_greedy_snd_eq {α : Type u_1} [Inhabited α] (O : List (α × Bool) → ℕ → Bool) (f : α → Bool) (cands : List α) {P : List (α × Bool)} (hP : ∀ q ∈ P, q.2 = f q.1) (k : ℕ) (q : α × Bool) :
q ∈ greedy O f cands k P → q.2 = f q.1

The greedy labels its samples by f.

theorem Cslib.MCSP.AntiChecker.apply_step_eq_true {α : Type u_1} [Inhabited α] {O : List (α × Bool) → ℕ → Bool} {f : α → Bool} {cands : List α} {u : ℕ} {P : List (α × Bool)} (h : ∃ y ∈ cands, O (P ++ [(y, f y)]) u = true) :
O (step O f cands u P) u = true

If the oracle answers yes on some candidate, it answers yes on the selected one.

theorem Cslib.MCSP.AntiChecker.consistent_step_eq_empty_or {α : Type u_1} {β : Type u_2} [Inhabited α] {O : List (α × Bool) → ℕ → Bool} {f : α → Bool} {cands : List α} {G : Finset β} {eval : β → α → Bool} {ℓ : ℕ} (ho : IsThresholdOracle G eval ℓ O) (hgood : ∀ G' ⊆ G, G'.Nonempty → ∃ x ∈ cands, G'.card ≤ 16 * {g ∈ G' | eval g x ≠ f x}.card) {u : ℕ} (hℓ : 4 * (u + 1) * 15 ^ ℓ ≤ 16 ^ ℓ) {P : List (α × Bool)} (hP : (consistent G eval P).card ^ ℓ < 2 ^ (u + 2)) :
consistent G eval (step O f cands u P) = ∅ ∨ O (step O f cands u P) u = true

One round. If #consistent ^ ℓ < 2 ^ (u + 2) before the round with threshold u and 4 (u + 1) 15 ^ ℓ ≤ 16 ^ ℓ, then after it no description is consistent or the oracle answered yes. A candidate refuting a sixteenth of the consistent descriptions leaves (u + 1) #consistent ^ ℓ < 2 ^ u, so the oracle answers yes on it.

theorem Cslib.MCSP.AntiChecker.consistent_greedy_succ_eq_empty {α : Type u_1} {β : Type u_2} [Inhabited α] {O : List (α × Bool) → ℕ → Bool} {f : α → Bool} {cands : List α} {G : Finset β} {eval : β → α → Bool} {ℓ : ℕ} (ho : IsThresholdOracle G eval ℓ O) (hgood : ∀ G' ⊆ G, G'.Nonempty → ∃ x ∈ cands, G'.card ≤ 16 * {g ∈ G' | eval g x ≠ f x}.card) (k : ℕ) (P : List (α × Bool)) :
4 * (k + 1) * 15 ^ ℓ ≤ 16 ^ ℓ → (consistent G eval P).card ^ ℓ < 2 ^ (k + 2) → consistent G eval (greedy O f cands (k + 1) P) = ∅

The invariant of the greedy: if #consistent ^ ℓ < 2 ^ (k + 2) before the rounds with thresholds k, …, 0 and 4 (k + 1) 15 ^ ℓ ≤ 16 ^ ℓ, then after them no description is consistent.

theorem Cslib.MCSP.AntiChecker.consistent_greedy_eq_empty {α : Type u_1} {β : Type u_2} [Inhabited α] {O : List (α × Bool) → ℕ → Bool} {f : α → Bool} {cands : List α} {G : Finset β} {eval : β → α → Bool} {ℓ : ℕ} (ho : IsThresholdOracle G eval ℓ O) (hgood : ∀ G' ⊆ G, G'.Nonempty → ∃ x ∈ cands, G'.card ≤ 16 * {g ∈ G' | eval g x ≠ f x}.card) {L : ℕ} (hG : G.card ≤ 2 ^ L) (hℓ : 4 * (L * ℓ + 1) * 15 ^ ℓ ≤ 16 ^ ℓ) :
consistent G eval (greedy O f cands (L * ℓ + 1) []) = ∅

The greedy refutes every description. If #G ≤ 2 ^ L, every nonempty subfamily of G is refuted on a sixteenth of its members by some candidate, and 4 (L ℓ + 1) 15 ^ ℓ ≤ 16 ^ ℓ, then after L ℓ + 1 rounds against a threshold oracle with power ℓ no description is consistent.

The power #

theorem Cslib.MCSP.AntiChecker.four_mul_mul_add_one_mul_fifteen_pow_le_sixteen_pow (L : ℕ) :
4 * (L * (L + 200) + 1) * 15 ^ (L + 200) ≤ 16 ^ (L + 200)

The power ℓ = L + 200 suffices: 4 (L ℓ + 1) 15 ^ ℓ ≤ 16 ^ ℓ.

The hash threshold oracle #

A set T of strings of N bits is large at threshold u if u + 1 affine hash functions to strings of u bits are jointly surjective on T.

Instances For
    @[instance_reducible]
    theorem Cslib.MCSP.AntiChecker.isLarge_of_card {N u : ℕ} {T : Finset (BitString N)} (h : 2 ^ (u + 1) ≤ T.card) :

    Sets of at least 2 ^ (u + 1) strings are large at threshold u.

    theorem Cslib.MCSP.AntiChecker.IsLarge.two_pow_le {N u : ℕ} {T : Finset (BitString N)} (h : IsLarge u T) :
    2 ^ u ≤ (u + 1) * T.card

    Sets large at threshold u have at least 2 ^ u / (u + 1) strings.

    At threshold 0, the large sets are the nonempty ones.

    def Cslib.MCSP.AntiChecker.hashOracle {α : Type u_1} {L : ℕ} (G : Finset (BitString L)) (eval : BitString L → α → Bool) (ℓ : ℕ) (P : List (α × Bool)) (u : ℕ) :

    The hash threshold oracle with power ℓ: it answers yes to (P, u) when the ℓ-th Cartesian power of the descriptions consistent with P is not large at threshold u.

    @[simp]
    theorem Cslib.MCSP.AntiChecker.hashOracle_eq_true {α : Type u_1} {u L : ℕ} {G : Finset (BitString L)} {eval : BitString L → α → Bool} {ℓ : ℕ} {P : List (α × Bool)} :
    hashOracle G eval ℓ P u = true ↔ ¬IsLarge u (BitString.blockPower (consistent G eval P) ℓ)
    theorem Cslib.MCSP.AntiChecker.isThresholdOracle_hashOracle {α : Type u_1} {L : ℕ} (G : Finset (BitString L)) (eval : BitString L → α → Bool) {ℓ : ℕ} (hℓ : 0 < ℓ) :
    IsThresholdOracle G eval ℓ (hashOracle G eval ℓ)

    Hashing gives a threshold oracle: for every power ℓ > 0, the hash oracle is a threshold oracle.

    The anti-checker for circuits #

    The greedy anti-checker for the circuits on n inputs with at most s gates: the inputs chosen in L (L + 200) + 1 rounds against the hash threshold oracle with power L + 200 for the valid descriptions, where L is the certificate length, with the candidates in the order of Cslib.BitString.enum.

    @[simp]

    The greedy anti-checker has L (L + 200) + 1 inputs, where L is the certificate length.

    The greedy is an anti-checker for circuits against any threshold oracle. If f needs more gates than n circuits with at most s gates and a circuit for their strict majority, then against any threshold oracle with power L + 200 for the valid descriptions, where L is the certificate length, every circuit with at most s gates differs from f on an input chosen in the L (L + 200) + 1 rounds of the greedy.

    The greedy anti-checker for circuits. If f needs more gates than n circuits with at most s gates and a circuit for their strict majority, then every circuit with at most s gates differs from f on an input of the greedy anti-checker.