1 Now we'll look at using monads to do intensional function application.
2 This really is just another application of the reader monad, not a new monad.
3 In Shan (2001) [Monads for natural
4 language semantics](http://arxiv.org/abs/cs/0205026v1), Ken shows that
5 making expressions sensitive to the world of evaluation is conceptually
6 the same thing as making use of the reader monad.
7 This technique was beautifully re-invented
8 by Ben-Avi and Winter (2007) in their paper [A modular
10 intensionality](http://parles.upf.es/glif/pub/sub11/individual/bena_wint.pdf),
11 though without explicitly using monads.
13 All of the code in the discussion below can be found here: [[intensionality-monad.ml]].
14 To run it, download the file, start OCaml, and say
16 # #use "intensionality-monad.ml";;
18 Note the extra `#` attached to the directive `use`.
20 First, the familiar linguistic problem:
24 Ann believes [Bill left].
25 Ann believes [Cam left].
27 We want an analysis on which all four of these sentences can be true
28 simultaneously. If sentences denoted simple truth values or booleans,
29 we have a problem: if the sentences *Bill left* and *Cam left* are
30 both true, they denote the same object, and Ann's beliefs can't
31 distinguish between them.
33 The traditional solution to the problem sketched above is to allow
34 sentences to denote a function from worlds to truth values, what
35 Montague called an intension. So if `s` is the type of possible
36 worlds, we have the following situation:
40 Extensional types Intensional types Examples
41 -------------------------------------------------------------------
45 VP e->t (s->e)->s->t left
46 Vt e->e->t (s->e)->(s->e)->s->t saw
47 Vs t->e->t (s->t)->(s->e)->s->t thought
50 This system is modeled on the way Montague arranged his grammar.
51 There are significant simplifications: for instance, determiner
52 phrases are thought of as corresponding to individuals rather than to
53 generalized quantifiers.
55 The main difference between the intensional types and the extensional
56 types is that in the intensional types, the arguments are functions
57 from worlds to extensions: intransitive verb phrases like "left" now
58 take individual concepts as arguments (type s->e) rather than plain
59 individuals (type e), and attitude verbs like "think" now take
60 propositions (type s->t) rather than truth values (type t).
61 In addition, the result of each predicate is an intension.
62 This expresses the fact that the set of people who left in one world
63 may be different than the set of people who left in a different world.
64 (Normally, the dependence of the extension of a predicate to the world
65 of evaluation is hidden inside of an evaluation coordinate, or built
66 into the the lexical meaning function, but we've made it explicit here
67 in the way that the intensionality monad makes most natural.)
69 The intenstional types are more complicated than the intensional
70 types. Wouldn't it be nice to make the complicated types available
71 for those expressions like attitude verbs that need to worry about
72 intensions, and keep the rest of the grammar as extensional as
73 possible? This desire is parallel to our earlier desire to limit the
74 concern about division by zero to the division function, and let the
75 other functions, like addition or multiplication, ignore
76 division-by-zero problems as much as possible.
80 In OCaml, we'll use integers to model possible worlds:
86 Characters (characters in the computational sense, i.e., letters like
87 `'a'` and `'b'`, not Kaplanian characters) will model individuals, and
88 OCaml booleans will serve for truth values.
95 let left1 (x:e) = true;;
96 let saw1 (x:e) (y:e) = y < x;;
99 saw1 bill ann;; (* true *)
100 saw1 ann bill;; (* false *)
103 So here's our extensional system: everyone left, including Ann;
104 and Ann saw Bill, but Bill didn't see Ann. (Note that Ocaml word
105 order is VOS, verb-object-subject.)
107 Now we add intensions. Because different people leave in different
108 worlds, the meaning of *leave* must depend on the world in which it is
111 let left (x:e) (w:s) = match (x, w) with ('c', 2) -> false | _ -> true;;
113 This new definition says that everyone always left, except that
114 in world 2, Cam didn't leave.
116 let saw x y w = (w < 2) && (y < x);;
117 saw bill ann 1;; (* true: Ann saw Bill in world 1 *)
118 saw bill ann 2;; (* false: no one saw anyone in world 2 *)
120 Along similar lines, this general version of *see* coincides with the
121 `saw1` function we defined above for world 1; in world 2, no one saw anyone.
123 Just to keep things straight, let's get the facts of the world set:
126 World 1: Everyone left.
127 Ann saw Bill, Ann saw Cam, Bill saw Cam, no one else saw anyone.
128 World 2: Ann left, Bill left, Cam didn't leave.
132 Now we are ready for the intensionality monad:
135 type 'a intension = s -> 'a;;
136 let unit x (w:s) = x;;
137 let bind m f (w:s) = f (m w) w;;
140 Then the individual concept `unit ann` is a rigid designator: a
141 constant function from worlds to individuals that returns `'a'` no
142 matter which world is used as an argument. This is a typical kind of
143 thing for a monad unit to do.
145 Then combining a prediction like *left* which is extensional in its
146 subject argument with a monadic subject like `unit ann` is simply bind
149 bind (unit ann) left 1;; (* true: Ann left in world 1 *)
150 bind (unit cam) left 2;; (* false: Cam didn't leave in world 2 *)
152 As usual, bind takes a monad box containing Ann, extracts Ann, and
153 feeds her to the extensional *left*. In linguistic terms, we take the
154 individual concept `unit ann`, apply it to the world of evaluation in
155 order to get hold of an individual (`'a'`), then feed that individual
156 to the extensional predicate *left*.
158 We can arrange for an extensional transitive verb to take intensional
161 let lift f u v = bind u (fun x -> bind v (fun y -> f x y));;
163 This is the exact same lift predicate we defined in order to allow
164 addition in our division monad example.
167 lift saw (unit bill) (unit ann) 1;; (* true *)
168 lift saw (unit bill) (unit ann) 2;; (* false *)
171 Ann did see bill in world 1, but Ann didn't see Bill in world 2.
173 Finally, we can define our intensional verb *thinks*. *Think* is
174 intensional with respect to its sentential complement, but extensional
175 with respect to its subject. (As Montague noticed, almost all verbs
176 in English are extensional with respect to their subject; a possible
177 exception is "appear".)
179 let thinks (p:s->t) (x:e) (w:s) =
180 match (x, p 2) with ('a', false) -> false | _ -> p w;;
182 Ann disbelieves any proposition that is false in world 2. Apparently,
183 she firmly believes we're in world 2. Everyone else believes a
184 proposition iff that proposition is true in the world of evaluation.
186 bind (unit ann) (thinks (bind (unit bill) left)) 1;;
188 So in world 1, Ann thinks that Bill left (because in world 2, Bill did leave).
190 bind (unit ann) (thinks (bind (unit cam) left)) 1;;
192 But even in world 1, Ann doesn't believe that Cam left (even though he
193 did: `bind (unit cam) left 1 == true`). Ann's thoughts are hung up on
194 what is happening in world 2, where Cam doesn't leave.
196 *Small project*: add intersective ("red") and non-intersective
197 adjectives ("good") to the fragment. The intersective adjectives
198 will be extensional with respect to the nominal they combine with
199 (using bind), and the non-intersective adjectives will take
200 intensional arguments.