\documentclass[noanswers,addpoints,10pt]{exam}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[most]{tcolorbox}
\usepackage{datetime}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{xltxtra}
\usepackage{listings}
\usepackage{listings-mips}

\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{makecell}
\usepackage{multicol}
\usepackage{multirow}

\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,decorations.pathmorphing,backgrounds,positioning,fit}
\usepackage{pgf-umlcd}

% compact itemized and then enumerated
\setlist{leftmargin=*,
  noitemsep,
  topsep=5pt,
  parsep=0pt,
  partopsep=0pt,
}

\setlist[enumerate]{leftmargin=*,
  itemsep=2pt,
  topsep=0pt,
  parsep=0pt,
  partopsep=0pt,
}


\usepackage{fontspec}
\setmainfont{Gentium Basic}
\setmonofont{Comic Code}[
  Scale          = 0.80,
  UprightFont    = *-Regular,
  ItalicFont     = *-Italic,
  BoldFont       = *-Bold,
  BoldItalicFont = *-Bold Italic
]

\lstset{
  language=[mips]assembler,
  basicstyle=\ttfamily\small,
}

\DeclareMathOperator{\limplies}{\Rightarrow}
\DeclareMathOperator{\liff}{\iff}
\DeclareMathOperator{\lxor}{\oplus}
\DeclareMathOperator{\qeq}{\overset{?}{=}}
\DeclareMathOperator{\modulus}{\mathbf{mod}}
\DeclareMathOperator{\even}{even}
\DeclareMathOperator{\odd}{odd}
\DeclareMathOperator{\ddiv}{|}
\DeclareMathOperator{\ndiv}{\not|}
\DeclareMathOperator{\contra}{\Rightarrow\mskip-\thinmuskip\Leftarrow}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\renewcommand{\P}[1]{\mathbb{P}(#1)}

\DeclareMathOperator{\vowel}{vowel}
\DeclareMathOperator{\consonant}{consonant}
\DeclareMathOperator{\isprime}{prime}
\DeclareMathOperator{\equals}{equals}
\DeclareMathOperator{\divides}{divides}

% classname
\newcommand\examNumber{Proving And/Or/Not Logically Complete}
\newcommand\semester{Spring 2024}
\newcommand\className{Computer Organization}
\newcommand\classNumber{CIS~356}
\newcommand\classFullName{\classNumber~\className}
\renewcommand{\dateseparator}{-}
\yyyymmdddate

% /classname

\pagestyle{headandfoot}
\firstpageheader{\classFullName\\\semester}{\examNumber\\~}{\today\\~}
\runningheader{\examNumber}{}{\today}
\begin{document}
\section*{Logically Complete}
\label{sec:org3eca696}
A \emph{set of logic gates} (or logic operators), \(L\), is \textbf{logically complete} if it can be used to build a logical circuit (or expression) that is \textbf{logicallly equivalent} to \emph{any} arbitrary logical circuit (or expression).

For any arbitrary \emph{logical circuit}, \(C\), there is a logical circuit, \(C'\), such that \(C \equiv C'\) and \(C'\) is constructed using \textbf{only} gates from \(L\).

\section*{Proving a Set of Gates is Logically Complete}
\label{sec:orgd1b96de}
\begin{itemize}
\item Approach (Reduction)
\label{sec:org6a0c5a3}

Give a \emph{canonical} set of logically complete gates, say \(LCG\), a \emph{different} set of gates, \(K\),  could be proven to be logically complete by showing that \(\forall g \in LCG \;\; \exists g' \ni g \equiv g' \; \wedge\; g'\) only uses gates in \(K\). This reduces the set \(K\) to a solved problem.

\begin{itemize}
\item Proving \(LCG\) is Logically Complete
\label{sec:org0052b00}
This is the hard part. Picking the first set to prove logically complete and then proving it.
\end{itemize}

\item \(\{\neg, \wedge, \vee\}\) Is Logically Complete
\label{sec:org1b50c25}

TBP: \(\forall K \in \{\mathrm{Logical Expression}\}\) \(\exists K' \ni K \equiv K' \;\wedge\; K'\) uses only operators from the set \(\{\neg, \wedge, \vee\}\).

Given logical expression \(K\): \(K\) has some number, \(n\), logical variables and a \emph{truth table} with \(2^n\) rows. Logic variables will be named \(x_i\) starting from \(0 \le i < n\).

Consider some row where \(K\) is 1.

Build a \emph{conjunction} of all of the variables or their negation. For each column, \(i\), if \(x_i\) is 1, include \(x_i\) in the conjunction; if \(x_i\) is 0, include its negation:

\(\bigwedge\limits_{i=0}^{n-1} (x_i== 1)?x_i:\overline{x_i}\)

With three logical variables and a \(K\) with four rows that are 1, four conjunctions are created is in this next table.

\begin{center}
\begin{tabular}{rrr|r|rrrr|r|}
 &  &  &  & \(A\) & \(B\) & \(C\) & \(D\) & \(K'\)\\
\(x_0\) & \(x_1\) & \(x_2\) & \(K\) & \(\overline{x_0}\overline{x_1} x_2\) & \(\overline{x_0}x_1 x_2\) & \(x_0\overline{x_1}\overline{x_2}\) & \(x_0 x_1 x_2\) & \(A \vee B \vee C \vee D\)\\
\hline
0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1\\
0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
0 & 1 & 1 & 1 & 0 & 1 & 0 & 0 & 1\\
1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 1\\
1 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\
1 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 1\\
\end{tabular}
\end{center}

Note that in the table \(K \equiv K'\) because the values are the same for every combination if input variables.

The \(K'\) column is generated by making a \emph{disjunct} of all of the \emph{conjuncts} built for the rows where \(K\) is 1.

Because each conjunct is 1 in only the row that was used to construct it, there is one conjunct with a 1 in each row where \(K\) is 1 and none with 1 in any row where \(K\) is 0. Joining them with a logical or creates a column with exactly as many 1 rows as there are conjuncts (none overlap) and in \emph{exactly the rows where \(K\) is 1}. Thus the disjunct of the constructed conjuncts is the sought \(K'\).

\(\therefore\) We can build a conjunct for any row with a 1 in \(K\) using just \(\wedge\) and \(\neg\) operators. These conjuncts are combined in a disjunct with only the \(\vee\) operator. The resulting \(K'\) is logically equivalent to \(K\) by construction and uses only operators in the set \(\{\neg, \wedge, \vee\}\).

\(\therefore\) \(\forall K \in \{\mathrm{Logical Expression}\}\) \(\exists K' \ni K \equiv K' \;\wedge\; K'\) uses only operators from the set \(\{\neg, \wedge, \vee\}\).

\item Anything Else
\label{sec:org7f567d1}
\begin{itemize}
\item Make an And, an Or, and a Not
\end{itemize}
\end{itemize}
\end{document}
