You should read this document to get some inspiration :)
For instance, basic functions (i.e. gates) can be described like
and(0, 0, 0).
and(0, 1, 0).
and(1, 0, 0).
and(1, 1, 1).
xor(0, 0, 0).
...
and then combined to get more complex building blocks
fulladder(A, B, Carryin, Sum, Carryout):-
xor(A, B, X),
and(A, B, Y),
and(X, Carryin, Z),
xor(Carryin, X, Sum),
or(Y, Z, Carryout).
that compute the logic function:
?- fulladder(X, Y, Z, 0, 1).
X = 0, Y = 1, Z = 1 ? ;
X = 1, Y = 0, Z = 1 ? ;
X = 1, Y = 1, Z = 0 ? ;
no