Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.confidence-interval
AHoF Confidence Interval: quantify the uncertainty of a point estimate by an interval that, over repeated sampling, covers the true parameter with a chosen confidence level (e.g. 95%). A symmetric interval is estimate +/- margin, where margin = z * standard-error; the interval [lower, upper] CONTAINS a value exactly when the value lies at or above the lower bound and at or below the upper bound: contains? value lower upper = (lower <= value) AND (value <= upper) over exact-rational bounds. Proved native and axiom-free: the containment test as a boolean conjunction of two decidable comparisons (via logic/if-data over Bool); that a value inside the interval is contained; that a value above the upper bound is not; and the certificates that a contained value satisfies both bounds (native nnrat/at-most). The estimate, standard error, and critical value are executable; what is proved is the interval-containment decision -- the coverage check behind confidence intervals. Requires nnrat/at-most, audit/decide-nnrat-at-most, logic/if-data, 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.confidence-interval` prints this classification.
confidence-interval/contains?
confidence-interval/contains? : (x₁ x₂ x₃ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
confidence-interval/contains-interior-value
confidence-interval/contains-interior-value : → confidence-interval/contains? 5 3 7 = data/true
= = equality/Eq
confidence-interval/excludes-value-above
confidence-interval/excludes-value-above : → confidence-interval/contains? 8 3 7 = data/false
= = equality/Eq
confidence-interval/contained-meets-lower
confidence-interval/contained-meets-lower : → 3 ≤ 5
≤ = nnrat/at-most
confidence-interval/contained-meets-upper
confidence-interval/contained-meets-upper : → 5 ≤ 7
≤ = nnrat/at-most