Documentation

CslibFrontier.Computability.Complexity.AverageCase

Mild Average-Case Hardness of Functions Against Efficient Heuristics #

This module formalizes generic mild average-case hardness definitions for functions f : List Bool → ℕ (and f : List Bool → ℕ∞) over the uniform distribution on {0, 1}^n following Y. Liu and R. Pass, On One-Way Functions and Kolmogorov Complexity. The parametric kernel MildlyHardOnAverageFor expresses hardness over any monotone asymptotic length quantifier (MonoQuant, satisfied by both ∀ᶠ n in atTop and ∃ᶠ n in atTop) and heuristic admissibility predicate (IsPPTOn, IsDetPolyTime), providing monotonicity, admissibility and quantifier transport, zero-gap equivalence, one-sided-to-symmetric 2g → g gap shifting, and negative nonvacuity witnesses across all named specializations. All section, definition, theorem, lemma, and page locators follow the full version arXiv:2009.11514v1 (and ECCC TR20-052).

Main definitions #

Main results #

References #

Monotone asymptotic quantifiers and the parametric hardness kernel #

class Cslib.Complexity.MonoQuant (Quant : (ℕ → Prop) → Prop) :

An asymptotic length quantifier Quant : (ℕ → Prop) → Prop closed under eventual implication along atTop. Both Filter.Eventually · atTop (∀ᶠ n in atTop) and Filter.Frequently · atTop (∃ᶠ n in atTop) satisfy MonoQuant, even though Frequently is not a filter.

  • imp_of_eventually {P Q : ℕ → Prop} : (∀ᶠ (n : ℕ) in Filter.atTop, P n → Q n) → Quant P → Quant Q

    Transport Quant P to Quant Q along an eventual implication ∀ᶠ n in atTop, P n → Q n.

