Skip to content
UoL CS Notes

Logic - 6

COMP109 Lectures

Boolean Functions

Below are two tables containing all the possible outputs and possible inputs of the two variables $P$ and $Q$. We should be able to deduce the function of $P$ and $Q$ that gives the results:

$P$ $Q$ $\bot$ $P\wedge Q$ $\neg(P\Rightarrow Q)$ $P$ $\neg(Q\Rightarrow P)$ $Q$ $\neg(P\equiv Q)$ $P\vee Q$
1 1 0 1 0 1 0 1 0 1
1 0 0 0 1 1 0 0 1 1
0 1 0 0 0 0 1 1 1 1
0 0 0 0 0 0 0 0 0 0
$P$ $Q$ $\neg(P\vee Q)$ $P\equiv Q$ $\neg Q$ $Q\Rightarrow P$ $\neg P$ $P\Rightarrow Q$ $\neg(P\wedge Q)$ $\top$
1 1 0 1 0 1 0 1 0 1
1 0 0 0 1 1 0 0 1 1
0 1 0 0 0 0 1 1 1 1
0 0 1 1 1 1 1 1 1 1

Logic Gates

  • AND, OR, NOT

    AND, OR  and NOT gates.

  • XOR

    XOR gate.

    This is the same as $\neg(\equiv)$

  • NAND, NOR, XNOR

    NAND, NOR and XNOR gates.

    XNOR is the same as $\equiv$.

Universality of NAND and NOR

Both the NAND and NOR gates can be used in place of any other gate. They also have their own symbols:

  • NAND (Sheffer Stroke)
    • $P\vert Q=\neg(P\wedge Q)$
  • NOR (Pierce Arrow)
    • $P\downarrow Q=\neg(P\vee Q)$

The universality means that they can be used as all gates:

  • $\neg P \equiv P\vert P$

    P NAND P = NOT P

  • $P\vee Q\equiv (P\vert P)\vert(Q\vert Q)$

    NAND gates can be used to make an OR gate.

  • $P\wedge Q\equiv (P\vert Q)\vert(P\vert Q)$

    NAND gates can be used to make an AND gate.

By using a single gate we can drive cost down through economy of scale.