title: Create Prolog Vocabulary
body: <p>I am quite new to prolog, and I have some basic questions...</p>
  <p>I don't know if &quot;vocabulary&quot; is the right world in English, but I need to create one to describe an electronic circuit.</p>
  <p>My problem is, how do I create these functions and how I use the &quot;=&quot; statement since prolog doesn't seems do accept it?</p>
  <p>I'm using SWI Prolog.</p>
  <p>That's what I have to put in prolog:</p>
  <p>Decide the vocabulary (Predicates, functions, constants):</p>
  <p>Ports are represented by constants (X1, X2, ...) –</p>
  <p>Gate(X1)</p>
  <p>Type(X1) = Xor – types: AND, OR, XOR or NOT</p>
  <p>Circuits(C1)</p>
  <p>Terminals(x) – returns inputs and outputs of x</p>
  <p>In(1, X1) – function that returns first input of X1</p>
  <p>Out – function that returns output</p>
  <p>Arity(c, i, j) – function, circuit c has i inputs and j outputs</p>
  <p>Connected(Out(1, X1), In(1, X2)) - which ports are connected</p>
  <p>Signal(t) – signal value for terminal t.</p>
  <p>That's what I tried until now. I don't think my approach to the &quot;=&quot; is right...</p>
  <pre><code>gate(x1).
  gate(x2).
  gate(a1).
  gate(a2).
  gate(o1).
  type(x1, xor).
  type(x2, xor).
  type(a1, and).
  type(a2, and).
  type(o1, or).
  circuit(c1).
  </code></pre>
  <p>Should i use an predicate named Equal(X, Y) ?, like &quot;equal (type(x1), xor).</p>
  <p>How should I implement these?</p>
  <pre><code>Gate(X1) , Type(X1) = XOR
  Gate(X2) , Type(X2) = XOR
  Gate(A1) , Type(A1) = AND
  Gate(A2) , Type(A2) = AND
  Gate(O1) , Type(O1) = OR 
  </code></pre>
  <p>I don't know how to continue from here. All my approaches trying to implement the functions seems to be wrong (can't consult).</p>