assignment7 tweaks
authorJim Pryor <profjim@jimpryor.net>
Thu, 18 Nov 2010 22:48:45 +0000 (17:48 -0500)
committerJim Pryor <profjim@jimpryor.net>
Thu, 18 Nov 2010 22:48:45 +0000 (17:48 -0500)
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
hints/assignment_7_hint_3.mdwn

index 3fec7e2..4a159e9 100644 (file)
@@ -29,4 +29,28 @@ More specifically, \[[expression]] will be a set of `'a discourse_possibility` m
 
 *      At the top of p. 13 (this is in between defs 2.8 and 2.9), GS&V give two examples, one for \[[&exist;xPx]] and the other for \[[Qx]]. In fact it will be easiest for us to break \[[&exist;xPx]] into two pieces, \[[&exist;x]] and \[[Px]]. Let's consider expressions like \[[Px]] (or \[[Qx]]) first.
 
 
 *      At the top of p. 13 (this is in between defs 2.8 and 2.9), GS&V give two examples, one for \[[&exist;xPx]] and the other for \[[Qx]]. In fact it will be easiest for us to break \[[&exist;xPx]] into two pieces, \[[&exist;x]] and \[[Px]]. Let's consider expressions like \[[Px]] (or \[[Qx]]) first.
 
+       They say that the effect of updating an information state `s` with the formula `Qx` should be to eliminate possibilities in which the object associated with the peg associated with the variable `x` does not have the property Q. In other words, if we let `Q` be a function from objects to `bool`s, `s` updated with \[[Qx]] should be `s` filtered by the function `fun (r, g) -> let obj = List.nth g (r 'x') in Q obj`.
+
+       Recall that [we said before](/hints/assignment_7_hint_2) that `List.filter (test : 'a -> bool) (u : 'a set) : 'a set` is the same as:
+
+               bind_set u (fun a -> if test a then unit_set a else empty_set)
+
+       Hence, updating `s` with \[[Qx]] should be:
+
+               bind_set s (fun (r, g) -> if (let obj = List.nth g (r 'x') in Q obj) then unit_set (r, g) else empty_set)
+
+       We can call the `(fun (r, g) -> ...)` part \[[Qx]] and then updating `s` with \[[Qx]] will be:
+
+               bind_set s [[Qx]]
+
+       or as it's written using Haskell's infix notation for bind:
+
+               s >>= [[Qx]]
+
+*      Now how shall we handle \[[&exist;x]]. As we said, GS&V really tell us how to interpret \[[&exist;xPx]], but what they say about this breaks naturally into two pieces, such that we can represent the update of `s` with \[[&exist;xPx]] as:
+
+               s >>= [[&exist;x]] >>= [[Px]]
+
+
+