Applicative Functors in Natural Language Semantics #
@cite{charlow-2018} @cite{mcbride-paterson-2008}
Three applicative functors — Reader, Set, and Cont — recur across
natural language semantics. @cite{charlow-2018} shows they share a
common algebraic structure (a type constructor F with ρ :: a → F a
and ⊛ :: F(a → b) → F a → F b satisfying four laws), and that this
structure is closed under composition.
| Applicative | F a | ρ | ⊛ | Linguistic use |
|---|---|---|---|---|
Reader E | E → a | λ_. x | λe. f e (x e) | Assignment-sensitivity |
| Set | a → Prop | {x} | {f x \| f ∈ m, x ∈ n} | Alternatives/Hamblin |
Cont R | (a → R) → R | λκ. κ x | λκ. m(λf. n(λx. κ(f x))) | Scope-taking |
Key results #
- Reader satisfies the four applicative functor laws (§3.3)
- Composed applicatives F ∘ G are applicative (§3.3, all 4 laws)
- Variable-free semantics (@cite{jacobson-1999}) = Reader Entity (§6)
- Set applicative satisfies all 4 laws; Hamblin
QuestionDen W=Cont Bool Wdefinitionally (both(W → Bool) → Bool) - Cont applicative operations =
Cont.pure/Cont.bind+Cont.map(§3.3) - Typed assignment family
Gᵣfor intensional variables (§5)
Reader applicative #
The Reader applicative for environment type E:
F a := E → aρ x := λ_. x(constant function)m ⊛ n := λe. m e (n e)(evaluate both at the same environment)
This is the foundation of assignment-sensitive composition (@cite{charlow-2018} §3.1–3.2). The four applicative functor laws hold definitionally.
ρ: lift a value into the Reader space (pure/return).
Equations
Instances For
⊛: compose two environment-dependent meanings (<*>/ap).
Equations
- Semantics.Composition.Applicative.readerAp f x e = f e (x e)
Instances For
Composed applicative functors #
@cite{charlow-2018} §3.3, Fig 5: Given two applicative type constructors F and G, their composition F ∘ G is applicative. For Reader E₁ ∘ Reader E₂:
ρ_{F∘G}(x) = λe₁ λe₂. x
(m ⊛_{F∘G} n)(e₁)(e₂) = m e₁ e₂ (n e₁ e₂)
This closure property guarantees modularity: any two applicative-based analyses can be combined without additional machinery. Examples:
- G ∘ S: assignment-dependent sets of alternatives
- S ∘ G: alternative assignment-dependent meanings
- G ∘ G: doubly assignment-dependent meanings (§5, paycheck/reconstruction)
Composed ρ for Reader E₁ ∘ Reader E₂.
Equations
- Semantics.Composition.Applicative.composedPure x x✝¹ x✝ = x
Instances For
Composed ⊛ for Reader E₁ ∘ Reader E₂.
Equations
- Semantics.Composition.Applicative.composedAp f x e₁ e₂ = f e₁ e₂ (x e₁ e₂)
Instances For
The Composition law — the fourth applicative functor law. Previously missing from the linglib formalization.
Variable-free semantics as Reader Entity #
@cite{charlow-2018} §6: @cite{jacobson-1999}'s variable-free semantics
treats pronouns as identity functions ⟦she⟧ := λx. x (type e → e).
The composition apparatus is structurally identical to the assignment-
sensitive version — readerPure and readerAp — with Entity as the
environment type instead of assignments.
The paper's striking observation: composing the VF applicative with itself
(Reader E ∘ Reader E) yields two-pronoun readings where the pronouns
resolve independently. Uncurrying the result produces assignment-dependence
"organically" (§6).
VF pronoun: the identity function ⟦she⟧ := λx. x.
Instances For
"She left" in VF: ρ(left) ⊛ she = left.
"She saw her" with a single entity parameter: both pronouns resolve
to the same entity, yielding λe. saw e e (reflexive reading).
"She saw her" with composed applicative (two entity parameters):
the two pronouns resolve independently, yielding λx λy. saw y x.
Assignment-dependence "springs organically into being" from
uncurrying (@cite{charlow-2018} §6).
Set applicative #
@cite{charlow-2018} §3.3 eqs (14)–(15): Alternative semantics of the @cite{hamblin-1973b} variety uses an applicative functor for sets:
S a := a → Prop
ρ x := {x} = `setPure`
m ⊛ n := {f x | f ∈ m, x ∈ n} = `setAp`
A Hamblin question denotation (W → Bool) → Bool is definitionally
Cont Bool W (both expand to (W → Bool) → Bool), connecting the
Set and Cont perspectives.
Set ρ: the singleton set {x}.
Equations
- Semantics.Composition.Applicative.setPure x y = (y = x)
Instances For
Continuation applicative #
@cite{charlow-2018} §3.3 eqs (16)–(17): scope-taking expressions use
the continuation applicative Cᵣ a := (a → r) → r. The operations
are definitionally Cont.pure and the derived <*> from
Core/Continuation.lean.
Eq (16): ρ x := λκ. κ x = Cont.pure.
Eq (17): m ⊛ n := λκ. m(λf. n(λx. κ(f x))) = Cont <*>.
Typed assignment family Gᵣ #
@cite{charlow-2018} §5.1: type-homogeneous assignments gᵣ := ℕ → r
avoid consistency problems of a single polymorphic assignment type.
Each type r gets its own assignment type:
gₑ: maps indices to individualsg_{gₑ→e}: maps indices to individual concepts (intensions)
The composed applicative Gₑ ∘ G_{gₑ→e} handles paycheck pronouns
without monadic join (§5.2): the paycheck pronoun reads an intension
from the intension-assignment and evaluates it at the entity-assignment.
Type-homogeneous assignment: maps indices to values of type r.
Specializes to Core.Assignment E when r = E.
Equations
Instances For
Self-contained paycheck derivation via composed Gₑ ∘ G_{gₑ→e}.
The intension-assignment gᵢ maps index j to the intension
λh. mom(h 0) (= "his₀ mom"). The entity-assignment gₑ maps
index 0 to Bill. The paycheck pronoun herⱼ reads from gᵢ and
evaluates at gₑ, yielding mom(bill).
The intension λh. mom(h 0) is compositionally derived as
ρ(mom) ⊛ pro₀ in the inner Gₑ applicative.