Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.exact-inference
AHoF D2 worked exact Bayesian inference by enumeration. A two-node binary network: a uniform prior over A in {0,1} and a conditional P(B|A). Enumerating the hidden variable A gives P(B=1) = 1/2*1/2 + 1/2*1 = 3/4 and P(B=0) = 1/2*1/2 + 1/2*0 = 1/4, which sum to one. All values are exact rationals; the marginals are proved by cross-product reflexivity. 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.exact-inference` prints this classification.
ahof-d2/grid
ahof-d2/grid : → Finset ℕ
Finset = finset-data/Finsetℕ = data/Nat
ahof-d2/prior
ahof-d2/prior : (x₁ : ℕ) → ℚ≥0
ℕ = data/Natℚ≥0 = nnrat/NonnegativeRational
ahof-d2/likelihood-true
ahof-d2/likelihood-true : (x₁ : ℕ) → ℚ≥0
ℕ = data/Natℚ≥0 = nnrat/NonnegativeRational
ahof-d2/likelihood-false
ahof-d2/likelihood-false : (x₁ : ℕ) → ℚ≥0
ℕ = data/Natℚ≥0 = nnrat/NonnegativeRational
ahof-d2/marginal-true
ahof-d2/marginal-true : → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
ahof-d2/marginal-false
ahof-d2/marginal-false : → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
ahof-d2/marginal-values
ahof-d2/marginal-values : → proposition/conjunction (ahof-d2/marginal-true = 3/4) (ahof-d2/marginal-false = 1/4)
= = nnrat/equivalent: equality of rational values
ahof-d2/normalization
ahof-d2/normalization : → ahof-d2/marginal-true + ahof-d2/marginal-false = 1
+ = nnrat/add1 = nnrat/one= = nnrat/equivalent: equality of rational values
ahof-d2/exact-inference
ahof-d2/exact-inference : → proposition/conjunction (conjunction) (ahof-d2/marginal-true + ahof-d2/marginal-false = 1) where conjunction := proposition/conjunction (ahof-d2/marginal-true = 3/4) (ahof-d2/marginal-false = 1/4)
+ = nnrat/add1 = nnrat/one= = nnrat/equivalent: equality of rational values