Documentation

Linglib.Semantics.NaturalLogic

Natural Logic Relations and Entailment Signatures #

[Ica12] [MCM09]

Framework-agnostic infrastructure for the natural logic relation algebra and entailment signatures, following [Ica12] "Inclusion and Exclusion in Natural Language."

Contents #

  1. NLRelation — 7 natural logic relations (≡, ⊑, ⊒, ^, |, ⌣, #)
  2. EntailmentSig — 9 entailment signatures unifying monotonicity/additivity

Key operations #

Algebraic structure #

The seven basic set-theoretic relations between denotations ([MCM09], [Ica12] §1).

SymbolNameSet relationExample
equivalenceA = Bcouch / sofa
forwardA ⊂ Bdog / animal
reverseA ⊃ Banimal / dog
^negationA ∩ B = ∅, A ∪ B = Uhappy / unhappy
|alternationA ∩ B = ∅cat / dog
coverA ∪ B = Uanimal / nondog
#independentall other caseshungry / tall
Instances For
    @[implicit_reducible]
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      Informativity ordering on NL relations.

      R ≤ R' means R is at least as informative as R'. The lattice has ≡ at

      at the top (least informative); there is no bottom — the two diamonds #

      (≡ over ⊑/⊒, ^ over |/⌣) meet only at #.

      Refines R R' is the implication ordering ([Ica12] §1): xRy entails xR'y (certified semantically by NLRelation.Holds.of_refines in Semantics/Entailment/Soundness.lean). ≡ refines the inclusion relations but not the exclusion relations (x = y does not make x,y disjoint or exhaustive); ^ refines both | and ⌣.

      Equations
      Instances For
        @[implicit_reducible]
        Equations
        @[implicit_reducible]
        instance NaturalLogic.NLRelation.decidableLE (a b : NLRelation) :
        Decidable (a b)
        Equations
        @[implicit_reducible]
        Equations
        • One or more equations did not get rendered due to their size.

        Join operation ⋈ ([Ica12], Lemma 1.5).

        Given xRy and yR'z, determines the strongest relation x(R⋈R')z. This is the "join" in the relation algebra sense (not lattice join).

        Equations
        Instances For

          ≡ is the identity for join.

          Entailment signature.

          An entailment signature classifies a function by its algebraic properties with respect to ∨ and ∧. This unifies the separate monotonicity and additivity hierarchies into one 9-element lattice.

          SymbolNameProperties
          allAny function (no property)
          +monoMonotone (= UE)
          antiAntitone (= DE)
          additivef(A∨B)=f(A)∨f(B), f(⊤)=⊤
          antiAddf(A∨B)=f(A)∧f(B)
          multf(A∧B)=f(A)∧f(B), f(⊥)=⊥
          antiMultf(A∧B)=f(A)∨f(B), f(⊥)=⊤
          ⊕⊞addMultAdditive + Multiplicative
          ◇⊟antiAddMultAnti-additive + Anti-mult
          Instances For
            @[implicit_reducible]
            Equations
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Refinement ordering on entailment signatures: σ.Refines τ iff every σ-function is a τ-function ([Ica12]'s ≼, §2.2). addMult/antiAddMult are the most specific elements of their halves; all (•, any function) is the top — every class is contained in it. Certified semantically by EntailmentSig.SoundFor.of_refines in Semantics/Entailment/Soundness.lean.

              Equations
              Instances For
                @[implicit_reducible]
                Equations
                @[implicit_reducible]
                instance NaturalLogic.EntailmentSig.decidableLE (a b : EntailmentSig) :
                Decidable (a b)
                Equations
                @[implicit_reducible]
                Equations
                • One or more equations did not get rendered due to their size.

                Projection of a NL relation through a function of given signature ([Ica12], Lemma 2.4).

                If xRy and f has signature φ, then f(x) [R]^φ f(y). Returns the ≪-maximal relation guaranteed to hold between f(x) and f(y).

                The table follows from the algebraic definitions:

                • Additive: f(x∨y) = f(x)∨f(y), f(1)=1 → preserves ∨ → [∧]^⊕ = ∼ (cover from x∨y=1)
                • Multiplicative: f(x∧y) = f(x)∧f(y), f(0)=0 → preserves ∧ → [|]^⊞ = | (disjoint from x∧y=0)
                • Anti-additive: f(x∨y) = f(x)∧f(y), f(1)=0 → [∼]^◇ = | (from x∨y=1 ⟹ f(x)∧f(y)=0)
                • Anti-multiplicative: f(x∧y) = f(x)∨f(y), f(0)=1 → [|]^⊟ = ∼ (from x∧y=0 ⟹ f(x)∨f(y)=1)
                • Mono/anti alone: only preserves ⊑/⊒; ^, |, ∼ all weaken to #
                Equations
                Instances For

                  Every signature except • preserves equiv (• is the class of arbitrary functions, which need not respect equivalence).

                  Composition of entailment signatures ([Ica12], Lemma 2.7).

                  Derived from project: compose(ψ, φ) is the unique signature whose projection table matches projecting through φ then ψ. This makes projection_composition hold by finite verification rather than requiring two independently maintained tables to agree.

                  The signature is identified by probing with forward and negation, which suffice to distinguish all 9 signatures (• included: its probe pair is (#, #), which makes it absorbing, [Ica12] p. 716).

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

                    addMult (⊕⊞, the morphism class) is the identity for composition ([Ica12] Lemma 2.7).

                    • is absorbing: composing with the no-property class yields the no-property class ([Ica12] p. 716: φ ∘ • = • = • ∘ φ).

                    Composition is associative.

                    @[implicit_reducible]
                    Equations
                    • One or more equations did not get rendered due to their size.

                    Strength of downward entailingness.

                    Names the three levels of the DE hierarchy:

                    • .weak = DE only (licenses weak NPIs: ever, any)
                    • .antiAdditive = DE + ∨→∧ distributive (licenses strong NPIs: lift a finger)
                    • .antiMorphic = AA + ∧→∨ distributive (= negation)
                    Instances For
                      @[implicit_reducible]
                      Equations
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        @[implicit_reducible]

                        The Zwarts DE hierarchy as the linear order weak < antiAdditive < antiMorphic. This is the carrier of the canonical zwartsScale (Semantics/Polarity/Licensing.lean); other theories of NPI strength supply other ordered carriers.

                        Equations

                        Strength of upward entailingness (dual of DEStrength).

                        Names the three levels of the UE hierarchy:

                        Instances For
                          @[implicit_reducible]
                          Equations
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def NaturalLogic.strengthSufficient (contextStrength requiredStrength : DEStrength) :
                            Bool

                            Check if a context's DE strength is sufficient for an NPI.

                            strengthSufficient contextStrength requiredStrength returns true when requiredStrength ≤ contextStrength in the Zwarts hierarchy (LinearOrder DEStrength).

                            Equations
                            Instances For

                              Map an entailment signature to DE strength, derived from project.

                              A signature is DE iff it reverses forward entailment: [⊑]^φ = ⊒. Within the DE side, anti-additivity is detected by [∼]^φ = | (the ∨→∧ swap: x∨y=1 ⟹ f(x)∧f(y)=0), and anti-morphism additionally requires [|]^φ = ∼ (the ∧→∨ swap).

                              Returns none for UE-side signatures.

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

                                Map an entailment signature to UE strength, derived from project.

                                A signature is UE iff it preserves forward entailment: [⊑]^φ = ⊑. Additivity is detected by [∼]^φ = ∼ (∨-preservation: x∨y=1 ⟹ f(x)∨f(y)=1), and multiplicativity by [|]^φ = | (∧-preservation: x∧y=0 ⟹ f(x)∧f(y)=0).

                                Returns none for DE-side signatures.

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

                                  Whether a context preserves or reverses entailment direction.

                                  This is a coarsening of EntailmentSig: all UE-side signatures collapse to .upward, all DE-side signatures collapse to .downward. Contexts that are neither monotone nor antitone (e.g., "exactly n") are .nonMonotonic.

                                  Used by:

                                  • NeoGricean: determines which alternatives count as "stronger"
                                  • RSA: polarity-sensitive inference
                                  • Any theory computing scalar implicatures
                                  Instances For
                                    @[implicit_reducible]
                                    Equations
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Map an entailment signature to the coarser ContextPolarity type, derived from project.

                                      A signature is UE iff it preserves forward entailment ([⊑]^φ = ⊑), DE iff it reverses it ([⊑]^φ = ⊒).

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

                                        toContextPolarity is a monoid homomorphism: composing signatures then coarsening gives the same result as coarsening then composing polarities.

                                        This theorem connects the fine-grained EntailmentSig monoid to the coarse ContextPolarity composition, ensuring the two systems can never disagree.

                                        Compute the projectivity signature of a context from the signatures along the path from the target position to the root ([Ica12], Definition 2.9).

                                        Given a parse tree and a target position (e.g., "dangerous" in "Every job that involves a giant squid is dangerous"), the path collects the top signature of each node from the target up to the root. The composed signature is List.prod, using the Monoid instance.

                                        Example from Icard §3.2: path = [⊞, ⊕, ◇] (top(is) ∘ top(involves) ∘ top(every_restrictor)) contextProjectivity path = ◇ (anti-additive)

                                        Equations
                                        Instances For

                                          Project a NL relation through a context given by its signature path. Combines contextProjectivity with project.

                                          Equations
                                          Instances For

                                            Projection composition ([Ica12], Corollary 2.12).

                                            Projecting through f then g is the same as projecting through g∘f. This is the compositionality principle: nested function application corresponds to signature composition.

                                            Since compose is derived from project (via fromProjectionPair), the only content of this theorem is that the two probe relations (forward, negation) suffice to determine the full projection table.

                                            Any DE-side signature licenses weak NPIs.

                                            This connects Icard's signature lattice to [Lad80]: a signature on the DE side (anti, antiAdd, antiMult, antiAddMult) creates a DE context, which is sufficient for weak NPI licensing.

                                            Anti-additive or stronger signature licenses strong NPIs.

                                            Strong NPIs (lift a finger, in weeks) require anti-additive contexts. In Icard's system, this corresponds to signatures antiAdd, antiAddMult — but NOT plain anti or antiMult.

                                            Negation has the anti-morphism signature ◇⊟ (strongest DE signature).

                                            Equations
                                            Instances For