cat theory tweaks
[lambda.git] / reader_monad.mdwn
index 9cbbef6..b0f6486 100644 (file)
@@ -192,47 +192,48 @@ Ummm...and why is this useful?
 
 I guess you haven't you been paying close enough attention, or you don't have much practical experience in linguistics yet.
 
-In Heim and Kratzer's textbook <cite>Semantics in Generative Grammar</cite>, the interpretation of complex phrases like [[interprets complex phrases]] are trees that look like this:
-
-
-                VP
-              /    \
-             /      \
-            /        \
-           /          \
-          /            \
-         /              NP
-        /              /  \
-       /              /    \
-       V             /      \
-       |            /        \
- [[interprets]]    AP         N
-                  / \         |
-              [[complex]] [[phrases]]
-
-
-Now the normal way in which the nodes of such trees are related to each other is that the semantic value of a parent node is the result of applying the functional value of one of the daughter nodes to the value of the other daughter node. (The types determine which side is the function and which side is the argument.) One exception to this general rule is when multiple adjectives are joined together, as happens in [[interprets complex English phrases]]. We'll ignore that though.
+In Heim and Kratzer's textbook <cite>Semantics in Generative Grammar</cite>, the interpretation of complex phrases like \[[interprets complex phrases]] are trees that look like this:
+
+<blockquote><pre>
+                               VP
+                         /    \
+                        /      \
+                       /        \
+                  /          \
+                 /            \
+                /              NP
+               /              /  \
+          /              /    \
+          V             /      \
+          |            /        \
+\[[interprets]]    AP         N
+                                 / \         |
+                         \[[complex]] \[[phrases]]
+</pre></blockquote>
+
+
+Now the normal way in which the nodes of such trees are related to each other is that the semantic value of a parent node is the result of applying the functional value of one of the daughter nodes to the value of the other daughter node. (The types determine which side is the function and which side is the argument.) One exception to this general rule is when multiple adjectives are joined together, as happens in \[[interprets complex English phrases]]. We'll ignore that though.
 
 Another exception is that Heim and Kratzer have to postulate a special rule to handle lambda abstraction. (This is their "Predicate Abstraction Rule.") Not only is it a special rule, but it's arguably not even a compositional rule. The basic idea is this. The semantic value of:
 
-       [[man who(i): Alice spurned i]]
+       \[[man who(i): Alice spurned i]]
 
-is the result of combining [[man]], an `e->t` type predicate value, with the adjective-type value of [[who(i): Alice spurned i]]. As I said, we'll ignore complexities about their treatment of adjectives. But how is [[who(i): Alice spurned i]] derived? Heim and Kratzer say this is defined only relative to an
-assignment g, and it's defined to be a function from objects x in the domain to the value [[Alice spurned i]] has relative to shifted assignment g{i:=x}, which is like g except for assigning object x to variable i. So this is not the result of taking some value [[who(i)]], and some separate value [[Alice spurned i]], and supplying one of them to the other as argument to function.
+is the result of combining \[[man]], an `e->t` type predicate value, with the adjective-type value of \[[who(i): Alice spurned i]]. As I said, we'll ignore complexities about their treatment of adjectives. But how is \[[who(i): Alice spurned i]] derived? Heim and Kratzer say this is defined only relative to an
+assignment g, and it's defined to be a function from objects x in the domain to the value \[[Alice spurned i]] has relative to shifted assignment g{i:=x}, which is like g except for assigning object x to variable i. So this is not the result of taking some value \[[who(i)]], and some separate value \[[Alice spurned i]], and supplying one of them to the other as argument to function.
 
 Getting any ideas?
 
-Yes! We can in fact implement this as a reader monad. And in doing so, we *will* get a value [[who(i)]] which is a function, and another value [[Alice spurned i]], to be its argument. So the semantics in the first place again becomes compositional, and in the second place doesn't need any special rule for how [[who(i): Alice spurned i]] is derived. It uses the same composition rule as other complex expressions.
+Yes! We can in fact implement this as a reader monad. And in doing so, we *will* get a value \[[who(i)]] which is a function, and another value \[[Alice spurned i]], to be its argument. So the semantics in the first place again becomes compositional, and in the second place doesn't need any special rule for how \[[who(i): Alice spurned i]] is derived. It uses the same composition rule as other complex expressions.
 
 How does this work?
 
