% an example logic circuit

circuit(A, B, C, D) :-
  not(B, X),
  and(A, X, U),
  or(U, V, W),
  and(B, C, V),
  not(W, D).

% definitions of logic elements

and(0, 0, 0).
and(0, 1, 0).
and(1, 0, 0).
and(1, 1, 1).

or(0, 0, 0).
or(0, 1, 1).
or(1, 0, 1).
or(1, 1, 1).

not(0, 1).
not(1, 0).
