Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.gibbs

The Applied Higher-Order Functions cataloguesrc/rainbow/algorithms/proofs/ahof/gibbs.clj1 definitions, 3 theorems

AHoF D8 Gibbs Sampling: an MCMC method that samples a joint distribution by repeatedly resampling one coordinate at a time from its full conditional given all the others. Unlike Metropolis-Hastings, a Gibbs step is always accepted -- the chain always moves -- because the proposal IS the exact conditional. Each full-conditional draw is inverse-transform sampling over the conditional CDF: draws? cumulative u = decide (u <= cumulative) over the exact-rational conditional cumulative probability. Proved native and axiom-free: the conditional-draw test, and a worked draw u = 5 -- the value with cumulative 7 is drawn; the certificate 5 <= 7 as a native nnrat/at-most; and the value with cumulative 2 is skipped. That the coordinate is sampled from its full conditional is the inverse-transform property and is not proved here. The conditional CDF is the proved prefix-sum scan; the sweep order and RNG are executable. What is proved here is the draw decision at these instances. Requires nnrat/at-most, audit/decide-nnrat-at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 3 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.gibbs` prints this classification.

gibbs/draws?

DefinitionSource, line 53

gibbs/draws? :
  (x₁ x₂ : ℚ≥0)
  → data/Bool

ℚ≥0 = nnrat/NonnegativeRational

gibbs/draws-value

TheoremWorked exampleNo axiomsSource, line 70

gibbs/draws-value :
  → bo/is-safe 7 5 = data/true

= = equality/Eq

gibbs/draw-is-from-conditional

TheoremWorked exampleNo axiomsSource, line 78

gibbs/draw-is-from-conditional :
  → 5 ≤ 7

≤ = nnrat/at-most

gibbs/skips-below-draw

TheoremWorked exampleNo axiomsSource, line 85

gibbs/skips-below-draw :
  → bo/is-safe 2 5 = data/false

= = equality/Eq