1:-include(library('ec_planner/ec_test_incl')). 2:-expects_dialect(pfc). 3 % loading(always,'examples/Shanahan1999/Happy.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%; @incollection{Shanahan:1999,
15%; author = "Shanahan, Murray",
16%; year = "1999",
17%; title = "The Event Calculus explained",
18%; editor = "Michael J. Wooldridge and Manuela M. Veloso",
19%; booktitle = "Artificial Intelligence Today: Recent Trends and Developments",
20%; series = "Lecture Notes in Computer Science",
21%; volume = "1600",
22%; pages = "409--430",
23%; address = "Berlin",
24%; publisher = "Springer",
25%; }
26%;
27%; deduction
28%;
29%; modifications from Shanahan's formulation:
30%; InitiallyN -> !HoldsAt
31%; InitiallyP -> HoldsAt
32%; timestamps
33%;
34
35% load foundations/Root.e
36
37% load foundations/EC.e
38
39% sort person
40==> sort(person).
41
42% event Feed(person)
43 % event(feed(person)).
44==> mpred_prop(feed(person),event).
45==> meta_argtypes(feed(person)).
46
47% event Clothe(person)
48 % event(clothe(person)).
49==> mpred_prop(clothe(person),event).
50==> meta_argtypes(clothe(person)).
51
52% fluent Happy(person)
53 % fluent(happy(person)).
54==> mpred_prop(happy(person),fluent).
55==> meta_argtypes(happy(person)).
56
57% fluent Hungry(person)
58 % fluent(hungry(person)).
59==> mpred_prop(hungry(person),fluent).
60==> meta_argtypes(hungry(person)).
61
62% fluent Cold(person)
63 % fluent(cold(person)).
64==> mpred_prop(cold(person),fluent).
65==> meta_argtypes(cold(person)).
66
67% noninertial Happy
68==> noninertial(happy).
69
70
76
77 82axiom(holds_at(happy(Person), Time),
83
84 [ not(holds_at(hungry(Person), Time)),
85 not(holds_at(cold(Person), Time))
86 ]).
87
88 91
92 97axiom(not(holds_at(happy(Happy_Ret), Time2)),
98 [holds_at(hungry(Happy_Ret), Time2)]).
99axiom(not(holds_at(happy(Happy_Ret), Time2)),
100 [holds_at(cold(Happy_Ret), Time2)]).
101
102 105axiom(not(holds_at(hungry(Hungry_Ret), Time4)),
106 [holds_at(happy(Hungry_Ret), Time4)]).
107
108 111axiom(not(holds_at(cold(Cold_Ret), Time6)),
112 [holds_at(happy(Cold_Ret), Time6)]).
113
114
119axiom(terminates(feed(Person), hungry(Person), Time),
120 []).
121
122
127axiom(terminates(clothe(Person), cold(Person), Time),
128 []).
129
130% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:53
131% person Fred
132% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:54
133==> t(person,fred).
134
135
138axiom(initially(hungry(fred)),
139 []).
140
141
144 145axiom(not(initially(cold(fred))),
146 []).
147
148
151axiom(happens(feed(fred), start),
152 [is_time(1), b(t, start), ignore(t+1=start)]).
153
154% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:59
155% completion Happens
156% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:60
157==> completion(happens).
158
159% range time 0 2
160% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:62
161==> range(time,0,2).
162
163% range offset 1 1
164% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Shanahan1999/Happy.e:63
165==> range(offset,1,1).