Something anomaly is there around maplist?

Something anomaly is there around maplist, or is this normal ? It seems that _S1 and _S5 are different.

% ?- X = [_S1, _S4, _S5],
%     _S1 = s(_S1, s(0, _S2)),
%     _S2 = s(_S2, _S2),
%     _S3 = s(_S3, 1),
%     _S4 = s(_S3, _S4),
%     _S5 = s(s(_S5, 0), _S5),
%	maplist(writeln, X).
%@ @(S_1,[S_1=s(S_1,s(0,S_2)),S_2=s(S_2,S_2)])
%@ @(S_2,[S_1=s(S_1,1),S_2=s(S_1,S_2)])
%@ @(S_1,[S_1=s(s(S_1,0),S_1)])
%@ X = [_S1, _S4, _S5], % where
%@     _S1 = s(_S1, s(0, _S2)),
%@     _S2 = s(_S2, _S2),
%@     _S3 = s(_S3, 1),
%@     _S4 = s(_S3, _S4),
%@     _S5 = s(s(_S5, 0), _S5),
%@ _S1 = s(_S1, s(0, _S2)),
%@ _S4 = s(_S3, _S4),
%@ _S5 = s(s(_S5, 0), _S5),
%@ _S2 = s(_S2, _S2),
%@ _S3 = s(_S3, 1).
% ?- X = [_S1, _S4, _S5],
%     _S1 = s(_S1, s(0, _S2)),
%     _S2 = s(_S2, _S2),
%     _S3 = s(_S3, 1),
%     _S4 = s(_S3, _S4),
%     _S5 = s(s(_S5, 0), _S5),
%		_S1 == _S5.
%@ false.

The first query returns as if _S1 == _S5 is the case, but the second one does _S1\== _S5.
This is my question. (In my blind calculation , the latter seems true.)

Don’t think it can be a problem with maplist which is implemented (eventually) as :

?- listing(maplist_).
apply:maplist_([], _).
apply:maplist_([Elem|Tail], Goal) :-
    call(Goal, Elem),
    maplist_(Tail, Goal).

but may be an issue with how writeln (and friends) display cyclic terms:

?- A=s(B,0), B=s(A,1), writeln(A), writeln(B).
@(S_1,[S_1=s(s(S_1,1),0)])
@(S_1,[S_1=s(s(S_1,0),1)])
A = s(s(A, 1), 0),
B = s(A, 1).

The variable ‘S_1’ in the two writeln output are not the same variable. Or was this not your issue?

I see, thanks. I have noticed that no underscore before S_x in the output display.