I am very new to prolog. As per my knowledge Pure Prolog is restricted to Horn clauses. Here is a very simple prolog program -
% student( Snr , FirstName , LastName , Semester ).
student( 1000 , 'Anna' , 'Arm' , 'ti2' ) .
student( 1001 , 'Rita' , 'Reich' , 'ti2' ) .
student( 1002 , 'Peter' , 'Reich' , 'ti2' ) .
student( 1003 , 'Peter' , 'Petersen' , 'ti7' ) .
% course( Semester , Course ) .
course( 'ti2' , 'Mathe2' ) .
course( 'ti2' , 'Physics2' ) .
course( 'ti7' , 'pdv2' ) .
musttake(M,V,N,S,C) :- student(M,V,N,S), course(S,C).
musttakereverse(M,V,N,S,C) :- course(S,C), student(M,V,N,S).
My university slide says that even if we reverse the order of the goals in a rule in Pure Prolog, the order of the results should not be changed. In the above code, there are 2 rules that I have implemented. musttake
and musttakereverse
in which I have simply changed the order of the goals. So, according to the slides, the the order of the results should not be changes when running.
But, when I run the code, they give results in different orders.(As per my understanding the above program is in pure prolog
).
So, I would like to know if it's true that
Change of orders in Goal does not change the order of the result in Pure Prolog code.
Thanks!