%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% Lxsameer's CV Latex class
% Copyright (C) 2022 Sameer Rahmani <lxsameer@gnu.org>
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

\documentclass{lxpresent}

\date{\today}
\title{Mathematics of Programming Languages}
\setep{02}{Basics of Logic}

\begin{document}
\maketitle

\begin{frame}{Why logic?}{}
  \begin{itemize}
  \item Logic serves as the backbone of computer science
  \item it provides the fundamental principles and tools necessary for understanding,
    designing, and building complex systems
  \item It forms the basis of logical reasoning, proofs, problem solving, and program correctness.
  \end{itemize}
\end{frame}


\begin{frame}{What is logic?}{}
  \begin{itemize}
  \item One of the key aspects of Mathematics is unambiguity
  \item The study of the principles of reasoning
  \item Logic is tool to remove ambiguity from our arguments and thoughts
  \item Most of the definitions of formal logic have been developed so that they agree with the
    natural or intuitive logic used by people.
  \item The difference between formal logic and intuitive logic exists to avoid ambiguity and obtain consistency.
  \item To put it simply logic is all about what counts as a good argument. A good argument is a valid argument. One that, preserves truth from premises to conclusion.
  \end{itemize}
\end{frame}

\begin{frame}{Arguments}{Propositional logic}
  \begin{itemize}
  \item An argument is a sequence of statements aimed at demonstrating the truth of an assertion.
  \item The assertion at the end of the sequence is called the \textbf{conclusion}.
  \item The preceding statements are called \textbf{premises}.
  \item As an example:\\
    \begin{flalign*}
      &\text{If} \overbrace{\text{Earth is a planet}}^{\textit{premise}} \text{then} \overbrace{\text{Earth is round}}^{\textit{conclusion}}\\
      &\text{Earth is a planet}\\
      \therefore \hspace{0.2em} &\text{Earth is round}.
    \end{flalign*}
  \end{itemize}
\end{frame}

\begin{frame}{Arguments}{Symbolic logic}
  \begin{itemize}
  \item In logic, the form of an argument is distinguished from its content.
  \item Logic, won't help you determine the intrinsic merit of an argument’s content.
  \item It will help you analyze an argument’s form to determine whether the truth of the conclusion follows \textit{necessarily} from the truth of the premises.
    \begin{flalign*}
      &\text{If} \overbrace{\text{Earth is a planet}}^{\textit{p}} \text{then} \overbrace{\text{Earth is round}}^{\textit{q}}\\
      &\overbrace{\text{Earth is a planet}}^{\textit{p}}\\
      \therefore \hspace{0.2em} &\overbrace{\text{Earth is round}}^{\textit{q}}.
    \end{flalign*}
\item Convension: We will use letters \textit{p}, \textit{q}, and \textit{r} to represent
component sentences.
  \end{itemize}
\end{frame}


\begin{frame}{Proposition}{}
  \begin{itemize}
  \item In any mathematical theory, new terms are defined by using those that have been
    previously defined. (E.g. A mathematical system)
  \item This process has to start somewhere
    \item In logic, the words \textbf{\textit{sentence}}, \textbf{\textit{true}}, \textbf{\textit{false}} are the initial
      undefined terms
  \item A \textbf{proposition} (or \textbf{statement}) is a sentence that is true or false but not both.
  \item For example:
    \begin{itemize}
    \item ``Earth is a planet'' (true)
    \item ``Earth is flat'' (false)
    \item $x + 5 > 0$ (Depends on the value of $x$)
    \item ``How are you?'' (not a proposition)

    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}{Compound propositions}{}
\begin{itemize}
\item We can use \textbf{logical connectives} to connect propositions together to form compound propositions.
\item For example:
  \begin{itemize}
  \item $\overbrace{\text{\say{Earth is a planet}}}^{\textit{p}}$ \textbf{or} $\overbrace{\text{\say{Sun is a planet}}}^{\textit{q}}$
  \item $\overbrace{\text{\say{Alice is at work}}}^{\textit{p}}$ \textbf{and} $\overbrace{\text{\say{Bob is at work}}}^{\textit{q}}$
  \item $\overbrace{\text{\say{Earth is \textbf{not} flat}}}^{\textit{p}}$
  \end{itemize}
\end{itemize}
\end{frame}

\begin{frame}{More symbols}{}
  Let's rewrite the propositions from before using symbolic variables:
  \begin{itemize}
  \item $\overbrace{\text{\say{Earth is a planet}}}^{\textit{p}}$ \textbf{or} $\overbrace{\text{\say{Sun is a planet}}}^{\textit{q}}$: ($p \lor q$)
  \item $\overbrace{\text{\say{Alice is at work}}}^{\textit{p}}$ \textbf{and} $\overbrace{\text{\say{Bob is at work}}}^{\textit{q}}$: ($p \land q$)
  \item $\overbrace{\text{\say{Earth is \textbf{not} flat}}}^{\textit{p}}$: ($\neg p$)
  \end{itemize}

\end{frame}
\begin{frame}{Contact}{}
  Please, share your thoughts and ideas or researches and papers that you want me to have a look at via:
  \begin{itemize}
  \item Comment section on \href{https://youtube.com/c/lxsameer}{youtube}
  \item \href{https://lxsameer.com}{https://lxsameer.com}
  \end{itemize}
  \end{frame}
\end{document}
