1% Basic Event Calculus 2 3%% Include the BASIC EVENT CALCULUS THEORY 4#include 'bec_theory.incl'. 5 6is_1_day_after(B, A) :- B #= A + 1.
9initiates(ends(A), it_is(B), _) :- 10 is_1_day_after(B, A). 11initiates(ends(1), is_liable_to_litigation(the_lender), A) :- 12 holdsAt(requested_on(the_borrower, 1000, 2), A), 13 not holdsAt(advanced_on(the_lender, 1000, _), 1). 14initiates(ends(2), is_terminated(the_agreement), _) :- 15 not holdsAt(requested_on(the_borrower, 1000, 2), 2). 16initiates(requests(the_borrower, A), requested_on(the_borrower, A, B), B). 17initiates(advances(the_lender, A), advanced_on(the_lender, A, B), B). 18initiates(ends(_), is_potentially_defaulted(B), A) :- 19 B=pays_to(C, D, E), 20 is_due_on_from_to(D, A, C, E), 21 holdsAt(it_is(F), F), 22 not holdsAt(paid_to_on(C, D, E, _), F). 23initiates(pays_to(A, B, C), paid_to_on(A, B, C, D), D). 24 25is_due_on_from_to(550, 4, the_borrower, the_lender). 26is_due_on_from_to(525, 5, the_borrower, the_lender).
30happens(ends(1), 1). 31happens(ends(2), 2). 32happens(requests(the_borrower, 1000), 2). 33 34?- holdsAt(F, T).