:-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/ShootingAttack.e',107). :- call_pel_directive(translate(unskipped, '/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.pel')). :-include(library('ec_planner/ec_test_incl')). :-expects_dialect(ecalc). :- call_pel_directive(translate(begining, '/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.pel')). %; %; 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 %; %; The Sleep representation deals with the activity of sleeping and %; body posture. %; It is similar to the finite automaton representation of sleep %; used in ThoughtTreasure \fullcite[chap. 7]{Mueller:1998}. %; %; @book{Mueller:1998, %; author = "Erik T. Mueller", %; year = "1998", %; title = "Natural Language Processing with \uppercase{T}hought\uppercase{T}reasure", %; address = "New York", %; publisher = "Signiform", %; } %; %; sleep %; agent wakes up. % event WakeUp(agent) :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',27). event(wakeUp(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',30). %; agent gets tired. % event GetTired(agent) event(getTired(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',33). %; agent falls asleep. % event FallAsleep(agent) event(fallAsleep(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',36). %; agent is asleep. % fluent Sleep0(agent) fluent(sleep0(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',36). %; agent is awake and in bed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',39). % fluent Sleep1(agent) fluent(sleep1(agent)). %; agent is awake, out of bed, and undressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',41). % fluent Sleep2(agent) fluent(sleep2(agent)). %; agent is awake and dressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',43). % fluent Sleep3(agent) fluent(sleep3(agent)). %; agent is tired and dressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',45). % fluent Sleep4(agent) fluent(sleep4(agent)). %; agent is tired and undressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',47). % fluent Sleep5(agent) fluent(sleep5(agent)). %; agent is in bed, waiting to fall asleep. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',49). % fluent Sleep6(agent) fluent(sleep6(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',51). %; At any time, an agent is in one of seven sleep states: % xor Sleep0, Sleep1, Sleep2, Sleep3, Sleep4, Sleep5, Sleep6 xor([sleep0,sleep1,sleep2,sleep3,sleep4,sleep5,sleep6]). %; constraints %; agent is asleep. % fluent Asleep(agent) :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',56). fluent(asleep(agent)). %; agent is awake. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',59). % fluent Awake(agent) fluent(awake(agent)). % noninertial Asleep :- call_pel_directive(noninertial(asleep)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',61). % noninertial Awake :- call_pel_directive(noninertial(awake)). %; Sleep0 indicates that the agent is asleep: % [agent,time] % HoldsAt(Asleep(agent),time) <-> HoldsAt(Sleep0(agent),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',63). holds_at(asleep(Agent), Time) <-> holds_at(sleep0(Agent), Time). %; In all other sleep states, the agent is awake: % [agent,time] % HoldsAt(Awake(agent),time) <-> % HoldsAt(Sleep1(agent),time) | % HoldsAt(Sleep2(agent),time) | % HoldsAt(Sleep3(agent),time) | % HoldsAt(Sleep4(agent),time) | % HoldsAt(Sleep5(agent),time) | % HoldsAt(Sleep6(agent),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',67). holds_at(awake(Agent), Time) <-> ( holds_at(sleep1(Agent), Time) ; holds_at(sleep2(Agent), Time) ; holds_at(sleep3(Agent), Time) ; holds_at(sleep4(Agent), Time) ; holds_at(sleep5(Agent), Time) ; holds_at(sleep6(Agent), Time) ). %; A number of axioms are used to specify the transitions of %; a finite automaton. %;-- %; Waking up causes a transition from Sleep0 %; to Sleep1: % [agent,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',82). % Terminates(WakeUp(agent),Sleep0(agent),time). terminates_at(wakeUp(Agent),sleep0(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',84). % [agent,time] % Initiates(WakeUp(agent),Sleep1(agent),time). initiates_at(wakeUp(Agent),sleep1(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',86). % [agent,time] % Happens(WakeUp(agent),time) -> HoldsAt(Sleep0(agent),time). happens_at(wakeUp(Agent), Time) -> holds_at(sleep0(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',88). %;-- %; Getting out of bed causes a transition from Sleep1 %; to Sleep2: % [agent,bed,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',92). % Terminates(RiseFrom(agent,bed),Sleep1(agent),time). terminates_at(riseFrom(Agent,Bed), sleep1(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',94). % [agent,bed,time] % Initiates(RiseFrom(agent,bed),Sleep2(agent),time). initiates_at(riseFrom(Agent,Bed), sleep2(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',96). % [agent,bed,time] % Happens(RiseFrom(agent,bed),time) -> HoldsAt(Sleep1(agent),time). happens_at(riseFrom(Agent, Bed), Time) -> holds_at(sleep1(Agent), Time). %;-- %; Getting dressed causes a transition from Sleep2 %; to Sleep3, the normal state of awakeness: % [agent,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',103). % Terminates(GetDressed(agent),Sleep2(agent),time). terminates_at(getDressed(Agent),sleep2(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',105). % [agent,time] % Initiates(GetDressed(agent),Sleep3(agent),time). initiates_at(getDressed(Agent),sleep3(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',107). % [agent,time] % Happens(GetDressed(agent),time) -> HoldsAt(Sleep2(agent),time). happens_at(getDressed(Agent), Time) -> holds_at(sleep2(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',109). %;-- %; Getting tired causes a transition from Sleep3 %; to Sleep4: % [agent,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',113). % Terminates(GetTired(agent),Sleep3(agent),time). terminates_at(getTired(Agent),sleep3(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',115). % [agent,time] % Initiates(GetTired(agent),Sleep4(agent),time). initiates_at(getTired(Agent),sleep4(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',117). % [agent,time] % Happens(GetTired(agent),time) -> HoldsAt(Sleep3(agent),time). happens_at(getTired(Agent), Time) -> holds_at(sleep3(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',119). %;-- %; Getting undressed causes a transition from Sleep4 %; to Sleep5: % [agent,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',123). % Terminates(GetUndressed(agent),Sleep4(agent),time). terminates_at(getUndressed(Agent),sleep4(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',125). % [agent,time] % Initiates(GetUndressed(agent),Sleep5(agent),time). initiates_at(getUndressed(Agent),sleep5(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',127). % [agent,time] % Happens(GetUndressed(agent),time) -> HoldsAt(Sleep4(agent),time). happens_at(getUndressed(Agent), Time) -> holds_at(sleep4(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',129). %;-- %; Lying on a bed causes a transition from Sleep5 %; to Sleep6: % [agent,bed,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',133). % Terminates(LieOn(agent,bed),Sleep5(agent),time). terminates_at(lieOn(Agent,Bed), sleep5(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',135). % [agent,bed,time] % Initiates(LieOn(agent,bed),Sleep6(agent),time). initiates_at(lieOn(Agent,Bed), sleep6(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',137). % [agent,bed,time] % Happens(LieOn(agent,bed),time) -> HoldsAt(Sleep5(agent),time). happens_at(lieOn(Agent, Bed), Time) -> holds_at(sleep5(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',139). %;-- %; Falling asleep causes a transition from Sleep6 %; to Sleep0: % [agent,time] :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',143). % Terminates(FallAsleep(agent),Sleep6(agent),time). terminates_at(fallAsleep(Agent),sleep6(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',145). % [agent,time] % Initiates(FallAsleep(agent),Sleep0(agent),time). initiates_at(fallAsleep(Agent),sleep0(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',147). % [agent,time] % Happens(FallAsleep(agent),time) -> HoldsAt(Sleep6(agent),time). happens_at(fallAsleep(Agent), Time) -> holds_at(sleep6(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',149). %;-- %; agent acts on being in state Sleep5. % fluent ActOnSleep5(agent) :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',151). fluent(actOnSleep5(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',153). % noninertial ActOnSleep5 :- call_pel_directive(noninertial(actOnSleep5)). %; We reduce the number of models by asserting that %; an agent only acts on being in state Sleep5 while in %; that state: % [agent,time] % !HoldsAt(Sleep5(agent),time) -> % !HoldsAt(ActOnSleep5(agent),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',158). holds_at(not(sleep5(Agent)), Time) -> holds_at(not(actOnSleep5(Agent)), Time). %; Undressed is like IntentionToPlay %; ActOnSleep5 is like ActOnIntentionToPlay %; A trigger axiom states that if an agent is in state Sleep5, %; the agent acts on this state, the agent is in a room, and %; a bed is at the room, the agent lies on the bed: % [agent,room,bed,time] % HoldsAt(Sleep5(agent),time) & % HoldsAt(ActOnSleep5(agent),time) & % HoldsAt(At(agent,room),time) & % HoldsAt(At(bed,room),time) -> % Happens(LieOn(agent,bed),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',168). holds_at(sleep5(Agent), Time), holds_at(actOnSleep5(Agent), Time), holds_at(at_loc(Agent, Room), Time), holds_at(at_loc(Bed, Room), Time) -> happens_at(lieOn(Agent, Bed), Time). %; A precondition axiom states that for %; an agent to lie on a bed, %; the agent must be in state Sleep5, %; the agent must act on this state, and %; there must be a room such that %; the agent is in the room and the bed is in the room: % [agent,bed,time] % Happens(LieOn(agent,bed),time) -> % HoldsAt(Sleep5(agent),time) & % HoldsAt(ActOnSleep5(agent),time) & :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',181). % {room}% % HoldsAt(At(agent,room),time) & % HoldsAt(At(bed,room),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',185). exists([Room], (happens_at(lieOn(Agent, Bed), Time)->holds_at(sleep5(Agent), Time), holds_at(actOnSleep5(Agent), Time), holds_at(at_loc(Agent, Room), Time), holds_at(at_loc(Bed, Room), Time))). %; (body) posture %; agent lies on physobj. % event LieOn(agent,physobj) :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',191). event(lieOn(agent,physobj)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',194). %; agent sits on physobj. % event SitOn(agent,physobj) event(sitOn(agent,physobj)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',197). % [agent,physobj,time] % Happens(SitOn(agent,physobj),time) -> % {location}% % HoldsAt(At(agent,location),time) & % HoldsAt(At(physobj,location),time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',199). exists([Location], (happens_at(sitOn(Agent, Physobj), Time)->holds_at(at_loc(Agent, Location), Time), holds_at(at_loc(Physobj, Location), Time))). %; agent rises from physobj. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',204). % event RiseFrom(agent,physobj) event(riseFrom(agent,physobj)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',206). %; agent is lying on physobj. % fluent LyingOn(agent,physobj) fluent(lyingOn(agent,physobj)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',206). %; agent is sitting on physobj. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',209). % fluent SittingOn(agent,physobj) fluent(sittingOn(agent,physobj)). %; agent is standing. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',211). % fluent Standing(agent) fluent(standing(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',213). %; agent is lying down. % fluent Lying(agent) fluent(lying(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',213). %; agent is sitting. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',216). % fluent Sitting(agent) fluent(sitting(agent)). % noninertial Lying :- call_pel_directive(noninertial(lying)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',218). % noninertial Sitting :- call_pel_directive(noninertial(sitting)). %; At any time, an agent is either lying, sitting, or standing: % xor Lying, Sitting, Standing :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',220). xor([lying,sitting,standing]). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',223). % [agent,physobj,time] % HoldsAt(LyingOn(agent,physobj),time) -> % HoldsAt(Lying(agent),time). holds_at(lyingOn(Agent, Physobj), Time) -> holds_at(lying(Agent), Time). % [agent,physobj,time] % HoldsAt(SittingOn(agent,physobj),time) -> % HoldsAt(Sitting(agent),time). holds_at(sittingOn(Agent, Physobj), Time) -> holds_at(sitting(Agent), Time). %; State constraints represent that an agent can lie or sit %; on at most one object at a time: % [agent,physobj1,physobj2,time] % HoldsAt(LyingOn(agent,physobj1),time) & % HoldsAt(LyingOn(agent,physobj2),time) -> % physobj1=physobj2. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',233). holds_at(lyingOn(Agent, Physobj1), Time), holds_at(lyingOn(Agent, Physobj2), Time) -> Physobj1=Physobj2. % [agent,physobj1,physobj2,time] % HoldsAt(SittingOn(agent,physobj1),time) & % HoldsAt(SittingOn(agent,physobj2),time) -> % physobj1=physobj2. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',239). holds_at(sittingOn(Agent, Physobj1), Time), holds_at(sittingOn(Agent, Physobj2), Time) -> Physobj1=Physobj2. %; An effect axiom states that if an agent is standing and %; lies on a physical object, the agent will be lying on %; the physical object: % [agent,physobj,time] % HoldsAt(Standing(agent),time) -> % Initiates(LieOn(agent,physobj), % LyingOn(agent,physobj), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',246). holds_at(standing(Agent), Time) -> initiates_at(lieOn(Agent, Physobj), lyingOn(Agent, Physobj), Time). %; An effect axiom states that if an agent %; lies on a physical object, the agent will no longer %; be standing: % [agent,physobj,time] % Terminates(LieOn(agent,physobj), % Standing(agent), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',255). terminates_at(lieOn(Agent,Physobj), standing(Agent), Time). %; An effect axiom states that if an agent is standing and %; sits on a physical object, the agent will be sitting on %; the physical object: % [agent,physobj,time] % HoldsAt(Standing(agent),time) -> % Initiates(SitOn(agent,physobj), % SittingOn(agent,physobj), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',263). holds_at(standing(Agent), Time) -> initiates_at(sitOn(Agent, Physobj), sittingOn(Agent, Physobj), Time). %; An effect axiom states that if an agent %; sits on a physical object, the agent will no longer %; be standing: % [agent,physobj,time] % Terminates(SitOn(agent,physobj), % Standing(agent), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',272). terminates_at(sitOn(Agent,Physobj), standing(Agent), Time). %; An effect axiom states that if an agent %; is sitting or lying on a physical object and %; the agent rises from the physical object, %; the agent will be standing: % [agent,physobj,time] % (HoldsAt(SittingOn(agent,physobj),time) | % HoldsAt(LyingOn(agent,physobj),time)) -> % Initiates(RiseFrom(agent,physobj), % Standing(agent), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',281). holds_at(sittingOn(Agent, Physobj), Time);holds_at(lyingOn(Agent, Physobj), Time) -> initiates_at(riseFrom(Agent, Physobj), standing(Agent), Time). %; An effect axiom states that if an agent is sitting on %; a physical object and the agent rises from the physical %; object, the agent will no longer be sitting on the %; physical object: % [agent,physobj,time] % HoldsAt(SittingOn(agent,physobj),time) -> % Terminates(RiseFrom(agent,physobj), % SittingOn(agent,physobj), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',292). holds_at(sittingOn(Agent, Physobj), Time) -> terminates_at(riseFrom(Agent, Physobj), sittingOn(Agent, Physobj), Time). %; An effect axiom states that if an agent is lying on %; a physical object and the agent rises from the physical %; object, the agent will no longer be lying on the %; physical object: % [agent,physobj,time] % HoldsAt(LyingOn(agent,physobj),time) -> % Terminates(RiseFrom(agent,physobj), % LyingOn(agent,physobj), % time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',302). holds_at(lyingOn(Agent, Physobj), Time) -> terminates_at(riseFrom(Agent, Physobj), lyingOn(Agent, Physobj), Time). %; dressing %; agent gets undressed. % event GetDressed(agent) :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',310). event(getDressed(agent)). %; agent gets dressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',313). % event GetUndressed(agent) event(getUndressed(agent)). %; agent is dressed. :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',315). % fluent Dressed(agent) fluent(dressed(agent)). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',317). %; Effect axioms deal with getting dressed and undressed: % [agent,time] % Initiates(GetDressed(agent),Dressed(agent),time). initiates_at(getDressed(Agent),dressed(Agent),Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',319). % [agent,time] % Terminates(GetUndressed(agent),Dressed(agent),time). terminates_at(getUndressed(Agent), dressed(Agent), Time). :-was_s_l('/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.e',321). %; End of file. :- call_pel_directive(translate(ending, '/pack/logicmoo_ec/ext/ec_sources/ecnet/Sleep.pel')).