Documentation

CslibFrontier.Computability.Probabilistic.RejectionSampling

Uniform strict PPT certificates for capped block rejection #

Capped block-rejection programs (sampleBlockTrials, sampleSeededTrials, sampleBlockCapped) are uniformly strict probabilistic polynomial time (Cslib.Probability.IsPPTOn) whenever the per-trial bit width and the trial cap are computed in unary (encUnary) and the single-block decoder attempt is deterministic polynomial time (ComputableInPolyTime).

On words of length trials * width, BlockRejectionSpec.decodeTrials agrees with folding over Cslib.BitString.listRows trials width while keeping the first some result. Once a block succeeds, later steps leave the optional accumulator unchanged, so its encoded length never accumulates across trials.

Main results #

theorem Cslib.Probability.BlockRejectionSpec.decodeTrials_eq_foldl_listRows {α : Type} (spec : BlockRejectionSpec α) (trials : ℕ) {w : List Bool} :
trials * spec.width ≤ w.length → spec.decodeTrials trials w = List.foldl (fun (acc : Option α) (row : List Bool) => acc.elim (spec.attempt row) some) none (BitString.listRows trials spec.width w)

On any bit string of length at least trials * spec.width, decodeTrials agrees with folding over BitString.listRows trials spec.width.

theorem Cslib.Probability.isPPTOn_sampleSeededTrials {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {spec : α → BlockRejectionSpec β} {trials : α → ℕ} (htrials : Turing.MultiTapeTM.ComputableInPolyTime trials input Turing.MultiTapeTM.encUnary) (hwidth : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (spec a).width) input Turing.MultiTapeTM.encUnary) (hattempt : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : α × List Bool) => (spec p.1).attempt p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption output)) :
IsPPTOn input (Turing.MultiTapeTM.encOption output) fun (a : α) => ProbComp.sampleSeededTrials (spec a) (trials a)

Single-tape capped block rejection sampleSeededTrials is uniformly strict PPT for unary trials and width and polynomial-time attempt.

theorem Cslib.Probability.isPPTOn_sampleBlockTrials {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {spec : α → BlockRejectionSpec β} {trials : α → ℕ} (htrials : Turing.MultiTapeTM.ComputableInPolyTime trials input Turing.MultiTapeTM.encUnary) (hwidth : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (spec a).width) input Turing.MultiTapeTM.encUnary) (hattempt : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : α × List Bool) => (spec p.1).attempt p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption output)) :
IsPPTOn input (Turing.MultiTapeTM.encOption output) fun (a : α) => ProbComp.sampleBlockTrials (spec a) (trials a)

Sequential capped block rejection sampleBlockTrials is uniformly strict PPT under the same hypotheses.

theorem Cslib.Probability.isPPTOn_sampleBlockCapped {α β : Type} {input : α ↪ List Bool} {output : β ↪ List Bool} {spec : α → BlockRejectionSpec β} {fallback : α → β} {trials : α → ℕ} (htrials : Turing.MultiTapeTM.ComputableInPolyTime trials input Turing.MultiTapeTM.encUnary) (hwidth : Turing.MultiTapeTM.ComputableInPolyTime (fun (a : α) => (spec a).width) input Turing.MultiTapeTM.encUnary) (hattempt : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : α × List Bool) => (spec p.1).attempt p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) (Turing.MultiTapeTM.encOption output)) (hfallback : Turing.MultiTapeTM.ComputableInPolyTime fallback input output) :
IsPPTOn input output fun (a : α) => ProbComp.sampleBlockCapped (spec a) (fallback a) (trials a)

Capped block rejection with a polynomial-time fallback value is uniformly strict PPT.