We will deal with *statements* that are either
**True** or **False**

For example

- The patient has an infection
- The antibiotic kills the bacteria
- It is raining
- I will win the lottery
- You will pass this course

Sometimes they are also called *propositions*

In math, when we want to make things general, we get rid of the “noise”, that is, the details that make things complicated and are not relevant to us.

In this case we are going to represent *statements* with
uppercase letters

- \(A\), \(B\), \(C\), …
- T means
**True**, F means**False**

We can change and modify statements to make new ones

We can say

- “the patient has an infection and the antibiotic kills the bacteria, but it is not raining”
- “You will pass this course or I will win the lottery”

The simplest way to change a statement is to negate it

For instance, if \[A\] means “It is raining”, then \[\text{not }A\] means “it is not raining”

There are several ways of combining two statements

The two more common are \[A\text{ and }B \qquad A\text{ or }B\]

The first one is sometimes called *conjunction*

The second one is called *disjunction*

As you can guess, \[A\text{ and
}B\] is true when both \(A\) and
\(B\) are **True**

**This is an important tool**

We can write all combinations of \(A\) and \(B\) and evaluate the value of \(A\text{ and }B\) in each case

\(A\) | \(B\) | \(A\text{ and }B\) |
---|---|---|

F | F | F |

F | T | F |

T | F | F |

T | T | T |

We will make many truth tables

**Exercise:** How many rows are needed for any truth
table?

It is easy to see that \[A\text{ and }B = B\text{ and }A\] (i.e. conjunction is commutative) \[(A\text{ and }B)\text{ and }C = A\text{ and }(B\text{ and }C)\] (i.e. conjunction is associative)

Since conjunction is associative we can write \[A\text{ and }B\text{ and }C\] without parenthesis, since there is no ambiguity

This expression will be true when *all* the statements are
**True**

**Exercise:** write the truth table so you can
convince that conjunction is commutative and associative

As you can guess, \[A\text{ or }B\]
is true when either \(A\) or \(B\) are **True**

**Exercise:** Write the truth table for
disjunction

Everyday language can be ambiguous. We may say

- You can eat
**or**drink - You can eat chicken
**or**pasta

In the first case you can do both.

In the second one you can only choose one

The last one is called *exclusive or*
(**xor**)

**Exercise:** Write the truth table for xor

It is easy to see that \[A\text{ or }B = B\text{ or }A\] (i.e. disjunction is commutative) \[(A\text{ or }B)\text{ or }C = A\text{ or }(B\text{ or }C)\] (i.e. disjunction is associative)

Since disjunction is associative we can write \[A\text{ or }B\text{ or }C\] without parenthesis, since there is no ambiguity

This complex expression will be true when *any* of the
statements is **True**

Notice that \[(A\text{ and }B)\text{ or }C\] is not the same as \[A\text{ and }(B\text{ or }C)\]

Thus, we need parenthesis when we combine “and” with “or”

**Exercise:** Write the truth table and verify that
they are different

So, what is \(A\text{ and }(B\text{ or }C)\)?

This is a little like \(A⋅(B+C)\)
which is equal to \(A⋅B + A⋅C\)

so we would expect a similar formula

Indeed, if we build the truth table, we can see that \[A\text{ and }(B\text{ or }C) = (A\text{ and }B)\text{ or }(A\text{ and }C)\]

**Exercise:** Write the truth table and verify that
they are the same

We have seen that \[A\text{ and }(B\text{ or }C) = (A\text{ and }B)\text{ or }(A\text{ and }C)\] which is similar to the formulas with numbers

But these are not numbers, so there are different formulas

For instance we also have \[A\text{ or }(B\text{ and }C) = (A\text{ or }B)\text{ and }(A\text{ or }C)\]

We can write \[\text{not }(A\text{ and }B)\] and see that it is different from \[(\text{not }A)\text{ and }B\] Again, we must be careful and use parenthesis

**Exercise:** Write the truth table and verify that
they are different

These two rules are super powerful

\[\begin{aligned} \text{not }(A\text{ and }B) &= (\text{not }A)\text{ or }(\text{not }B)\\ \text{not }(A\text{ or }B) &= (\text{not }A)\text{ and }(\text{not }B) \end{aligned}\]

In English

- The negation of a disjunction is the conjunction of the negations
- The negation of a conjunction is the disjunction of the negations

I assume that you know the basic ideas of sets

- If \(P\) is a set and \(x\) is an element of the set, then \(x∈P\)
- \(P∩Q\) is the intersection of sets \(P\) and \(Q\)
- \(P∪Q\) is the union of sets \(P\) and \(Q\)

For any set \(P\), the expression \[x∈P\] is a logical statement. Either true or false. Then \[\begin{aligned} x\not∈ P &= \text{not } (x∈P)\\ x∈P∩Q &= (x∈P)\text{ and } (x∈Q)\\ x∈P∪Q &= (x∈P)\text{ or } (x∈Q)\\ \end{aligned}\]

**not**is easy**and**is commutative and associative**or**is commutative and associative- Both are distributive, in both directions
- We can explore them with truth tables
- De Morgan’s Law is important. Learn it by hart
- Logic is the same as set theory, with different “packing”