Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.k2

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

AHoF D15 K2 Graph Search: greedy Bayesian-network structure learning. Following a fixed variable ordering, K2 adds to a node the candidate parent whose addition most improves the local (decomposable) score, and stops when no addition improves it. The greedy-acceptance test is the decidable score comparison: improves? new-score old-score = decide (old-score <= new-score) over the exact-rational local scores (BDeu / BIC). Proved native and axiom-free, as worked instances: a parent raising the score from 5 to 8 is accepted; the worked certificate 5 <= 8 (native nnrat/at-most); and a parent lowering the score from 5 to 4 is rejected. That K2's greedy hill-climb is monotone for all scores is the algorithm's classical property, not proved here. The score function, the ordering, and the parent enumeration are executable concerns. 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.k2` prints this classification.

k2/improves?

DefinitionSource, line 52

k2/improves? :
  (x₁ x₂ : ℚ≥0)
  → data/Bool

ℚ≥0 = nnrat/NonnegativeRational

k2/accepts-improvement

TheoremWorked exampleNo axiomsSource, line 69

k2/accepts-improvement :
  → bo/is-safe 8 5 = data/true

= = equality/Eq

k2/accepted-does-not-decrease

TheoremWorked exampleNo axiomsSource, line 77

k2/accepted-does-not-decrease :
  → 5 ≤ 8

≤ = nnrat/at-most

k2/rejects-non-improvement

TheoremWorked exampleNo axiomsSource, line 83

k2/rejects-non-improvement :
  → bo/is-safe 4 5 = data/false

= = equality/Eq