; ; Copyright (c) 2005 IBM Corporation and others. ; All rights reserved. This program and the accompanying materials ; are made available under the terms of the Common Public License v1.0 ; which accompanies this distribution, and is available at ; http://www.eclipse.org/legal/cpl-v10.html ; ; Contributors: ; IBM - Initial implementation ; ; Example: Telephone ; ; @book{Mueller:2006, ; author = "Erik T. Mueller", ; year = "2006", ; title = "Commonsense Reasoning", ; address = "San Francisco", ; publisher = "Morgan Kaufmann/Elsevier", ; } ; load foundations/Root.e load foundations/EC.e sort agent sort phone agent Agent1, Agent2 phone Phone1, Phone2 fluent Ringing(phone,phone) fluent DialTone(phone) fluent BusySignal(phone) fluent Idle(phone) fluent Connected(phone,phone) fluent Disconnected(phone) event PickUp(agent,phone) event SetDown(agent,phone) event Dial(agent,phone,phone) ; Sigma [agent,phone,time] HoldsAt(Idle(phone),time) -> Initiates(PickUp(agent,phone),DialTone(phone),time). [agent,phone,time] HoldsAt(Idle(phone),time) -> Terminates(PickUp(agent,phone),Idle(phone),time). [agent,phone,time] HoldsAt(DialTone(phone),time) -> Initiates(SetDown(agent,phone),Idle(phone),time). [agent,phone,time] HoldsAt(DialTone(phone),time) -> Terminates(SetDown(agent,phone),DialTone(phone),time). [agent,phone1,phone2,time] HoldsAt(DialTone(phone1),time) & HoldsAt(Idle(phone2),time) -> Initiates(Dial(agent,phone1,phone2),Ringing(phone1,phone2),time). [agent,phone1,phone2,time] HoldsAt(DialTone(phone1),time) & HoldsAt(Idle(phone2),time) -> Terminates(Dial(agent,phone1,phone2),DialTone(phone1),time). [agent,phone1,phone2,time] HoldsAt(DialTone(phone1),time) & HoldsAt(Idle(phone2),time) -> Terminates(Dial(agent,phone1,phone2),Idle(phone2),time). [agent,phone1,phone2,time] HoldsAt(DialTone(phone1),time) & !HoldsAt(Idle(phone2),time) -> Initiates(Dial(agent,phone1,phone2),BusySignal(phone1),time). [agent,phone1,phone2,time] HoldsAt(DialTone(phone1),time) & !HoldsAt(Idle(phone2),time) -> Terminates(Dial(agent,phone1,phone2),DialTone(phone1),time). [agent,phone,time] HoldsAt(BusySignal(phone),time) -> Initiates(SetDown(agent,phone),Idle(phone),time). [agent,phone,time] HoldsAt(BusySignal(phone),time) -> Terminates(SetDown(agent,phone),BusySignal(phone),time). [agent,phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) -> Initiates(SetDown(agent,phone1),Idle(phone1),time). [agent,phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) -> Initiates(SetDown(agent,phone1),Idle(phone2),time). [agent,phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) -> Terminates(SetDown(agent,phone1),Ringing(phone1,phone2),time). [agent,phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) -> Initiates(PickUp(agent,phone2),Connected(phone1,phone2),time). [agent,phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) -> Terminates(PickUp(agent,phone2),Ringing(phone1,phone2),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Initiates(SetDown(agent,phone1),Idle(phone1),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Initiates(SetDown(agent,phone1),Disconnected(phone2),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Terminates(SetDown(agent,phone1),Connected(phone1,phone2),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Initiates(SetDown(agent,phone2),Idle(phone2),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Initiates(SetDown(agent,phone2),Disconnected(phone1),time). [agent,phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) -> Terminates(SetDown(agent,phone2),Connected(phone1,phone2),time). [agent,phone,time] HoldsAt(Disconnected(phone),time) -> Initiates(SetDown(agent,phone),Idle(phone),time). [agent,phone,time] HoldsAt(Disconnected(phone),time) -> Terminates(SetDown(agent,phone),Disconnected(phone),time). ; Delta ; (1) Two agents dial each other simultaneously without first ; picking up phone. Happens(Dial(Agent1,Phone1,Phone2),0). Happens(Dial(Agent2,Phone2,Phone1),0). ; (2) Two agents dial each other simultaneously. Happens(PickUp(Agent1,Phone1),1). Happens(PickUp(Agent2,Phone2),1). Happens(Dial(Agent1,Phone1,Phone2),2). Happens(Dial(Agent2,Phone2,Phone1),2). Happens(SetDown(Agent1,Phone1),3). Happens(SetDown(Agent2,Phone2),3). ; (3) One agent dials another agent just as the other ; agent picks up the phone. Happens(PickUp(Agent1,Phone1),4). Happens(Dial(Agent1,Phone1,Phone2),5). Happens(PickUp(Agent2,Phone2),5). ; Psi [phone,time] !HoldsAt(Ringing(phone,phone),time). [phone1,phone2,time] HoldsAt(Ringing(phone1,phone2),time) & phone1!=phone2 -> !HoldsAt(Ringing(phone2,phone1),time). [phone,time] !HoldsAt(Connected(phone,phone),time). [phone1,phone2,time] HoldsAt(Connected(phone1,phone2),time) & phone1!=phone2 -> !HoldsAt(Connected(phone2,phone1),time). mutex Idle, DialTone, BusySignal, Disconnected [phone1,phone2,time] HoldsAt(Idle(phone1),time) -> !HoldsAt(Ringing(phone1,phone2),time) & !HoldsAt(Connected(phone1,phone2),time). ; contradicts (3) above: ;[phone1,phone2,time] ;HoldsAt(DialTone(phone2),time) -> ;!HoldsAt(Ringing(phone1,phone2),time) & ;!HoldsAt(Connected(phone1,phone2),time). ; etc. ; Gamma [phone] HoldsAt(Idle(phone),0). completion Happens range time 0 6 range offset 1 1 ; End of file.