Hello,
In the following code, I was expecting the second test to fail because no facts of the dynamic ev/2 predicate were defined in t2, but the ev/2 facts are being shared by t1 and t2:
:- begin_tests(probability).
:- use_module(probability).
test(frequency) :-
t1:import(probability:ev/2),
t1:import(probability:f/3),
assert(t1:ev(coin_toss, heads)),
assert(t1:ev(coin_toss, tails)),
assertion(t1:f(heads, [], 0)),
assertion(t1:f(heads, [tails, tails], 0)),
assertion(t1:f(heads, [heads, tails], 1)),
assertion(t1:f(tails, [heads, tails], 1)),
assertion(t1:f(tails, [tails, heads, tails], 2)),
assertion(t1:f(tails, [tails, tails, tails], 3)).
test(probability) :-
t2:import(probability:ev/2),
t2:import(probability:p/3),
assertion(t2:p(heads, [], 0.0)),
assertion(t2:p(heads, [tails, tails], 0.0)),
assertion(t2:p(heads, [heads, tails], 0.5)),
assertion(t2:p(tails, [heads, tails], 0.5)),
assertion(t2:p(tails, [tails, heads, heads, heads], 0.25)),
assertion(t2:p(tails, [tails, tails, tails], 1.0)).
:- end_tests(probability).
Is there a way to isolate the facts of dynamic predicates in t1 and t2?
Thanks,
Quenio