1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'examples/Mueller2006/Chapter12/ErraticDevice.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%; @book{Mueller:2006,
15%; author = "Erik T. Mueller",
16%; year = "2006",
17%; title = "Commonsense Reasoning",
18%; address = "San Francisco",
19%; publisher = "Morgan Kaufmann/Elsevier",
20%; }
21%;
22
23% load foundations/Root.e
24
25% load foundations/EC.e
26
27% sort agent
28==> sort(agent).
29
30% sort device
31==> sort(device).
32
33% agent Nathan
34==> t(agent,nathan).
35
36% device Device1
37==> t(device,device1).
38
39% predicate Ab1(device,time)
40 % predicate(ab1(device,time)).
41==> mpred_prop(ab1(device,time),predicate).
42==> meta_argtypes(ab1(device,time)).
43
44% fluent On(device)
45 % fluent(on(device)).
46==> mpred_prop(on(device),fluent).
47==> meta_argtypes(on(device)).
48
49% fluent PluggedIn(device)
50 % fluent(pluggedIn(device)).
51==> mpred_prop(pluggedIn(device),fluent).
52==> meta_argtypes(pluggedIn(device)).
53
54% fluent BrokenSwitch(device)
55 % fluent(brokenSwitch(device)).
56==> mpred_prop(brokenSwitch(device),fluent).
57==> meta_argtypes(brokenSwitch(device)).
58
59% fluent Erratic(device)
60 % fluent(erratic(device)).
61==> mpred_prop(erratic(device),fluent).
62==> meta_argtypes(erratic(device)).
63
64% fluent DeterminingFluent(device)
65 % fluent(determiningFluent(device)).
66==> mpred_prop(determiningFluent(device),fluent).
67==> meta_argtypes(determiningFluent(device)).
68
69% noninertial DeterminingFluent
70==> noninertial(determiningFluent).
71
72% event TurnOn(agent,device)
73 % event(turnOn(agent,device)).
74==> mpred_prop(turnOn(agent,device),event).
75==> meta_argtypes(turnOn(agent,device)).
76
77
85axiom(initiates(turnOn(Agent, Device), on(Device), Time),
86 [not(ab1(Device, Time))]).
87
88
91
92
95axiom(happens(turnOn(nathan, device1), t),
96 [is_time(0)]).
97
98
101
104next_axiom_uses(theta).
105
106
107
110 111axiom(ab1(Device, Time),
112 [holds_at(brokenSwitch(Device), Time)]).
113
116next_axiom_uses(theta).
117
118
119
125axiom(ab1(Device, Time),
126
127 [ holds_at(erratic(Device), Time),
128 holds_at(determiningFluent(Device), Time)
129 ]).
130
133next_axiom_uses(theta).
134
135
136
139 140axiom(ab1(Device, Time),
141 [not(holds_at(pluggedIn(Device), Time))]).
142
143
146
147
150 151axiom(not(initially(on(device1))),
152 []).
153
154
157 158axiom(not(initially(brokenSwitch(device1))),
159 []).
160
161
164axiom(initially(erratic(device1)),
165 []).
166
167
170axiom(initially(pluggedIn(device1)),
171 []).
172
173
176
177
180holds_at(determiningFluent(device1),1).
181
182% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter12/ErraticDevice.e:70
183% completion Theta Ab1
184% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter12/ErraticDevice.e:71
185==> completion(theta).
186==> completion(ab1).
187
188% completion Happens
189% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter12/ErraticDevice.e:72
190==> completion(happens).
191
192% range time 0 1
193% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter12/ErraticDevice.e:74
194==> range(time,0,1).
195
196% range offset 1 1
197% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter12/ErraticDevice.e:75
198==> range(offset,1,1).