1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'examples/Mueller2006/Chapter6/ThielscherCircuit2.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% sort switch
37==> sort(switch).
38
39% sort relay
40==> sort(relay).
41
42% sort light
43==> sort(light).
44
45% switch S1, S2, S3
46==> t(switch,s1).
47==> t(switch,s2).
48==> t(switch,s3).
49
50% relay R
51==> t(relay,r).
52
53% light L
54==> t(light,l).
55
56% event Light(light)
57 % event(light(light)).
58==> mpred_prop(light(light),event).
59==> meta_argtypes(light(light)).
60
61% event Unlight(light)
62 % event(unlight(light)).
63==> mpred_prop(unlight(light),event).
64==> meta_argtypes(unlight(light)).
65
66% event Close(switch)
67 % event(close(switch)).
68==> mpred_prop(close(switch),event).
69==> meta_argtypes(close(switch)).
70
71% event Open(switch)
72 % event(open(switch)).
73==> mpred_prop(open(switch),event).
74==> meta_argtypes(open(switch)).
75
76% event Activate(relay)
77 % event(activate(relay)).
78==> mpred_prop(activate(relay),event).
79==> meta_argtypes(activate(relay)).
80
81% fluent Lit(light)
82 % fluent(lit(light)).
83==> mpred_prop(lit(light),fluent).
84==> meta_argtypes(lit(light)).
85
86% fluent Closed(switch)
87 % fluent(closed(switch)).
88==> mpred_prop(closed(switch),fluent).
89==> meta_argtypes(closed(switch)).
90
91% fluent Activated(relay)
92 % fluent(activated(relay)).
93==> mpred_prop(activated(relay),fluent).
94==> meta_argtypes(activated(relay)).
95
96
104axiom(happens(light(l), Time),
105
106 [ not(holds_at(lit(l), Time)),
107 holds_at(closed(s1), Time),
108 holds_at(closed(s2), Time)
109 ]).
110
111
118axiom(happens(unlight(l), Time),
119 [not(holds_at(closed(s1), Time)), holds_at(lit(l), Time)]).
120axiom(happens(unlight(l), Time),
121 [not(holds_at(closed(s2), Time)), holds_at(lit(l), Time)]).
122
123
130axiom(happens(open(s2), Time),
131 [holds_at(closed(s2), Time), holds_at(activated(r), Time)]).
132
133
141axiom(happens(activate(r), Time),
142
143 [ not(holds_at(activated(r), Time)),
144 holds_at(closed(s1), Time),
145 holds_at(closed(s3), Time)
146 ]).
147
148
151 152axiom(initiates(close(Switch), closed(Switch), Time),
153 []).
154
155
158 159axiom(terminates(open(Switch), closed(Switch), Time),
160 []).
161
162
165 166axiom(initiates(activate(Relay), activated(Relay), Time),
167 []).
168
169
172 173axiom(initiates(light(Light), lit(Light), Time),
174 []).
175
176
179 180axiom(terminates(unlight(Light), lit(Light), Time),
181 []).
182
183
186 187axiom(not(initially(closed(s1))),
188 []).
189
190
193axiom(initially(closed(s2)),
194 []).
195
196
199axiom(initially(closed(s3)),
200 []).
201
202
205 206axiom(not(initially(activated(r))),
207 []).
208
209
212 213axiom(not(initially(lit(l))),
214 []).
215
216
219axiom(happens(close(s1), t),
220 [is_time(0)]).
221
222% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit2.e:85
223% completion Happens
224% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit2.e:86
225==> completion(happens).
226
227% range time 0 4
228% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit2.e:88
229==> range(time,0,4).
230
231% range offset 1 1
232% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter6/ThielscherCircuit2.e:89
233==> range(offset,1,1).