# Problem with Unification

#1

I’m using: SWI-Prolog version ???
8.0.2
I want the code to:
Well i have a function called ‘verifica_count’ wich verifies the content of a list of 3 and makes the necessarys unifications:
Exemple:

?- T = [1,_,1], verifica_count(T).

T = [1,0,1]

?- T = [1,1,1], verifica_count(T).

false

You get the point. The problem is not this.
On my other fuction i use this one. Its called aply_R1_triple(Triple,N_Triple), in wich Triple is the what is given and N_Triple should be the resolved Triple:
Exemple:
?- R = [0,,0], aply_R1_triple(R,T).
R = [0,
,0], T=[0,1,0]

But what im getting is :
R = T, T = [0,1,0].

Its unifying when i dont whant to. And im stuck in this.

My code looks like this:

aply_R1_triplo_aux([ ],N_Triplo,N_Triplo).

aply_R1_triplo_aux(_,X,N_Triplo) :-
verifica_count(X),
aply_R1_triplo_aux([ ],X,N_Triplo).

aply_R1_triplo(Triplo,N_Triplo) :-
aply_R1_triplo_aux(Triplo,Triplo,N_Triplo).

#2

This example is small enough you could walk through it on paper and see where the faulty unification is happening.