Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.rejection
AHoF D6 Rejection Sampling: draw a proposal and a uniform u, accepting the proposal when u falls under the acceptance ratio f(x)/(M g(x)): accepts? draw accept-ratio = decide (draw <= accept-ratio). Proved native and axiom-free (decision, two positive instances, at-most certificate, negative instance). Requires audit/decide-nnrat-at-most, nnrat/at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 4 worked instances (statements about specific values). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.ahof.rejection` prints this classification.
rejection/accepts?
rejection/accepts? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
rejection/draw-under-ratio-accepts
rejection/draw-under-ratio-accepts : → lis/extends? 1/4 1/2 = data/true
= = equality/Eq
rejection/boundary-accepts
rejection/boundary-accepts : → lis/extends? 1/2 1/2 = data/true
= = equality/Eq
rejection/acceptance-certificate
rejection/acceptance-certificate : → 1/4 ≤ 1/2
≤ = nnrat/at-most
rejection/draw-over-ratio-rejects
rejection/draw-over-ratio-rejects : → lis/extends? 3/4 1/2 = data/false
= = equality/Eq