-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshrdlu.log
363 lines (313 loc) · 10.6 KB
/
shrdlu.log
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
>>> #include "test/shrdlu-world.ldcs".
>>> #include "test/shrdlu-actions.ldcs".
>>>
>>> % PICK UP A BIG RED BLOCK.
>>> pickup(big red block)!
--> goal(pickup(A)) :- big(A), red(A), block(A).
cost: 3.
pickup(first green cube)!
put_on(first green cube, blue block)!
pickup(big red block)!
>>>
>>> % GRASP THE PYRAMID.
>>> holding(that pyramid)!
--> goal(holding(A)) :- that(A), pyramid(A).
cost: 0.
>>>
>>> % FIND A BLOCK WHICH IS TALLER THAN THE ONE YOU ARE HOLDING AND PUT IT INTO THE BOX.
>>> block tall.holding?
--> what(B) :- block(B), tall(B,A), holding(A).
that: blue block.
>>> in(that, box)!
--> goal(in(A,B)) :- that(A), box(B).
cost: 5.
put_on(big red block, box)!
pickup(first green cube)!
put_on(first green cube, big red block)!
pickup(blue block)!
put_on(blue block, first green cube)!
>>>
>>> % WHAT DOES THE BOX CONTAIN?
>>> contains'.box?
--> what(B) :- contains(A,B), box(A).
that: blue pyramid | first green cube | big red block | blue block.
>>>
>>> % WHAT IS THE PYRAMID SUPPORTED BY?
>>> supports[that pyramid]?
--> what(B) :- supports(B,A), that(A), pyramid(A).
that: box.
>>>
>>> % HOW MANY BLOCKS ARE NOT IN THE BOX?
>>> block ~in.box?
--> what(C) :- block(C), not negation((4),C).
negation((4),B) :- in(B,A), box(A), block(B).
that: small red cube | second green cube.
>>>
>>> % IS AT LEAST ONE OF THEM NARROWER THAN THE ONE WHICH I TOLD YOU TO PICK UP?
>>> that narrow.X :- command(pickup(X))?
--> what(A) :- that(A), narrow(A,MuX), command(pickup(MuX)).
that: small red cube.
>>>
>>> % IS IT SUPPORTED?
>>> supports.that?
--> what(B) :- supports(B,A), that(A).
that: front left table.
>>>
>>> % CAN A PYRAMID BE SUPPORTED BY A BLOCK?
>>> :- action(put_on(pyramid, block))?
--> yes :- action(put_on(A,B)), pyramid(A), block(B).
no :- not yes.
yes.
>>>
>>> % CAN A PYRAMID SUPPORT A PYRAMID?
>>> :- action(put_on(pyramid, pyramid))?
--> yes :- action(put_on(A,B)), pyramid(A), pyramid(B).
no :- not yes.
no.
>>>
>>> % STACK UP TWO PYRAMIDS.
>>> stack(pyramid, pyramid)!
--> goal(stack(A,B)) :- pyramid(A), pyramid(B).
impossible.
>>>
>>> % THE BLUE PYRAMID IS MINE.
>>> mine(blue pyramid).
--> mine(A) :- blue(A), pyramid(A).
understood.
>>>
>>> % I OWN BLOCKS WHICH ARE NOT RED BUT I DON'T OWN ANYTHING WHICH SUPPORTS A PYRAMID.
>>> mine(block ~red ~supports.pyramid).
--> mine(D) :- block(D), not negation((5),D), not negation((6),D).
negation((5),A) :- red(A), block(A).
negation((6),C) :- supports(C,B), pyramid(B), block(C).
understood.
>>>
>>> % DO I OWN THE BOX?
>>> :- exists(box mine)?
--> yes :- box(A), mine(A).
no :- not yes.
no.
>>>
>>> % DO I OWN ANYTHING IN THE BOX?
>>> in.box mine?
--> what(B) :- in(B,A), box(A), mine(B).
that: blue pyramid | first green cube | blue block.
>>>
>>> % WILL YOU PLEASE STACK UP BOTH OF THE RED BLOCKS AND EITHER A GREEN CUBE OR A PYRAMID?
>>> :- stack(red block, red block, green cube | pyramid)!
--> goal(done).
disjunction((1),C) :- green(C), cube(C).
disjunction((1),D) :- pyramid(D).
holds(done,Time) :- holds(stack(A,B,E),Time), red(A), block(A), red(B), block(B), disjunction((1),E).
cost: 6.
pickup(green pyramid)!
put_on(green pyramid, blue block)!
pickup(small red cube)!
put_on(small red cube, big red block)!
pickup(green pyramid)!
put_on(green pyramid, small red cube)!
>>>
>>> % WHICH CUBE IS SITTING ON THE TABLE?
>>> cube on.table?
--> what(B) :- cube(B), on(B,A), table(A).
that: second green cube.
>>>
>>> :- in(big block, back)!
--> goal(done).
holds(done,Time) :- holds(in(A,B),Time), big(A), block(A), back(B).
cost: 0.
done.
>>>
>>> % IS THERE A LARGE BLOCK BEHIND A PYRAMID?
>>> big block behind.pyramid?
--> what(B) :- big(B), block(B), behind(B,A), pyramid(A).
that: big red block.
>>>
>>> :- on(red pyramid, green cube)!
--> goal(done).
holds(done,Time) :- holds(on(A,B),Time), red(A), pyramid(A), green(B), cube(B).
cost: 0.
done.
>>>
>>> % PUT A SMALL ONE ONTO THE GREEN CUBE WHICH SUPPORTS A PYRAMID.
>>> :- on(small block, green cube supports.pyramid)!
--> goal(done).
holds(done,Time) :- holds(on(A,C),Time), small(A), block(A), green(C), cube(C), supports(C,B), pyramid(B).
cost: 4.
pickup(green pyramid)!
put_on(green pyramid, front right table)!
pickup(small red cube)!
put_on(small red cube, second green cube)!
>>>
>>> % PUT THE LITTLEST PYRAMID ON TOP OF IT.
>>> on(small'est.{pyramid}, small block)!
--> goal(on(D,E)) :- small(D,A) : A = @memberof(C), D != A; D = @memberof(C), setof((1),C), small(E), block(E).
gather((1),B) :- pyramid(B).
cost: 2.
pickup(green pyramid)!
put_on(green pyramid, small red cube)!
>>>
>>> % DOES THE SHORTEST THING THE TALLEST PYRAMID'S SUPPORT SUPPORTS SUPPORT ANYTHING GREEN?
>>> green on.short'est.{on.supports.tall'est.{pyramid}}?
--> what(J) :- green(J), on(J,I), short(I,A) : A = @memberof(H), I != A; I = @memberof(H), setof((3),H).
gather((2),C) :- pyramid(C).
gather((3),G) :- on(G,F), supports(F,E), tall(E,B) : B = @memberof(D), E != B; E = @memberof(D), setof((2),D).
that: green pyramid.
>>>
>>> % WHAT COLOR IS IT?
>>> colour.supports.that?
--> what(C) :- colour(C,B), supports(B,A), that(A).
that: red.
>>>
>>> % HOW MANY THINGS ARE ON TOP OF GREEN CUBES?
>>> above[green cube]?
--> what(B) :- above(B,A), green(A), cube(A).
that: red pyramid | green pyramid | small red cube | blue block.
>>>
>>> pickup.X: apply(pickup(X),T) :- apply(pickup(X),T).
--> pickup(apply(pickup(MuX),MuT),MuX) :- apply(pickup(MuX),MuT).
understood.
>>>
>>> % HAD YOU TOUCHED ANY PYRAMID BEFORE YOU PUT THE GREEN ONE ON THE LITTLE CUBE?
>>> pickup.pyramid before.goal.on(green pyramid, small cube)?
--> what(G) :- pickup(G,A), pyramid(A), end_time(H,G), H = 0 .. (I - 1), start_time(I,D), goal(D,on(B,C)), green(B), pyramid(B), small(C), cube(C).
that: apply(pickup(green pyramid),9)
| apply(pickup(green pyramid),13)
| apply(pickup(green pyramid),15).
>>>
>>> that pickup.green?
--> what(B) :- that(B), pickup(B,A), green(A).
that: apply(pickup(green pyramid),9)
| apply(pickup(green pyramid),13)
| apply(pickup(green pyramid),15).
>>>
>>> % WHEN DID YOU PICK IT UP?
>>> event during'.that?
--> what(H) :- event(H), start_time(I,A), I = J, I = K .. L, end_time(M,A), M = J .. L, start_time(K,N), N = H, N != A, end_time(L,H), that(A).
that: history(14,goal(done)) | history(19,goal(done)).
>>>
>>> % WHY?
>>> why.that.2?
--> what(B) :- why(B,A), that(A,2).
that: apply(pickup(small red cube),11)
| apply(pickup(small red cube),17)
| apply(put_on(green pyramid,front right table),16)
| apply(put_on(green pyramid,small red cube),14)
| apply(put_on(green pyramid,blue block),10).
>>>
>>> that pickup.cube?
--> what(B) :- that(B), pickup(B,A), cube(A).
that: apply(pickup(small red cube),11)
| apply(pickup(small red cube),17).
>>>
>>> % WHY DID YOU DO THAT?
>>> why.that?
--> what(B) :- why(B,A), that(A).
that: apply(put_on(small red cube,second green cube),18)
| apply(put_on(small red cube,big red block),12).
>>> why.that?
--> what(B) :- why(B,A), that(A).
that: apply(pickup(green pyramid),13) | history(19,goal(done)).
>>>
>>> % HOW DID YOU DO IT?
>>> event during.that?
--> what(H) :- event(H), start_time(I,H), I = J, I = K .. L, end_time(M,H), M = J .. L, start_time(K,N), N = A, N != H, end_time(L,A), that(A).
that: apply(pickup(green pyramid),15)
| apply(pickup(small red cube),17)
| apply(put_on(green pyramid,front right table),16)
| apply(put_on(small red cube,second green cube),18).
>>>
>>> % HOW MANY OBJECTS DID YOU TOUCH WHILE YOU WERE DOING IT?
>>> count{pickup.object during.that.2}?
--> what(Q) :- Q = @countof(P), setof((4),P).
gather((4),I) :- pickup(I,A), object(A), start_time(J,I), J = K, J = L .. M, end_time(N,I), N = K .. M, start_time(L,O), O = B, O != I, end_time(M,B), that(B,2).
that: 2.
>>>
>>> % WHAT DID THE RED CUBE SUPPORT BEFORE YOU STARTED TO CLEAN IT OFF?
>>> supports'[red cube] @ just_before.cleanoff[red cube]?
--> what(B) :- event(F,supports(A,B)), red(A), cube(A), end_time(G - 1,F), start_time(G,D), cleanoff(D,C), red(C), cube(C).
that: green pyramid.
>>>
>>> % THERE WERE FIVE BLOCKS TO THE LEFT OF THE BOX THEN.
>>> block left_of.box @ just_before.cleanoff[red cube]?
--> what(H) :- block(H), H = B, event(F,left_of(B,A)), box(A), end_time(G - 1,F), start_time(G,D), cleanoff(D,C), red(C), cube(C).
that: small red cube.
>>> count{that}?
--> what(C) :- C = @countof(B), setof((5),B).
gather((5),A) :- that(A).
that: 1.
>>>
>>> #reset.
>>> #include "test/shrdlu-world.ldcs".
>>> #include "test/shrdlu-actions.ldcs".
>>> on(blue block, box)!
--> goal(on(A,B)) :- blue(A), block(A), box(B).
cost: 2.
pickup(blue block)!
put_on(blue block, box)!
>>>
>>> % PUT THE BLUE PYRAMID ON THE BLOCK IN THE BOX.
>>> :- on(blue pyramid, block in.box)!
--> goal(done).
holds(done,Time) :- holds(on(A,C),Time), blue(A), pyramid(A), block(C), in(C,B), box(B).
cost: 2.
pickup(blue pyramid)!
put_on(blue pyramid, blue block)!
>>>
>>> % IS THERE ANYTHING WHICH IS BIGGER THAN EVERY PYRAMID BUT IS NOT AS WIDE AS THE THING THAT SUPPORTS IT?
>>> object big'each.{pyramid} X narrow.supports.X?
--> what(E) :- object(E), big(E,A) : A = @memberof(C); setof((1),C), E = MuX, narrow(E,D), supports(D,MuX).
gather((1),B) :- pyramid(B).
that: blue block.
>>>
>>> % A "STEEPLE" IS A STACK WHICH CONTAINS TWO GREEN CUBES AND A PYRAMID.
>>> #fluent steeple() :- stack(green cube, green cube, pyramid).
--> steeple :- holds(steeple).
holds(steeple,Time) :- holds(stack(A,B,C),Time), green(A), cube(A), green(B), cube(B), pyramid(C).
understood.
>>>
>>> % ARE THERE ANY STEEPLES NOW?
>>> :- steeple()?
--> yes :- steeple.
no :- not yes.
no.
>>>
>>> % BUILD ONE.
>>> :- steeple()!
--> goal(done).
holds(done,Time) :- holds(steeple,Time).
cost: 4.
pickup(first green cube)!
put_on(first green cube, second green cube)!
pickup(red pyramid)!
put_on(red pyramid, first green cube)!
>>>
>>> % CALL THE BIGGEST BLOCK "SUPERBLOCK".
>>> superblock: big'est.{block}.
--> superblock(D) :- big(D,A) : A = @memberof(C), D != A; D = @memberof(C), setof((2),C).
gather((2),B) :- block(B).
understood.
>>>
>>> % HAVE YOU PICKED SUPERBLOCK UP SINCE WE BEGAN?
>>> :- holds(holding(superblock), T)?
--> yes :- holds(holding(A),MuT), superblock(A).
no :- not yes.
yes.
>>>
>>> % WHY DID YOU DROP IT?
>>> why.put_on(superblock, table)?
--> what(C) :- why(C,put_on(A,B)), superblock(A), table(B).
>>>
>>> left_of(red pyramid, box)!
--> goal(left_of(A,B)) :- red(A), pyramid(A), box(B).
cost: 2.
pickup(red pyramid)!
put_on(red pyramid, big red block)!
>>>
>>> % IS THERE ANYTHING TO THE RIGHT OF THE RED PYRAMID?
>>> right_of[red pyramid]?
--> what(B) :- right_of(B,A), red(A), pyramid(A).
that: box | blue pyramid | first green cube | second green cube | blue block.
>>>
>>> thanks.
YOU'RE WELCOME!