I have a program in swi-prolog and there is an operator (?) β that I met for the first time, and I donβt know what it does. There is a piece of code that I do not understand:
swf([PP->Q|F], [PP|L], X):- swf(F, L, X), axioms(X, PP->Q, F).
I found that when we have
X -> Y ; Z
then if X is true, then Y is executed, otherwise Z. But I do not see how this works in the case shown above.
Thanks in advance.
EDIT:
Honestly, this is part of the computer proof of Arrow's theorem (more precisely, of the base case), this is all the code (from the proof of proof theorem PROLOG, Kenryo Indo):
p(Q) :- permutation(Q, [a, b, c]). p((X, Y), Q) :- p(Q), append(_, [X|B], Q), member(Y, B). pp((Q1,Q2)) :- p(Q1), p(Q2). all_pp(L) :- findall(QQ, pp(QQ), L). axioms(arrow, V, F) :- p(Q), V=(PP->Q), pareto(V), iia(V, F). swf([], [], _). swf([PP->Q|F], [PP|L], X):- swf(F, L, X), axioms(X, PP->Q, F). swf(F, X) :- all_pp(L), swf(F, L, X). pp(XY, agree, (Q1,Q2)) :- p(XY, Q1), p(XY, Q2). pp((X, Y), opposite, (Q1, Q2)) :- p((X, Y), Q1), p((Y, X), Q2). pareto(PP->R) :- \+ (pp(XY, agree, PP), \+ p(XY, R)). dictator(J, F) :- member(J:PP, [1:(P, _), 2:(_, P)]), \+ (member(PP->R, F), pp(_, opposite, (P, R))). agree(+, XY, QQ) :- pp(XY, agree, QQ). agree(-,(X,Y), QQ) :- pp((Y, X), agree, QQ). iia(PP->R, F) :- \+ (F \= [], pp(XY, A, PP), member(QQ->S, F), pp(XY, A, QQ), \+ agree(_, XY, (R, S))).
However, I do not know how to treat β. There is a chain of use X-> Y: swf - axioms - Pareto and swf - iia - member.