delX(X,[X|T],T).
delX(X,[H|T],[H|L]):-delX(X,T,L).
%--- Hazfe Avalin Rokhdade X
countX(_,[],0):-!.
countX(X,[X|T],C):-countX(X,T,M),C is M+1,!.
countX(X,[_|T],C):-countX(X,T,C).
%--- Shomareshe Tedad X
majmoe(L):-im(L,L).
im([],_).
im([X|T],L):-countX(X,L,C),C=1,im(T,L).
%--- Liste L majmoe Hast Ya Kheyr
eshterak([],_,[]).
eshterak([H|A],B,[H|K]):-eshterak(A,B,K),member(H,B).
eshterak([_|A],B,K):-eshterak(A,B,K).
%--- eshterake majmoe A,B
tafazol([],_,[]).
tafazol([H|A],B,[H|K]):-tafazol(A,B,K),not(member(H,B)),!.
tafazol([_|A],B,K):-tafazol(A,B,K).
%--- tafazole majmoe A,B
ejtema([],B,B).
ejtema([H|A],B,[H|K]):-ejtema(A,B,K),not(member(H,B)),!.
ejtema([_|A],B,K):-ejtema(A,B,K).
%--- ejtemae majmoe A,B
jaygasht(X,A,J):-delX(X,J,A).
%------ jaygashte X dar Majmoe A
append([],B,B).
append([H|A],B,[H|C]):-append(A,B,C).
%------	append A + B
pfix(A,P):-append(P,_,A).
sfix(A,S):-append(_,S,A).
%--- pishvand va pasvand
eq([],[]).
eq([H|A],B):-member(H,B),delX(H,B,Bnew),eq(A,Bnew).













