Documentation

Linglib.Theories.Syntax.CCG.Formal.Equivalence

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

    Semantic equivalence for category-meaning pairs.

    Equations
    Instances For

      Semantic equivalence is reflexive.

      theorem CCG.Equivalence.sem_equiv_symm {m : Semantics.Montague.Model} (cm₁ cm₂ : (c : Cat) × m.interpTy (catToTy c)) :

      Semantic equivalence is symmetric.

      theorem CCG.Equivalence.sem_equiv_trans {m : Semantics.Montague.Model} (cm₁ cm₂ cm₃ : (c : Cat) × m.interpTy (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)) = Combinators.B f (Combinators.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 full binary tree represents a bracketing of items.

      • leaf: A single item (no bracketing needed)
      • node l r: A binary split (l r) combining two sub-bracketings

      For n items, a full binary tree has n leaves and n-1 internal nodes.

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

          Number of leaves in a binary tree (= number of items being bracketed).

          Equations
          Instances For

            Number of internal nodes (= number of binary operations / compositions).

            Equations
            Instances For

              A tree with n leaves has n-1 internal nodes.

              Generate all binary trees with exactly n leaves (helper with explicit termination).

              Equations
              Instances For

                Generate all binary trees with exactly n leaves.

                Equations
                Instances For

                  Catalan numbers via the closed formula.

                  Equations
                  Instances For

                    Count bracketings directly (helper with explicit termination).

                    Equations
                    Instances For

                      Count bracketings directly (matches Catalan structure).

                      Equations
                      Instances For

                        countBracketings n = catalan (n-1) for n >= 1.

                        Verified computationally for small values.

                        allTreesWithLeaves generates exactly countBracketings trees.

                        The tree enumeration function produces the correct count.

                        Combined: tree count equals Catalan number.

                        The number of bracketings of n items equals the (n-1)th Catalan number.

                        Equations
                        Instances For

                          A derivation strategy selects bracketings.

                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem CCG.Equivalence.strategy_irrelevant {α : Type} (f g h : αα) (x : α) :
                              ∀ (x✝ : BracketStrategy), f (g (h x)) = f (g (h x))

                              Under purely compositional derivation, all strategies yield the same meaning.

                              A chart entry: category + meaning for a span.

                              Instances For

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

                                Equations
                                Instances For

                                  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

                                      Real ambiguity: multiple equivalence classes for the same string.

                                      Equations
                                      Instances For

                                        Spuriously ambiguous: multiple derivations but only one equivalence class.

                                        Equations
                                        Instances For