You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. \tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]
  2. \begin{tikzpicture}[label distance=2mm]
  3. \node (a) at (0,0) {$a$};
  4. \node (b) at (0,-1) {$b$};
  5. \node (c) at (0,-2) {$c$};
  6. \node (z) at (6,-1) {$z$};
  7. \node (am) at (1,0) {};
  8. \node (bm) at (1,-1) {};
  9. \node[and gate US, draw, logic gate inputs=nn] at ($(2,-.5)$) (and1) {\tiny AND};
  10. \node[or gate US, draw, logic gate inputs=nn] at ($(4,-1)$) (or1) {\tiny OR};
  11. \node (and1m) at (3,-.5) {};
  12. \node (c1m) at (3,-2) {};
  13. \draw (a.east) -| (am.center) |- (and1.input 1);
  14. \draw (b.east) |- (bm.center) |- (and1.input 2);
  15. \draw (and1.output) |- (and1m.center) node[above] {$y$} |- (or1.input 1);
  16. \draw (c.east) |- (c1m.center) |- (or1.input 2);
  17. \draw (or1.output) -- (z);
  18. \end{tikzpicture}
  19. The inputs are denoted by $a$, $b$, and $c$ and the output is denoted by $z$.
  20. We assign temporary variable names to the inner wires; in this case we use $y$.
  21. Using these variables, we can create the propositional formula over the inputs and the output.
  22. %
  23. \begin{equation*}
  24. \begin{split}
  25. z & = y \lor c \\
  26. & = (a \land b) \lor c
  27. \end{split}
  28. \end{equation*}