Reference · Algorithm guarantees
rainbow.algorithms.proofs.bisection
Bisection bracket search over exact nonnegative rationals. The probe point of a bracket [lo, hi] is its midpoint (lo + hi) / 2; narrowing keeps the lower or upper half depending on a pluggable test, exactly halving the interval. All bracket methods share this ITERATE loop and differ only in the probe point (AHoF O12, the simplest instance). Scope (measured by the kernel): this module has 3 definitional unfoldings (true by unfolding a definition). None of its theorems is a guarantee about the algorithm for all inputs; `lein verify rainbow.algorithms.proofs.bisection` prints this classification.
search/bracket-midpoint
search/bracket-midpoint : (x₁ x₂ : ℚ≥0) → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
search/bisection-narrow
search/bisection-narrow : (x₁ : data/Bool) (x₂ x₃ : ℚ≥0) → data/Product ℚ≥0 ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
search/bracket-midpoint-unfold
search/bracket-midpoint-unfold : (lo hi : ℚ≥0) → search/bracket-midpoint lo hi = (lo + hi) · nnrat/half
+ = nnrat/add= = equality/Eq· = nnrat/multiplyℚ≥0 = nnrat/NonnegativeRational
search/narrow-keeps-lower
search/narrow-keeps-lower : (lo hi : ℚ≥0) (keep : data/true = data/true) → search/bisection-narrow data/true lo hi = data/pair ℚ≥0 ℚ≥0 lo (search/bracket-midpoint lo hi)
= = equality/Eqℚ≥0 = nnrat/NonnegativeRational
search/narrow-keeps-upper
search/narrow-keeps-upper : (lo hi : ℚ≥0) (reject : data/false = data/false) → search/bisection-narrow data/false lo hi = data/pair ℚ≥0 ℚ≥0 (search/bracket-midpoint lo hi) hi
= = equality/Eqℚ≥0 = nnrat/NonnegativeRational