CS计算机代考程序代写 % CPSC 312 2021 – Assignment 5 Solution

% CPSC 312 2021 – Assignment 5 Solution
% Copyright David Poole 2021. Do not redistribute.

% Question Two

% am(H,M) where H is an integer in [1,12] and M is integer in range [0,59]
% denotes the function H:M am.
% For example am(5,33) denotes 5:33am. am(12,30) denotes half-past midnight.
% am(11,59) denotes the time one minute before noon.

% pm(H,M) denotes the time H:M after noon.

% Note that midnight is am(12,00) and noon is pm(12,00).

% before(T1,T2) is true if time T1 is before time T2 in the same day.
before(am(_,_), pm(_,_)).
before(am(12,_),am(H2,_)) :-
H2<12. before(am(H1,_),am(H2,_)) :- H1