- let newpeg_and_bind (bound_variable : char) (d : entity) =
- fun ((r, g) : assignment * store) ->
- let newindex = List.length g
- (* first we store d at index newindex in g, which is at the very end *)
- (* the following line achieves that in a simple but very inefficient way *)
- in let g' = List.append g [d]
- (* next we assign 'x' to location newindex *)
- in let r' = fun v ->
- if v = bound_variable then newindex else r v
- (* the reason for returning a triple with () in first position will emerge *)
- in ((), r',g')
-
-* At the top of p. 13 (this is in between defs 2.8 and 2.9), GS&V give two examples, one for \[[∃xPx]] and the other for \[[Qx]]. In fact it will be easiest for us to break \[[∃xPx]] into two pieces, \[[∃x]] and \[[Px]]. Let's consider expressions like \[[Px]] first.
-
- They say that the effect of updating an information state `s` with the meaning of "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)
+ They say the denotation of a variable is the entity which the store `h` assigns to the index that the assignment function `r` assigns to the variable. In other words, if the variable is `'x'`, its denotation wrt `(r, h, w)` is `h[r['x']]`. In our OCaml implementation, that will be `List.nth h (r 'x')`.