-We set [[i]] = the reader-monad value `lookup i`.
+We set \[[i]] = the reader-monad value `lookup i`.
 
-We set [[Alice]] = the reader-monad value `unit Alice`.
+We set \[[Alice]] = the reader-monad value `unit Alice`.
 
-We have to lift the semantic values of predicates into the reader-monad. So if before we were taking the semantic value of "spurned" to be a function `S` of type `e -> e -> t`, now we set [[spurned]] = lift2 S.
+We have to lift the semantic values of predicates into the reader-monad. So if before we were taking the semantic value of "spurned" to be a function `S` of type `e -> e -> t`, now we set \[[spurned]] = lift2 S.
 
-Finally, we set [[who(i)]] to be:
+Finally, we set \[[who(i)]] to be:
 
        fun (u : bool reader) (v : entity reader) ->
                fun (g : env) -> u (g{i:=v g})
@@ -241,9 +242,9 @@ That is, it takes as arguments a clause-type reader-monad `u`, and an entity-typ
 
        fun (u : bool reader) (v : entity reader) -> shift i v u
 
-You can trace through what happens then if we apply [[who(i)]] to ([[spurned]] applied to [[Alice]] and [[i]]):
+You can trace through what happens then if we apply \[[who(i)]] to (\[[spurned]] applied to \[[Alice]] and \[[i]]):
 
-       [[Alice spurned i]] = [[spurned]] [[Alice]] [[i]]
+       \[[Alice spurned i]] = \[[spurned]] \[[Alice]] \[[i]]
                = (lift2 S) (unit Alice) (lookup i)
                = bind (unit Alice) (fun x -> bind (lookup i) (fun y -> unit (S x y)))
 
@@ -260,9 +261,9 @@ Substituting in the definition of `unit`, this is:
 
                = fun e -> S Alice (lookup i e)
 
-And now supplying [[Alice spurned i]] as an argument to [[who(i)]], we get:
+And now supplying \[[Alice spurned i]] as an argument to \[[who(i)]], we get:
 
-       [[who(i): Alice spurned i]] = [[who(i)]] [[Alice spurned i]]
+       \[[who(i): Alice spurned i]] = \[[who(i)]] \[[Alice spurned i]]
                = (fun u v -> shift i v u) (fun e -> S Alice (lookup i e))
                = fun v -> shift i v (fun e -> S Alice (lookup i e))
 
@@ -274,13 +275,13 @@ Substituting in the definition of `shift`, this is:
                = fun v -> (fun e -> S Alice (lookup i ((i, v e) :: e)) )
                = fun v -> (fun e -> S Alice (v e) )
 
-In other words, it's a function from entity reader monads to a function from assignment functions to the result of applying S to Alice and the value of that entity reader-monad under that assignment function. Essentially the same as Heim and Kratzer's final value, except here we work with monadic values, such as functions from assignments to entities, rather than bare entities. And our derivation is completely compositional and uses the same composition rules for joining [[who(i)]] to [[Alice spurned i]] as it uses for joining [[spurned]] to [[Alice]] and [[i]].
+In other words, it's a function from entity reader monads to a function from assignment functions to the result of applying S to Alice and the value of that entity reader-monad under that assignment function. Essentially the same as Heim and Kratzer's final value, except here we work with monadic values, such as functions from assignments to entities, rather than bare entities. And our derivation is completely compositional and uses the same composition rules for joining \[[who(i)]] to \[[Alice spurned i]] as it uses for joining \[[spurned]] to \[[Alice]] and \[[i]].
 
 What's not to like?
 
 Well, some of our semantic values here are assignment-shifters:
 
-       [[who(i)]] = fun u v -> shift i v u
+       \[[who(i)]] = fun u v -> shift i v u
 
 and some philosophers count assignment-shifters as "monsters" and think there can't be any such thing. Clearly they're wrong.