Documentation

CslibFrontier.Probability.IID.FirstAccepted

The first accepted trial #

Run m independent uniform trials v : Fin m → T and keep the first one accepted by acc (Cslib.Probability.firstAccepted). Counting over all m-tuples:

So the first accepted trial is bad with probability at most Pr[bad | accepted], whatever m is. The bound is the elementary fact behind rejection sampling with a timeout, as in the circuit C_{A,v} of Impagliazzo, Jaiswal, Kabanets and Wigderson, Section 3.

Main definitions #

Main results #

References #

def Cslib.Probability.firstAccepted {T : Type u_1} (acc : T → Bool) {m : ℕ} (v : Fin m → T) :

The first entry of v accepted by acc, if any.

@[simp]
theorem Cslib.Probability.firstAccepted_zero {T : Type u_1} (acc : T → Bool) (v : Fin 0 → T) :
theorem Cslib.Probability.firstAccepted_cons {T : Type u_1} (acc : T → Bool) {m : ℕ} (a : T) (w : Fin m → T) :
theorem Cslib.Probability.firstAccepted_eq_none_iff {T : Type u_1} (acc : T → Bool) {m : ℕ} (v : Fin m → T) :
firstAccepted acc v = none ↔ ∀ (i : Fin m), acc (v i) = false

No trial is accepted exactly when the first accepted trial does not exist.

theorem Cslib.Probability.firstAccepted_eq_some {T : Type u_1} {acc : T → Bool} {m : ℕ} {v : Fin m → T} {a : T} (h : firstAccepted acc v = some a) :
acc a = true ∧ ∃ (i : Fin m), v i = a

The first accepted trial is accepted and is one of the trials.

theorem Cslib.Probability.card_filter_forall_not_acc {T : Type u_1} [Fintype T] (acc : T → Bool) (m : ℕ) :
{v : Fin m → T | ∀ (i : Fin m), acc (v i) = false}.card = {a : T | acc a = false}.card ^ m

No trial is accepted: exactly R ^ m tuples have every entry rejected.

theorem Cslib.Probability.card_filter_firstAccepted_bad_mul_le {T : Type u_1} [Fintype T] (acc bad : T → Bool) (m : ℕ) :
{v : Fin m → T | Option.any bad (firstAccepted acc v) = true}.card * {a : T | acc a = true}.card ≤ {a : T | acc a = true ∧ bad a = true}.card * Fintype.card T ^ m

The first accepted trial is bad for at most a B / A fraction of the tuples, where A counts the accepted values and B the accepted bad ones.