Reference · The Applied Higher-Order Functions catalogue
rainbow.algorithms.proofs.ahof.softmax
AHoF Softmax: turn a vector of real-valued scores (logits) into a probability distribution over classes -- the standard output layer of multi-class classifiers and the policy head of policy-gradient RL. Each class probability is its exponentiated score divided by the sum of all exponentiated scores: softmax-share exp-score total-exp = exp-score / total-exp so the shares are classically non-negative and sum to one. Proved native and axiom-free: the softmax share as exact rational division of the score's exponential by the normalizer; a worked share 3 / 4 = 3/4; and the worked sum 3/4 + 1/4 = 1 of two complementary shares. The exponentials (a transcendental) are executable / supplied. That the shares sum to one for all inputs is not proved here. Requires nnrat/divide (rational-division capability, composed here), nnrat/add, nnrat/equivalent, and the D63 checkpoint. Scope (measured by the kernel): this module has 2 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.softmax` prints this classification.