Lecture 02 - Logic

Published

February 11, 2026

Goals

  • learn the three basic Boolean operators
  • produce truth tables for arbitrary Boolean expressions
  • produce Boolean expressions for arbitrary truth tables

How low will we go?

This isn’t a physics class, we won’t build any real hardware

We will be using a simulator

we will not be worrying about - resistors - voltage levels - current - inductance - how components are made

wires will either be on or off, which we will express as 0 or 1 or true or false or high or low OR, the wire can be “floating” (not connected) which we may express as U (in the simulator, we will also sometimes see error states when we do something wrong)

So, our base level of abstraction will be one where everything can be one of two values

Note

While the use of two value logic is now standard, this is not the only way. In the early days, voltage levels and continuous signals were used to get a greater range of values.

There are actually some folks experimenting with this approach to build “Analog AI” chips which are hugely faster and more efficient than digital chips for handling networks of weighted averages (i.e., neural networks).

To help us reason about this, we turn to George Boole’s system of mathematics for two values intended for reasoning about logic – now known as Boolean Algebra

Boolean Algebra has three operators - AND - OR - NOT

We can use truth tables to enumerate all possible values of a Boolean expression, so the easiest way to describe our three operations is to look at their truth tables

AND

A B A•B
0 0 0
0 1 0
1 0 0
1 1 1
NoteWriting AND in an expression

AND working something like multiplication when we write it out. We can use the operator, or if we omit the operator, it is implied, so \(A \cdot B = AB\). Unlike multiplication, however, we never use the \(\times\) operator.

OR

A B A+B
0 0 0
0 1 1
1 0 1
1 1 1

NOT

A A’
0 1
1 0
NoteWriting negation

You will also see two different ways to write negation. The traditional form is to use a bar over the top: \(\overline{A}\). However, as this is difficult to type without a text layout tool like LaTex, we also use an apostrophe: \(A'\). These are equivalent notations.

The traditional form places a bar over the portion of the expression to be negated: \(f = A \cdot \overline{BC}\). This would be read as f equals A AND NOT B AND C.

Since this is difficult to write without using a typesetting tool like LaTex, we will use the apostrophe instead and write \(f = A \cdot (BC)'\). These two are equivalent, but notice that we need to use parentheses to negate anything beyond a single variable.

Boolean expressions

We can compose these operations together to make more complex expressions

A • (A•B)'

To evaluate this, we can write a truth table enumerating all possible values for A and B To make our lives easier, we can write out the intermediate expressions as we go

A B A•B (A•B)’ A • (A•B)’
0 0 0 1 0
0 1 0 1 0
1 0 0 1 1
1 1 1 0 0
CautionWriting negation in expressions

We have to be a little careful with how we negate multi-variable expressions versus single variables depending on which negation style we chose. To negate a multi-variable expression with an apostrophe, we need to use parentheses. \((A \cdot B)'\) is “NOT (A AND B)”, while \(A \cdot B'\) is “A AND (NOT B)”. This is true even if we use implicit AND. \(AB'\) is still “A AND (NOT B)”.

On the other hand, if we use the line on top, then it can cover the expression. \(\overline{A \cdot B}\) and \(\overline{AB}\) are both “NOT (A AND B)”. With the bar, what we have to look out for is the difference between \(\overline{A \cdot B}\) (“NOT (A AND B)”) and \(\overline{A} \cdot \overline{B}\) (“(NOT A) AND (NOT B)”), which can come down to paying close attention to the gaps.

We can work in the other direction as well and take a truth table and extract a Boolean expression from it

A B F
0 0 0
0 1 1
1 0 1
1 1 0

To do this,

  • look for the rows in the table where the expression is true
  • write a Boolean expression that expresses each row (it will only use AND and NOT)
  • OR the expressions together

You are literally saying the function is true when this condition is true OR this condition is true etc…

f = AB' + A'B

This particular expression is a special one – it is the exclusive OR, usually written XOR (or \(A \oplus B\)) “one or the other, but not both”.

The general term for this expression is the sum of products

let’s do a second one: “should I work on 202 homework?”, with variables

    1. due tomorrow
    1. something else is due tomorrow
    1. I’m hungry
D S H f
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0

There are some potentially controversial choices in this table…

f = D'S'H' + DS'H' + DSH'

While the function I created above may not be how you would design it, hopefully you can see that we can always write out a truth table for any logic function we can imagine (though the full enumeration does get a little tedious if we have a lot of variables).

Given the fact that we can extract a valid Boolean expression using only AND, OR and NOT from any truth table, we can say that any logic operation can be expressed using only these three operations.

Mechanical level

Skills

  • construct a truth table from a Boolean expression
  • construct a SOP Boolean expression from a truth table