Donkey Sentences and ML Modules
In the field of formal semantics for natural languages, there is a problem of so-called “donkey sentences”. Consider how you might translate this sentence into formal logic:
Intuitively, I would reach for something like:
We assume we have some sets and predicates . But what about this sentence?
It is tempting to write
but this is meaningless formally, because the variable is not in scope in . We need to pull the quantifier out so it scopes over the whole implication. Knowing that is contravariant in its left argument, we might also intuit that the quantifier must be changed from existential to universal:
So the problem, in short, is: how do we assign meaning to the noun phrase “a donkey” in isolation, if it needs to introduce a quantifier whose scope isn’t semantically limited to the noun phrase itself?
With the disclaimer I don’t have formal training in linguistics, and this might not be a new idea, some of the existing approaches to this problem bear striking resemblance to how Rossberg, Russo, and Dreyer (2010) describe the “F-ing” semantics of ML modules.
In the linguistics world, we have discourse representation theory. Emphasis mine:
A discourse representation structure (DRS) is a mental representation built up by the hearer as the discourse unfolds. A DRS consists of two parts: a universe of so-called “discourse referents”, which represent the objects under discussion, and a set of DRS-conditions which encode the information that has accumulated on these discourse referents.
An indefinite like “a donkey” is treated not as a quantifier but simply as device for introducing a discourse referent and one or more conditions; on the DRT account, indefinites have no quantifying force of their own. What quantifying force they seem to have is not theirs, but derives from the environment in which they occur.
If we replace discourse referents ↦ declared type variables and conditions ↦ declared bindings (propositions are types!), this is identical to the notion of a translucent abstract type in the ML modules world. To quote my previous post on this subject:
A better mental model of an abstracted type is something like — a large type expression that has a number of free variables, and is equipped with a description of those variables… but does not prescribe an interpretation for the variables, allowing them to later become existentially quantified, universally quantified, or substituted with concrete types.
We can even pick out exactly the rule in F-ing Modules that would handle our original example (heavily simplified):
We can think of the rule as being applied to the sentence as follows:
Okay, this is glossing over a lot of detail here, and I probably have linguists in my audience mad at me. Natural languages are a lot more complicated than programming languages. For example, you need machinery for keeping track of how pronouns are bound to existing discourse referents.
Nevertheless, at some level, it’s exactly the same logical transformation being made! The premise contains what looks like an existential quantifier , but it gets pulled out and turned into a universal quantifier in the conclusion.
What to make of this correspondence?
There is lots of room for cross-pollination between linguistics and PL, and it would be cool for someone with more background in linguistics than me to explore it. For example, the SEP article on discourse representation theory I quoted from above also brings up model theory as a way of understanding the semantics of discourse. I’ve never seen this discussed in the ML modules literature, and I would love to see how it transfers.
The linguistics and PL perspectives are both valuable when we think about mathematical natural language. You can’t write about module systems without bringing up an abstract algebra example, so consider this sentence:
If is an element of a finite group, then has finite order.
Although “order” is not a pronoun, there is still something referential or anaphoric about it—it is only defined with respect to the specific group structure mentioned. In most systems of mathematical foundations, including ZFC and type theory (as it is typically done), the existence of this group structure is a separate hypothesis, not an inherent part of the type of . Nonetheless, “the order of ” is a perfectly unambiguous concept. We can explain this by positing that the noun phrase “a finite group” introduces the group as a discourse referent which remains in scope for the consequent part of the sentence.