1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'examples/Mueller2006/Chapter6/ThielscherCircuit1.e').
4%;
5%; Copyright (c) 2005 IBM Corporation and others.
6%; All rights reserved. This program and the accompanying materials
7%; are made available under the terms of the Common Public License v1.0
8%; which accompanies this distribution, and is available at
9%; http://www.eclipse.org/legal/cpl-v10.html
10%;
11%; Contributors:
12%; IBM - Initial implementation
13%;
14%; @article{Thielscher:1997,
15%; author = "Michael Thielscher",
16%; year = "1997",
17%; title = "Ramification and causality",
18%; journal = "Artificial Intelligence",
19%; volume = "89",
20%; pages = "317--364",
21%; }
22%;
23%; @book{Mueller:2006,
24%; author = "Erik T. Mueller",
25%; year = "2006",
26%; title = "Commonsense Reasoning",
27%; address = "San Francisco",
28%; publisher = "Morgan Kaufmann/Elsevier",
29%; }
30%;
31
32% load foundations/Root.e
33
34% load foundations/EC.e
35
36% load foundations/ECCausal.e
37 % loading(changed,'foundations/ECCausal.e').
38%;
39%; Copyright (c) 2005 IBM Corporation and others.
40%; All rights reserved. This program and the accompanying materials
41%; are made available under the terms of the Common Public License v1.0
42%; which accompanies this distribution, and is available at
43%; http://www.eclipse.org/legal/cpl-v10.html
44%;
45%; Contributors:
46%; IBM - Initial implementation
47%;
48%; Causal Constraints
49%;
50%; @inproceedings{Shanahan:1999a,
51%; author = "Murray Shanahan",
52%; year = "1999",
53%; title = "The ramification problem in the event calculus",
54%; booktitle = "\uppercase{P}roceedings of the \uppercase{S}ixteenth \uppercase{I}nternational \uppercase{J}oint \uppercase{C}onference on \uppercase{A}rtificial \uppercase{I}ntelligence",
55%; pages = "140--146",
56%; address = "San Mateo, CA",
57%; publisher = "Morgan Kaufmann",
58%; }
59%;
60
61% predicate Started(fluent,time)
62 % predicate(started(fluent,time)).
63==> mpred_prop(started(fluent,time),predicate).
64==> meta_argtypes(started(fluent,time)).
65
66% predicate Stopped(fluent,time)
67 % predicate(stopped(fluent,time)).
68==> mpred_prop(stopped(fluent,time),predicate).
69==> meta_argtypes(stopped(fluent,time)).
70
71
77
78 84axiom(started(Fluent, Time),
85 [holds_at(Fluent, Time)]).
86axiom(started(Fluent, Time),
87
88 [ happens(Event, Time),
89 initiates(Event, Fluent, Time)
90 ]).
91
92 95
96 102axiom(not(started(Started_Param, Time3)),
103
104 [ not(happens(Happens_Param, Time3)),
105 not(holds_at(Started_Param, Time3))
106 ]).
107axiom(not(started(Started_Param, Time3)),
108
109 [ not(initiates(Happens_Param, Started_Param, Time3)),
110 not(holds_at(Started_Param, Time3))
111 ]).
112
113 119axiom(holds_at(Holds_at_Param, Time6),
120
121 [ not(happens(Happens_Param8, Time6)),
122 started(Holds_at_Param, Time6)
123 ]).
124axiom(holds_at(Holds_at_Param, Time6),
125
126 [ not(initiates(Happens_Param8, Holds_at_Param, Time6)),
127 started(Holds_at_Param, Time6)
128 ]).
129
130 134axiom(happens(Happens_Param10, Maptime),
135
136 [ not(holds_at(Holds_at_Param11, Maptime)),
137 started(Holds_at_Param11, Maptime)
138 ]).
139
140 144axiom(initiates(Initiates_Param, Holds_at_Param14, Time12),
145
146 [ not(holds_at(Holds_at_Param14, Time12)),
147 started(Holds_at_Param14, Time12)
148 ]).
149
150
156
157 163axiom(stopped(Fluent, Time),
164 [not(holds_at(Fluent, Time))]).
165axiom(stopped(Fluent, Time),
166
167 [ happens(Event, Time),
168 terminates(Event, Fluent, Time)
169 ]).
170
171 174
175 181axiom(not(stopped(Stopped_Param, Time3)),
182
183 [ not(happens(Happens_Param, Time3)),
184 holds_at(Stopped_Param, Time3)
185 ]).
186axiom(not(stopped(Stopped_Param, Time3)),
187
188 [ not(terminates(Happens_Param, Stopped_Param, Time3)),
189 holds_at(Stopped_Param, Time3)
190 ]).
191
192 198axiom(not(holds_at(Holds_at_Param, Time6)),
199
200 [ not(happens(Happens_Param8, Time6)),
201 stopped(Holds_at_Param, Time6)
202 ]).
203axiom(not(holds_at(Holds_at_Param, Time6)),
204
205 [ not(terminates(Happens_Param8, Holds_at_Param, Time6)),
206 stopped(Holds_at_Param, Time6)
207 ]).
208
209 213axiom(happens(Happens_Param10, Maptime),
214
215 [ holds_at(Holds_at_Param11, Maptime),
216 stopped(Holds_at_Param11, Maptime)
217 ]).
218
219 223axiom(terminates(Terminates_Param, Holds_at_Param14, Time12),
224
225 [ holds_at(Holds_at_Param14, Time12),
226 stopped(Holds_at_Param14, Time12)
227 ]).
228
229% predicate Initiated(fluent,time)
230 % predicate(initiated(fluent,time)).
231==> mpred_prop(initiated(fluent,time),predicate).
232==> meta_argtypes(initiated(fluent,time)).
233
234% predicate Terminated(fluent,time)
235 % predicate(terminated(fluent,time)).
236==> mpred_prop(terminated(fluent,time),predicate).
237==> meta_argtypes(terminated(fluent,time)).
238
239
245
246 251axiom(initiated(Fluent, Time),
252 [not(happens(Event, Time)), started(Fluent, Time)]).
253axiom(initiated(Fluent, Time),
254
255 [ not(terminates(Event, Fluent, Time)),
256 started(Fluent, Time)
257 ]).
258
259 262
263 269axiom(not(initiated(Initiated_Param, Maptime)),
270 [not(started(Initiated_Param, Maptime))]).
271axiom(not(initiated(Initiated_Param, Maptime)),
272
273 [ happens(Happens_Param, Maptime),
274 terminates(Happens_Param, Initiated_Param, Maptime)
275 ]).
276
277 280axiom(started(Started_Param, Started_Ret),
281 [initiated(Started_Param, Started_Ret)]).
282
283 287axiom(not(happens(Happens_Param9, Maptime8)),
288
289 [ terminates(Happens_Param9, Initiated_Param10, Maptime8),
290 initiated(Initiated_Param10, Maptime8)
291 ]).
292
293 297axiom(not(terminates(Terminates_Param, Initiated_Param13, Maptime11)),
298
299 [ happens(Terminates_Param, Maptime11),
300 initiated(Initiated_Param13, Maptime11)
301 ]).
302
303
309
310 315axiom(terminated(Fluent, Time),
316 [not(happens(Event, Time)), stopped(Fluent, Time)]).
317axiom(terminated(Fluent, Time),
318
319 [ not(initiates(Event, Fluent, Time)),
320 stopped(Fluent, Time)
321 ]).
322
323 326
327 333axiom(not(terminated(Terminated_Param, Maptime)),
334 [not(stopped(Terminated_Param, Maptime))]).
335axiom(not(terminated(Terminated_Param, Maptime)),
336
337 [ happens(Happens_Param, Maptime),
338 initiates(Happens_Param, Terminated_Param, Maptime)
339 ]).
340
341 344axiom(stopped(Stopped_Param, Stopped_Ret),
345 [terminated(Stopped_Param, Stopped_Ret)]).
346
347 351axiom(not(happens(Happens_Param9, Maptime8)),
352
353 [ initiates(Happens_Param9, Terminated_Param10, Maptime8),
354 terminated(Terminated_Param10, Maptime8)
355 ]).
356
357 361axiom(not(initiates(Initiates_Param, Terminated_Param13, Maptime11)),
362
363 [ happens(Initiates_Param, Maptime11),
364 terminated(Terminated_Param13, Maptime11)
365 ]).
366
367
368% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:31
369%; End of file.
370
371% sort switch
372% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:33
373==> sort(switch).
374
375% sort relay
376% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:34
377==> sort(relay).
378
379% sort light
380% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:35
381==> sort(light).
382
383% switch S1, S2, S3
384% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:37
385==> t(switch,s1).
386==> t(switch,s2).
387==> t(switch,s3).
388
389% relay R
390% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:38
391==> t(relay,r).
392
393% light L
394% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:39
395==> t(light,l).
396
397% event Light(light)
398 % event(light(light)).
399% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:41
400==> mpred_prop(light(light),event).
401==> meta_argtypes(light(light)).
402
403% event Close(switch)
404 % event(close(switch)).
405% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:42
406==> mpred_prop(close(switch),event).
407==> meta_argtypes(close(switch)).
408
409% event Open(switch)
410 % event(open(switch)).
411% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:43
412==> mpred_prop(open(switch),event).
413==> meta_argtypes(open(switch)).
414
415% event Activate(relay)
416 % event(activate(relay)).
417% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:44
418==> mpred_prop(activate(relay),event).
419==> meta_argtypes(activate(relay)).
420
421% fluent Lit(light)
422 % fluent(lit(light)).
423% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:46
424==> mpred_prop(lit(light),fluent).
425==> meta_argtypes(lit(light)).
426
427% fluent Closed(switch)
428 % fluent(closed(switch)).
429% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:47
430==> mpred_prop(closed(switch),fluent).
431==> meta_argtypes(closed(switch)).
432
433% fluent Activated(relay)
434 % fluent(activated(relay)).
435% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:48
436==> mpred_prop(activated(relay),fluent).
437==> meta_argtypes(activated(relay)).
438
439
447axiom(happens(light(l), Time),
448
449 [ stopped(lit(l), Time),
450 initiated(closed(s1), Time),
451 initiated(closed(s2), Time)
452 ]).
453
454
461axiom(happens(open(s2), Time),
462 [started(closed(s2), Time), initiated(activated(r), Time)]).
463
464
472axiom(happens(activate(r), Time),
473
474 [ stopped(activated(r), Time),
475 initiated(closed(s1), Time),
476 initiated(closed(s3), Time)
477 ]).
478
479
482 483axiom(initiates(close(Switch), closed(Switch), Time),
484 []).
485
486
489 490axiom(terminates(open(Switch), closed(Switch), Time),
491 []).
492
493
496 497axiom(initiates(activate(Relay), activated(Relay), Time),
498 []).
499
500
503 504axiom(initiates(light(Light), lit(Light), Time),
505 []).
506
507
510 511axiom(not(initially(closed(s1))),
512 []).
513
514
517axiom(initially(closed(s2)),
518 []).
519
520
523axiom(initially(closed(s3)),
524 []).
525
526
529 530axiom(not(initially(activated(r))),
531 []).
532
533
536 537axiom(not(initially(lit(l))),
538 []).
539
540
543axiom(happens(close(s1), t),
544 [is_time(0)]).
545
546% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:79
547% completion Happens
548% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:80
549==> completion(happens).
550
551% range time 0 1
552% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:82
553==> range(time,0,1).
554
555% range offset 1 1
556% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit1.e:83
557==> range(offset,1,1).