\documentclass{article}
\usepackage{amssymb, mathrsfs, enumitem}
\usepackage{tikz-cd}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{color}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{verbatim}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{amsmath, epsfig, colortbl}
\usepackage[breakable, skins]{tcolorbox}
\setlength{\parskip}{8pt}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{cor}{Corollary}
\theoremstyle{definition}
\newtheorem{prop}{Proposition}
\newtheorem{fact}{Fact}
\newtheorem{example}{Example}
\newtheorem{definition}{Definition}
\renewcommand{\today}{}

\newtcolorbox{examplebox}{ breakable, enhanced}

\addtolength{\topmargin}{-.875in}
\addtolength{\oddsidemargin}{-.8in}
\addtolength{\textwidth}{1.6in}
\addtolength{\textheight}{1.75in}


\newcommand{\abs}[1]{\left| #1\right|}
\newcommand{\la}{\Leftarrow}
\newcommand{\Ra}{\Rightarrow}
\renewcommand{\iff}{\Leftrightarrow}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\floor}[1]{\left\lfloor #1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil #1\right\rceil}

\newcommand{\ex}[1]{\begin{examplebox}\begin{example} #1 \end{example}\end{examplebox}}

\newcommand{\eps}{\epsilon}
\newcommand{\N}{\mathbb{N}}
\newcommand{\lilOh}[1]{\ensuremath{\mathit{o}\!\left(#1\right)}}

\newcommand{\ba}{\backslash}



\begin{document}
\title{Math 127: Propositional Logic}
\author{Mary Radcliffe}
\maketitle

\section{What is a proposition?}

The fundamentals of proofs are based in an understanding of logic. In order to consider and prove mathematical statements, we first turn our attention to understanding the structure of these statements, how to manipulate them, and how to know if they are true.

First, of course, we need a formal understanding of what the word ``statement'' means. 

\begin{definition}
A {\it proposition} is a statement to which it is possible to assign a value of either true or false. 
\end{definition}

\ex{Consider the statement \begin{quote} Mary Radcliffe is my 21-127 Professor.\end{quote}
This is a proposition. The statement has a truth value: in particular, if you are enrolled in this class, it is true, and if you are not, it is false. In any case, provided that we know who the ``me'' is that has issued the statement, we can assign it a truth value.}

\ex{Consider the statement \begin{quote} Mary Radcliffe has two children. \end{quote}
This is also a proposition. The statement has a truth value, it is either true or false. You may not know which truth value to assign to it, but that isn't relevant: it has a truth value nonetheless. 
}

The above two examples are demonstrative, but they don't seem very mathematical. Of course, we can easily correct that: here are some mathematical propositions:
\begin{itemize}
\item 2 is an even number.
\item 3 is an even number.
\end{itemize}

These are both propositions, since each of them has a truth value. One happens to be a true proposition, the second one false. But how about this one: 
\begin{quote}
$x$ is an even number.
\end{quote}

Is this a proposition? It's hard to say. Out of context, with no understanding of the variable $x$, we cannot assign this statement a truth value, so by itself, it doesn't seem to qualify. If, however, it existed in a context where $x$ had meaning, it could be a proposition. I give this example to stress, especially, the importance of definitions in mathematics. You may have noticed in your other math classes, and you will definitely notice here, that mathematicians are a bit obsessed with precision in defining terms. This is no accident: without precise definitions, we end up with the kind of unverifiable statements like the one above. Definitions are critical to writing mathematical proofs.

\section{Basic operators and Truth Tables}

In order to manipulate propositions, we will first introduce some means of performing arithmetic with them. In order to do so, we will represent propositions with variables such as $p, q, r$. We can then build an arithmetic structure to understand how to combine and relate propositions to each other.

\subsection{Conjunction}

Our first logical operator is conjunction, a fancy way to say ``and.''

\begin{definition}
Let $p$ and $q$ be propositions. The {\it conjunction} of $p$ and $q$, denoted by $p\wedge q$ is a proposition that is true when both $p$ and $q$ are true, and false in any other condition.
\end{definition}

This sounds a bit complicated, so let's disentangle this with a nonmathematical example.
\ex{
Consider the proposition 
\begin{quote}
John is an engineer and a runner.
\end{quote}
In order for this proposition to be true, two things need to BOTH be true. Namely, we need that John is an engineer AND that John is a runner. If we take $p$ to be the proposition ``John is an engineer'' and take $q$ to be the proposition ``John is a runner,'' then the above proposition can be represented as $p\wedge q$. Clearly, it is true only when both $p$ and $q$ are true; if either of them is false than $p\wedge q$ is certainly false as well.
}

Notice that the truth value of $p\wedge q$ is entirely dependent upon the truth values of $p$ and $q$. Moreover, each of $p$ and $q$ can only take the truth value of True or False, by definition. Hence, in general, we can look at the truth value of $p\wedge q$ in a general case by examining the various possibilities for $p$ and $q$, individually. We can do such a thing by considering what is known as a ``truth table:'' a table where we enumerate all possible truth values for $p$ and $q$.

 \begin{table}[htp]\centering\begin{tabular}{c|c||c} $p$ & $q$ & $p\wedge q$  \\ \hline T & T & T\\ T&F&F\\F&T&F\\F&F&F\end{tabular}\end{table} 

On the left of this table, we see the two propositions $p$ and $q$ that make up the conjunction $p\wedge q$, and all their possible truth values. To the right, we see $p\wedge q$, whose truth value is entirely determined based upon the values assigned to $p$ and $q$, and only can be true in the case that both $p$ and $q$ are true.

\subsection{Disjunction}

The second logical operator is disjunction, a fancy way to say ``or.''

\begin{definition}
Let $p$ and $q$ be propositions. The {\it disjunction} of $p$ and $q$, denoted by $p\vee q$, is a proposition that is true when at least one of $p$ or $q$ is true, and false if both $p$ and $q$ are false.
\end{definition}

Notice that this is not usually how we use the word ``or'' in English language. Often, when we say ``or'' we mean it to be exclusive. That is to say, if your friend asks ``Should we get Mexican or Thai for dinner?'' the response of ``Both'' is not usually available. Your friend's question uses an exclusive or: one thing, or the other, but not both. This is formalized as follows: 

\begin{definition}
Let $p$ and $q$ be propositions. The {\it exclusive disjunction} of $p$ and $q$, denoted by $p\ \dot\vee\ q$ or $p\oplus q$, is a proposition that is true when exactly one of $p$ or $q$ is true, and false in any other condition.
\end{definition}

You may have seen this if you've studied some computer science; in that context the exclusive disjunction is usually called ``xor.'' We can clearly see the difference between $p\vee q$ and $p\ \dot \vee\ q$ by considering a truth table that includes both propositions:

 \begin{table}[htp]\centering\begin{tabular}{c|c||c|c} $p$ & $q$ & $p\vee q$ & $p\ \dot\vee\ q$ \\ \hline T & T & T&F\\ T&F&T & T\\F&T&T & T\\F&F&F&F\end{tabular}\end{table} 

In much mathematical work, the nonexclusive disjunction is often more useful than the exclusive disjunction. We will rarely see $\dot \vee$ show up, and hence we will generally not use it much in developing our understanding of propositional logic. 

\subsection{Negation}

Our last basic logical operator is negation, a fancy way to say ``not.''

\begin{definition}
Let $p$ be a proposition. The {\it negation} of $p$, denoted $\neg p$, is a proposition that is true when $p$ is false, and false when $p$ is true.
\end{definition}

This operator is fairly straightforward: it simply takes the opposite truth value from $p$. A truth table for $\neg p$ takes the form:
\begin{table}[htp]\centering\begin{tabular}{c||c} $p$ & $\neg p$  \\ \hline T & F\\ F& T\end{tabular}\end{table}

We shall use, frequently, the fact that for any proposition $p$, we have $\neg \neg p$ is the same as $p$; that is, applying the negation operator twice does nothing to a proposition. 

\subsection{Propositional Formulae}

Armed with these three basic operations, we can now build more complex formulae to represent propositions. Let's take a look at an example, to begin.

\ex{\label{ex:basicform}Let $x$ be an integer. Consider the following proposition about $x$:
\begin{quote}
 $x$ is positive and odd, or $x$ is negative and odd.
\end{quote}

Let's consider how we can represent this as a propositional formula. Note that as with the above example about John, we are making multiple assertions about $x$, and combining them together. Lets give these assertions propositional variables:
\begin{quote}
$p$: $x$ is positive

$q$: $x$ is negative

$r$: $x$ is odd
\end{quote}

Hence, we can read our proposition as
\begin{quote}
$p$ and $r$, or $q$ and $r$
\end{quote}

Nice, now we can simply replace the words ``and'' and ``or'' with our symbolic representations $\wedge$ and $\vee$, and we should be on our way! We can now rewrite the proposition as
\begin{quote}
$(p\wedge r)\vee(q\wedge r)$
\end{quote}
}
Nice, so by combining the logical operators we have developed, we can represent much more complex propositions. These combinations are called propositional formulae. 

\begin{definition}
A {\it propositional formula} is a proposition constructed using propositional variables and logical operators.
\end{definition}

A quick note: as with arithmetic formulae, we should be attentive to the order of operations here. That is to say, we used some parentheses in our example above; were they necessary? Certainly the original meaning of the proposition intended to group ``positive and odd'' into one group, and ``negative and odd'' into a second group. In most technical cases, we take the following order of precedence for operations: 
\begin{enumerate}
\item $\neg$
\item $\wedge$
\item $\vee$
\item $\Ra$ (this will be discussed in Section \ref{sec:conditionals})
\item $\iff$ (this will also be discussed in Section \ref{sec:conditionals})
\end{enumerate}

Under these rules, we could have written our above proposition with no parentheses at all, since it is presumed that $\wedge$ takes precedence over $\vee$. 

But let's not be too hasty. I said above in {\it most} technical cases, but there are some writings that take $\wedge$ and $\vee$ to have {\it equal} precedence (like addition and subtraction in arithmetic). In that case, the meaning of our proposition would have been lost without parentheses. In general, I would recommend parenthesizing liberally here, so as not to confuse the reader as to which operations take priority in a given propositional formula. 

Now, let us return to the proposition that we developed in Example \ref{ex:basicform}, namely $(p\wedge r)\vee (q\wedge r)$. We can consider the possible truth values for this proposition using a truth table, as follows:

\begin{table}[htp]\centering
\begin{tabular}{c|c|c||c|c|c} $p$&$q$&$r$&$p\wedge r$ & $q\wedge r$ & $(p\wedge r)\vee (q\wedge r)$\\\hline
T&T&T&T&T&T\\
T&T&F&F&F&F\\
T&F&T&T&F&T\\
T&F&F&F&F&F\\
F&T&T&F&T&T\\
F&T&F&F&F&F\\
F&F&T&F&F&F\\
F&F&F&F&F&F
\end{tabular}
\end{table}

Notice that we have 3 columns to the left in the truth table, enumerating the various possibilities for the propositional variables $p$, $q$, and $r$. To the right, the column we care about is the last. We include the intermediary columns $p\wedge r$ and $q\wedge r$ simply to help us do the calculation; these columns are not necessary at all, and the truth table would be equally correct without them.

Now, thinking carefully about this proposition, notice that in both cases $p\wedge r$ and $q\wedge r$, we require proposition $r$ to be true for the conjunction to be true. This seems to suggest an alternative way to write our proposition: we need $r$, and at least one of $p$ or $q$, so perhaps it is equivalent to write the proposition as $r\wedge (p\vee q)$. But in order to determine whether this is truly the same, we need to know what it means for two propositions to be the same.

\begin{definition}
Two propositional formulae are called ``logically equivalent'' if the two propositions give the same truth value, regardless of the truth values of the propositional variables from which they are constructed.
\end{definition}

That is to say, the two propositions are logically equivalent (fancy math language for ``the same thing'') provided that no matter how we assign T/F to the variables $p$, $q$, $r$, we would expect to get the same truth value out from the propositional formulae. A really simplistic way of putting it: every row of the truth table for the two formulae should be the same. Since each row corresponds to a way to assign truth values to $p$, $q$, $r$, the two propositions are equivalent if they yield the same truth values on every row in the truth table. Examining this carefully for the example given, we find

\begin{table}[htp]\centering
\begin{tabular}{c|c|c||c|c|c|c|c} $p$&$q$&$r$&$p\wedge r$ & $q\wedge r$ & \cellcolor[gray]{0.8}$(p\wedge r)\vee (q\wedge r)$ & $p\vee q$ &\cellcolor[gray]{0.8} $r\wedge(p\vee q)$\\\hline
T&T&T&T&T&\cellcolor[gray]{0.8}T&T&\cellcolor[gray]{0.8}T\\
T&T&F&F&F&\cellcolor[gray]{0.8}F&T&\cellcolor[gray]{0.8}F\\
T&F&T&T&F&\cellcolor[gray]{0.8}T&T&\cellcolor[gray]{0.8}T\\
T&F&F&F&F&\cellcolor[gray]{0.8}F&T&\cellcolor[gray]{0.8}F\\
F&T&T&F&T&\cellcolor[gray]{0.8}T&T&\cellcolor[gray]{0.8}T\\
F&T&F&F&F&\cellcolor[gray]{0.8}F&T&\cellcolor[gray]{0.8}F\\
F&F&T&F&F&\cellcolor[gray]{0.8}F&F&\cellcolor[gray]{0.8}F\\
F&F&F&F&F&\cellcolor[gray]{0.8}F&F&\cellcolor[gray]{0.8}F
\end{tabular}
\end{table}

Notice that the two hilighted columns have the same truth values, and hence, as expected, the two logical formulae $(p\wedge r)\vee (q\wedge r)$ and $r\wedge(p\vee q)$ are logically equivalent. We use the notation $\equiv$ to denote logical equivalence, so we can write $(p\wedge r)\vee (q\wedge r) \equiv r\wedge(p\vee q)$.

\subsection{De Morgan's Laws and the Law of Excluded Middle}

We begin this section with a perhaps obvious theorem.

\begin{theorem}[Law of Excluded Middle]
Let $p$ be a proposition. Regardless of the truth value of $p$, $p\vee(\neg p)$ is always true.
\end{theorem}

\begin{proof}
To prove this theorem, we consider the following truth table:

\begin{table}[htp]\centering
\begin{tabular}{c||c|c}
$p$ & $\neg p$ & $p\vee(\neg p)$\\
\hline T & F & T\\
F & T & T
\end{tabular}
\end{table}
Notice that regardless of the truth value of $p$, we have that $p\vee (\neg p)$ is always true.
\end{proof}

Logically, this theorem makes perfect sense. For any statement, either the statement is true, or the statement is not true. There is no in between. This is an example of a tautology:

\begin{definition}
A propositional formula is called a {\it tautology} if the formula is true, regardless of the truth values of the propositional variables from which it is constructed. Such a formula may be referred to as ``tautologically true.''
\end{definition}

In general, then, it is very useful to be able to negate a proposition. Since we know that a proposition or its negation must be true, understanding how to negate will give us tools to write proofs (more on this later). Hence, it would be convenient to understand how negation interacts with conjunction and disjunction. This is precisely the content of De Morgan's Laws for propositional formulae.

\begin{theorem}[De Morgan's Laws]
Let $p, q$ be propositional variables. Then
\begin{enumerate}
\item $\neg(p\wedge q) \equiv (\neg p)\vee(\neg q)$
\item $\neg(p\vee q)\equiv (\neg p)\wedge (\neg q)$
\end{enumerate}
\end{theorem}

A full proof of this theorem is left as an exercise; each part can be completed by examining a truth table and observing that the two columns corresponding to the two propositional formulae are identical.

In plain English, the theorem is also apparent. Consider the first item, which state ``not ($p$ and $q$).'' In plain English, this means that it is not true that both $p$ and $q$ are true, so it must be true that at least one of them is false. That is, either not $p$ or not $q$. This is precisely the statement on the right hand side of the first item. The second item is similar.

Using De Morgan's Laws, we can manipulate propositional formulae without having to resort to truth tables, as follows:

\ex{Show that the propositional formula $(\neg p)\wedge (\neg(p\wedge q))$ is logically equivalent to $\neg p$.

Notice that, by De Morgan's Laws, we have
\begin{eqnarray*}
(\neg p)\wedge (\neg(p\wedge q))& \equiv &(\neg p)\wedge( (\neg p)\vee(\neg q) )
\end{eqnarray*}
Note that if $p$ is false, then $\neg p$ is true, so both $\neg p$ and $(\neg p)\vee (\neg q)$ are true, and hence $(\neg p)\wedge( (\neg p)\vee(\neg q) )$ is true. If $p$ is true, then $\neg p$ is false, and hence $(\neg p)\wedge( (\neg p)\vee(\neg q) )$ is false. Thus, the logical value of $\neg p$ is the same as the logical value of $(\neg p)\wedge( (\neg p)\vee(\neg q) )$, so \[\neg p \equiv (\neg p)\wedge( (\neg p)\vee(\neg q) ) \equiv (\neg p)\wedge (\neg(p\wedge q)).\] 
}

\section{Conditional and biconditional operators}\label{sec:conditionals}

The final logical operators we shall consider are conditional and biconditional operators, also called implication operators. 
\subsection{Conditional operator}
\begin{definition}
Let $p$ and $q$ be propositions. The proposition $p\Ra q$ is false if $p\wedge(\neg q)$ is true, and is true otherwise. The operator $\Ra$ is called the conditional operator, or implicative operator.
\end{definition}

Note that we read or speak the proposition $p\Ra q$ as ``$p$ implies $q$'' or ``if $p$, then $q$.'' In plain English, the proposition should be true if, whenever $p$ is true, we must have that $q$ is also true. Hence, the only way for the proposition to fail to be true is in the case that $p$ is true, but $q$ is not. Note that, by definition and De Morgan's Laws, we can write this as 
\[ p\Ra q \equiv \neg(p\wedge(\neg q)) \equiv (\neg p)\vee q,\]

so that $p\Ra q$ is true means either $p$ is false, or $q$ is true (or both). This explicitly excludes the case that $p$ is true and $q$ is false, as desired.

An important note here is that the truth value of $p\Ra q$ is true in the case that $p$ is false, regardless of what $q$ does. Let's consider an example to think about why this is so.
\ex{
Let $x$ be a positive integer. Consider the following proposition about $x$:
\begin{quote}
If $x$ is an odd prime, then $x\geq 3$.
\end{quote}
We can write this using propositional variables: define $p$ to be the proposition ``$x$ is an odd prime,'' and define $q$ to be the proposition ``$x\geq 3$.'' The proposition here states $p\Ra q$. It is clear that this proposition is true: anytime $p$ is true, obviously $q$ is also true.

\quad However, suppose we know that $p$ is false. What does that tell us? Well, it tells us that $x$ is not an odd prime. This gives us no information about whether or not $x\geq 3$: $x$ could be, for example, 2 or 4 (or lots of other numbers). Hence, if $p$ is false, the conditional statement $p\Ra q$ does not help us understand information about $q$. The statement only gives us information about $q$ in the circumstance that $p$ is true.
}

Perhaps this seems obvious to you now, but it is a common mistake in introductory proofs classes like this one for people to confuse what they know in a conditional proposition like this one, and to assume that if $p$ is false, then $q$ must also be false. As in the above example, that simply is not correct. 


\subsection{Biconditional Operator}

\begin{definition}
Let $p$ and $q$ be propositions. The proposition $p\iff q$ is true if $p$ and $q$ always have the same truth value. The operator $\iff$ is called the biconditional operator, or bi-implicative operator.
\end{definition}

We read or speak the biconditional proposition $p\iff q$ as ``$p$ if and only if $q$'' or ``$p$ is equivalent to $q$.''

Formally speaking, the biconditional operator is not fundamentally different from logical equivalence; that is, $p\iff q$ is true is the same thing as saying $p\equiv q$ is true. Indeed, some people use the symbol $\iff$ in place of the symbol $\equiv$ when determining if propositional formulae are logically equivalent. In the context of propositions requiring proof, however, it is common to use $\iff$ in place of $\equiv$, and to think of the biconditional statement as $(p\Ra q)\wedge (q\Ra p)$. The proof that $p\iff q$ is logically equivalent to $(p\Ra q)\wedge (q\Ra p)$ is left as an exercise. 






\end{document}