Instances
    def Cslib.Complexity.IsDetPolyTime {β : Type} (encOut : β ↪ List Bool) (H : List Bool → ProbComp β) :

    Admissibility predicate for deterministic polynomial-time heuristics lifted into ProbComp: H is point-wise pure ∘ hDet for some hDet : List Bool → β computable in polynomial time.

    Every deterministic polynomial-time heuristic is a strict PPT heuristic.

    Lifting a polynomial-time function List Bool → β with pure yields an IsDetPolyTime heuristic.

    def Cslib.Complexity.MildlyHardOnAverageFor {β : Type} (Quant : (ℕ → Prop) → Prop) (Admissible : (List Bool → ProbComp β) → Prop) (correct : ℕ → List Bool → β → Bool) :

    Parametric mild average-case hardness kernel (MildlyHardOnAverageFor). For an asymptotic length quantifier Quant : (ℕ → Prop) → Prop, a heuristic admissibility predicate Admissible : (List Bool → ProbComp β) → Prop, and a Boolean correctness test correct : ℕ → List Bool → β → Bool, there exists a positive polynomial p such that every admissible heuristic H satisfies Quant on the lengths n where H passes correct n x with probability at most 1 - 1 / p(n) over x ← {0, 1}^n and H's coins.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.mono {β : Type} {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp β) → Prop} {correct₁ correct₂ : ℕ → List Bool → β → Bool} (himp : ∀ᶠ (n : ℕ) in Filter.atTop, ∀ (x : List Bool), x.length = n → ∀ (v : β), correct₁ n x v = true → correct₂ n x v = true) (h : MildlyHardOnAverageFor Quant Admissible correct₂) :
    MildlyHardOnAverageFor Quant Admissible correct₁

    Monotonicity in the correctness test: if, for all sufficiently large n, every output passing correct₁ on an input of length n also passes correct₂, then hardness for correct₂ implies hardness for correct₁.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.of_admissible {β : Type} {Quant : (ℕ → Prop) → Prop} {Admissible₁ Admissible₂ : (List Bool → ProbComp β) → Prop} {correct : ℕ → List Bool → β → Bool} (hadm : ∀ {H : List Bool → ProbComp β}, Admissible₁ H → Admissible₂ H) (h : MildlyHardOnAverageFor Quant Admissible₂ correct) :
    MildlyHardOnAverageFor Quant Admissible₁ correct

    Contravariance in admissibility: hardness against a broader heuristic class Admissible₂ implies hardness against any narrower class Admissible₁.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.of_quant {β : Type} {Quant₁ Quant₂ : (ℕ → Prop) → Prop} {Admissible : (List Bool → ProbComp β) → Prop} {correct : ℕ → List Bool → β → Bool} (hq : ∀ {P : ℕ → Prop}, Quant₂ P → Quant₁ P) (h : MildlyHardOnAverageFor Quant₂ Admissible correct) :
    MildlyHardOnAverageFor Quant₁ Admissible correct

    Covariance in the length quantifier: transporting Quant₂ to a weaker quantifier Quant₁ preserves MildlyHardOnAverageFor.

    theorem Cslib.Complexity.mildlyHardOnAverageFor_isDetPolyTime_iff {β : Type} {Quant : (ℕ → Prop) → Prop} {encOut : β ↪ List Bool} {correct : ℕ → List Bool → β → Bool} :
    MildlyHardOnAverageFor Quant (IsDetPolyTime encOut) correct ↔ ∃ (p : Polynomial ℕ), (∀ (n : ℕ), 0 < Polynomial.eval n p) ∧ ∀ (H : List Bool → β), Turing.MultiTapeTM.ComputableInPolyTime H Turing.MultiTapeTM.encBits encOut → Quant fun (n : ℕ) => ((PMF.map (fun (x : List Bool) => correct n x (H x)) (BitString.uniformList n)) true).toReal ≤ 1 - 1 / ↑(Polynomial.eval n p)

    Quantifying over IsDetPolyTime heuristics in ProbComp is equivalent to quantifying directly over deterministic polynomial-time functions H : List Bool → β.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.approx_mono {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g₁ g₂ : ℕ → ℕ} {f : List Bool → ℕ} (hle : ∀ (n : ℕ), g₁ n ≤ g₂ n) (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (v.dist (f x) ≤ g₂ n)) :
    MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (v.dist (f x) ≤ g₁ n)

    Monotonicity of symmetric g-approximation hardness on the kernel.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.oneSidedApprox_mono {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g₁ g₂ : ℕ → ℕ} {f : List Bool → ℕ} (hle : ∀ (n : ℕ), g₁ n ≤ g₂ n) (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (f x - g₂ n ≤ v ∧ v ≤ f x)) :
    MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (f x - g₁ n ≤ v ∧ v ≤ f x)

    Monotonicity of one-sided g-approximation hardness on the kernel.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.oneSidedApprox_of_approx {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g : ℕ → ℕ} {f : List Bool → ℕ} (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (v.dist (f x) ≤ g n)) :
    MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (f x - g n ≤ v ∧ v ≤ f x)

    Symmetric g-approximation hardness implies one-sided g-approximation hardness on the kernel.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.exact_of_approx {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g : ℕ → ℕ} {f : List Bool → ℕ} (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (v.dist (f x) ≤ g n)) :
    MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (v = f x_1)

    Symmetric g-approximation hardness implies exact hardness on the kernel.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.exact_of_oneSidedApprox {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g : ℕ → ℕ} {f : List Bool → ℕ} (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (f x - g n ≤ v ∧ v ≤ f x)) :
    MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (v = f x_1)

    One-sided g-approximation hardness implies exact hardness on the kernel.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.approx_zero_iff {Quant : (ℕ → Prop) → Prop} {Admissible : (List Bool → ProbComp ℕ) → Prop} {f : List Bool → ℕ} :
    (MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (v.dist (f x_1) ≤ 0)) ↔ MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (v = f x_1)

    Zero-gap specialization (symmetric): symmetric 0-approximation hardness coincides with exact hardness for every quantifier and admissibility predicate.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.oneSidedApprox_zero_iff {Quant : (ℕ → Prop) → Prop} {Admissible : (List Bool → ProbComp ℕ) → Prop} {f : List Bool → ℕ} :
    (MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (f x_1 - 0 ≤ v ∧ v ≤ f x_1)) ↔ MildlyHardOnAverageFor Quant Admissible fun (x : ℕ) (x_1 : List Bool) (v : ℕ) => decide (v = f x_1)

    Zero-gap specialization (one-sided): one-sided 0-approximation hardness coincides with exact hardness for every quantifier and admissibility predicate.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.approx_of_oneSided_two_mul {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] {Admissible : (List Bool → ProbComp ℕ) → Prop} {g : ℕ → ℕ} {f : List Bool → ℕ} (hshift : ∀ {H : List Bool → ProbComp ℕ}, Admissible H → Admissible fun (x : List Bool) => (fun (v : ℕ) => v - g x.length) <$> H x) (h : MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (f x - 2 * g n ≤ v ∧ v ≤ f x)) :
    MildlyHardOnAverageFor Quant Admissible fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (v.dist (f x) ≤ g n)

    Parametric 2g → g gap-shifting bridge: whenever Admissible is closed under shifting outputs down by g x.length, one-sided (2 g)-approximation hardness implies symmetric g-approximation hardness.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.not_of_forall_poly {β : Type} {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] (hfalse : ¬Quant fun (x : ℕ) => False) {Admissible : (List Bool → ProbComp β) → Prop} {correct : ℕ → List Bool → β → Bool} (hwin : ∀ (p : Polynomial ℕ), (∀ (n : ℕ), 0 < Polynomial.eval n p) → ∃ (H : List Bool → ProbComp β), Admissible H ∧ ∀ᶠ (n : ℕ) in Filter.atTop, 1 - 1 / ↑(Polynomial.eval n p) < ((do let x ← BitString.uniformList n PMF.map (correct n x) (H x).eval) true).toReal) :
    ¬MildlyHardOnAverageFor Quant Admissible correct

    Negative-witness criterion on the kernel: if Quant rejects False and every positive polynomial p admits an admissible heuristic whose success probability eventually exceeds 1 - 1 / p(n), then MildlyHardOnAverageFor fails.

    theorem Cslib.Complexity.MildlyHardOnAverageFor.not_of_admissible_pure {β : Type} {Quant : (ℕ → Prop) → Prop} [MonoQuant Quant] (hfalse : ¬Quant fun (x : ℕ) => False) {Admissible : (List Bool → ProbComp β) → Prop} {correct : ℕ → List Bool → β → Bool} {v₀ : β} (hadm : Admissible fun (x : List Bool) => pure v₀) (hcorr : ∀ᶠ (n : ℕ) in Filter.atTop, ∀ (x : List Bool), x.length = n → correct n x v₀ = true) :
    ¬MildlyHardOnAverageFor Quant Admissible correct

    Constant-heuristic nonvacuity on the kernel: if an admissible constant heuristic pure v₀ eventually passes correct on every input of length n, then MildlyHardOnAverageFor fails.

    Specializations of the kernel to PPT, deterministic, and infinitely-often cores #

    @[reducible, inline]

    Mild average-case hardness for a correctness test, against strict PPT heuristics: MildlyHardOnAverageFor instantiated at ∀ᶠ n in atTop and IsPPTOn encBits encNat.

    @[reducible, inline]

    Mild average-case hardness for a correctness test, against deterministic heuristics: MildlyHardOnAverageFor instantiated at ∀ᶠ n in atTop and IsDetPolyTime encNat.

    @[reducible, inline]

    Infinitely-often mild average-case hardness for a correctness test, against deterministic heuristics: MildlyHardOnAverageFor instantiated at ∃ᶠ n in atTop and IsDetPolyTime encNat.

    theorem Cslib.Complexity.MildlyHardOnAverageWith.mono {correct₁ correct₂ : ℕ → List Bool → ℕ → Bool} (himp : ∀ᶠ (n : ℕ) in Filter.atTop, ∀ (x : List Bool), x.length = n → ∀ (v : ℕ), correct₁ n x v = true → correct₂ n x v = true) (h : MildlyHardOnAverageWith correct₂) :

    Monotonicity of MildlyHardOnAverageWith in the correctness test.

    theorem Cslib.Complexity.MildlyHardOnAverageDetWith.mono {correct₁ correct₂ : ℕ → List Bool → ℕ → Bool} (himp : ∀ᶠ (n : ℕ) in Filter.atTop, ∀ (x : List Bool), x.length = n → ∀ (v : ℕ), correct₁ n x v = true → correct₂ n x v = true) (h : MildlyHardOnAverageDetWith correct₂) :

    MildlyHardOnAverageWith.mono for deterministic heuristics.

    theorem Cslib.Complexity.MildlyHardOnAverageIOWith.mono {correct₁ correct₂ : ℕ → List Bool → ℕ → Bool} (himp : ∀ᶠ (n : ℕ) in Filter.atTop, ∀ (x : List Bool), x.length = n → ∀ (v : ℕ), correct₁ n x v = true → correct₂ n x v = true) (h : MildlyHardOnAverageIOWith correct₂) :

    MildlyHardOnAverageWith.mono for infinitely-often hardness.

    Hardness against strict PPT heuristics implies hardness against deterministic polynomial-time heuristics, since every deterministic polynomial-time heuristic is a strict PPT heuristic.

    Eventual hardness implies infinitely-often hardness.

    Average-case hardness definitions #

    (Liu and Pass, Definitions 2.4 and 2.5, §2.3, p. 8 of arXiv:2009.11514v1)

    Liu and Pass, Definition 2.4, §2.3, p. 8 of arXiv:2009.11514v1: Mildly hard on average (MildlyHardOnAverage). A function $f : \{0, 1\}^* \to \mathbb{N}$ is mildly hard on average if there exists a positive polynomial $p$ such that for every uniform strict PPT heuristic $\mathcal{H} : \{0, 1\}^* \to \mathrm{ProbComp}\ \mathbb{N}$, for all sufficiently large $n \in \mathbb{N}$, $$\Pr_{x \leftarrow \{0, 1\}^n, v \leftarrow \mathcal{H}(x)}[v = f(x)] \le 1 - \frac{1}{p(n)}.$$

    Liu and Pass, Definition 2.5, §2.3, p. 8 of arXiv:2009.11514v1: Mildly hard on average to $g$-approximate (MildlyHardOnAverageToApprox). A function $f : \{0, 1\}^* \to \mathbb{N}$ is mildly hard on average to $g$-approximate if there exists a positive polynomial $p$ such that for every uniform strict PPT heuristic $\mathcal{H} : \{0, 1\}^* \to \mathrm{ProbComp}\ \mathbb{N}$, for all sufficiently large $n \in \mathbb{N}$, $$\Pr_{x \leftarrow \{0, 1\}^n, v \leftarrow \mathcal{H}(x)}[|v - f(x)| \le g(n)] \le 1 - \frac{1}{p(n)},$$ where $|v - f(x)|$ is formalized on $\mathbb{N}$ by the symmetric distance Nat.dist v (f x).

    Library helper (MildlyHardOnAverageToOneSidedApprox): one-sided underestimation approximation hardness against uniform strict PPT heuristics, requiring $$\Pr_{x \leftarrow \{0, 1\}^n, v \leftarrow \mathcal{H}(x)}[f(x) - g(n) \le v \le f(x)] \le 1 - \frac{1}{p(n)}$$ for all sufficiently large $n$. By MildlyHardOnAverageToOneSidedApprox.mildlyHardOnAverageToApprox, one-sided $(2 g)$-approximation hardness implies symmetric $g$-approximation hardness (MildlyHardOnAverageToApprox g f) whenever fun x => g x.length is computable in polynomial time by shifting any heuristic output down by $g(|x|)$.

    Library specialization (MildlyHardOnAverageDet): deterministic polynomial-time heuristic specialization of MildlyHardOnAverage.

    Library specialization (MildlyHardOnAverageToApproxDet): deterministic polynomial-time heuristic specialization of MildlyHardOnAverageToApprox.

    Library specialization (MildlyHardOnAverageToOneSidedApproxDet): deterministic polynomial-time heuristic specialization of MildlyHardOnAverageToOneSidedApprox.

    Library companion (MildlyHardOnAverageIO): infinitely-often (∃ᶠ n in atTop) deterministic-heuristic companion to MildlyHardOnAverageDet.

    Library companion (MildlyHardOnAverageToApproxIO): infinitely-often (∃ᶠ n in atTop) deterministic-heuristic companion to MildlyHardOnAverageToApproxDet.

    Library companion (MildlyHardOnAverageToOneSidedApproxIO): infinitely-often (∃ᶠ n in atTop) deterministic-heuristic companion to MildlyHardOnAverageToOneSidedApproxDet.

    Library companion (MildlyHardOnAverageENat): ℕ∞-valued companion to MildlyHardOnAverage for functions f : List Bool → ℕ∞ such as Kolmogorov.timeBounded t. Heuristics output natural numbers, so no output is correct on an input with f x = ⊤: the predicate holds for every f that is ⊤ on all inputs of every sufficiently large length.

    Library companion (MildlyHardOnAverageIOENat): ℕ∞-valued companion to MildlyHardOnAverageIO for functions f : List Bool → ℕ∞ such as Kolmogorov.timeBounded t. Heuristics output natural numbers, so no output is correct on an input with f x = ⊤: the predicate holds for every f that is ⊤ on all inputs of infinitely many lengths.

    Monotonicity, shifting, and specialization corollaries #

    theorem Cslib.Complexity.MildlyHardOnAverageToApprox.mono {g₁ g₂ : ℕ → ℕ} {f : List Bool → ℕ} (hle : ∀ (n : ℕ), g₁ n ≤ g₂ n) (h : MildlyHardOnAverageToApprox g₂ f) :

    Monotonicity of MildlyHardOnAverageToApprox in the error window: if $g_1(n) \le g_2(n)$ for all $n$, then hardness of $g_2$-approximation implies hardness of $g_1$-approximation.

    theorem Cslib.Complexity.MildlyHardOnAverageToApproxDet.mono {g₁ g₂ : ℕ → ℕ} {f : List Bool → ℕ} (hle : ∀ (n : ℕ), g₁ n ≤ g₂ n) (h : MildlyHardOnAverageToApproxDet g₂ f) :

    Monotonicity of MildlyHardOnAverageToApproxDet in the error window.

    Monotonicity of MildlyHardOnAverageToOneSidedApprox in the error window.

    Monotonicity of MildlyHardOnAverageToOneSidedApproxDet in the error window.

    Shift + gap-scaling bridge (MildlyHardOnAverageToOneSidedApprox.mildlyHardOnAverageToApprox): shifting a symmetric $g$-estimator $\mathcal{H}(x)$ down by $g(|x|)$ produces a one-sided $(2 g)$-estimator $\mathcal{H}'(x) = \mathcal{H}(x) - g(|x|)$, because $|v - f(x)| \le g(|x|)$ implies $f(x) - 2 g(|x|) \le v - g(|x|) \le f(x)$. Consequently, when fun x => g x.length is computable in polynomial time, one-sided $(2 g)$-approximation hardness against PPT heuristics implies symmetric $g$-approximation hardness (MildlyHardOnAverageToApprox g f).

    Rounded logarithm bounds and real-valued log window bridge #

    For every $n \in \mathbb{N}$, $\lceil \log_2 n \rceil \le \lfloor \log_2 n \rfloor + 1$.

    For every $n \ge 1$, the real binary logarithm satisfies $\log_2 n \le \lfloor \log_2 n \rfloor + 1$.

    theorem Cslib.Complexity.nat_dist_le_mul_log_two_succ_of_abs_sub_le_mul_logb {v w d n : ℕ} (hn : 1 ≤ n) (h : |↑v - ↑w| ≤ ↑d * Real.logb 2 ↑n) :
    v.dist w ≤ d * (Nat.log 2 n + 1)

    Any real-valued symmetric approximation error $|(v : \mathbb{R}) - (w : \mathbb{R})| \le d \log_2 n$ (for $n \ge 1$) implies the upper-rounded integer distance bound Nat.dist v w ≤ d * (Nat.log 2 n + 1).

    theorem Cslib.Complexity.MildlyHardOnAverageToApprox.eventually_real_abs_sub_le {d : ℕ} {f : List Bool → ℕ} (h : MildlyHardOnAverageToApprox (fun (n : ℕ) => d * (Nat.log 2 n + 1)) f) :
    MildlyHardOnAverageWith fun (n : ℕ) (x : List Bool) (v : ℕ) => decide (|↑v - ↑(f x)| ≤ ↑d * Real.logb 2 ↑n)

    Real-valued $d \log_2 n$ approximation window bridge: if f is mildly hard on average to approximate within the upper-rounded integer window fun n => d * (Nat.log 2 n + 1), then f is mildly hard on average to approximate within the real-valued window $d \log_2 n$ of Liu and Pass, Definition 2.5 and Theorem 3.1 (c), pp. 8–9 of arXiv:2009.11514v1.

    Negative-side nonvacuity lemmas for the constant zero function #

    The constant zero function fun _ => 0 is not MildlyHardOnAverageIO, because the constant zero polynomial-time heuristic succeeds with probability $1$ on every input length.

    The constant zero function fun _ => 0 is not MildlyHardOnAverageDet.

    The constant zero function fun _ => 0 is not MildlyHardOnAverage.

    The constant zero function fun _ => 0 is not MildlyHardOnAverageToApproxIO g for any error function g.

    The constant zero function fun _ => 0 is not MildlyHardOnAverageToApproxDet g for any error function g.

    The constant zero function fun _ => 0 is not MildlyHardOnAverageToApprox g for any error function g.

    The constant zero function fun _ => 0 is not MildlyHardOnAverageToOneSidedApprox g for any error function g.