Toggle navigation
?
users online
Logout
Open hangout
Open chat for current file
a(a,a). % 0000 false b(1,1). % 0001 P and Q c(1,0). % 0010 P and not Q d(1,_). % 0011 P e(0,1). % 0100 not P and Q f(_,1). % 0101 Q g(P,Q):-P\=Q. % 0110 P xor Q h(1,_). % 0111 P or Q h(0,1). i(0,0). % 1000 not P and not Q j(P,P). % 1001 P == Q k(_,0). % 1010 not Q m(P,Q):-P>=Q. % 1011 P or not Q n(0,_). % 1100 not P r(P,Q):-P=<Q. % 1101 not P or Q s(0,_). % 1110 not P or not Q s(1,0). t(_,_). % 1111 true runTest :- testPredicates([a,b,c,d,e,f,g,h,i,j,k,m,n,r,s,t], [[0,0], [0,1], [1,0], [1,1]]),!. testPredicates([], _). testPredicates([H|T], Inputs):- testPredicate(H, Inputs), testPredicates(T, Inputs). testPredicate(_, []). testPredicate(P, [H|T]) :- testPredForInput(P, H), testPredicate(P,T). testPredForInput(Pred, Args) :- append([Pred], Args, TermList), Term =.. TermList, write(Term), ( callTermWithArgs(Pred, Args), write(' is true'), nl, ! ; write(' is false'), nl ). callTermWithArgs(T, []) :- call(T). callTermWithArgs(T, [L|[]]) :- call(T, L). callTermWithArgs(T, [H|Tail]) :- callTermWithArgs(call(T, H), Tail).