Assume we are only looking at lists of Peano numbers. And lets assume pure_2 Prolog is not pure_1 Prolog with dif/2, but rather with pure_1 Prolog with when/2. Can we implement list intersection?
We would step back and pick up ideas from programming languages Gödel and Nu-Prolog. Thus for any needed if-then-else we would draw on this answer here. What would be:
/* pure_2 Prolog = pure_1 Prolog with when/2 */
intersect(A, B, C) :- ??
Note that nevertheless contrary to Gödel and Nu-Prolog, to adhere to pure_2 Prolog for this equestion here we would be not allowed to use ISO Prolog if-then-else (->;_). But we might use an apartness relation as demanded here.
A test case would be steadfastness:
?- intersect([s(0)], [0], X).
X = []
?- intersect([X], [Y], Z), X = s(0), Y = 0.
X = []
(Taking code from this and this)
Tests: