Scored choice systems #
A ConstraintSystem Cand Score packages the three components of a
scored-choice problem into a single record:
- a finite
candidates : Finset Cand, - a
score : Cand → Scorefunction, and - a
decoder : Decoder Cand Scoremapping scored candidates to a probability distribution.
Candidates ──score──▶ Score ──decoder──▶ P : Cand → ℝ
Every system exposes a single predict operation. Probability-preserving
decoders (Decoder.IsProb) yield non-negative predictions that sum to 1.
A closed-form predict and standard monotonicity / equiprobability /
sum-to-one lemmas for the softmaxDecoder specialisation also live here,
since they depend only on the record + softmaxDecoder from Decoder.lean
— no domain-specific score type is required.
Domain-specific instantiations (lex-min on integer cost vectors, weighted-sum scoring, softmax over weighted sums, ...) live in the consuming layer.
A scored-choice system: candidate set + score function + decoder.
- candidates : Finset Cand
The finite set of candidates this system evaluates.
- score : Cand → Score
The aggregated score for each candidate.
- decoder : Decoder Cand Score
The choice rule: scored candidates → probability distribution.
Instances For
The predicted probability of each candidate.
Equations
- s.predict = s.decoder.decode s.candidates s.score
Instances For
A system whose decoder is IsProb produces non-negative predictions.
A system whose decoder is IsProb predicts a probability distribution
over its candidate set.
Softmax-decoder specialisations #
Closed-form / monotonicity / equiprobability lemmas for
ConstraintSystems whose decoder = softmaxDecoder α. The hypothesis
hd : s.decoder = softmaxDecoder α is rfl for the explicit-record
construction pattern.
For a system whose decoder is softmaxDecoder α, the predicted
probability of an in-set candidate has the standard closed form
exp(α · score(c)) / Σ exp(α · score(c')).
Softmax monotonicity: for α > 0, the in-set candidate with strictly
higher score gets strictly higher predicted probability.
Softmax equality: candidates with equal scores get equal predicted probability.
For a system whose decoder is softmaxDecoder α, predicted
probabilities sum to 1 over the (non-empty) candidate set.
Specialises predict_sum_eq_one so consumers needn't supply
the IsProb instance argument explicitly.