\documentclass[12pt]{article}
\usepackage{ntnu}
\usepackage{ntnu-math}

\author{Øystein Tveit}
\title{MA0301 Exercise 3}

\begin{document}
  \ntnuTitle{}
  \break{}
  
  \begin{excs}
    \exc{}
    \begin{align*}
      \neg ((\neg p \wedge q) \vee (\neg p \wedge \neg q)) &\vee (p \wedge q) && \\
      \neg (\neg p \wedge (q \vee \neg  q)) &\vee (p \wedge q) && \text{Distributive law} \\
      \neg (\neg p \wedge T) &\vee (p \wedge q) && \text{Complement law} \\
      \neg (\neg p) &\vee (p \wedge q) && \text{Identity law} \\
      p &\vee (p \wedge q) && \text{Double negation law} \\
      p & && \text{Absortion law} \\
    \end{align*}
    
    \exc{}
    \begin{align*}
      ((p \wedge q) \vee (p \wedge \neg r) \vee \neg(\neg p \vee q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \\
      ((p \wedge q) \vee (p \wedge \neg r) \vee (\neg\neg p \wedge \neg q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{De Morgans's law} \\
      ((p \wedge q) \vee (p \wedge \neg r) \vee ( p \wedge \neg q)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Double negation law} \\
      ((p \wedge (q \vee \neg q)) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Distributive law} \\
      ((p \wedge T) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Complement law} \\
      ((p) \vee (p \wedge \neg r)) &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Identity law} \\
      p &\vee ((r \vee s \vee \neg r) \wedge \neg q) && \text{Absortion law} \\
      p &\vee ((\neg q \wedge r) \vee (\neg q \wedge s) \vee (\neg q \wedge \neg r)) && \text{Distributive law} \\
      p &\vee (\neg q \wedge r) \vee (\neg q \wedge s) \vee (\neg q \wedge \neg r) && \text{Associative law}
    \end{align*}
 
    \exc{}

    \renewcommand{\theenumii}{\roman{enumii})}
    \renewcommand{\theenumiii}{\alph{enumiii})}
    
    \begin{subexcs}
      \subexc{}

      \begin{ssubexcs}
        
        \ssubexc{}
        \begin{gather*}
          \{\{2,3,5\} \cup \{6,4\}\} \cap \{4,6,8\} \\
          \{\{2,4,6\}\} \cap \{4,6,8\} \\
          \emptyset
        \end{gather*}

        \ssubexc{}
        \begin{align*}
          P(\{7,8,9\}) &- P(\{7,9\}) \\
          \{\{7,8,9\}, \{7,8\}, \{8,9\}, \{7,9\}, \{7\}, \{8\}, \{9\}, \emptyset\} &- \{\{7,9\}, \{7\}, \{9\}, \emptyset\} \\
          \{\{7,8,9\}, \{7,8\}, \{8,9\}, \{8\}\} & \\
        \end{align*}

        \ssubexc{}
        \begin{gather*}
          P(\emptyset) \\
          \{\emptyset\}
        \end{gather*}

        \ssubexc{}
        \begin{gather*}
          \{1, 3, 5\} \times \{0\} \\
          \{	\langle 1,0	\rangle, \langle 3,0 \rangle, \langle 5, 0 \rangle \}
        \end{gather*}
        
        \ssubexc{}
        \begin{gather*}
          \{2,4,6\} \times \emptyset \\
          \emptyset
        \end{gather*}

        \ssubexc{}
        \begin{gather*}
          P(\{0\}) \times P(\{1\}) \\
          \{\emptyset, \{0\}\} \times \{\emptyset, \{1\}\} \\
          \{\langle\emptyset,\emptyset\rangle, \langle\emptyset,\{1\}\rangle, \langle\{0\},\emptyset\rangle, \langle\{0\},\{1\}\rangle\}
        \end{gather*}
        
        \ssubexc{}
        \begin{gather*}
          P(P(\{2\})) \\
          P(\{\emptyset,\{2\}\}) \\
          \{ \{\{\emptyset\}, \{2\}\}, \{\{\emptyset\}\}, \{\{2\}\}, \emptyset \}
        \end{gather*}
        
      \end{ssubexcs}

      \subexc{}
      Because the elements in a power set can be represented as a binary tree where every leaf node is a set that has the cardinality of $1$, and that $\{\{x\} : x \in A\}$ would make up all the leaf nodes, we can reason that
      \[ |P(A) - \{\{x\} : x \in A\}| = \frac{n}{2} \]
      
    \end{subexcs}

    \renewcommand{\theenumii}{\alph{enumii})}
    \renewcommand{\theenumiii}{\roman{enumiii})}

    \exc{}
    \begin{subexcs}
      \subexc{}
      $\emptyset = \{\emptyset\}$ is {\color{red}False} because $|\emptyset| \neq |\{\emptyset\}|$

      \subexc{}
      $\emptyset = \{0\}$ is {\color{red}False} because $|\emptyset| \neq |\{0\}|$
      
      \subexc{}
      $|\emptyset| = 0$ is {\color{ForestGreen}True} because $\emptyset$ has $0$ elements

      \subexc{}
      $P(\emptyset)$ is {\color{red}False} because $P(\emptyset) = \{\{\emptyset\}\}$ has $1$ element

      \subexc{}
      $\emptyset = \{\}$ is {\color{ForestGreen}True} because the empty set is a subset of every possible set

      \subexc{}
      $\emptyset = \{x \in \mathbb{N} : x \leq 0 and x > 0\}$ is {\color{red}False} because $x \leq 0 \wedge x > 0 \equiv \F$, which means there are no such elements, and thus the set is empty
    \end{subexcs} 

    \exc{}
    \begin{subexcs}
      \subexc{}
      \begin{align*}
        &A \cap (A \cup B) \\
        &\{x : x \in A \wedge x \in (A \cup B)\} \\
        &\{x : x \in A \wedge (x \in A \vee x \in B)\} \\
        &\{x : x \in A\} \\
        &A
      \end{align*}

      \subexc{}
      \begin{align*}
        &A-(B \cap C) \\
        &\{x : x \in A \wedge x \notin (B \cap C)\} \\
        &\{x : x \in A \wedge (x \notin B \wedge x \notin C)\} \\
        &\{x : (x \in A \wedge x \notin B) \vee (x \in A \wedge x \notin C)\} \\
        &\{x : x \in (A - B) \vee x \in (A - C)\} \\
        &\{x : x \in (A - B) \cup (A - C)\} \\
        &(A-B) \cup (A-C)
      \end{align*}

    \end{subexcs} 

    \exc{}

    \renewcommand{\theenumii}{\roman{enumii})}

    \begin{subexcs}
      \subexc{}
      
      \begin{align*}
        &(A \cup B) \setminus (A \cap B) \\
        &\{x: x \in (A \cup B) \setminus (A \cap B)\} \\
        &\{x: x \in (A \cup B) \wedge x \notin (A \cap B)\} \\
        &\{x: (x \in A \vee x \in B) \wedge (x \notin A \vee x \notin B)\} \\
        &\{x: x \in A \wedge (x \notin A \vee x \notin B) \vee x \in B \wedge (x \notin A \vee x \notin B) \} \\
        &\{x: ((x \in A \wedge x \notin A) \vee (x \in A \wedge x \notin B)) \vee ((x \in B \wedge x \notin A) \vee (x \in B \wedge x \notin B)) \} \\
        &\{x: (F \vee (x \in A \wedge x \notin B)) \vee ((x \in B \wedge x \notin A) \vee F) \} \\
        &\{x: (x \in A \wedge x \notin B) \vee (x \in B \wedge x \notin A) \} \\
        &\{x: x \in (A - B) \vee x \in (B - A) \} \\
        &\{x: x \in (A - B) \cup (B - A) \} \\
        &(A - B) \cup (B - A) \\
      \end{align*}
      
      \subexc{}
      For this exercise, I counted the elements which was in either set but not both
      \[ A \Delta B = \{2, 4, 6, 7, 8\} \]
      
    \end{subexcs} 

    \renewcommand{\theenumii}{\alph{enumii})}

    \exc{}
    \begin{align*}
      X &= \{\{1,2,3\}, \{2,3\}, \{ef\}\} \cup \{\{e\}\} \\
        &= \{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\} \\
    \end{align*}      

    \begin{align*}
      P(x) = \{ \\
             &\{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\}, \\
             &\{\{1,2,3\}, \{2,3\}, \{ef\}\}, \\
             &\{\{1,2,3\}, \{2,3\}, \{e\}\}, \\
             &\{\{1,2,3\}, \{ef\}, \{e\}\}, \\
             &\{\{2,3\}, \{ef\}, \{e\}\}, \\
             &\{\{1,2,3\}, \{2,3\}\}, \\
             &\{\{1,2,3\}, \{e\}\}, \\
             &\{\{1,2,3\}, \{ef\}\}, \\ 
             &\{\{2,3\}, \{ef\}\}, \\
             &\{\{2,3\}, \{e\}\}, \\
             &\{\{ef\}, \{e\}\}, \\
             &\{\{e\}\}, \\
             &\{\{ef\}\}, \\
             &\{\{2,3\}\}, \\
             &\{\{1,2,3\}\} \\
             \} \\
    \end{align*}      

    \begin{align*}
     P(X \cap Y) &= P(\{\{1,2,3\}, \{2,3\}, \{ef\}, \{e\}\} \cap \{\{1,2,3,e,f\}\}) \\
              &= P(\emptyset) \\
              &= \{\emptyset\}
    \end{align*}      

    \exc{}
    \begin{subexcs}
      \subexc{}
      Here, the exercise says ``[\ldots] four sets $A_1$, $A_2$, $A_3$''. I'm not sure if I'm supposed to do three or four, but I'll assume three sets $A_1$, $A_2$, $A_3$ was the intention.

      \begin{align*}
        A_1 \cap A_2 \cap A_3 \\
        A_1 \cap A_2 \cap \overline{A_3} \\
        A_1 \cap \overline{A_2} \cap A_3 \\
        A_1 \cap \overline{A_2} \cap \overline{A_3} \\
        \overline{A_1} \cap A_2 \cap A_3 \\
        \overline{A_1} \cap A_2 \cap \overline{A_3} \\
        \overline{A_1} \cap \overline{A_2} \cap A_3 \\
        \overline{A_1} \cap \overline{A_2} \cap \overline{A_3} \\
      \end{align*}

      \subexc{}
        For each set, the amount of fundamental products is multiplied by $2$. Therefore, the amount of fundamental sets of $n$ sets is $2^n$

    \end{subexcs}

    \exc{}
    \begin{gather*}
      A \overline{( B \overline{C} )} \overline{( (A \overline{B}) \overline{C})} \\
      A ( \overline{B} + \overline{\overline{C}} ) \overline{(A \overline{B}\ \overline{C})} \\
      A ( \overline{B} + C ) \overline{(A \overline{B}\ \overline{C})} \\
      A ( \overline{B} + C ) \overline{(A \overline{B}\ \overline{C})} \\
      A ( \overline{B} + C ) (\overline{A} + \overline{\overline{B}} + \overline{\overline{C}}) \\
      A ( \overline{B} + C ) (\overline{A} + B + C) \\
      ( A\overline{B} + AC ) (\overline{A} + B + C) \\
      A\overline{B}(\overline{A} + B + C) + AC(\overline{A} + B + C)\\
      (A\overline{B}\ \overline{A} + A\overline{B}B + A\overline{B}C) + (AC\overline{A} + ACB + ACC)\\
      (0 + 0 + A\overline{B}C) + (0 + ACB + AC)\\
      A\overline{B}C + ACB + AC\\
      ACB + AC\\
      AC
    \end{gather*}

    \exc{}
    LHS    
    \begin{gather*}
      ((A+B)+(A+C)) \overline{((A+B)(A+C))} \overline{A} \\
      (A+B+A+C) \overline{(A+B)(A+C)} \overline{A} \\
      (A+B+C) (\overline{(A+B)} + \overline{(A+C)}) \overline{A} \\
      (A+B+C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \overline{A} \\
      (\overline{A}A + \overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\
      (0 + \overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\
      (\overline{A}B + \overline{A}C) (\overline{A}\ \overline{B} + \overline{A}\ \overline{C}) \\
      \overline{A}B \overline{A}\ \overline{B} + 
      \overline{A}B \overline{A}\ \overline{C} +
      \overline{A}C \overline{A}\ \overline{B} + 
      \overline{A}C \overline{A}\ \overline{C} \\
      0 + 
      \overline{A}B \overline{A}\ \overline{C} +
      \overline{A}C \overline{A}\ \overline{B} + 
      0 \\
      \overline{A}B \overline{C} + \overline{A}C \overline{B} \\
    \end{gather*}

    RHS
    \begin{gather*}
      (B+C) \overline{(BC)} \overline{A} \\
      (B+C) (\overline{B} + \overline{C}) \overline{A} \\ 
      (\overline{A}B + \overline{A}C) (\overline{B} + \overline{C}) \\ 
      \overline{A}B\overline{B} + \overline{A}B\overline{C} + \overline{A}C\overline{B} + \overline{A}C\overline{C} \\ 
      0 + \overline{A}B\overline{C} + \overline{A}C\overline{B} + 0 \\ 
      \overline{A}B\overline{C} + \overline{A}C\overline{B} \\ 
    \end{gather*}

    $LHS = RHS$

  \end{excs}
  
\end{document}
