Documentation

Linglib.Theories.Semantics.Probabilistic.SDS.Core

A constraint system in the style of Situation Description Systems (SDS).

The core pattern: given an entity and context, we marginalize over a parameter space, combining selectional (entity-dependent) and scenario (context-dependent) factors via Product of Experts.

Type Parameters #

  • α: The system type (e.g., GradableAdjective E, Concept)
  • Θ: The parameter space being marginalized over

Fields #

Key Operations #

The unnormalized posterior at parameter θ is:

posterior(θ) = selectionalFactor(θ) × scenarioFactor(θ)

The normalized posterior divides by the sum over all θ in support.

  • paramSupport : αList Θ

    Support for the parameter space (for finite marginalization)

  • selectionalFactor : αΘ

    The selectional component: entity-dependent factor

  • scenarioFactor : αΘ

    The scenario component: context-dependent factor

Instances

    Unnormalized posterior at a given parameter value.

    This is the Product of Experts combination: posterior(θ) = selectionalFactor(θ) × scenarioFactor(θ)

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

      Partition function (normalizing constant) for the posterior.

      Z = Σ_θ selectionalFactor(θ) × scenarioFactor(θ)

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

        Normalized posterior probability at a given parameter value.

        P(θ | sys) = unnormalizedPosterior(θ) / Z

        Returns 0 if Z = 0 (degenerate case).

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

          Expected value of a function under the normalized posterior.

          E[f] = Σ_θ P(θ | sys) × f(θ)

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            def Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.posteriorProb {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (pred : ΘBool) :

            Probability that a predicate holds under the posterior.

            P(pred) = E[1_pred]

            Equations
            Instances For

              Product of Experts is commutative: order of factors doesn't matter.

              Zero-absorbing: if either factor is zero, the posterior is zero.

              def Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.softTruth {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (holds : ΘBool) :

              Soft truth value: probability that a threshold-based predicate holds.

              For threshold semantics, this computes: E[1_{measure(x) ≥ θ}] under the posterior over θ

              This is the key connection: threshold uncertainty yields soft/graded meanings.

              Equations
              Instances For
                def Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.marginal {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (project : Θ) :

                Marginal over parameter space.

                Returns the distribution over some property computed from θ. For SDS, this is how soft meanings emerge from Boolean semantics + uncertainty.

                Equations
                Instances For
                  def Semantics.Probabilistic.SDS.Core.listArgmax {α : Type u_1} (xs : List α) (f : α) :

                  Find the element with maximum value according to a scoring function.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Semantics.Probabilistic.SDS.Core.hasConflict {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] [BEq Θ] (sys : α) :

                    Detect when selectional and scenario factors disagree.

                    A conflict occurs when the argmax of each factor differs. This is useful for predicting ambiguity, puns, and zeugma.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Semantics.Probabilistic.SDS.Core.conflictDegree {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] [BEq Θ] (sys : α) :

                      Get the degree of conflict between factors.

                      Measures how different the expert preferences are.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Semantics.Probabilistic.SDS.Core.trivialScenario {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (θ : Θ) :

                        A degenerate SDS where the scenario factor is uniform (no context dependence).

                        This captures cases like gradable nouns where the threshold is compositionally determined rather than contextually inferred.

                        Equations
                        Instances For

                          Relationship to Core.ProductOfExperts #

                          The SDSConstraintSystem typeclass is conceptually equivalent to Core.ProductOfExperts.FactoredDist, but with key differences:

                          1. Typeclass vs Structure: SDS uses a typeclass for instance inference, allowing automatic derivation of operations for any type that provides the selectional/scenario factors.

                          2. Universe Polymorphism: SDS is fully universe-polymorphic (Type*), while FactoredDist uses Type.

                          3. Instance Pattern: SDS supports instantiation at different entity types (e.g., SDSConstraintSystem (AdjWithEntity E) ℚ for any E).

                          For types where both apply, the underlying computation is identical:

                          See Core.ProductOfExperts for the standalone PoE combinators.

                          Summary #

                          This module provides:

                          Core Typeclass #

                          Operations #

                          Utilities #

                          Insight #

                          SDS unifies many linguistic phenomena under a common computational pattern:

                          All share: Boolean semantics + parameter uncertainty = soft/graded meanings

                          A disambiguation scenario with selectional and scenario constraints.

                          This is the standard SDS setup from @cite{erk-herbelot-2024}: an ambiguous word in context, with a selectional factor (from the governing predicate) and a scenario factor (from the activated frame/script).

                          • word : String

                            Name of the ambiguous word

                          • context : String

                            Context sentence

                          • selectional : C

                            Selectional constraint (from predicate)

                          • scenario : C

                            Scenario constraint (from frame/context words)

                          • concepts : List C

                            Support (list of concepts)

                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            structure Semantics.Probabilistic.SDS.Core.ConceptFeature (Concept : Type u_1) (Feature : Type u_2) :
                            Type (max u_1 u_2)

                            Concept-associated features, following @cite{mcrae-etal-2005}.

                            Each concept has features with associated probabilities. For example, BAT-ANIMAL has features like flies (prob 1.0), is_black (prob 0.75). These features can be projected back into DRS conditions after disambiguation.

                            • featureProb : ConceptFeature

                              P(feature | concept) — probability of feature given concept

                            Instances For
                              def Semantics.Probabilistic.SDS.Core.ConceptFeature.projectFeature {α : Type u_1} {Concept : Type u_2} {Feature : Type u_3} [SDSConstraintSystem α Concept] (cf : ConceptFeature Concept Feature) (sys : α) (f : Feature) :

                              Project a feature through the posterior over concepts.

                              Given a posterior distribution over concepts and concept-feature associations, compute the posterior probability of a feature:

                              P(feature | context) = Σ_c P(feature | c) × P(c | context)

                              This is the mechanism by which disambiguation affects truth conditions: features inferred from the winning concept become DRS conditions.

                              Equations
                              Instances For