Skip to content
Rainbow docs menu

Reference · The Applied Higher-Order Functions catalogue

rainbow.algorithms.proofs.ahof.activity-selection

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

AHoF Activity Selection (greedy interval scheduling): from a set of activities with start and finish times, select the largest set of mutually compatible (non-overlapping) activities. The optimal greedy strategy sorts by finish time and admits each activity whose start is no earlier than the last selected finish: compatible? start last-finish = decide (last-finish <= start) over exact-rational times. Proved native and axiom-free: the compatibility test; worked instances on concrete times -- an activity starting at 5 after the last finish 3 is admitted; the certificate 3 <= 5 as a native nnrat/at-most; and an activity starting at 2 is rejected (it would overlap). The sort by finish time and the selection sweep are executable; what is proved is the earliest-finish admission decision at these instances. Optimality of the earliest-finish greedy (the classical exchange argument) is not proved here. 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.activity-selection` prints this classification.

activity-selection/compatible?

DefinitionSource, line 54

activity-selection/compatible? :
  (x₁ x₂ : ℚ≥0)
  → data/Bool

ℚ≥0 = nnrat/NonnegativeRational

activity-selection/admits-compatible-activity

TheoremWorked exampleNo axiomsSource, line 71

activity-selection/admits-compatible-activity :
  → estimation/mle-prefers 5 3 = data/true

= = equality/Eq

activity-selection/admitted-does-not-overlap

TheoremWorked exampleNo axiomsSource, line 79

activity-selection/admitted-does-not-overlap :
  → 3 ≤ 5

≤ = nnrat/at-most

activity-selection/rejects-overlapping-activity

TheoremWorked exampleNo axiomsSource, line 85

activity-selection/rejects-overlapping-activity :
  → estimation/mle-prefers 2 3 = data/false

= = equality/Eq