\documentclass{beamer}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{calc,decorations.markings,positioning,arrows.meta}

\tikzset{->-/.style={decoration={
  markings,
  mark=at position #1 with {\arrow{>}}},postaction={decorate}}}
  
\author{Tom Cuchta}
\title{}
\mode<presentation> {
\usetheme{Warsaw}
\setbeamertemplate{navigation symbols}{}
}
\begin{document}

\begin{frame}{Logic of identity}
A useful symbol is the equals sign ``$=$" which we will take to mean ``identical to". \\
\onslide<2->{\begin{center}``The sky is blue."\end{center}
Does not mean ``Sky=Blue" but rather that ``blue" is a property of ``sky".
Whereas \\
\onslide<3->{\begin{center}``$5$ is the sum of $2$ and $3$"\end{center}
Does mean ``$5=2+3$".}}
\end{frame}

\begin{frame}{Logic of identity}
The equality relation $a = b$ obeys... 
\begin{enumerate}
\item $(\forall x)(x=x)$ (``$=$ is reflexive")
\item $(\forall x)(\forall y)(x=y \wedge y=x)$ (``$=$ is symmetric")
\item $(\forall x)(\forall y)(\forall z)(((x=y) \wedge(y=z))\rightarrow x=z)$ (``$=$ is transitive")
\end{enumerate} 
\textbf{What we want:} the ability to use equality in deductions by using ``$=$" to make appropriate substitutions. \\
\textbf{\textit{note}:} sometimes ``$a \neq b$" is used to denote ``$\neg(a=b)$"
\end{frame}

\begin{frame}{Logic of identity}
We want to \textbf{avoid}: \\
\begin{center}\begin{tabular}{|lll|}
\hline
$\{1\}$ & (1) $x=y$ & Premise \\
$\{2\}$ & (2) $(\exists x)(\neg (x=y))$ & Premise \\
$\{1,2\}$ & (3) $(\exists x)(\neg (x=x))$ & 1 2 (\textbf{wrong} rule) \\
\hline
\end{tabular}\end{center} 
To fix it, we agree to only use ``substituting equal things" in formulas with \textit{no quantifiers} (pg. 103).
\end{frame}

\begin{frame}{Logic of identity}
Equality is also ``self-evident" in that we will always accept the statement that $x=x$ for any $x$ in any deduction. This is formalized (pg. 104): \\
\textbf{New rule of inference (Identity rule):} If $S$ is a formula with no quantifiers, then from $S$ and $t_1=t_2$ (or $t_2=t_1$), we may derive $T$, provided that $T$ results from $S$ by replacing one or more occurrences of $t_1$ in $S$ by $t_2$. Moreover, $t=t$ is derivable from the \textit{empty set of premises}. 
\end{frame}

\begin{frame}{Theories}
A \textbf{theory} $T$ is a set of premises (called axioms) along with a \textbf{deductive system} (i.e. our ``rules of inference"). Any formula that follows from the axioms is called a \textbf{theorem of $T$}.  \\
\vspace{1cm}
\textbf{The simplest theory:} No premises/axioms! The identity rule gives us everything we need. This is called a ``pure identity theory". 
\end{frame}

\begin{frame}{Pure identity theory}
Since we have no premises, the following deduction is valid: let us derive the formula $(x=x) \wedge (y=y)$ in ``pure identity theory": \\
\begin{center}\begin{tabular}{|lll|}
\hline
$\{\}$ & (1) $x=x$ & Identity Rule \\
$\{\}$ & (2) $y=y$ & Identity Rule \\
$\{\}$ & (3) $(x=x) \wedge (y=y)$ & 1 2 Adjunction \\
\hline
\end{tabular}\end{center}
This deduction \textit{proves} that ``$(x=x) \wedge (y=y)$" is a ``theorem of pure identity theory". 
\end{frame}

\begin{frame}{Pure identity theory}
Let us derive the following theorem of pure identity theory: $\neg(x=y) \wedge (y=z) \rightarrow \neg(x=z)$. \\
\begin{tabular}{|lll|}
\hline 
$\{1\}$ & (1) $\neg (x=y) \wedge (y=z)$ & Premise \\
$\{1\}$ & (2) $\neg(x=y)$ & 1 Simplification \\
$\{1\}$ & (3) $(y=z) \wedge \neg (x=y)$ & 1 Commutative Law of $\wedge$ \\
$\{1\}$ & (4) $y=z$ & 3 Simplification \\
$\{1\}$ & (5) $\neg(x=z)$ & 2 4 Identity Rule \\
$\{\}$ & (6) $\neg(x=y) \wedge (y=z) \rightarrow \neg(x=z)$ & 1 5 C.P. \\
\hline
\end{tabular}
\end{frame}

\begin{frame}{Pure identity theory}
Suppose that someone claims the following is a theorem of pure identity theory: \\
$$(x=y) \wedge \neg (y=z) \rightarrow (x=z).$$
Of course this is an invalid argument (so find an interpretation): let $\mathscr{U}=\{0,1\}$, let $x=y=0$ and $z=1$. Then the premises are all true (there are none) and the conclusion 
$$(x=y) \wedge \neg (y=z) \rightarrow (x=z)$$
is false.
\end{frame}

\begin{frame}{Inconsistent theory}
The inconsistent theory is given by the following axiom (premise): \\
$$(\exists x)(\neg x = x).$$
Not much else to say about it, but it exists! 
\end{frame}

\begin{frame}{First order arithmetic}
First order arithmetic is equipped with the predicates ``$+$", ``$\cdot$", and ``$S$" (``successor"). We introduce a special constant ``$0$" to our theory which will play a special role. \\
\vspace{1cm}
We will \textbf{not} have numbers like ``$1$", ``$2$", etc in first order arithmetic. All numbers will be written in terms of $S$ -- e.g. $S0$ ``is 1" and $SS0$ ``is $2$". \end{frame}



\begin{frame}{First order arithmetic}
\textbf{\underline{Axioms}} \\
\begin{enumerate}
\item $(\forall x)(0 \neq Sx)$ \onslide<2->{{\color{red}(zero is not the successor of anything)}}
\item $(\forall x)(\forall y)((Sx=Sy) \rightarrow (x=y))$ \onslide<2->{{\color{red} (if successors of $x$ and $y$ are equal, then $x$ and $y$ are equal)}}
\item $(\forall y)((y=0) \vee (\exists x)(Sx=y))$ \onslide<2->{{\color{red} (either $y=0$ or there is some $x$ such that $y=Sx$)}}
\item $(\forall x)(x+0=x)$ \onslide<2->{{\color{red} (how zero and addition interact)}}
\item $(\forall x)(\forall y)(x+Sy=S(x+y))$ \onslide<2->{{\color{red} (how addition and succession interact)}}
\item $(\forall x)(x \cdot 0=0)$ \onslide<2->{{\color{red} (how zero and multiplication interact)}}
\item $(\forall x)(\forall y)(x \cdot Sy=(x\cdot y)+x)$ \onslide<2->{{\color{red} (how multiplication and succession interact)}} \\
\item $(\forall x)(\forall y)(x+y=y+x)$ \onslide<2->{{\color{red} ($+$ is commutative)}}
\item $(\forall x)(\forall y)(x \cdot y = y \cdot x)$ \onslide<2->{{\color{red} ($\cdot$ is commutative)}}
\end{enumerate}
\end{frame}

\begin{frame}{First order arithmetic}
Prove that ``$S0+S0=SS0$" is a theorem of first order arithmetic. \\
\begin{tabular}{|lll|}
\hline
$\{\mathrm{Ax \hspace{2pt}} 5\}$ & (1) $(\forall y)(S0 + Sy) = S(S0+y)$ & Axiom 5 US \\
$\{\mathrm{Ax \hspace{2pt}} 5\}$ & (2) $S0 + S0 = S(S0+0)$ & 1 US \\
$\{\mathrm{Ax \hspace{2pt}} 4\}$ & (3) $S0+0=S0$ & Axiom 4 US \\
$\{\mathrm{Ax \hspace{2pt}} 4,5\}$ & (4) $S0+S0=SS0$ & 2 3 Identity Law \\
\hline
\end{tabular}
\end{frame}

\begin{frame}{First order arithmetic}
Prove that $SS0 \cdot SS0=SSSS0$. \\
\begin{tabular}{|lll|}
\hline
$\{\mathrm{A}7\}$ & (1) $(\forall y)(SS0\cdot Sy=(SS0 \cdot y)+SS0)$ & Axiom 7 US \\
$\{\mathrm{A}7\}$ & (2) $SS0 \cdot SS0 = (SS0 \cdot S0)+ SS0$ & 1 US \\
$\{\mathrm{A}7\}$ & (3) $SS0 \cdot S0 = (SS0 \cdot 0)+SS0$ & 1 US \\
$\{\mathrm{A}6\}$ & (4) $SS0 \cdot 0 =0$ & Axiom 6 US \\
$\{\mathrm{A}6,7\}$ & (5) $SS0 \cdot S0 = 0+SS0$ & 3 4 Identity \\
$\{\mathrm{A}8 \}$ & (6) $(\forall y)(SS0  +y = y+SS0)$ & Axiom 8 US \\
$\{\mathrm{A}8 \}$ & (7) $SS0 + 0 = 0 + SS0$ & 6 US \\
$\{\mathrm{A}4 \}$ & (8) $SS0 + 0 = SS0$ & Axiom 4 US \\
$\{\mathrm{A}6,7,8\}$ & (9) $SS0 \cdot S0 = SS0 + 0$ & 5 7 Identity \\
$\{\mathrm{A}4,6,7,8\}$ & (10) $SS0 \cdot SS0 = SS0 + SS0$ & 2 8 9 Identity \\
$\{\mathrm{A}5\}$ & (11) $(\forall y)(SS0+Sy=S(SS0+y)$ & Axiom 5 US \\
$\{\mathrm{A}5\}$ & (12) $SS0+SS0=S(SS0+S0)$ & 11 US \\ 
$\{\mathrm{A}5\}$ & (13) $SS0 + S0 = S(SS0+0)$ & 11 US \\
$\{\mathrm{A}4,5\}$ & (14) $SS0+S0=SSS0$ & 8 13 Identity \\
$\{\mathrm{A}4,5\}$ & (15) $SS0+SS0=SSSS0$ & 12 14 Identity \\
$\{\mathrm{A}4,5,6,7,8\}$ & (16) $SS0 \cdot SS0 = SSSS0$ & 10 15 Identity \\
\hline
\end{tabular}
\end{frame}

\end{document}
