% This is lecture no. 2 of MH1300/: Foundations Of Mathematics.

\chapter{The Logic of Compound Statements}

\section{Logical Form and Logical Equivalence}

\begin{definition}
	Statement / Proposition.
	A statement or proposition is a sentence that is true of false but not both. They can be used interchangeably.
\end{definition}

\begin{exmp}
	Are these statements?
	\begin{itemize}
		\item The cover of this book. NOT TRUE. Sentence does not propose anything.
		\item I like the design of these notes. TRUE. Sentence can be true or false.
		\item This statement is false. NOT TRUE. Sentence is paradoxical, cannot be true or false, therefore is not a statement.
	\end{itemize}
\end{exmp}

\subsection{Negation}

\begin{definition}
	Negation.
	Let $p$ be a statement variable.
	\begin{itemize}
		\item Then $\lnot p$ is `not $p$'.
		\item It is called the negation of $p$.
		\item If $p$ is true, then $\lnot p$ is false; if $p$ is false, then $\lnot p$ is true.
	\end{itemize}
\end{definition}

This table is known as a truth table; it shows the value of $\lnot p$ given a value of $p$:

\begin{center}
	\begin{tabular}{c | c}
		$p$ & $\lnot p$\\
		\hline
		True & False \\
		False & True \\
	\end{tabular}
\end{center}

It is better to use examples.
\bigbreak

\begin{exmp}
	Suppose $p$ is the proposition $\sqrt{2}$ is irrational.

	What is $\lnot p$?
	\begin{itemize}
		\item $\sqrt{3}$ is irrational. $\times$
		\item Every other number is irrational except $\sqrt{2}$. $\times$
		\item $\sqrt{2}$ is not irrational. \checkmark
		\item $\sqrt{2}$ is rational. \checkmark
	\end{itemize}
\end{exmp}

\subsection{Conjunction $\land$ and Disjunction $\lor$}

Let $p$ and $q$ be statement variables.
\begin{itemize}
	\item The \textbf{conjunction} of $p$ and $q$ is `$p$ and $q$'.
	\item It is denoted by $p \land q$.
	\item The \textbf{disjunction} of $p$ and $q$ is `$p$ or $q$'.
	\item It is denoted by $p \lor q$.
\end{itemize}

\noindent
This is the truth table for conjunction $\land$:

\begin{center}
	\begin{tabular}{l r | c}
		$p$ & $q$ & $p \land q$\\
		\hline
		1 & 1 & 1\\
		1 & 0 & 0\\
		0 & 1 & 0\\
		0 & 0 & 0\\
	\end{tabular}
\end{center}

\noindent
This is the truth table for disjunction $\lor$:

\begin{center}
	\begin{tabular}{l r | c}
		$p$ & $q$ & $p \lor q$\\
		\hline
		1 & 1 & 1\\
		1 & 0 & 1\\
		0 & 1 & 1\\
		0 & 0 & 0\\
	\end{tabular}
\end{center}

\subsection{Logical Equivalence}

\begin{definition}
	Logical Equivalence.
	Two statement forms are logically equivalent if and only if they have identical truth values for each possible substitution of statements for their statement variables:
	\[
	p \equiv q
	.\] they have logically equivalent forms.
\end{definition}

To check if two statements are equivalent, check if their truth tables are the same.

\begin{definition}
	Tautology and Contradiction.

	A tautology is a statement form whose truth-table consists entirely of 1's. The statement is always true.

	A contradiction is a statement form whose truth-table consists entirely of 0's. The statement is always false.
\end{definition}

\noindent
Let $p$, $q$, and $r$ be three statement variables, $\mathbf{T}$ be a tautology, and $\mathbf{F}$ be a contradiction. The following equivalences hold:

\begin{center}
	\begin{tabular}{c|c}
		\hline
		Commutative laws & Associative laws\\
		$p \lor q \equiv q \lor p$ & $(p \land q) \land r \equiv p \land (q \land r)$\\
		$p \land q \equiv q \land p$ & $(p \lor q) \lor r \equiv p \lor (q \lor r)$\\
		\hline
		Distributive laws & Identity laws\\
		$p \land (q \lor r) \equiv (p \land q) \lor (p \land r)$ & $p \land \mathbf{T} \equiv p$\\
		$p \lor (q \land r) \equiv (p \lor q) \land (p \lor r)$ & $p \land \mathbf{F} \equiv p$\\
		\hline
		Negation laws & Idempotent laws\\
		$p \lor \lnot p \equiv \mathbf{T}$ & $p \lor p \equiv p$\\
		$p \land \lnot p \equiv \mathbf{F}$ & $p \land p \equiv p$\\
		\hline
		Universal bound laws & De Morgan's laws\\
		$p \lor \mathbf{T} \equiv \mathbf{T}$ & $\lnot (p \lor q) \equiv \lnot p \land \lnot q$\\
		$p \land \mathbf{F} \equiv \mathbf{F}$ & $\lnot (p \land q) \equiv \lnot p \lor \lnot q$\\
		\hline
		Absorption laws & Negations of $\mathbf{T}$ and $\mathbf{F}$\\
		$p \lor (p \land q) \equiv p$ & $\lnot \mathbf{T} \equiv \mathbf{F}$\\
		$p \land (p \land q) \equiv p$ & $\lnot \mathbf{F} \equiv \mathbf{T}$\\
		\hline
		\multicolumn{2}{c}{
			Double Negation
		}\\
		\multicolumn{2}{c}{
		$\lnot (\lnot p) \equiv p$
		}\\
		\hline
	\end{tabular}
\end{center}

\begin{exmp}
	Use logical equivalence to prove that:
	\[
		\lnot (\lnot p \land q) \land (p \lor q) \equiv p
	.\] 
	\begin{align*}
		\lnot (\lnot p \land q) \land (p \lor q) & \equiv (\lnot (\lnot p) \lor \lnot q) \land (p \lor q) \quad & \text{(De Morgan's Law)} \\
		 & \equiv (p \lor \lnot q) \land (p \lor q) \quad & \text{(Double Negation)} \\
		 & \equiv p \lor (\lnot q \land q) \quad & \text{(Distributive Law)} \\
		 & \equiv p \lor (q \land \lnot q) \quad & \text{(Commutative Law)} \\
		 & \equiv p \lor \mathbf{F} \quad & \text{(Negation Law)} \\
		 & \equiv p \quad & \text{(Identity Law)} \\
	\end{align*}
	This can also be proven using truth-tables.
\end{exmp}

\section{Conditional Statements}

\begin{definition}
	Conditional statements.
	Let $p$ and $q$ be statement variables. The conditional of $q$ by $p$ is:
	\begin{itemize}
		\item `If $p$ then $q$'
		\item or `$p$ implies $q$'
	\end{itemize}
	Denoted by:
	\[
	p \rightarrow q
	.\]
	It is false when $p$ is true and $q$ is false; otherwise, it is true.
	We call $p$ the premise (or hypothesis) of the conditional and $q$ the conclusion (or consequent).
\end{definition}

Truth table for $p \rightarrow q$:

\begin{center}
	\begin{tabular}{l r | c}
		$p$ & $q$ & $p \rightarrow q$\\
		\hline
		1 & 1 & 1\\
		1 & 0 & 0\\
		0 & 1 & 1\\
		0 & 0 & 1\\
	\end{tabular}
\end{center}

Note that:
\[
p \rightarrow q \equiv \lnot p \lor q
.\] 

\bigbreak

The negation of `if $p$ then $q$' is logically equivalent to $p$ and not $q$:
\[
	\lnot (p \rightarrow q) \equiv p \land \lnot q
.\] 

