Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.hmm-forward

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

AHoF HMM Forward Algorithm: compute the TOTAL likelihood of an observation sequence under a Hidden Markov Model by summing over all hidden-state paths -- the sum-product companion to Viterbi's max-product decoding. The forward variable alpha_t(j) accumulates the probability of the observations up to time t ending in state j: alpha-step a0 t0 a1 t1 emission = (a0*t0 + a1*t1) * emission (a two-predecessor step: sum the incoming path masses weighted by transition probabilities, then multiply by the emission), over exact-rational probabilities. Proved native and axiom-free: the forward-step sum-of-products times emission (stated as rational equivalence via the cross-product certificate, since the mixed fractions are not in lowest terms); and a degenerate step where a single certain predecessor propagates its mass exactly. The observation sequence and full recursion are executable; what is proved is the forward-step combination. Requires nnrat/add, nnrat/multiply, nnrat/equivalent (all in the D63 checkpoint). Scope (measured by the kernel): this module has 2 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.hmm-forward` prints this classification.

hmm-forward/alpha-step

DefinitionSource, line 66

hmm-forward/alpha-step :
  (x₁ x₂ x₃ x₄ x₅ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

hmm-forward/alpha-step-example

TheoremWorked exampleNo axiomsSource, line 82

hmm-forward/alpha-step-example :
  → hmm-forward/alpha-step 1/2 1/2 1/2 1/2 1 = 1/2

= = nnrat/equivalent: equality of rational values

hmm-forward/certain-predecessor

TheoremWorked exampleNo axiomsSource, line 95

hmm-forward/certain-predecessor :
  → hmm-forward/alpha-step 1 1 0 0 1 = 1

= = nnrat/equivalent: equality of rational values