-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07-reflect-ask-reply.edn
279 lines (229 loc) · 7.75 KB
/
07-reflect-ask-reply.edn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
[:root "What is the capital of [Texas]?"]
P0
{:q "What is the capital of $0?"
:sq {}
:r :locked}
[:ask "What is the capital city of $q.0?"]
P1
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a :locked}}
:r :locked}
[:unlock "sq.0.a"]
;;;; ▶️ BEGIN In child workspace
C0
{:q "What is the capital city of $0?"
:sq {}
:r :locked}
[:reply "Niniveh"]
;;;; ⏹ END In child workspace.
P2
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r :locked}
[:unlock "r"]
P3
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r {:parent :locked
:max-v 3}}
[:unlock "r.2"]
P4
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r {:parent :locked
:max-v 4
2 {:ws {:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r :locked}
:act [:unlock "r"]
:children {0 :locked}}}}
;; This makes me think that it should be possible to unlock a child more
;; easily and without seeing so much other stuff. That's easy to change
;; later, though, so let's keep it simple for now.
[:ask "Did $r.2.children.0 unlock the pointer in its question?"]
P5
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}
1 {:q "Did $r.2.children.0 unlock the pointer in its question?"
:a :locked}}
:r {:parent :locked
:max-v 5
2 {:ws {:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r :locked}
:act [:unlock "r"]
:children {0 :locked}}}}
[:unlock "sq.1.a"]
;;;; ▶️ BEGIN In child workspace
{:q "Did $1 unlock the pointer in its question?"
:sq {}
:r :locked}
[:unlock "q.1"]
{:q "Did [1:
{:parent :locked
:max-v 0}
] unlock the pointer in its question?"
:sq {}
:r :locked}
[:unlock "q.1.0"]
{:q "Did [1:
{:parent :locked
:max-v 0
0 {:ws {:q “What is the capital city of $0?”
:sq {}
:r :locked}
:act [:reply “Nineveh”]
:children []}}
] unlock the pointer in its question?"
:sq {}
:r :locked}
[:reply "No, it didn't."]
;;;; ⏹ END In child workspace.
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}
1 {:q "Did $r.2.children.0 unlock the pointer in its question?"
:a "No, it didn't."}}
:r {:parent :locked
:max-v 6
2 {:ws {:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}}
:r :locked}
:act [:unlock "r"]
:children {0 :locked}}}}
[:ask "What is the capital city of q.0? Make sure to unlock the pointer."]
;; Leaving out the reflection part, because I don't need it for the rest of
;; this scenario.
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}
1 {:q "Did $r.2.children.0 unlock the pointer in its question?"
:a "No, it didn't."}
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a :locked}}
:r [...]}
[:unlock "sq.2.a"]
;;;; ▶️ BEGIN In child workspace
C2.0
{:q "What is the capital city of q.0? Make sure to unlock the pointer."
:sq {}
:r :locked}
[:unlock "r"]
C2.1
{:q "What is the capital city of q.0? Make sure to unlock the pointer."
:sq {}
:r {:parent :locked
:max-v 1}}
[:reply "There is no pointer. See: $r.0 Did you forget to write a dollar sign?"]
;;;; ⏹ END In child workspace.
{:q "What is the capital of $0?"
:sq {0 {:q "What is the capital city of $q.0?"
:a "Niniveh"}
1 {:q "Did $r.2.children.0 unlock the pointer in its question?"
:a "No, it didn't."}
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a "There is no pointer. See: $1 Did you forget to write a dollar sign?"}}
:r [...]}
[:unlock "sq.2.a.1"]
;; Leaving out the two first sub-questions for brevity.
{:q "What is the capital of $0?"
:sq {0 ... 1 ...
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a "There is no pointer. See: [1:
{:parent :locked
:max-v 1
0 {:ws {:q “What is the capital city of q.0? Make sure to unlock the pointer.”
:sq {}
:r :locked}
:act [:unlock “r”]
:children {}}}
] Did you forget to write a dollar sign?"}}
:r [...]}
;; Now pointer laundering, unrelated to the story of this scenario.
[:ask "Give me this pointer unchanged: $sq.2.a.1.0.r"]
{:q "What is the capital of $0?"
:sq {0 ... 1 ...
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a "There is no pointer. See: [1:
{:parent :locked
:max-v 1
0 {:ws {:q “What is the capital city of q.0? Make sure to unlock the pointer.”
:sq {}
:r :locked}
:act [:unlock “r”]
:children {}}}
] Did you forget to write a dollar sign?"}
3 {:q "Give me this pointer unchanged: $sq.2.a.1.0.r"
:a :locked}}
:r [...]}
[:unlock "sq.3.a"]
;;;; ▶️ BEGIN In child workspace
{:q "Give me this pointer unchanged: $1"
:sq {}
:r :locked}
[:reply "$q.1"]
;;;; ⏹ END In child workspace.
{:q "What is the capital of $0?"
:sq {0 ... 1 ...
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a "There is no pointer. See: [1:
{:parent :locked
:max-v 1
0 {:ws {:q “What is the capital city of q.0? Make sure to unlock the pointer.”
:sq {}
:r :locked}
:act [:unlock “r”]
:children {}}}
] Did you forget to write a dollar sign?"}
3 {:q "Give me this pointer unchanged: $sq.2.a.1.0.r"
:a "$0"}}
:r [...]}
[:unlock "sq.3.a.0"]
{:q "What is the capital of $0?"
:sq {0 ... 1 ...
2 {:q "What is the capital city of q.0? Make sure to unlock the pointer."
:a "There is no pointer. See: [1:
{:parent :locked
:max-v 1
0 {:ws {:q “What is the capital city of q.0? Make sure to unlock the pointer.”
:sq {}
:r :locked}
:act [:unlock “r”]
:children {}}}
] Did you forget to write a dollar sign?"}
3 {:q "Give me this pointer unchanged: $sq.2.a.1.0.r"
:a "[0:
{:parent :locked
:max-v 0}
]"}}
:r [...]}
;; Should :max-v be 0 or 1 in this? If I had unlocked "r" at the time that is
;; reflected, its :max-v would have been 0. However, the reflection structure
;; doesn's store such information. In fact, at that time, the workspace
;; didn't even have a value for its :ws/reflection attribute (otherwise the
;; "r" entry would have been rendered unlocked). So when it makes the
;; pointer, it has to fabricate a reflection structure. It doesn't appear
;; unlocked, because :pointer/locked? true. This is a bit ugly.
;; All in all the question is: Can we reach from the laundered r everything
;; that was reachable at the time or everything that is reachable now?
;; Everything that was reachable at the time makes more sense theoretically.
;; But is it implementable at all?
;;
;; When I first ask the laundering question and pass the "r" pointer, I have to
;; fabricate the reflection structure. At that point I know the transaction
;; time of "r"'s workspace. So I could put that transaction time in the
;; pointer structure and write the rest of the code in a way that it doesn't
;; go beyond that transaction time. But then there is a discrepancy. If I
;; ordinarily unlock a workspace's "r", the "r" doesn't retain the
;; transaction time. In fact, it updates itself every time the workspace is
;; updated. So we could say that from an "r" we can reach anything that
;; happened up to its :reflection/ws's last transaction time. I think it
;; makes sense.