Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.weighted-interval

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

AHoF Weighted Interval Scheduling (dynamic programming): given intervals with weights (values), select a mutually-compatible subset of MAXIMUM total weight. Unlike unweighted activity selection (which is greedy), the weighted version needs DP: sort by finish time, and for each interval j decide whether INCLUDING it (its weight plus the best solution among intervals compatible with it) beats EXCLUDING it (the best solution over the earlier intervals): cell include-value exclude-value = max(include-value, exclude-value) over exact-rational values. Proved native and axiom-free: the DP cell as the decidable rational max (via logic/if-data); a worked cell that includes the interval; a worked cell that excludes it; and the certificates that the chosen value dominates BOTH the include and exclude options (native nnrat/at-most). The predecessor computation (latest compatible interval) and the finish-time sort are executable; what is proved is the include/exclude max choice. Requires audit/decide-nnrat-at-most, logic/if-data, nnrat/at-most, nnrat/decide-at-most-true-sound (all in the D63 checkpoint). Scope (measured by the kernel): this module has 4 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.weighted-interval` prints this classification.

weighted-interval/cell

DefinitionSource, line 63

weighted-interval/cell :
  (x₁ x₂ : ℚ≥0)
  → ℚ≥0

ℚ≥0 = nnrat/NonnegativeRational

weighted-interval/includes-when-better

TheoremWorked exampleNo axiomsSource, line 75

weighted-interval/includes-when-better :
  → viterbi/cell 7 5 = 7

= = equality/Eq

weighted-interval/excludes-when-better

TheoremWorked exampleNo axiomsSource, line 82

weighted-interval/excludes-when-better :
  → viterbi/cell 4 8 = 8

= = equality/Eq

weighted-interval/dominates-include

TheoremWorked exampleNo axiomsSource, line 89

weighted-interval/dominates-include :
  → 7 ≤ 7

≤ = nnrat/at-most

weighted-interval/dominates-exclude

TheoremWorked exampleNo axiomsSource, line 95

weighted-interval/dominates-exclude :
  → 5 ≤ 7

≤ = nnrat/at-most