Documentation

Linglib.Syntax.CCG.Equivalence

Semantic Equivalence and Spurious Ambiguity #

CCG derivations fall into equivalence classes: multiple derivations yield identical interpretations due to the associativity of functional composition. This is sometimes called "spurious ambiguity" — but it's not really ambiguity, since all derivations in an equivalence class have the same meaning.

Key concepts #

  1. Semantic equivalence — two derivations are equivalent iff they have the same category and the same meaning.
  2. Source of equivalence — the B combinator is associative (B (B f g) h = B f (B g h)), so (f ∘ g) ∘ h = f ∘ (g ∘ h) in the semantics.
  3. Equivalence classes — for a string of n words there are Catalan(n-1) binary bracketings, all yielding the same meaning if built purely from composition.
  4. Processing — a parser need only find one derivation per equivalence class.

Two derivations are semantically equivalent iff they span the same substring, have the same category, and have the same meaning.

This defines equivalence for "spurious ambiguity" analysis.

Instances For
    def CCG.Equivalence.semanticallyEquivalent {E W : Type} (cm₁ cm₂ : (c : Cat) × Intensional.Denot E W (catToTy c)) :

    Semantic equivalence for category-meaning pairs.

    Equations
    Instances For

      Semantic equivalence is reflexive.

      theorem CCG.Equivalence.sem_equiv_symm {E W : Type} (cm₁ cm₂ : (c : Cat) × Intensional.Denot E W (catToTy c)) :

      Semantic equivalence is symmetric.

      theorem CCG.Equivalence.sem_equiv_trans {E W : Type} (cm₁ cm₂ cm₃ : (c : Cat) × Intensional.Denot E W (catToTy c)) :
      semanticallyEquivalent cm₁ cm₂semanticallyEquivalent cm₂ cm₃semanticallyEquivalent cm₁ cm₃

      Semantic equivalence is transitive.

      theorem CCG.Equivalence.B_assoc {α β γ δ : Type} (f : γδ) (g : βγ) (h : αβ) :

      B (composition) is associative: (f ∘ g) ∘ h = f ∘ (g ∘ h)

      theorem CCG.Equivalence.B_assoc_apply {α β γ δ : Type} (f : γδ) (g : βγ) (h : αβ) (x : α) :

      Associativity stated pointwise.

      theorem CCG.Equivalence.composition_order_irrelevant {α β γ δ : Type} (f : γδ) (g : βγ) (h : αβ) (x : α) :
      f (g (h x)) = Combinator.B f (Combinator.B g h) x

      Consequence: Two ways of composing three functions yield the same result.

      This is why "Harry thinks that Anna married" can be derived by:

      1. (Harry ∘ thinks) ∘ (that ∘ (Anna ∘ married))
      2. Harry ∘ (thinks ∘ that) ∘ (Anna ∘ married)
      3. Harry ∘ (thinks ∘ (that ∘ Anna)) ∘ married ... etc.

      All yield the same predicate-argument structure.

      A chart entry: category + meaning for a span.

      Instances For
        def CCG.Equivalence.chartEntriesMatch {E W : Type} (e₁ e₂ : ChartEntry E W) :

        Two chart entries match if they have the same span, category, and meaning.

        Equations
        Instances For
          def CCG.Equivalence.chartEntriesSameCat {E W : Type} (e₁ e₂ : ChartEntry E W) :
          Bool

          The matching relation is decidable for categories (not meanings in general).

          Equations
          Instances For

            An equivalence class of derivations: all have the same meaning.

            Instances For
              def CCG.Equivalence.reallyAmbiguous {E W : Type} (classes : List (EquivalenceClass E W)) :

              Real ambiguity: multiple equivalence classes for the same string.

              Equations
              Instances For
                def CCG.Equivalence.spuriouslyAmbiguous {E W : Type} (derivCount : ) (classes : List (EquivalenceClass E W)) :

                Spuriously ambiguous: multiple derivations but only one equivalence class.

                Equations
                Instances For