2:- include('../ec_test_incl').    3
    4/*
    5   Test queries:
    6
    7*/
    8
    9% end_of_file.
   10
   11do_test(num_cakes(0)).
   12do_test(num_cakes(1)).
   13
   14do_test(G) :- G= neg(num_cakes(0)), abdemo_solve(G,R).
   15do_test(G) :- G= neg(num_cakes(1)), abdemo_solve(G,R).
   16
   17do_test(G) :- G= eat_cakes(0), abdemo_solve(G,R).
   18do_test(G) :- G= eat_cakes(1), abdemo_solve(G,R).
   19
   20%do_test(G) :- G= [happens(eat_cakes(1),now),holds_at(eat_cakes(0),now)], fail_solve_goal(G,R).
   21%do_test(G) :- G= [happens(eat_cakes(1),now),holds_at(eat_cakes(1),now)], abdemo_solve(G,R).
   22
   23do_test(G) :- G= {eat_cakes(1),num_cakes(0)}, abdemo_solve(G,R).
   24
   25do_test(G) :- G= {happens(eat_cakes(1),now),holds_at(num_cakes(1),start)}, abdemo_solve(G,R).
   26
   27do_test(G) :- G= {happens(eat_cakes(1),now),holds_at(num_cakes(1),now-1)}, abdemo_solve(G,R).
   28
   29do_test(G) :- G= {happens(eat_cakes(1),now),holds_at(num_cakes(0),aft)}, abdemo_solve(G,R).
   30
   31% rus out of stack but should just fail
   32% do_test(G) :- G= {happens(eat_cakes(1),start),holds_at(num_cakes(1),aft)}, abdemo_solve(G,R).
   33
   34fluent(num_cakes(integer)).
   35
   36axiom(initially(hypothesizing(num_cakes(1))),[]).
   37axiom(initially(hypothesizing(num_cakes(0))),[]).
   38
   39axiom(initially(num_cakes(1))).
   40
   41axiom(initiates(eat_cakes(1),num_cakes(0),T), [holds_at(num_cakes(1),T)]).
   42axiom(terminates(eat_cakes(1),num_cakes(N),T), [holds_at(num_cakes(N),T)]).
   43
   44%axiom(initiates(eat_cakes(0),num_cakes(0),T), [holds_at(num_cakes(0),T)]).
   45%axiom(initiates(eat_cakes(0),num_cakes(1),T), [holds_at(num_cakes(1),T)]).
   46
   47%axiom(initiates(imagine_initiates(Holds),Holds,T), [holds_at(neg(Holds),T),holds_at(hypothesizing(Holds),T)]).
   48%axiom(terminates(imagine_terminates(Holds),Holds,T), [holds_at(Holds,T),holds_at(hypothesizing(Holds),T)]).
   49
   50axiom(initiates(imagine_initiates(Propostion),Propostion,T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   51axiom(initiates(imagine_terminates(Propostion),neg(Propostion),T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   52axiom(initiates(imagine_initiates(neg(Propostion)),neg(Propostion),T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   53axiom(initiates(imagine_terminates(neg(Propostion)),Propostion,T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   54
   55axiom(terminates(imagine_initiates(Propostion),neg(Propostion),T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   56axiom(terminates(imagine_terminates(Propostion),Propostion,T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   57axiom(terminates(imagine_initiates(neg(Propostion)),Propostion,T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   58axiom(terminates(imagine_terminates(neg(Propostion)),neg(Propostion),T), [holds_at(hypothesizingAboutTruth(Propostion),T)]).
   59
   60/*
   61*/
   62%axiom(initiates(immagine_initiates(Holds),Holds,T), [holds_at(neg(Holds),T)]).
   63%axiom(terminates(immagine_terminates(Holds),Holds,T), [holds_at(Holds,T)]).
   64%axiom(releases(immagine_releases(Holds),Holds,T), [holds_at(Holds,T)]).
   65
   66axiom(holds_at(num_cakes(0),T),
   67     [holds_at(neg(num_cakes(1)),T)]).
   68
   69%axiom(holds_at(neg(num_cakes(0)),T),
   70%     [holds_at(num_cakes(1),T)]).
   71
   72axiom(holds_at(num_cakes(1),T),
   73     [holds_at(neg(num_cakes(0)),T)]).
   74
   75% Why causes loops?
   76%axiom(holds_at(neg(num_cakes(1)),T),
   77%     [holds_at(num_cakes(0),T)]):- fail.
   78
   79/* Abduction policy */
   80
   81abducible(dummy).
   82
   83executable(imagine_terminates(_)).
   84executable(imagine_initiates(_)).
   85%executable(make_cake(_)).
   86executable(eat_cakes(_)).
   87%executable(ignore_cakes(_)).