1% ectest/TestBoxRoom.e:1 2% translate: begining File: ectest/TestBoxRoom.e.pro 3% % 4% % 5% ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 6% ; FILE: examples/Mueller2006/Chapter10/MovingNewspaperAndBox.e 7% ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 8% ; 9% ; Copyright (c) 2005 IBM Corporation and others. 10% ; All rights reserved. This program and the accompanying materials 11% ; are made available under the terms of the Common Public License v1.0 12% ; which accompanies this distribution, and is available in 13% ; http://www.eclipse.org/legal/cpl-v10.html 14% ; 15% ; Contributors: 16% ; IBM - Initial implementation 17% ; 18% ; @book{Mueller:2006, 19% ; author = "Erik T. Mueller", 20% ; year = "2006", 21% ; title = "Commonsense Reasoning", 22% ; address = "San Francisco", 23% ; publisher = "Morgan Kaufmann/Elsevier", 24% ; } 25% ; 26 27% ectest/TestBoxRoom.e:24 28% load foundations/Root.e 29load('foundations/Root.e'). 30 31% load foundations/EC.e 32load('foundations/EC.e'). 33 34% % 35% sort object 36sort(object). 37 38% sort agent: object 39subsort(agent, object). 40 41% sort physobj: object 42subsort(physobj, object). 43 44% ectest/TestBoxRoom.e:30 45% sort room: object 46subsort(room, object). 47 48% % 49% fluent directlyIn(object,object) fluent(directlyIn(object, object)). 50 51% 52% fluent inRoom(object,room) fluent(inRoom(object, room)). 53 54% 55% noninertial inRoom 56noninertial(inRoom). 57 58% % 59% ;; executable(move(agent,object,object,object)) 60% ectest/TestBoxRoom.e:37 61% % 62% agent Lisa 63t(agent, lisa). 64 65% physobj Box, Newspaper 66t(physobj, box). 67 68t(physobj, newspaper). 69 70% room Kitchen, LivingRoom 71t(room, kitchen). 72 73t(room, livingRoom). 74 75% % 76% ; Sigma 77% ectest/TestBoxRoom.e:43 78% % 79% ; RS10 80% ectest/TestBoxRoom.e:45 81% [agent,physobj1,physobj2,room,time]% % 82% HoldsAt(directlyIn(agent,room),time) & % 83% HoldsAt(directlyIn(physobj1,room),time) & % 84% HoldsAt(inRoom(physobj2,room),time) -> % 85% Initiates(move(agent,physobj1,room,physobj2),directlyIn(physobj1,physobj2),time). 86holds_at(directlyIn(Agent, Room), Time), holds_at(directlyIn(Physobj1, Room), Time), holds_at(inRoom(Physobj2, Room), Time) -> 87 initiates(move(Agent, Physobj1, Room, Physobj2), 88 directlyIn(Physobj1, Physobj2), 89 Time). 90 91% % 92% % 93% ; RS11 94% ectest/TestBoxRoom.e:52 95% [agent,physobj1,physobj2,room,time]% % 96% HoldsAt(directlyIn(agent,room),time) & % 97% HoldsAt(directlyIn(physobj1,room),time) & % 98% HoldsAt(inRoom(physobj2,room),time) -> % 99% Terminates(move(agent,physobj1,room,physobj2),directlyIn(physobj1,room),time). 100holds_at(directlyIn(Agent, Room), Time), holds_at(directlyIn(Physobj1, Room), Time), holds_at(inRoom(Physobj2, Room), Time) -> 101 terminates(move(Agent, Physobj1, Room, Physobj2), 102 directlyIn(Physobj1, Room), 103 Time). 104 105% % 106% % 107% ; RS12 108% ectest/TestBoxRoom.e:59 109% [agent,physobj1,physobj2,room,time]% % 110% HoldsAt(directlyIn(agent,room),time) -> % 111% Initiates(move(agent,physobj1,physobj2,room),directlyIn(physobj1,room),time). 112holds_at(directlyIn(Agent, Room), Time) -> 113 initiates(move(Agent, Physobj1, Physobj2, Room), 114 directlyIn(Physobj1, Room), 115 Time). 116 117% % 118% % 119% ; RS13 120% ectest/TestBoxRoom.e:64 121% [agent,physobj1,physobj2,room,time]% % 122% HoldsAt(directlyIn(agent,room),time) -> % 123% Terminates(move(agent,physobj1,physobj2,room),directlyIn(physobj1,physobj2),time). 124holds_at(directlyIn(Agent, Room), Time) -> 125 terminates(move(Agent, Physobj1, Physobj2, Room), 126 directlyIn(Physobj1, Physobj2), 127 Time). 128 129% % 130% % 131% ; RS14 132% ectest/TestBoxRoom.e:69 133% [agent,room1,room2,time]% % 134% HoldsAt(directlyIn(agent,room1),time) -> % 135% Initiates(move(agent,agent,room1,room2),directlyIn(agent,room2),time). 136holds_at(directlyIn(Agent, Room1), Time) -> 137 initiates(move(Agent, Agent, Room1, Room2), 138 directlyIn(Agent, Room2), 139 Time). 140 141% % 142% % 143% ; RS15 144% ectest/TestBoxRoom.e:74 145% [agent,room1,room2,time]% % 146% HoldsAt(directlyIn(agent,room1),time) -> % 147% Terminates(move(agent,agent,room1,room2),directlyIn(agent,room1),time). 148holds_at(directlyIn(Agent, Room1), Time) -> 149 terminates(move(Agent, Agent, Room1, Room2), 150 directlyIn(Agent, Room1), 151 Time). 152 153% % 154% % 155% ; RS16 156% ectest/TestBoxRoom.e:79 157% [agent,physobj,room,time]% % 158% HoldsAt(directlyIn(agent,room),time) & % 159% HoldsAt(directlyIn(physobj,room),time) -> % 160% Initiates(move(agent,physobj,room,agent),directlyIn(physobj,agent),time). 161holds_at(directlyIn(Agent, Room), Time), holds_at(directlyIn(Physobj, Room), Time) -> 162 initiates(move(Agent, Physobj, Room, Agent), 163 directlyIn(Physobj, Agent), 164 Time). 165 166% % 167% % 168% ; RS17 169% ectest/TestBoxRoom.e:85 170% [agent,physobj,room,time]% % 171% HoldsAt(directlyIn(agent,room),time) & % 172% HoldsAt(directlyIn(physobj,room),time) -> % 173% Terminates(move(agent,physobj,room,agent),directlyIn(physobj,room),time). 174holds_at(directlyIn(Agent, Room), Time), holds_at(directlyIn(Physobj, Room), Time) -> 175 terminates(move(Agent, Physobj, Room, Agent), 176 directlyIn(Physobj, Room), 177 Time). 178 179% % 180% % 181% ; RS18 182% ectest/TestBoxRoom.e:91 183% [agent,physobj,room,time]% % 184% HoldsAt(directlyIn(physobj,agent),time) & % 185% HoldsAt(directlyIn(agent,room),time) -> % 186% Initiates(move(agent,physobj,agent,room),directlyIn(physobj,room),time). 187holds_at(directlyIn(Physobj, Agent), Time), holds_at(directlyIn(Agent, Room), Time) -> 188 initiates(move(Agent, Physobj, Agent, Room), 189 directlyIn(Physobj, Room), 190 Time). 191 192% % 193% % 194% ; RS19 195% ectest/TestBoxRoom.e:97 196% [agent,physobj,room,time]% % 197% HoldsAt(directlyIn(physobj,agent),time) & % 198% HoldsAt(directlyIn(agent,room),time) -> % 199% Terminates(move(agent,physobj,agent,room),directlyIn(physobj,agent),time). 200holds_at(directlyIn(Physobj, Agent), Time), holds_at(directlyIn(Agent, Room), Time) -> 201 terminates(move(Agent, Physobj, Agent, Room), 202 directlyIn(Physobj, Agent), 203 Time). 204 205% % 206% % 207% ; Delta 208% ectest/TestBoxRoom.e:103 209% % 210% Happens(move(Lisa,Newspaper,LivingRoom,Box),0). 211happens(move(lisa, newspaper, livingRoom, box), 0). 212 213% % 214% Happens(move(Lisa,Box,LivingRoom,Lisa),1). 215happens(move(lisa, box, livingRoom, lisa), 1). 216 217% % 218% Happens(move(Lisa,Lisa,LivingRoom,Kitchen),2). 219happens(move(lisa, lisa, livingRoom, kitchen), 2). 220 221% % 222% Happens(move(Lisa,Box,Lisa,Kitchen),3). 223happens(move(lisa, box, lisa, kitchen), 3). 224 225% % 226% Happens(move(Lisa,Lisa,Kitchen,LivingRoom),4). 227happens(move(lisa, lisa, kitchen, livingRoom), 4). 228 229% % 230% ectest/TestBoxRoom.e:109 231% % 232% ; Psi 233% % 234% ; RS1 235% ectest/TestBoxRoom.e:113 236% [object,time] % !HoldsAt(directlyIn(object,object),time). 237not(holds_at(directlyIn(Object, Object), Time)). 238 239% % 240% % 241% ; RS2 242% ectest/TestBoxRoom.e:116 243% [object1,object2,time]% % 244% HoldsAt(directlyIn(object1,object2),time) -> % 245% !HoldsAt(directlyIn(object2,object1),time). 246holds_at(directlyIn(Object1, Object2), Time) -> 247 not(holds_at(directlyIn(Object2, Object1), Time)). 248 249% % 250% % 251% ; RS3 252% ectest/TestBoxRoom.e:121 253% [object1,object2,object3,time]% % 254% HoldsAt(directlyIn(object1,object2),time) & % 255% HoldsAt(directlyIn(object2,object3),time) -> % 256% !HoldsAt(directlyIn(object1,object3),time). 257holds_at(directlyIn(Object1, Object2), Time), holds_at(directlyIn(Object2, Object3), Time) -> 258 not(holds_at(directlyIn(Object1, Object3), Time)). 259 260% % 261% % 262% ; RS4 263% ectest/TestBoxRoom.e:127 264% [object,object1,object2,time]% % 265% HoldsAt(directlyIn(object,object1),time) & % 266% HoldsAt(directlyIn(object,object2),time) -> % 267% object1=object2. 268holds_at(directlyIn(Object, Object1), Time), holds_at(directlyIn(Object, Object2), Time) -> 269 Object1=Object2. 270 271% % 272% % 273% ; RS7 274% ectest/TestBoxRoom.e:133 275% [object,room,time]% % 276% HoldsAt(directlyIn(object,room),time) -> % 277% HoldsAt(inRoom(object,room),time). 278holds_at(directlyIn(Object, Room), Time) -> 279 holds_at(inRoom(Object, Room), Time). 280 281% % 282% % 283% ; RS8 284% ectest/TestBoxRoom.e:138 285% [object1,object2,room,time]% % 286% HoldsAt(directlyIn(object1,object2),time) & % 287% HoldsAt(inRoom(object2,room),time) -> % 288% HoldsAt(inRoom(object1,room),time). 289holds_at(directlyIn(Object1, Object2), Time), holds_at(inRoom(Object2, Room), Time) -> 290 holds_at(inRoom(Object1, Room), Time). 291 292% % 293% % 294% ; RS9 295% ectest/TestBoxRoom.e:144 296% [object,room1,room2,time]% % 297% HoldsAt(inRoom(object,room1),time) & % 298% HoldsAt(inRoom(object,room2),time) -> % 299% room1=room2. 300holds_at(inRoom(Object, Room1), Time), holds_at(inRoom(Object, Room2), Time) -> 301 Room1=Room2. 302 303% % 304% % 305% ; Gamma 306% ectest/TestBoxRoom.e:150 307% % 308% HoldsAt(directlyIn(Lisa,LivingRoom),0). 309holds_at(directlyIn(lisa, livingRoom), 0). 310 311% % 312% HoldsAt(directlyIn(Newspaper,LivingRoom),0). 313holds_at(directlyIn(newspaper, livingRoom), 0). 314 315% % 316% HoldsAt(directlyIn(Box,LivingRoom),0). 317holds_at(directlyIn(box, livingRoom), 0). 318 319% % 320% % 321% ; added: 322% ectest/TestBoxRoom.e:156 323% [room1,room2,time] % !HoldsAt(inRoom(room1,room2),time). 324not(holds_at(inRoom(Room1, Room2), Time)). 325 326% % 327% ectest/TestBoxRoom.e:157 328% [room,object,time] % !HoldsAt(directlyIn(room,object),time). 329not(holds_at(directlyIn(Room, Object), Time)). 330 331% % 332% % 333% ; entailed: 334% ; HoldsAt(directlyIn(Lisa,LivingRoom),5). 335% ; HoldsAt(directlyIn(Box,Kitchen),5). 336% ; HoldsAt(inRoom(Newspaper,Kitchen),5). 337% ectest/TestBoxRoom.e:163 338% % 339% completion Happens 340completion(happens). 341 342% % 343% range time 0 5 344range(time, 0, 5). 345 346% range offset 1 1 347range(offset, 1, 1). 348 349% % 350% ; End of file. 351% ectest/TestBoxRoom.e:170 352% % 353% % 354% ectest/TestBoxRoom.e:172 355% translate: ending File: ectest/TestBoxRoom.e.pro