We show this by using truth-table or by logical equivalence:
\begin{align*}
	\lnot(p \rightarrow q) & \equiv \lnot(\lnot p \lor q)\\
			       & \equiv \lnot(\lnot p) \land (\lnot q) \quad & \text{(De Morgan's Law)}\\
			       & \equiv p \land \lnot q \quad & \text{(Double Negative)}\\
\end{align*}

\subsection{Contrapositive, Converse, \& Inverse Conditional \\ Statements}

\begin{definition}
	Contrapositive.
	The contrapositive of a conditional statement of the form `if $p$ then $q$' is:
	 \[
		 \text{if} \quad \lnot q \quad \text{then} \quad \lnot p
	.\] Symbolically, the contrapositive of $p \rightarrow q$ is $\lnot q \rightarrow \lnot p$.
\end{definition}

Note that these are defined operations on conditional statements.

\begin{definition}
	Converse \& Inverse.
	Let a conditional statement $p \rightarrow q$ be given.
	\begin{itemize}
		\item The converse is `if $q$ then $p$'
		\begin{itemize}
			\item Symbolically: $q \rightarrow p.$
		\end{itemize}
		\item The inverse is `if $\lnot q$ then $\lnot p$'
		\begin{itemize}
			\item Symbolically: $\lnot q \rightarrow \lnot p.$
		\end{itemize}
	\end{itemize}
\end{definition}

We can therefore see that:
\begin{align*}
	\text{Conditional Statement} & \not\equiv \text{Converse Statement} \\
	\text{Conditional Statement} & \not\equiv \text{Inverse Statement} \\
	\text{Converse Statement} & \equiv \text{Inverse Statement} \\
\end{align*}

\noindent
Let $p$ and $q$ be statements. Then the statment:
\[
	p \ \textbf{only if} \ q
.\]
means ``if not $q$ then not $p$", equivalently, ``if $p$ then $q$".
\[
	p \ \textbf{only if} \ q \not\equiv p \ \textbf{if} \ q
.\]

\subsection{Biconditionals}

\begin{definition}
	Biconditional.
	Let $p$ and $q$ be statement variables. Then the \textbf{biconditional of} $p$ and $q$ is `$p$ if and only if $q$ ', denoted by:
	\[
	p \leftrightarrow q
	.\]
	also abbreviated $p$ \textbf{iff} q.
	It is true if both $p$ and $q$ have the same truth values, fasle if $p$ and $q$ have opposite truth values.
\end{definition}

Truth table for $p \leftrightarrow q$ :
 
\begin{center}
	\begin{tabular}{l r | c}
		$p$ & $q$ & $p \leftrightarrow q$\\
		\hline
		1 & 1 & 1\\
		1 & 0 & 0\\
		0 & 1 & 0\\
		0 & 0 & 1\\
	\end{tabular}
\end{center}

\begin{exmp}
	$x$ divides $y$ if and only if $2x$ divides $2y$.
\end{exmp}

\bigbreak
\noindent
Order of operations:
\begin{enumerate}
	\item $\lnot$
	\item $\land , \lor$
	\item $\rightarrow , \leftrightarrow$
\end{enumerate}

\subsection{Necessary and Sufficient}

Let $r$ and $s$ be statements.
\begin{itemize}
	\item $r$ is a sufficient condition for $s$ means `if $r$ then $s$'.
	\item $r$ is a necessary condition for $s$ means `if not $r$ then not $s$'.
	\item $r$ is a necessary condition for $s$ also means `if $s$ then $r$'.
	\item $r$ is a necessary and sufficient condition for $s$ means `$r$ if and only if $s$'.
\end{itemize}

\section{Valid and Invalid Arguments}

An \textbf{argument} is a sequence of statements.
An \textbf{argument form} is a sequence of statement forms.
All statements in an argument and all statement forms in an argument form, except the final one, are called
\textbf{premises} (or \textbf{assumptions} or \textbf{hypotheses}).

The final statement or statement form is called the \textbf{conclusion}.
An argument form is \textbf{valid} means that no matter what particular statements are substituted for the statement variables in its premises, if the resulting premises are all true, then the conclusion is also true.

\subsection{Testing an argument from for validity}

\begin{enumerate}
	\item Identify the premises and conclusion of the argument form.
	\item Constrict a truth table showing the truth values of all the premises and the conclusion.
	\item Check the conclusion in each \textbf{critical row} (a row where all the premises are true).
		\begin{enumerate}
			\item If the conclusion is false at some critical row, the argument form is invalid.
			\item If conclusions at all critical rows are true, then the argument form is valid.
		\end{enumerate}
\end{enumerate}

\begin{exmp}
	Show that the following argument from is invalid:
	\begin{align*}
		p & \rightarrow q \lor \lnot r \\
		q & \rightarrow p \land r \\
		\therefore p & \rightarrow r
	\end{align*}
\end{exmp}

Solution:

\begin{center}
	\begin{tabular}{c c c || c c c || c c || c}
		\multicolumn{6}{c||}{} & \multicolumn{2}{| c ||}{Premises} & Conclusion \\
		\hline
		$p$ & $q$ & $r$ & $\lnot r$ & $q \lor \lnot r$ & $p\land r$ & $p \rightarrow q \lor \lnot r$ & $q \rightarrow p \land r$ & $p \rightarrow r$ \\
		\hline
		1 & 1 & 1 & 0 & 1 & 1 & 1 & 1 & 1 \\
		\hline
		1 & 1 & 0 & 1 & 1 & 0 & 1 & 0 &  \\
		\hline
		1 & 0 & 1 & 0 & 0 & 1 & 0 & 1 &  \\
		\hline
		1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 & 0 \\
	\end{tabular}
\end{center}

In the fourth row of the truth table, the premises are true, yet the conclusion is untrue, therefore the argument form is invalid.

\subsection{Special valid argument forms}

\begin{mdframed}
	\underline{Modus Ponens}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\rightarrow q\\
					       & p & \\
			\text{Conclusion:} \quad & \therefore q &
		\end{array}
	\end{equation*}
\end{mdframed}

\begin{mdframed}
	\underline{Modus Tollens}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\rightarrow q\\
					       & \lnot q & \\
			\text{Conclusion:} \quad & \therefore \lnot p &
		\end{array}
	\end{equation*}
\end{mdframed}

A rule of inference is a form of an argument that is valid.
\textit{Modus Ponens} and \textit{Modus Tollens} are examples of rules of inference.

\subsubsection{Rules of inference}

\begin{mdframed}
	\underline{Generalisation}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \\
			\text{Conclusion:} \quad & \therefore  p & \!\!\!\!\!\lor\, q
		\end{array}
	\end{equation*}
	\begin{exmp}
		Chan is the lecturer, therefore, Chan is a freshman or Chan is the lecturer.
	\end{exmp}
\end{mdframed}

\begin{mdframed}
	\underline{Specialisation}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\!\land\, q\\
			\text{Conclusion:} \quad & \therefore  p &
		\end{array}
	\end{equation*}
	\begin{exmp}
		Sam is a freshman and he is 21 years old.
		Therefore Sam is a freshman.
	\end{exmp}
\end{mdframed}

\begin{mdframed}
	\underline{Elimination}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\!\lor\, q\\
					       & \lnot q & \\
			\text{Conclusion:} \quad & \therefore  p &
		\end{array}
	\end{equation*}
	\begin{exmp}
		Suppose we know that:
		\[
			x-3 = 0 \quad \text{or} \quad x+2=0
		.\]
		Suppose we also know that $x\neq-2$.
		Therefore, we conclude that $x-3=0$.
	\end{exmp}
\end{mdframed}

\begin{mdframed}
	\underline{Transitivity}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\rightarrow q\\
					       & q & \!\!\!\!\rightarrow r\\
			\text{Conclusion:} \quad & \therefore  p & \!\!\!\!\rightarrow r
		\end{array}
	\end{equation*}
	\begin{exmp}
		If $x>a$, then $x>b$.
		If $x>a$, then $x>c$.
		$\therefore$ If $x>a$, then $x>c$.
	\end{exmp}
\end{mdframed}

\begin{mdframed}
	\underline{Proof by Division into Cases}
	\begin{equation*}
		\begin{array}{rrl}
			\text{Premises:} \quad & p & \!\!\!\!\!\lor\, q\\
					       & p & \!\!\!\!\rightarrow r\\
					       & q & \!\!\!\!\rightarrow r\\
			\text{Conclusion:} \quad & \therefore r &
		\end{array}
	\end{equation*}
	\begin{exmp}
		$x$ is positive or $x$ is negative.
		If $x$ is positive, then $x^2>0$.
		If $x$ is negative, then $x^2>0$.
		$\therefore x^2 > 0$.
	\end{exmp}
\end{mdframed}

\subsection{Fallacies}%
\label{sub:fallacies}

Converse Error:
\begin{equation*}
	\begin{array}{rrl}
		\text{Premises:} \quad & p & \!\!\!\!\rightarrow q\\
				       & q & \\
		\text{Conclusion:} \quad & \therefore p &
	\end{array}
\end{equation*}

Inverse Error:
\begin{equation*}
	\begin{array}{rrl}
		\text{Premises:} \quad & p & \!\!\!\!\rightarrow q\\
				       & \lnot p & \\
		\text{Conclusion:} \quad & \therefore \lnot q &
	\end{array}
\end{equation*}

\subsection{Contradictions and Valid Arguments}%
\label{sub:contradictions_and_valid_arguments}

\begin{definition}
	Contradiction Rule.
	Show that the supposition that the statement $p$ is false leads logically to a contradiction.
	Then we conclude that $p$ is true.
\end{definition}

Show that the following argument form is valid:
\begin{align*}
	\lnot p & \rightarrow \mathbf{F}, \text{where \textbf{F} is a contradiction}\\
	\therefore p &
\end{align*}
\begin{sol}
	Construct truth table:
	\begin{center}
		\begin{tabular}{c|cc|c|c}
			$p$ & $\lnot p$ & \textbf{F} & $\lnot p \rightarrow \textbf{F}$ & $p$ \\
			\hline
			1 & 0 & 0 & 1 & 1 \\
			0 & 1 & 0 & 0 & 0 \\
		\end{tabular}
	\end{center}
\end{sol}

