You selected newcomb1.pl

/* newcomb problem */
% file: newcomb1.pl
% 15 Dec 2002.
% reference: Nozick, R. (1969). Newomb’s problem and two principles of choice.
% In N. Rescher et al. (eds.). Essays in Honor of Carl G. Hempel. 
% Reidel. pp. 114-146.

:- write(' To derive the one box solution, type either of bellow.'),nl,
	tab(3),write('rational_1a(A,B)'),nl,
	tab(3),write('rational_1b(A,B)'),nl,
	tab(3),write('rational_1c(A,B)'),nl,
	tab(3),write('rational_1d(A,B)'),nl,
	write(' And to derive the both box solution, type either of bellow.'),
	nl,
	tab(3),write('rational_2a(A,B,C)'),nl,
	tab(3),write('rational_2b(A,B,C)'),nl.


/*
% このプログラムは∞再帰
box1(10000000):-predicted([box1]).
box1(0):-predicted([box1,box2]).
box2(1000).
pay(P,[box1,box2]):-box1(X),box2(Y),P is X + Y.
pay(P,[box1]):-box1(P).
rational(P,S):-pay(P,S),\+pay(Q,_),Q>P.
predicted(S):-member(S,[[box1],[box1,box2]]),read(y),rational(_,S).
*/

% エイリアン(=完全予測マシン)による支払ルール
box1(10000000, predicted([box1])).
box1(0, predicted([box1,box2])).
box2(1000).
pay(P,[box1,box2]):-box1(X,predicted([box1,box2])),box2(Y),P is X + Y.
pay(P,[box1]):-box1(P,predicted([box1])).

% One Box 解を導くプログラム---backward induction
rational_1a(P,S):-pay(P,S),\+ (pay(Q,_),Q>P).
rational_1b(P,S):-pay(P,S),forall(pay(Q,_S1),Q=P).
rational_1d(P,S):-pay0(P,S,S),forall(pay0(Q,S,_Y),Q=P),
	collect_pay(S,Ps,Cf).
rational_2b(Ps,Cf,S):- 
	member(S,[[box1],[box1,box2]]),
	forall((pay0(P,S,X),pay0(Q,_S1,X)),Q=P),pay0(P,S,X),Ps),
	bagof((X->P),(pay0(P,T,X),T\=S),Cf).

%end 

return to front page.