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 >>>>>>> f879a647e289a67b992caaafd497910259a81040
11 intensionality](http://parles.upf.es/glif/pub/sub11/individual/bena_wint.pdf),
12 though without explicitly using monads.
15 All of the code in the discussion below can be found here: [[intensionality-monad.ml]].
16 To run it, download the file, start OCaml, and say
18 # #use "intensionality-monad.ml";;
20 Note the extra `#` attached to the directive `use`.
22 First, the familiar linguistic problem:
26 Ann believes [Bill left].
27 Ann believes [Cam left].
29 We want an analysis on which all four of these sentences can be true
30 simultaneously. If sentences denoted simple truth values or booleans,
31 we have a problem: if the sentences *Bill left* and *Cam left* are
32 both true, they denote the same object, and Ann's beliefs can't
33 distinguish between them.
35 The traditional solution to the problem sketched above is to allow
36 sentences to denote a function from worlds to truth values, what
37 Montague called an intension. So if `s` is the type of possible
38 worlds, we have the following situation:
42 Extensional types Intensional types Examples
43 -------------------------------------------------------------------
47 VP e->t (s->e)->s->t left
48 Vt e->e->t (s->e)->(s->e)->s->t saw
49 Vs t->e->t (s->t)->(s->e)->s->t thought
52 This system is modeled on the way Montague arranged his grammar.
53 There are significant simplifications: for instance, determiner
54 phrases are thought of as corresponding to individuals rather than to
55 generalized quantifiers.
57 The main difference between the intensional types and the extensional
58 types is that in the intensional types, the arguments are functions
59 from worlds to extensions: intransitive verb phrases like "left" now
60 take intensional concepts as arguments (type s->e) rather than plain
61 individuals (type e), and attitude verbs like "think" now take
62 propositions (type s->t) rather than truth values (type t).
63 In addition, the result of each predicate is an intension.
64 This expresses the fact that the set of people who left in one world
65 may be different than the set of people who left in a different world.
66 Normally, the dependence of the extension of a predicate to the world
67 of evaluation is hidden inside of an evaluation coordinate, or built
68 into the the lexical meaning function, but we've made it explicit here
69 in the way that the intensionality monad makes most natural.
71 The intenstional types are more complicated than the intensional
72 types. Wouldn't it be nice to make the complicated types available
73 for those expressions like attitude verbs that need to worry about
74 intensions, and keep the rest of the grammar as extensional as
75 possible? This desire is parallel to our earlier desire to limit the
76 concern about division by zero to the division function, and let the
77 other functions, like addition or multiplication, ignore
78 division-by-zero problems as much as possible.
82 In OCaml, we'll use integers to model possible worlds:
88 Characters (characters in the computational sense, i.e., letters like
89 `'a'` and `'b'`, not Kaplanian characters) will model individuals, and
90 OCaml booleans will serve for truth values.
97 let left1 (x:e) = true;;
98 let saw1 (x:e) (y:e) = y < x;;
101 saw1 bill ann;; (* true *)
102 saw1 ann bill;; (* false *)
105 So here's our extensional system: everyone left, including Ann;
106 and Ann saw Bill, but Bill didn't see Ann. (Note that Ocaml word
107 order is VOS, verb-object-subject.)
109 Now we add intensions. Because different people leave in different
110 worlds, the meaning of *leave* must depend on the world in which it is
113 let left (x:e) (w:s) = match (x, w) with ('c', 2) -> false | _ -> true;;
115 This new definition says that everyone always left, except that
116 in world 2, Cam didn't leave.
118 let saw x y w = (w < 2) && (y < x);;
119 saw bill ann 1;; (* true: Ann saw Bill in world 1 *)
120 saw bill ann 2;; (* false: no one saw anyone in world 2 *)
122 Along similar lines, this general version of *see* coincides with the
123 `saw1` function we defined above for world 1; in world 2, no one saw anyone.
125 Just to keep things straight, let's get the facts of the world set:
128 World 1: Everyone left.
129 Ann saw Bill, Ann saw Cam, Bill saw Cam, no one else saw anyone.
130 World 2: Ann left, Bill left, Cam didn't leave.
134 Now we are ready for the intensionality monad:
137 type 'a intension = s -> 'a;;
138 let unit x (w:s) = x;;
139 let bind m f (w:s) = f (m w) w;;
142 Then the individual concept `unit ann` is a rigid designator: a
143 constant function from worlds to individuals that returns `'a'` no
144 matter which world is used as an argument. This is a typical kind of
145 thing for a monad unit to do.
147 Then combining a prediction like *left* which is extensional in its
148 subject argument with a monadic subject like `unit ann` is simply bind
151 bind (unit ann) left 1;; (* true: Ann left in world 1 *)
152 bind (unit cam) left 2;; (* false: Cam didn't leave in world 2 *)
154 As usual, bind takes a monad box containing Ann, extracts Ann, and
155 feeds her to the extensional *left*. In linguistic terms, we take the
156 individual concept `unit ann`, apply it to the world of evaluation in
157 order to get hold of an individual (`'a'`), then feed that individual
158 to the extensional predicate *left*.
160 We can arrange for an extensional transitive verb to take intensional
163 let lift f u v = bind u (fun x -> bind v (fun y -> f x y));;
165 This is the exact same lift predicate we defined in order to allow
166 addition in our division monad example.
169 lift saw (unit bill) (unit ann) 1;; (* true *)
170 lift saw (unit bill) (unit ann) 2;; (* false *)
173 Ann did see bill in world 1, but Ann didn't see Bill in world 2.
175 Finally, we can define our intensional verb *thinks*. *Think* is
176 intensional with respect to its sentential complement, but extensional
177 with respect to its subject. (As Montague noticed, almost all verbs
178 in English are extensional with respect to their subject; a possible
179 exception is "appear".)
181 let thinks (p:s->t) (x:e) (w:s) =
182 match (x, p 2) with ('a', false) -> false | _ -> p w;;
184 Ann disbelieves any proposition that is false in world 2. Apparently,
185 she firmly believes we're in world 2. Everyone else believes a
186 proposition iff that proposition is true in the world of evaluation.
188 bind (unit ann) (thinks (bind (unit bill) left)) 1;;
190 So in world 1, Ann thinks that Bill left (because in world 2, Bill did leave).
192 bind (unit ann) (thinks (bind (unit cam) left)) 1;;
194 But even in world 1, Ann doesn't believe that Cam left (even though he
195 did: `bind (unit cam) left 1 == true`). Ann's thoughts are hung up on
196 what is happening in world 2, where Cam doesn't leave.
198 *Small project*: add intersective ("red") and non-intersective
199 adjectives ("good") to the fragment. The intersective adjectives
200 will be extensional with respect to the nominal they combine with
201 (using bind), and the non-intersective adjectives will take
202 intensional arguments.