Reference · Algorithm guarantees
rainbow.algorithms.proofs.metropolis
AHoF V22 Metropolis-Hastings acceptance (also the acceptance rule of Simulated Annealing): a proposed state is scored by an energy (cost), and the Metropolis rule always accepts a downhill proposal, while an uphill proposal is accepted only with probability exp(-(E' - E)/T). The deterministic core is the downhill test, accepts-downhill? proposed current = decide (proposed <= current) over the decidable rational order. Proved on worked instances: a proposal of energy 3 against current 5 is accepted (the decision computes to true); the certificate 3 <= 5 as a native nnrat/at-most; and a proposal of 8 against 5 is not deterministically accepted. The stochastic uphill acceptance (the Boltzmann factor) and the proposal kernel are executable concerns; what is proved here is the acceptance test on these instances, not a property of the chain. Requires nnrat/at-most, audit/decide-nnrat-at-most, and nnrat/decide-at-most-true-sound (carried by 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.metropolis` prints this classification.
metropolis/accepts-downhill?
metropolis/accepts-downhill? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
metropolis/accepts-downhill-move
metropolis/accepts-downhill-move : → failmon/safe? 3 5 = data/true
= = equality/Eq
metropolis/downhill-does-not-worsen
metropolis/downhill-does-not-worsen : → 3 ≤ 5
≤ = nnrat/at-most
metropolis/uphill-not-deterministic
metropolis/uphill-not-deterministic : → failmon/safe? 8 5 = data/false
= = equality/Eq