Documentation

Linglib.Core.Agent.Emotion

Emotion as Post-Inference Appraisal @cite{houlihan-kleiman-weiner-hewitt-tenenbaum-saxe-2023} #

Houlihan, Kleiman-Weiner, @cite{houlihan-kleiman-weiner-hewitt-tenenbaum-saxe-2023} show that emotions are not primitive mental states — they are computed from more basic cognitive variables via a three-layer architecture:

  1. Inverse Planning (= BToM): observe action → infer beliefs, desires, percepts
  2. Computed Appraisals: from inferred mental states, compute appraisal variables across multiple utility domains (monetary, affiliation, social equity)
  3. Emotion Concepts: each emotion is a specific qualitative pattern (β weights) over the shared appraisal space — a linear readout with logistic transform

The key architectural claims:

Appraisal Dimensions #

The paper computes appraisals along four types × two perspectives:

TypeDefinitionBToM Component
AUU(outcome | preferences)Desire marginal
PEoutcome − E[outcome | beliefs]Belief expectation
CFaU(agent's alternative) − U(actual)Planning model
CFoU(opponent's alternative) − U(actual)Planning model
PerspectiveMeaning
BaseDirect outcomes: monetary + social utility
ReputationalHow the agent's choices appear to others

The paper's full model decomposes base utility into three domains (monetary, affiliation, social equity), yielding an 18-dimensional appraisal space. Our qualitative profiles collapse these base domains into a single "base" perspective (4 types × 2 perspectives = 8 dimensions), which suffices to uniquely characterize all 20 emotion concepts.

The four appraisal computation types from @cite{houlihan-kleiman-weiner-hewitt-tenenbaum-saxe-2023}.

Each type is a different way of evaluating an outcome relative to the agent's inferred mental states:

  • AU: value of actual outcome given preferences
  • PE: actual outcome minus expected outcome given beliefs
  • CFa: utility of agent's alternative action minus actual
  • CFo: utility of opponent's alternative action minus actual
Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Perspective for appraisal computation.

      The paper's full model has three base utility domains (monetary, affiliation, social equity) plus reputational utility. We collapse the three base domains into a single "base" perspective, capturing the key structural distinction: base appraisals evaluate direct outcomes, reputational appraisals evaluate how the agent's choices appear to others.

      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Qualitative sign of an appraisal dimension in an emotion profile.

          Rather than modeling continuous β weights, we capture the qualitative structure: whether high values of a given appraisal dimension increase the emotion (+), decrease it (−), or are irrelevant (·). Abstracted from the learned transformation in Houlihan et al.'s Fig. 4.

          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Temporal orientation of an emotion.

              Retrospective emotions presuppose an observed outcome and evaluate it against the agent's inferred mental states. Prospective emotions (hope, fear, dread) concern uncertain future outcomes and require expected utility computations — a fundamentally different appraisal architecture not covered by the current model.

              All 20 emotion concepts in Houlihan et al. are retrospective.

              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Core.Agent.Emotion.achievedUtility {F : Type u_1} [CommSemiring F] {A : Type u_2} {P : Type u_3} {B : Type u_4} {D : Type u_5} {S : Type u_6} {M : Type u_7} {W : Type u_8} [Fintype P] [Fintype B] [Fintype D] [Fintype S] [Fintype M] [Fintype W] (model : BToM.BToMModel F A P B D S M W) (utility : WDF) (action : A) (world : W) :
                  F

                  Achieved Utility from BToM desire marginals.

                  AU(a, w) = Σ_d P(d | a) · U(w, d)
                  

                  The desire marginal P(d | a) is the observer's posterior over what the agent wanted, given the observed action. Weighting by utility U(w, d) yields the expected value of the actual outcome under the inferred desires.

                  This is the core post-inference property: AU is a function of the BToM posterior, not a primitive input to the model.

                  Equations
                  Instances For
                    def Core.Agent.Emotion.predictionError {F : Type u_1} [CommSemiring F] {A : Type u_2} {P : Type u_3} {B : Type u_4} {D : Type u_5} {S : Type u_6} {M : Type u_7} {W : Type u_8} [Fintype P] [Fintype B] [Fintype D] [Fintype S] [Fintype M] [Fintype W] [AddCommGroup F] (model : BToM.BToMModel F A P B D S M W) (outcome : WF) (beliefPrediction : BF) (action : A) (world : W) :
                    F

                    Prediction Error from BToM belief expectation.

                    PE(a, w) = outcome(w) − E_B[prediction(b) | a]
                    

                    The belief expectation is the observer's posterior-weighted average of what the agent believed would happen. The difference from the actual outcome measures surprise.

                    Equations
                    Instances For
                      def Core.Agent.Emotion.counterfactualAppraisal {F : Type u_1} {A : Type u_2} {W : Type u_8} (utility : WAF) [AddCommGroup F] (actualAction altAction : A) (world : W) :
                      F

                      Counterfactual Appraisal: utility difference from alternative action.

                      CF(a_actual, a_alt, w) = U(w, a_alt) − U(w, a_actual)
                      

                      Serves as both CFa (agent counterfactual) and CFo (opponent counterfactual) depending on which agent's action space is being varied:

                      • CFa: altAction ranges over the focal agent's alternative actions
                      • CFo: altAction ranges over the opponent's alternative actions

                      Positive values mean the alternative would have been better.

                      Equations
                      Instances For
                        theorem Core.Agent.Emotion.au_from_btom_marginals {F : Type u_1} [CommSemiring F] {A : Type u_2} {P : Type u_3} {B : Type u_4} {D : Type u_5} {S : Type u_6} {M : Type u_7} {W : Type u_8} [Fintype P] [Fintype B] [Fintype D] [Fintype S] [Fintype M] [Fintype W] (model : BToM.BToMModel F A P B D S M W) (utility : WDF) (action : A) (world : W) :
                        achievedUtility model utility action world = d : D, model.desireMarginal action d * utility world d

                        AU is a desire-marginal weighted sum — structurally post-inference.

                        theorem Core.Agent.Emotion.pe_uses_belief_expectation {F : Type u_1} [CommSemiring F] {A : Type u_2} {P : Type u_3} {B : Type u_4} {D : Type u_5} {S : Type u_6} {M : Type u_7} {W : Type u_8} [Fintype P] [Fintype B] [Fintype D] [Fintype S] [Fintype M] [Fintype W] [AddCommGroup F] (model : BToM.BToMModel F A P B D S M W) (outcome : WF) (beliefPrediction : BF) (action : A) (world : W) :
                        predictionError model outcome beliefPrediction action world = outcome world - model.beliefExpectation beliefPrediction action

                        PE uses beliefExpectation — structurally post-inference.

                        Appraisal weights for a single appraisal type, split by perspective.

                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              The 4 × 2 qualitative appraisal weight matrix for an emotion concept.

                              Each of the four appraisal types has a base and reputational weight, yielding 8 qualitative dimensions. This is our abstraction of the paper's full 18-dimensional learned β weight matrix (Fig. 4), collapsing monetary + affiliation + social equity into "base."

                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Equations
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      An emotion concept as a qualitative pattern over the appraisal space.

                                      The paper's central claim: each emotion is a specific readout pattern (β weight vector) over the shared set of computed appraisals. Different emotions = different patterns over the SAME underlying variables. The readout is applied identically for all emotions (eq. 8.2):

                                      P(e | ψ) ∝ exp(β_e · ψ + b_e) 
                                      
                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          Equations
                                          Instances For
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For

                                              All base (non-reputational) dimensions are irrelevant.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Qualitative profiles abstracted from the learned β weights in Houlihan et al.'s Fig. 4. Convention: .positive = β > 0 (high appraisal values increase emotion), .negative = β < 0, .irrelevant = β ≈ 0.

                                                Each definition specifies: ⟨name, ⟨au, pe, cfa, cfo⟩, orientation⟩ where each of au, pe, cfa, cfo is ⟨base, reputational⟩.

                                                EmotionAU_bAU_rPE_bPE_rCFa_bCFa_rCFo_bCFo_r
                                                joy+·+·····
                                                surprise··+·····
                                                pride++··+···
                                                gratitude+·+····
                                                relief+·+····
                                                amusement+·+···+·
                                                disappointment··+···
                                                annoyance······
                                                fury·····
                                                embarrassment·····
                                                regret······
                                                guilt······
                                                disgust······
                                                devastation·····
                                                contempt·······
                                                respect·+······
                                                envy·····+·
                                                sympathy······
                                                confusion··++····
                                                excitement+·++····
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            Equations
                                                            • One or more equations did not get rendered due to their size.
                                                            Instances For
                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                Equations
                                                                • One or more equations did not get rendered due to their size.
                                                                Instances For
                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For
                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          Equations
                                                                          • One or more equations did not get rendered due to their size.
                                                                          Instances For
                                                                            Equations
                                                                            • One or more equations did not get rendered due to their size.
                                                                            Instances For
                                                                              Equations
                                                                              • One or more equations did not get rendered due to their size.
                                                                              Instances For
                                                                                Equations
                                                                                • One or more equations did not get rendered due to their size.
                                                                                Instances For
                                                                                  Equations
                                                                                  • One or more equations did not get rendered due to their size.
                                                                                  Instances For
                                                                                    Equations
                                                                                    • One or more equations did not get rendered due to their size.
                                                                                    Instances For
                                                                                      Equations
                                                                                      • One or more equations did not get rendered due to their size.
                                                                                      Instances For

                                                                                        All 20 emotion concepts from @cite{houlihan-kleiman-weiner-hewitt-tenenbaum-saxe-2023}.

                                                                                        Equations
                                                                                        • One or more equations did not get rendered due to their size.
                                                                                        Instances For

                                                                                          All 20 emotions have distinct appraisal weight patterns. This is the paper's central empirical finding (Fig. 4): "the learned appraisal structure is unique for each emotion."

                                                                                          All 20 emotions in the model are retrospective (post-outcome). The paper explicitly excludes prospective emotions: "we target retrospective emotions... and did not include prospective emotions that concern uncertain future events (e.g. hope, fear)" (p. 22).

                                                                                          Embarrassment is purely reputational: all base dimensions are irrelevant.