Logic gates are special circuits built into computer chips.

They receive booleans, apply an operation, then output a boolean result.

We know from Section 2 that booleans are usually represented as True and False, but in this section we will be using 1 and 0 because we will be writing down a lot of boolean values.


There are four logic gates that you need to know.

The NOT gate receives one boolean input and outputs its opposite.

That means that NOT(1) is 0, and NOT(0) is 1

The AND gate receives two boolean inputs and checks if both of them are true.

That means that 1 AND 1 is 1, and any other combination of inputs will give 0.

The OR gate receives two boolean inputs and checks if either one of them is true.

That means that 0 OR 0 is 0, and any other combination of inputs will give 1.

The XOR gate (exclusive OR) receives two boolean inputs and checks if exactly one of them is true.

That means that 0 XOR 1 is 1; 1 XOR 0 is 1; 0 XOR 0 is 0; and 1 XOR 1 is 0.

You can think of XOR as checking for inequality: if it is given two different inputs it returns 1, but if the two inputs are the same, it returns 0.



What is (1 XOR 0) AND NOT(0 OR 1)?

This simplifies to 1 AND NOT(1), which is 1 AND 0, which is 0.