Propositional Logic

Learning Objectives

Propositions and Basic Operations

A proposition is a sentence to which one and only one of the terms \(\texttt{True}\) or \(\texttt{False}\) can be applied.

Which of the following are propositions?

Propositions and Basic Operations

A proposition is a sentence to which one and only one of the terms \(\texttt{True}\) or \(\texttt{False}\) can be applied.

Which of the following are propositions?

Negation

A Truth Table for negation would look like the following:

\(\begin{array}{|c|c|} \hline p & \neg p \\ \hline T & F \\ F & T \\ \hline \end{array}\)

What this is saying is:
“When \(p\) is \(\texttt{True}\), \(\neg p\) is \(\texttt{False}\),
and when \(p\) is \(\texttt{False}\), \(\neg p\) is \(\texttt{True}\).’’

Conjunction

A Truth Table for conjunction would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \land q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & F \\ \hline \end{array}\)

Conjunction

A Truth Table for conjunction would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \land q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & F \\ \hline \end{array}\)

Disjunction

A Truth Table for disjunction would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \lor q \\ \hline T & T & T \\ T & F & T \\ F & T & T \\ F & F & F \\ \hline \end{array}\)

Disjunction

A Truth Table for disjunction would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \lor q \\ \hline T & T & T \\ T & F & T \\ F & T & T \\ F & F & F \\ \hline \end{array}\)

Exclusive Or

A Truth Table for exclusive or would look like the following: \(\begin{array}{|c|c|c|} \hline p & q& p \oplus q \\ \hline T & T & F \\ T & F & T \\ F & T & T \\ F & F & F \\ \hline \end{array}\)

Exclusive Or

A Truth Table for exclusive or would look like the following: \(\begin{array}{|c|c|c|} \hline p & q& p \oplus q \\ \hline T & T & F \\ T & F & T \\ F & T & T \\ F & F & F \\ \hline \end{array}\)

Conditionals

The conditional statement \(p \rightarrow q\) is False when \(p\) is \(\texttt{True}\) and \(q\) is \(\texttt{False}\), and True otherwise. \(p\) is called the hypothesis and \(q\) the conclusion. This can also be called implication.

Some English phrases for this would be:

Conditionals Continued

\(\begin{array}{|c|c|c|} \hline p & q & p \rightarrow q \\ \hline T & T & T \\ T & F & F \\ F & T & T \\ F & F & T \\ \hline \end{array}\)

Conditionals Continued

\(\begin{array}{|c|c|c|} \hline p & q & p \rightarrow q \\ \hline T & T & T \\ T & F & F \\ F & T & T \\ F & F & T \\ \hline \end{array}\)

Biconditionals

The biconditional statement (“if and only if” or “iff”) \(p \leftrightarrow q\) is \(\texttt{True}\) when \(p\) and \(q\) have the same truth value, and \(\texttt{False}\) otherwise.

A Truth Table for implication would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \leftrightarrow q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & T \\ \hline \end{array}\)

Biconditionals

The biconditional statement (“if and only if” or “iff”) \(p \leftrightarrow q\) is \(\texttt{True}\) when \(p\) and \(q\) have the same truth value, and \(\texttt{False}\) otherwise.

A Truth Table for implication would look like the following: \(\begin{array}{|c|c|c|} \hline p & q & p \leftrightarrow q \\ \hline T & T & T \\ T & F & F \\ F & T & F \\ F & F & T \\ \hline \end{array}\)

Order Of Operations

Everything else can be written as a combination of the above three, but in general, it’s best to always clarify order of operations using parentheses!

Logical Equivalences

Logical expressions that result in the same truth values are considered logical equivalences.

Common Logical Equivalences

