The Rational Speech Act pipeline on probability kernels #
The RSA model ([FG12]; [Deg23] eqs. 1–4;
[FB20b] eqs. 5–22) in mathlib's probability vocabulary. A
RSA.Scenario bundles a choice space with an extension and an observable
form per choice; the literal listener is uniform on the extension, the
speaker is the best response in power-weight form (ENNReal.rpow is total,
so falsity needs no signed utilities), and the listeners are conditionals of
the joint — rationality and priors are arguments, so findings quantify over
them. Preference facts come in two registers, each closed by decide:
Multiset.StrictDominates certificates on informativity profiles (strict
stochastic dominance — uniform in the rationality, with empty fibers as the
support case), and pinned natural rationality, where comparisons clear to ℕ
inequalities via Multiset.divPowSum.
Main definitions #
RSA.literalListener— eq. 1: a prior conditioned on the extension.RSA.speakerOf— eqs. 2/6–7: the best-response speaker to a listener kernel, asProbabilityTheory.Kernel.ofWeightsofL ^ α.RSA.Scenario— the bundled model:sem,obs, and the derivedL0,speaker,production,jointListener,listener,choicePosterior.RSA.Scenario.pool— choice-side latents: the speaker chooses the family index, normalizing across the pooled pairs (eqs. 18a/21a).RSA.Scenario.familySpeaker,RSA.Scenario.familyListener— state-side latents: the index is a speaker argument, normalization is per-index (eqs. 11–13).pool_L0shows the two architectures share their weights — they differ only in the position of the latent.
Main statements #
ProbabilityTheory.posterior_apply_singleton— exact Bayes forκ†μat a positive-mass observation.RSA.Scenario.listener_real_lt_of_prodMul_strictDominates— the certificate register: strict domination of fiber-by-rest profile products decides listener preference uniformly in the rationality.RSA.Scenario.listener_real_lt_of_divPowSum,RSA.Scenario.choicePosterior_real_lt_of_divPowSum— the evaluation register: at a natural rationality, preference is a decided ℕ inequality.
Implementation notes #
All spaces here are finite and discrete; the ⊤ σ-algebra makes every study
enum standard Borel, so mathlib's disintegration-based conditionals apply.
Their characterization is almost-everywhere, but an ae-fact holds at every
atom of positive mass (MeasureTheory.ae_of_singleton_ne_zero), which
yields exact Bayes pointwise — no rnDeriv.
Almost-everywhere facts at atoms #
An almost-everywhere property holds at any atom of positive mass.
Kernels from weight functions #
The kernel that normalizes a nonnegative weight function on a finite
target: row a is the probability measure proportional to w a. A row of
zero (or infinite) total weight collapses to the zero measure.
Equations
- ProbabilityTheory.Kernel.ofWeights w = ProbabilityTheory.Kernel.ofFunOfCountable fun (a : α) => (∑ b : β, w a b)⁻¹ • ∑ b : β, w a b • MeasureTheory.Measure.dirac b
Instances For
A row with a positive entry and finite entries normalizes to a probability measure.
Row-preference in a weight kernel reduces to weight comparison; the normalization cancels.
Weight-kernel rows are subprobabilities: normalization gives mass 1 on positive finite total weight and 0 otherwise.
Exact Bayes for the posterior kernel at atoms #
Exact Bayes for the posterior kernel at a positive-mass observation: evaluate the defining compProd identity on a singleton rectangle.
A single state of positive prior mass and positive emission witnesses a positive observation marginal.
Marginal evaluation on finite products #
Uniform priors on reals #
Marginal listener preference over product parameter spaces #
Marginal listener preference over a product parameter space, on reals: for latent-in-the-state models, the observation's marginal cancels and the latent pools.
Marginal listener preference over the latent component of a product parameter space, on reals: the states pool.
The RSA pipeline #
The literal listener (eq. 1): the prior belief conditioned on the utterance's extension.
Equations
- RSA.literalListener μ sem = ProbabilityTheory.Kernel.ofFunOfCountable fun (u : U) => μ[|sem u]
Instances For
On a positive-mass extension, the literal listener is the renormalized prior at members …
… and zero at non-members: literal falsity is never entertained.
The literal listener is Markov as soon as every extension has positive prior mass.
The best-response speaker in power-weight form #
[FB20b] eq. 6 ≡ eq. 7: softmax of α · log L is, in weight
form, L ^ α. On ℝ≥0∞ the power is total — an inapplicable utterance has
weight 0 ^ α = 0 — so falsity needs no EReal utilities and no ⊥/⊤
side conditions.
The best-response speaker to a listener kernel: power weights
L u {w} ^ α ([FB20b] eq. 7, [Deg23] eq. 2 at the
informativity utility).
Equations
- RSA.speakerOf α L = ProbabilityTheory.Kernel.ofWeights fun (w : W) (u : U) => (L u) {w} ^ α
Instances For
The speaker is a probability kernel whenever every state has a true utterance ([FB20b] eq. 7's proviso).
A literally false utterance is never produced (positive rationality).
A literally true utterance is produced with positive mass.
Choice scenarios #
The bundled theory object: a choice space with an extension and an
observable form for each choice. Rationality and prior are arguments of the
derived kernels, not data — findings quantify over α. [FB20b]'s
vanilla, LI, and GI models are three instantiations (identity observation
with the bare parse; Prod.fst over pair choices, eqs. 18/21); LU places its
latent in the state instead and is not a Scenario — its speaker
normalizes per lexicon, not against the pooled choice space.
A finite RSA choice scenario: each choice (an utterance, or an (utterance, parse) pair) carries an extension and an observable form.
- sem : C → Finset T
The extension of each choice.
- obs : C → O
The observable form of each choice: what the listener hears.
Instances For
Pool a family of scenarios into one whose choices carry the family index:
the speaker chooses the index with the utterance, normalizing across the
whole family ([FB20b] eqs. 18a/21a). familySpeaker instead
keeps the index as an argument of the speaker (eq. 11) — with pool_L0, the
paper's observation (p. e86) that the two architectures differ only in the
position of the latent parameter.
Equations
- RSA.Scenario.pool f = { sem := fun (cl : C × L) => (f cl.2).sem cl.1, obs := fun (cl : C × L) => (f cl.2).obs cl.1 }
Instances For
The literal listener ([FB20b] eq. 5 at the paper's standing uniform prior): uniform over the choice's extension.
Equations
Instances For
Pooling does not change the literal listener: pool and familySpeaker
share their weights and differ only in the normalization domain — the
type-level content of [FB20b]'s contrast between eq. 11 and
eqs. 18a/21a (p. e86).
The pragmatic speaker ([FB20b] eqs. 6–7, 18a, 21a): best
response at rationality α.
Equations
- s.speaker α = RSA.speakerOf α s.L0
Instances For
Informativity profiles #
The combinatorial shadow of the model: the multiset of extension sizes of a
state's true choices. Softmax masses are ratios of Multiset.invPowSums over
profiles, so preference certificates are Multiset.StrictDominates facts
closed by decide — uniform in the rationality.
The choices true at a state.
Equations
- s.trueChoices t = {x : C | t ∈ s.sem x}
Instances For
The informativity profile: extension sizes of the true choices.
Equations
- s.profile t = Multiset.map (fun (c : C) => (s.sem c).card) (s.trueChoices t).val
Instances For
The profile restricted to choices heard as o.
Equations
- s.fiberProfile o t = Multiset.map (fun (c : C) => (s.sem c).card) {x ∈ s.trueChoices t | s.obs x = o}.val
Instances For
The profile of true choices heard otherwise.
Equations
- s.restProfile o t = Multiset.map (fun (c : C) => (s.sem c).card) {x ∈ s.trueChoices t | s.obs x ≠ o}.val
Instances For
A nonempty fiber profile exhibits an o-shaped true choice — certificates
carry their own truth witnesses.
Pooled speaker mass over an observation's fiber is a ratio of profile sums — [FB20b] eq. 8, structurally.
Exact speaker mass on reals: extension-size weight over the state's partition.
Speaker shares over any set of choices stay within the row's unit mass.
Competition: any other true choice caps a share strictly below one.
Informativity monotonicity ([FB20b] eq. 7's qualitative claim): between two true choices, the one with the strictly smaller extension is produced with strictly higher probability, at every positive rationality.
Softmax constant-utility invariance: when every true choice at a state
has the same extension size, the speaker is uniform on them — each share is
m⁻¹ regardless of the rationality.
The ℕ-cleared production mass of a choice, pooled over its true states: its common-denominator weight times, per true state, the product of the other states' cleared partition sums. Pooled evaluation-register hypotheses compare these.
Equations
- s.divPowSumColumn D k c = (D / (s.sem c).card) ^ k * ∑ t ∈ s.sem c, ∏ t' ∈ Finset.univ.erase t, Multiset.divPowSum D k (s.profile t')
Instances For
Exact speaker mass at a natural rationality, as a ratio of ℕ-valued common-denominator sums.
A positive-prior state truly described by an o-shaped choice witnesses
a positive observation marginal.
Utterance production ([FB20b] eq. 19a): the observable form of the speaker's choice.
Equations
- s.production α = (s.speaker α).map s.obs
Instances For
The joint distribution of the heard form with the (state, choice) pair.
Equations
Instances For
The heard form is distributed as the production marginal.
The joint pragmatic listener ([FB20b] eqs. 18b/21b): posterior over (state, choice) given the heard form.
Equations
- s.jointListener α μ = (s.jointObs α μ).condKernel
Instances For
The state posterior ([FB20b] eqs. 9/19b): the world marginal of the joint listener.
Equations
- s.listener α μ = (s.jointListener α μ).fst
Instances For
The choice posterior ([FB20b] eq. 22, at pairs).
Equations
- s.choicePosterior α μ = (s.jointListener α μ).snd
Instances For
Exact Bayes for the joint listener at a positive-mass observation.
Listener preference on reals: the observation's marginal cancels, leaving prior-weighted speaker mass pooled over the observation's fiber.
Choice preference among o-shaped choices reduces to comparing
prior-weighted speaker masses across states.
The evaluation register for the choice posterior at a natural rationality
and equal priors: pooled preference between two o-shaped choices is the
ℕ-valued common-denominator comparison over all states — a kernel decide.
The strict inequality carries its own truth witness.
Listener preference at equal priors reduces to the cross-multiplied profile comparison, on reals: the observation marginal and the shared prior cancel. Both registers' closers enter here.
The certificate closes the odds comparison: strict domination of the fiber-by-rest cross products decides it uniformly in the rationality (the shared fiber-by-fiber terms cancel).
The certificate register: at equal priors, strict domination of the
fiber-by-rest profile products decides listener preference uniformly in the
rationality. The certificate carries its own truth witness, so a finding is a
single decided Multiset.StrictDominates fact. An empty fiber at t₁ is the
support case: any nonempty product strictly dominates 0.
The evaluation register at a natural rationality: with all profile entries
dividing D, listener preference at equal priors is the ℕ-valued
common-denominator comparison — a kernel decide. The strict inequality
carries its own truth witness.
State-side latent families #
[FB20b] eqs. 11–13 (lexical uncertainty): each speaker carries a
fixed latent index and best-responds within it — normalization is per-index,
in contrast to the choice-side latents of jointListener, whose speaker
normalizes across the pooled pairs. The weight functions coincide; only the
normalization differs.
The family speaker: the latent index rides in the state.
Equations
- RSA.Scenario.familySpeaker f α = ProbabilityTheory.Kernel.ofFunOfCountable fun (tl : T × L) => ((f tl.2).speaker α) tl.1
Instances For
The family listener: the Bayesian inverse of the family speaker over the
joint (state, index) space — [FB20b] eqs. 12–13. Bundling the
posterior keeps consumers' goals first-order in familyListener.
Equations
- RSA.Scenario.familyListener f α μ = ProbabilityTheory.posterior (RSA.Scenario.familySpeaker f α) μ
Instances For
A member's true choice at a positive-prior state witnesses a positive observation marginal for the family speaker.
State-marginal preference for a latent family at equal priors: the latent pools, leaving summed member speaker shares. Any member's true choice at either state supplies the positivity side condition.
Latent-marginal preference for a latent family at equal priors: the states pool, leaving summed member speaker shares.