Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.perceptron
AHoF Perceptron (Rosenblatt): the foundational linear classifier and the atom of neural networks. It predicts a class from the sign of a weighted sum of inputs (the activation) relative to a threshold, and learns by the mistake-driven rule w <- w + eta*(y - y_hat)*x, which -- by the perceptron convergence theorem -- finds a separating hyperplane in finitely many updates when the data are linearly separable. The firing (activation) decision is: fires? activation threshold = decide (threshold <= activation) over exact-rational activations. Proved native and axiom-free: the firing test and worked instances on concrete values -- activation 3 against threshold 2 fires; the worked certificate 2 <= 3 as a native nnrat/at-most; and activation 1 against threshold 2 does not fire. The weight vector, the update rule, and the dot product are executable; what is proved is the firing decision at these instances. The perceptron convergence theorem 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.perceptron` prints this classification.
perceptron/fires?
perceptron/fires? : (x₁ x₂ : ℚ≥0) → data/Bool
ℚ≥0 = nnrat/NonnegativeRational
perceptron/activation-fires
perceptron/activation-fires : → bo/is-safe 3 2 = data/true
= = equality/Eq
perceptron/firing-meets-threshold
perceptron/firing-meets-threshold : → 2 ≤ 3
≤ = nnrat/at-most
perceptron/subthreshold-does-not-fire
perceptron/subthreshold-does-not-fire : → bo/is-safe 1 2 = data/false
= = equality/Eq