[[!toc]] Jacobson's Variable-Free Semantics as a bare-bones Reader Monad --------------------------------------------------------------- Jacobson's Variable-Free Semantics (e.g., Jacobson 1999, [Towards a Variable-Free Semantics](http://www.springerlink.com/content/j706674r4w217jj5/)) uses combinators to impose binding relationships between argument positions. The system does not make use of assignment functions or variables. We'll see that from the point of view of our discussion of monads, Jacobson's system is essentially a reader monad in which the assignment function threaded through the computation is limited to at most one assignment. Jacobson's system contains two main combinators, *g* and *z*. She calls *g* the Geach rule, and *z* effects binding. (There is a third combinator, *l*, which we'll make use of to adjust function/argument order to better match English word order; N.B., though, that Jacobson's name for this combinator is "lift", but it is different from the monadic lift discussed in some detail below.) Here is a typical computation (based closely on email from Simon Charlow, with beta reduction as performed by the on-line evaluator):
```; Analysis of "Everyone_i thinks he_i left"
let g = \f g x. f (g x) in
let z = \f g x. f (g x) x in
let everyone = \P. FORALL x (P x) in
let he = \x. x in
everyone ((z thinks) (g left he))

~~>  FORALL x (thinks (left x) x)
```
Several things to notice: First, pronouns denote identity functions. As Jeremy Kuhn has pointed out, this is related to the fact that in the mapping from the lambda calculus into combinatory logic that we discussed earlier in the course, bound variables translated to I, the identity combinator. This is a point we'll return to in later discussions. Second, *g* plays the role of transmitting a binding dependency for an embedded constituent to a containing constituent. If the sentence had been *Everyone_i thinks Bill said he_i left*, there would be an occurrence of *g* in the most deeply embedded clause (*he left*), and another occurrence of (a variant of) *g* in the next most deeply embedded clause (*Bill said he left*). Third, binding is accomplished by applying *z* not to the element that will (in some pre-theoretic sense) bind the pronoun, here, *everyone*, but by applying *z* instead to the predicate that will take *everyone* as an argument, here, *thinks*. The basic recipe in Jacobson's system is that you transmit the dependence of a pronoun upwards through the tree using *g* until just before you are about to combine with the binder, when you finish off with *z*. Last week we saw a reader monad for tracking variable assignments:
```type env = (char * int) list;;
type 'a reader = env -> 'a;;
let unit x = fun (e : env) -> x;;
fun (e : env) -> f (u e) e;;
let shift (c : char) (v : int reader) (u : 'a reader) =
fun (e : env) -> u ((c, v e) :: e);;
let lookup (c : char) : int reader = fun (e : env) -> List.assoc c e;;
```
(We've used a simplified term for the bind function in order to emphasize its similarities with Jacboson's geach combinator.) This monad boxed up a value along with an assignment function, where an assignemnt function was implemented as a list of `char * int`. The idea is that a list like `[('a', 2); ('b',5)]` associates the variable `'a'` with the value 2, and the variable `'b'` with the value 5. Combining this reader monad with ideas from Jacobson's approach, we can consider the following monad:
```type e = int;;
type 'a link = e -> 'a;;
let unit (a:'a): 'a link = fun x -> a;;
let bind (u: 'a link) (f: 'a -> 'b link) : 'b link = fun (x:e) -> f (u x) x;;
let ap (u: ('a -> 'b) link) (v: 'a link) : 'b link = fun (x:e) -> u x (v x);;
let lift (f: 'a -> 'b) (u: 'a link): ('b link) = ap (unit f) u;;
let g = lift;;
let z (f: 'a -> e -> 'b) (u: 'a link) : e -> 'b = fun (x:e) -> f (u x) x;;
```
```let bind (u: 'a link) (f: 'a -> 'b link) : 'b link = fun (x:e) -> f (u x) x;;
```everyone (z thinks (g left he))