Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.linear-interpolation
AHoF D27 Linear Interpolation over exact rationals: interpolate between two values a and b with convex weights w0, w1 (summing to one), lerp a b w0 w1 = w0 * a + w1 * b. Interpolating between 1/2 and 3/4: the midpoint (weights 1/2, 1/2) is 5/8; the left endpoint (weights 1, 0) is 1/2; the right endpoint (weights 0, 1) is 3/4. Values are proved by cross-product equivalence. Proved native and axiom-free. Scope (measured by the kernel): this module has 4 worked instances (statements about specific values) and 1 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.ahof.linear-interpolation` prints this classification.
interp/lerp
interp/lerp : (x₁ x₂ x₃ x₄ : ℚ≥0) → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
interp/midpoint
interp/midpoint : → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
interp/left-endpoint
interp/left-endpoint : → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
interp/right-endpoint
interp/right-endpoint : → ℚ≥0
ℚ≥0 = nnrat/NonnegativeRational
interp/lerp-unfold
interp/lerp-unfold : (a b w0 w1 : ℚ≥0) → interp/lerp a b w0 w1 = w0 · a + w1 · b
+ = nnrat/add= = equality/Eq· = nnrat/multiplyℚ≥0 = nnrat/NonnegativeRational
interp/midpoint-is-five-eighths
interp/midpoint-is-five-eighths : → interp/midpoint = 5/8
= = nnrat/equivalent: equality of rational values
interp/left-endpoint-is-a
interp/left-endpoint-is-a : → interp/left-endpoint = 1/2
= = nnrat/equivalent: equality of rational values
interp/right-endpoint-is-b
interp/right-endpoint-is-b : → interp/right-endpoint = 3/4
= = nnrat/equivalent: equality of rational values
interp/linear-interpolation
interp/linear-interpolation : → proposition/conjunction (interp/midpoint = 5/8) (interp/left-endpoint = 1/2)
= = nnrat/equivalent: equality of rational values