Documentation

Linglib.Theories.Semantics.Probabilistic.SDS.Core

class Semantics.Probabilistic.SDS.Core.SDSConstraintSystem (α : Type u_1) (Θ : outParam (Type u_2)) :
Type (max u_1 u_2)

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
          def Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.expectation {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (f : Θ) :

          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.

              theorem Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.poe_zero_selectional {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (θ : Θ) (h : selectionalFactor sys θ = 0) :

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

              theorem Semantics.Probabilistic.SDS.Core.SDSConstraintSystem.poe_zero_scenario {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (θ : Θ) (h : scenarioFactor sys θ = 0) :
              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 : α) :
                  Option α

                  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 : α) :
                    Bool

                    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

                        Posterior uncertainty as Gini impurity: 1 - Σ_θ P(θ)².

                        For a two-concept system, ranges from 0 (one concept has probability 1) to 0.5 (uniform 50/50). For a k-concept uniform distribution, equals (k-1)/k. Captures "how spread out is the posterior" without requiring real-valued logarithms.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Semantics.Probabilistic.SDS.Core.isTied {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] (sys : α) (θ₁ θ₂ : Θ) (tolerance : := 1 / 10) :
                          Bool

                          Two parameter values are tied under the posterior if their normalized posteriors are within tolerance of each other (default 1/10).

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            theorem Semantics.Probabilistic.SDS.Core.hasConflict_iff_different_argmax {α : Type u_1} {Θ : Type u_2} [SDSConstraintSystem α Θ] [BEq Θ] (sys : α) :
                            hasConflict sys = true (θ₁ : Θ), (θ₂ : Θ), listArgmax (SDSConstraintSystem.paramSupport sys) (SDSConstraintSystem.selectionalFactor sys) = some θ₁ listArgmax (SDSConstraintSystem.paramSupport sys) (SDSConstraintSystem.scenarioFactor sys) = some θ₂ (θ₁ != θ₂) = true

                            Substrate property: hasConflict is true exactly when the selectional and scenario factors have different argmax elements (and both argmaxes exist).

                            This is the formal content of "selectional and scenario disagree on which parameter to prefer." Polymorphic over any SDSConstraintSystem; the DisambiguationScenario case (the paper's bat/star/port examples) is the intended consumer.

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

                            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 PMF.productOfExperts #

                              The SDSConstraintSystem typeclass implements the SDS-specific selectional × scenario product factorization, with unnormalizedPosterior giving the multiplicative joint score and normalizedPosterior doing the explicit ℚ-valued normalization. For the canonical mathlib mechanism (PMF-typed, ENNReal-valued, with measure-theoretic foundation), see Mathlib.Probability.ProbabilityMassFunction.Constructions (PMF.normalize) and Core/Probability/Posterior.lean (PMF.productOfExperts, PMF.posterior). The SDS typeclass favors decidable ℚ computation for study-file replications; PMF is canonical for general probability work.

                              Summary #

                              This module provides:

                              Core Typeclass #

                              Operations #

                              Utilities #

                              Substrate theorems #

                              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
                                @[implicit_reducible]
                                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