I don't know how can I achieve the following:
I want to count the number of times a certain condition (whose values are unknown) is met.
For instance, if I have the lists [A1,A2,A3] and [B1,B2,B3], how can I
create a list [R1,R2,R3] where Ri is 1 if Ai=Bi and 0 if not.
This is the basis of the "program".
:- use_module(library(clpfd)).
main(A,B) :-
    length(A,3),
    domain(A,1,3),
    all_different(A),
    length(B,3),
    domain(B,1,3),
    all_different(B),
    append(A,B,L),
    labeling([],L).
				
                        
you should 'reify' your conditions, posting constraints of the form
reify(A,B,C) :- C #<==> A #= B.
between pairs of variables. maplist/3 it's an handy shortcut
yields