1:-include(library('ec_planner/ec_test_incl')).    2:-expects_dialect(pfc).    3 %  loading(always,'examples/Mueller2006/Chapter11/Lottery.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{OrtonyCloreCollins:1988,
   15%;   author = "Andrew Ortony and Gerald L. Clore and Allan M. Collins",
   16%;   year = "1988",
   17%;   title = "The Cognitive Structure of Emotions",
   18%;   address = "Cambridge",
   19%;   publisher = "Cambridge University Press",
   20%; }
   21%;
   22%; @book{Mueller:2006,
   23%;   author = "Erik T. Mueller",
   24%;   year = "2006",
   25%;   title = "Commonsense Reasoning",
   26%;   address = "San Francisco",
   27%;   publisher = "Morgan Kaufmann/Elsevier",
   28%; }
   29%;
   30
   31% option modeldiff on
   32:- set_ec_option(modeldiff, on).   33
   34% load foundations/Root.e
   35
   36% load foundations/EC.e
   37
   38% sort agent
   39==> sort(agent).
   40
   41% sort aboutevent
   42==> sort(aboutevent).
   43
   44% sort desirability: integer
   45==> subsort(desirability,integer).
   46
   47% agent Kate, Lisa
   48==> t(agent,kate).
   49==> t(agent,lisa).
   50
   51% aboutevent WinLotteryKate, WinLotteryLisa
   52==> t(aboutevent,winLotteryKate).
   53==> t(aboutevent,winLotteryLisa).
   54
   55% fluent Joy(agent,aboutevent)
   56 %  fluent(joy(agent,aboutevent)).
   57==> mpred_prop(joy(agent,aboutevent),fluent).
   58==> meta_argtypes(joy(agent,aboutevent)).
   59
   60% fluent Desirability(agent,agent,aboutevent,desirability)
   61 %  fluent(desirability(agent,agent,aboutevent,desirability)).
   62==> mpred_prop(desirability(agent,agent,aboutevent,desirability),
   63	       fluent).
   64==> meta_argtypes(desirability(agent,agent,aboutevent,desirability)).
   65
   66% fluent Believe(agent,aboutevent)
   67 %  fluent(believe(agent,aboutevent)).
   68==> mpred_prop(believe(agent,aboutevent),fluent).
   69==> meta_argtypes(believe(agent,aboutevent)).
   70
   71% fluent Like(agent,agent)
   72 %  fluent(like(agent,agent)).
   73==> mpred_prop(like(agent,agent),fluent).
   74==> meta_argtypes(like(agent,agent)).
   75
   76% fluent HappyFor(agent,agent,aboutevent)
   77 %  fluent(happyFor(agent,agent,aboutevent)).
   78==> mpred_prop(happyFor(agent,agent,aboutevent),fluent).
   79==> meta_argtypes(happyFor(agent,agent,aboutevent)).
   80
   81% event WinLottery(agent)
   82 %  event(winLottery(agent)).
   83==> mpred_prop(winLottery(agent),event).
   84==> meta_argtypes(winLottery(agent)).
   85
   86% event AddJoy(agent,aboutevent)
   87 %  event(addJoy(agent,aboutevent)).
   88==> mpred_prop(addJoy(agent,aboutevent),event).
   89==> meta_argtypes(addJoy(agent,aboutevent)).
   90
   91% event AddHappyFor(agent,agent,aboutevent)
   92 %  event(addHappyFor(agent,agent,aboutevent)).
   93==> mpred_prop(addHappyFor(agent,agent,aboutevent),event).
   94==> meta_argtypes(addHappyFor(agent,agent,aboutevent)).
   95
   96
   97% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:49
   98%; Sigma
   99% [agent,aboutevent,time]
  100% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:52
  101% Initiates(AddJoy(agent,aboutevent),Joy(agent,aboutevent),time).
  102axiom(initiates(addJoy(Agent, Aboutevent), joy(Agent, Aboutevent), Time),
  103    []).
  104
  105
  106% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:54
  107% [agent1,agent2,aboutevent,time]
  108% Initiates(AddHappyFor(agent1,agent2,aboutevent),
  109%           HappyFor(agent1,agent2,aboutevent),
  110%           time).
  111% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:57
  112axiom(initiates(addHappyFor(Agent1, Agent2, Aboutevent), happyFor(Agent1, Agent2, Aboutevent), Time),
  113    []).
  114
  115
  116% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:59
  117% [agent1,agent2,aboutevent,time]
  118% (agent1=Kate & aboutevent=WinLotteryKate) |
  119% (agent1=Lisa & aboutevent=WinLotteryLisa) ->
  120% Initiates(WinLottery(agent1),Believe(agent2,aboutevent),time).
  121% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:62
  122axiom(initiates(winLottery(Agent1), believe(Agent2, Aboutevent), Time),
  123    [equals(Agent1, kate), equals(Aboutevent, winLotteryKate)]).
  124axiom(initiates(winLottery(Agent1), believe(Agent2, Aboutevent), Time),
  125    [equals(Agent1, lisa), equals(Aboutevent, winLotteryLisa)]).
  126
  127
  128% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:64
  129%; Delta
  130% [agent,aboutevent,desirability,time]
  131% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:67
  132% !HoldsAt(Joy(agent,aboutevent),time) &
  133% HoldsAt(Desirability(agent,agent,aboutevent,desirability),time) &
  134% desirability=1 &
  135% HoldsAt(Believe(agent,aboutevent),time) ->
  136% Happens(AddJoy(agent,aboutevent),time).
  137% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:71
  138axiom(happens(addJoy(Agent, Aboutevent), Time),
  139   
  140    [ not(holds_at(joy(Agent, Aboutevent), Time)),
  141      holds_at(desirability(Agent,
  142                            Agent,
  143                            Aboutevent,
  144                            Desirability),
  145               Time),
  146      equals(Desirability, 1),
  147      holds_at(believe(Agent, Aboutevent), Time)
  148    ]).
  149
  150
  151% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:73
  152% [agent1,agent2,aboutevent,desirability1,desirability2,time]
  153% !HoldsAt(HappyFor(agent1,agent2,aboutevent),time) &
  154% HoldsAt(Desirability(agent1,agent2,aboutevent,desirability1),time) &
  155% desirability1=1 &
  156% HoldsAt(Desirability(agent1,agent1,aboutevent,desirability2),time) &
  157% desirability2=1 &
  158% HoldsAt(Like(agent1,agent2),time) &
  159% HoldsAt(Believe(agent1,aboutevent),time) &
  160% agent1 != agent2 ->
  161% Happens(AddHappyFor(agent1,agent2,aboutevent),time).
  162% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:82
  163axiom(happens(addHappyFor(Agent1, Agent2, Aboutevent), Time),
  164   
  165    [ not(holds_at(happyFor(Agent1, Agent2, Aboutevent),
  166                   Time)),
  167      holds_at(desirability(Agent1,
  168                            Agent2,
  169                            Aboutevent,
  170                            Desirability1),
  171               Time),
  172      equals(Desirability1, 1),
  173      holds_at(desirability(Agent1,
  174                            Agent1,
  175                            Aboutevent,
  176                            Desirability2),
  177               Time),
  178      equals(Desirability2, 1),
  179      holds_at(like(Agent1, Agent2), Time),
  180      holds_at(believe(Agent1, Aboutevent), Time),
  181      dif(Agent1, Agent2)
  182    ]).
  183
  184
  185% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:84
  186% Happens(WinLottery(Kate),0).
  187axiom(happens(winLottery(kate), t),
  188    [is_time(0)]).
  189
  190
  191% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:86
  192%; Psi
  193% [agent1,agent2,aboutevent,desirability1,desirability2,time]
  194% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:89
  195% HoldsAt(Desirability(agent1,agent2,aboutevent,desirability1),time) &
  196% HoldsAt(Desirability(agent1,agent2,aboutevent,desirability2),time) ->
  197% desirability1 = desirability2.
  198% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:91
  199axiom(Desirability1=Desirability2,
  200   
  201    [ holds_at(desirability(Agent1,
  202                            Agent2,
  203                            Aboutevent,
  204                            Desirability1),
  205               Time),
  206      holds_at(desirability(Agent1,
  207                            Agent2,
  208                            Aboutevent,
  209                            Desirability2),
  210               Time)
  211    ]).
  212
  213
  214% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:93
  215%; Gamma
  216% [agent,aboutevent]
  217 % !HoldsAt(Joy(agent,aboutevent),0).
  218 %  not(initially(joy(Agent,Aboutevent))).
  219% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:95
  220axiom(not(initially(joy(Joy_Param, Joy_Ret))),
  221    []).
  222
  223
  224% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:96
  225% [agent1,agent2,aboutevent]
  226 % !HoldsAt(HappyFor(agent1,agent2,aboutevent),0).
  227 %  not(initially(happyFor(Agent1,Agent2,Aboutevent))).
  228axiom(not(initially(happyFor(HappyFor_Param, _, HappyFor_Ret))),
  229    []).
  230
  231
  232% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:97
  233% [aboutevent]
  234 % !HoldsAt(Believe(Kate,aboutevent),0).
  235 %  not(initially(believe(kate,Aboutevent))).
  236axiom(not(initially(believe(kate, Believe_Ret))),
  237    []).
  238
  239
  240% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:98
  241% [aboutevent]
  242 % !HoldsAt(Believe(Lisa,aboutevent),0).
  243 %  not(initially(believe(lisa,Aboutevent))).
  244axiom(not(initially(believe(lisa, Believe_Ret))),
  245    []).
  246
  247
  248% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:99
  249% [agent1,agent2,time]
  250 % HoldsAt(Like(agent1,agent2),time).
  251holds_at(like(Agent1,Agent2),Time).
  252
  253
  254% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:101
  255% [time]
  256 % HoldsAt(Desirability(Lisa,Kate,WinLotteryKate,1),time).
  257holds_at(desirability(lisa,kate,winLotteryKate,1),Time).
  258
  259
  260% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:102
  261% [time]
  262 % HoldsAt(Desirability(Kate,Kate,WinLotteryKate,1),time).
  263holds_at(desirability(kate,kate,winLotteryKate,1),Time).
  264
  265
  266% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:103
  267% [time]
  268 % HoldsAt(Desirability(Lisa,Lisa,WinLotteryKate,1),time).
  269holds_at(desirability(lisa,lisa,winLotteryKate,1),Time).
  270
  271
  272% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:104
  273% [time]
  274 % HoldsAt(Desirability(Kate,Kate,WinLotteryLisa,0),time).
  275holds_at(desirability(kate,kate,winLotteryLisa,0),Time).
  276
  277
  278% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:105
  279% [time]
  280 % HoldsAt(Desirability(Kate,Lisa,WinLotteryLisa,0),time).
  281holds_at(desirability(kate,lisa,winLotteryLisa,0),Time).
  282
  283
  284% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:106
  285% [time]
  286 % HoldsAt(Desirability(Kate,Kate,WinLotteryLisa,0),time).
  287holds_at(desirability(kate,kate,winLotteryLisa,0),Time).
  288
  289
  290% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:107
  291% [time]
  292 % HoldsAt(Desirability(Kate,Lisa,WinLotteryKate,0),time).
  293holds_at(desirability(kate,lisa,winLotteryKate,0),Time).
  294
  295
  296% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:108
  297% [time]
  298 % HoldsAt(Desirability(Lisa,Lisa,WinLotteryLisa,0),time).
  299holds_at(desirability(lisa,lisa,winLotteryLisa,0),Time).
  300
  301
  302% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:109
  303% [time]
  304 % HoldsAt(Desirability(Lisa,Kate,WinLotteryLisa,1),time).
  305holds_at(desirability(lisa,kate,winLotteryLisa,1),Time).
  306
  307% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:111
  308% completion Happens
  309% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:112
  310==> completion(happens).
  311
  312% range time 0 3
  313% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:114
  314==> range(time,0,3).
  315
  316% range desirability -1 1
  317% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:115
  318==> range(desirability,-1,1).
  319
  320% range offset 1 1
  321% From /opt/logicmoo_workspace/packs_sys/small_adventure_games/prolog/ec_planner/examples/Mueller2006/Chapter11/Lottery.e:116
  322==> range(offset,1,1).
  323%; End of file.