\[\begin{array}{l l} \textbf{Commutative Laws} & p \lor q \equiv q \lor p \\ & p \land q\equiv q \land p \\ \hline \textbf{Associative Laws} & (p \lor q) \lor r \equiv p \lor (q \lor r) \\ & (p \land q) \land r\equiv p \land (q \land r)\\ \hline \textbf{Distributive Laws}& p \land (q \lor r) \equiv (p \land q ) \lor (p \land r)\\ & p \lor (q \land r) \equiv (p \lor q) \land (p \lor r) \\ \hline \textbf{Identity Laws} & p \lor F\equiv p\\ & p \land T \equiv p\\ \hline \textbf{Negation Laws} & p\land \neg p\equiv F\\ & p\lor \neg p\equiv T\\ \hline \textbf{Idempotent Laws}& p \lor p \equiv p\\ & p\land p \equiv p\\ \hline \textbf{Domination Laws}& p \land F \equiv F\\ & p \lor T \equiv T\\ \hline \textbf{Absorption Laws} & p \land (p\lor q)\equiv p\\ & p \lor (p \land q) \equiv p\\ \hline \textbf{DeMorgan's Laws} & \neg (p \lor q) \equiv (\neg p) \land (\neg q)\\ & \neg (p \land q) \equiv (\neg p) \lor (\neg q)\\ \hline \textbf{Double Negation Law} & \neg (\neg p)\equiv p\\ \hline \textbf{Implication} & p \implies q \equiv \neg p \lor q\\ \end{array}\]

Proving Equivalences

Logical Equivalences can be proven two different ways:

  1. Using Truth Tables
  2. Directly, using other logical equivalences

Proving Equivalences - Example 1

We can prove the first part of DeMorgan’s Law
(\(\neg (p \land q) \equiv \neg p \lor \neg q\)) using a truth table.

\(\begin{array}{|c|c|c|c|c|c|c|} \hline p & q & \neg p & \neg q & p \land q & \neg(p \land q) & \neg p \lor \neg q \\ \hline T & T \\ T & F \\ F & T \\ F & F \\ \hline \end{array}\)

Proving Equivalences - Example 1

We can prove the first part of DeMorgan’s Law
(\(\neg (p \land q) \equiv \neg p \lor \neg q\)) using a truth table.

\(\begin{array}{|c|c|c|c|c|c|c|} \hline p & q & \neg p & \neg q & p \land q & \neg(p \land q) & \neg p \lor \neg q \\ \hline T & T & F & F & T & F & F\\ T & F & F & T & F & T & T\\ F & T & T & F & F & T & T\\ F & F & T & T & F & T & T \\ \hline \end{array}\)

The columns for \(\neg(p \land q)\) and \(\neg p \lor \neg q\) are equal, so this means \(\neg(p \land q)\) and \(\neg p \lor \neg q\) are logically equivalent!

Proving Equivalences - Example 2

Prove \((a \land \neg b) \rightarrow c \equiv \neg a \lor b \lor c\) directly using existing logical equivalences. \[\begin{array}{|c|c|} \hline \textbf{Equivalence} & \textbf{Rule Used}\\ \hline (a \land \neg b) \rightarrow c & \textbf{Given} \\ \ldots \\ \equiv \neg a \lor b \lor c & \\ \hline \end{array}\]

Proving Equivalences - Example 2

Prove \((a \land \neg b) \rightarrow c \equiv \neg a \lor b \lor c\) directly using existing logical equivalences. \[\begin{array}{|c|c|} \hline \textbf{Equivalence} & \textbf{Rule Used}\\ \hline (a \land \neg b) \rightarrow c & \textbf{Given} \\ \hline & \\ \hline & \\ \hline & \\ \hline \end{array}\]

Proving Equivalences - Example 2

Prove \((a \land \neg b) \rightarrow c \equiv \neg a \lor b \lor c\) directly using existing logical equivalences. \[\begin{array}{|c|c|} \hline \textbf{Equivalence} & \textbf{Rule Used}\\ \hline (a \land \neg b) \rightarrow c & \textbf{Given} \\ \hline \equiv \neg (a \land \neg b) \lor c & \textbf{Implication} \\ \hline \equiv \neg a \lor \neg \neg b \lor c & \textbf{DeMorgan's} \\ \hline \equiv \neg a \lor b \lor c & \textbf{Double Negation}\\ \hline \end{array}\]

Other Considerations

propositions = \(\{p\}\)

truth values = \(\{\texttt{True}, \texttt{False}\}\)

Truth table:

\(\begin{array}{|c|} \hline p \\ \hline T \\ F \\ \hline \end{array}\)

2 rows…

Other Considerations

propositions = \(\{p, q\}\)

truth values = \(\{\texttt{True}, \texttt{False}\}\)

Truth table:

\(\begin{array}{|c|c|} \hline p & q \\ \hline T & T \\ T & F \\ F & T \\ F & F \\ \hline \end{array}\)

4 rows…

Other Considerations

propositions = \(\{p,q,...\}\) \(\leftarrow\) \(n\) propositions

truth values = \(\{\texttt{True}, \texttt{False}\}\)

?

Other Considerations

propositions = \(\{p,q,...\}\) \(\leftarrow\) \(n\) propositions

truth values = \(\{\texttt{True}, \texttt{False}\}\)

\(2^n\) rows!

Tautologies

\(\begin{array}{|c|c|c|} \hline p & \neg p & p \lor \neg p \\ \hline T & F & T \\ F & T & T \\ \hline \end{array}\)

For all values, \(p \lor \neg p\) evaluates to \(\texttt{True}\)!

Translating English Sentences

To translate logic to and from English sentences, it is important to know the common phrases for the operators.

Translating English Sentences

Here’s an example of breaking up an English language sentence.

Using Logic For Problem Solving

The rest of these slides are optional, but they demonstrate how logic can be used for problem solving!

Using Logic For Problem Solving

Knights and Knaves (Raymond Smullyan)

On an island, every inhabitant is a knight who always tells the truth, or a knave who always lies. You meet three inhabitants, Alice, Bob, and Chris.

Can you determine uniquely what each of Alice, Bob, and Chris are?

Using Logic For Problem Solving

Knights and Knaves (Raymond Smullyan)

  1. Define convenient variables for propositions.
  2. Transform what they say into statements that always should evaluate to \(\texttt{True}\). These are the rules of our world.
  3. Make a truth table – With 3 people, we have \(2^3\) rows
  4. Check if a unique row makes both statements true.

Using Logic For Problem Solving

Knights and Knaves (Raymond Smullyan)

\(1.\) Define convenient variables for propositions.

Using Logic For Problem Solving

\(2.\) Transform what they say into statements that always should evaluate to \(\texttt{True}\). These are the rules of our world.

Using Logic For Problem Solving

\(2.\) Transform what they say into statements that always should evaluate to \(\texttt{True}\). These are the rules of our world.

(Propositions:

\(\{A =\) “Alice is a knight”, \(B =\) “Bob is a knight”,\(C=\) “Chris is a knight”, \(\neg A =\) “Alice is a knave”, \(\neg B =\) “Bob is a knave”,\(\neg C=\) “Chris is a knave”})

Using Logic For Problem Solving

\(2.\) Transform what they say into statements that always should evaluate to \(\texttt{True}\). These are the rules of our world.

(Propositions:

\(\{A =\) “Alice is a knight”, \(B =\) “Bob is a knight”,\(C=\) “Chris is a knight”, \(\neg A =\) “Alice is a knave”, \(\neg B =\) “Bob is a knave”,\(\neg C=\) “Chris is a knave”})

Using Logic For Problem Solving

\(3.\) Make a truth table

Rules of the World: \(A \rightarrow (\neg B \lor C)\) and \(B \rightarrow (A \leftrightarrow \neg C)\)

\(\begin{array}{|c|c|c|c|c|} \hline A & B & C & A \rightarrow (\neg B \lor C) & B \rightarrow (A \leftrightarrow \neg C) \\ \hline T & T & T & T & F\\ T & T & F & F & T\\ \color{green}T & \color{green}F & \color{green}T & \color{green}T &\color{green}T\\ \color{green}T & \color{green}F & \color{green}F &\color{green} T &\color{green}T\\ \color{green}F & \color{green}T & \color{green}T & \color{green}T &\color{green}T\\ F & T & F & T &F\\ \color{green}F & \color{green}F & \color{green}T & \color{green}T &\color{green}T\\ \color{green}F & \color{green}F & \color{green}F & \color{green}T &\color{green}T\\ \hline \end{array}\)

Using Logic For Problem Solving

\(4.\) Check if a unique row makes both statements true.

\(\begin{array}{|c|c|c|c|c|} \hline A & B & C & A \rightarrow (\neg B \lor C) & B \rightarrow (A \leftrightarrow \neg C) \\ \hline T & T & T & T & F\\ T & T & F & F & T\\ \color{green}T & \color{green}F & \color{green}T & \color{green}T &\color{green}T\\ \color{green}T & \color{green}F & \color{green}F &\color{green} T &\color{green}T\\ \color{green}F & \color{green}T & \color{green}T & \color{green}T &\color{green}T\\ F & T & F & T &F\\ \color{green}F & \color{green}F & \color{green}T & \color{green}T &\color{green}T\\ \color{green}F & \color{green}F & \color{green}F & \color{green}T &\color{green}T\\ \hline \end{array}\)

All of the values in green are assignments that could work! Let’s test one of these!

Testing A Solution…

\(A = T, B = F, C = T\)

So, Alice is a knight, Bob is a knave, and Chris is a knight.

Both of our rules hold in this world with these assignments, so we know that this solution works!

Why this isn’t a good problem…

This problem isn’t explicit enough, so we found ourselves making an assumption.

When we solved it, we assumed that if someone is lying, they don’t actually know whether or not what they are saying is the truth, so their claim could either be true or false. This is why we were able to use implication.

However, what if we assumed that if someone is lying, they know their claim is false?

Why this isn’t a good problem…

If we assume that if someone is lying, they know their claim is false, then we would have to explain our rules using a biconditional.

Therefore, our answer is correct for what we assume the rules of the world are, but that might not match the author of the puzzle’s original intention. This shows the benefit of logic! We can use it to address these ambiguities!