\documentclass[12pt]{article}

\usepackage[T1]{fontenc} 
\usepackage{fullpage,amsmath,amsfonts}
\usepackage{circuitikz}
\usetikzlibrary{positioning}

\begin{document}

\title{Foundations of Information Systems}
\author{Winter Semester 2023--24, Exercise 2}
\date{For discussion on Tuesday(!), October 31, 2023}
\maketitle


\begin{enumerate}
\item Prove the following statements, referring to the axioms of
Boolean algebra and, if applicable, elementary theorems from class:
\begin{enumerate}
\item $(a \wedge b) \vee (a \wedge b') = a$
\item $(a \wedge b') \vee b = a \vee b$
\item $(a \vee b) \wedge (b \vee c) \wedge (a' \vee c) = (a \vee b) \wedge (a' \vee c)$
\end{enumerate}


\item Derive and simplify a Boolean algebra expression for the
following binary truth table:
\begin{center}
\begin{tabular}{|ccc|c|}
\hline
$a$ & $b$ & $c$ & $z$ \\
\hline
0 & 0 & 0 & 0\vphantom{$\int^1$}\\
0 & 0 & 1 & 1 \\
0 & 1 & 0 & 0 \\
0 & 1 & 1 & 1 \\
1 & 0 & 0 & 1 \\
1 & 0 & 1 & 0 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\hline
\end{tabular}
\end{center}

\item
\begin{enumerate}
\item Convert the following circuit diagram into a Boolean expression
and simplify, if possible:
\begin{center}
% Setup from https://latexdraw.com/draw-a-logic-circuit-in-circuitikz/
\begin{tikzpicture}
 
% Circuit style
\ctikzset{
    logic ports=ieee,
    logic ports/scale=0.8,
    logic ports/fill=lightgray
}
 
% Logic ports
\node[not port] (NOTa) at (0,0){};
\node[or port, right=of NOTa, anchor=in 1] (ORa) {};
\node[not port, below=of ORa] (NOTb) {};
\node[and port, right=of NOTb, anchor=in 2] (ANDa) {};

% Connection
\draw (NOTa.out) -- (ORa.in 1);
\draw (ORa.out) -| (ANDa.in 1);
\draw (NOTb.out) -- (ANDa.in 2);

\draw (NOTa.in) -- (-2,0) node[left](INa){$a$};
\draw (NOTb.in) -- (-2, 0 |- NOTb.in) node[left](INb){$b$};
\draw (ORa.in 2) -- (1, 0 |- ORa.in 2)  to[short, -*] (1, 0 |- NOTb.in);
\draw (ANDa.out) -- ++(1,0) node[right]{$z$};
\end{tikzpicture}
\end{center}

\item Draw a circuit diagram implementing the following Boolean
expression:
\[
  z = (a \wedge b' \wedge c) \vee (a' \wedge b) \vee (a \wedge c)'
\]

\end{enumerate}

\item Perform the following conversion to different number systems:
\begin{enumerate}
\item $(\mathrm{DC})_{16} = (\ldots)_{2} = (\ldots)_{10}$
\item $(110101)_{2} = (\ldots)_{10} = (\ldots)_{16}$
\item $(1000)_{10} = (\ldots)_{2} = (\ldots)_{16}$
\end{enumerate}

\end{enumerate}
\end{document}
