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

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

\begin{document}
  \ntnuTitle{}
  \break{}
  
  \begin{excs}
    \exc{}
  
    \begin{truthtable}
      {c|c|c}
      {$p$ & $q$ & $p \Rightarrow q$}
      \T & \T & \T \\
      \erow{}
      \T & \F & \F \\
      \F & \T & \T \\
      \F & \F & \T \\
    \end{truthtable}
  
    Looking at the truthtable, we can see that $p \Rightarrow q$ only is false when $p$ is true and $q$ is false.
  
    \begin{subexcs}
      \subexc{}
      \begin{align*}
        p \wedge q &\equiv T \wedge F \\
              &\equiv F
      \end{align*}
  
      \subexc{}
      \begin{align*}
        \neg p \vee q &\equiv \neg T \vee F \\
                &\equiv F \vee F \\
                &\equiv F
      \end{align*}
  
      \subexc{}
      \begin{align*}
        q \Rightarrow p &\equiv F \Rightarrow T \\
              &\equiv \neg F \vee T \\
              &\equiv T \vee T \\
              &\equiv T
      \end{align*} 
 
      \subexc{}
      \begin{align*}
        \neg q \Rightarrow \neg p &\equiv \neg F \Rightarrow \neg T \\
                  &\equiv T \Rightarrow F \\
                  &\equiv \neg T \vee F \\
                  &\equiv F \vee F \\
                  &\equiv F
      \end{align*}
  
    \end{subexcs}
  
    \exc{}
    \begin{subexcs}
      \subexc{}
        If triangle ABC is equilateral then triangle ABC is isosceles.
  
      \subexc{}
        If triangle ABC is not isosceles then triangle ABC is not equilateral.
  
      \subexc{}
        Triangle ABC is equilateral if and only if triangle ABC is equiangular.
     
      \subexc{}
        Triangle ABC is isosceles and triangle ABC is not equilateral.
  
      \subexc{}
        If triangle ABC is equiangular then triangle ABC is isosceles.
    \end{subexcs}
  
    \exc{}
    \begin{subexcs}
  
      \subexc{}
  
      \begin{truthtable}
        {c|c|c|c|c|c|c}
        {$p$ & $q$ & $\neg p$ & $\neg q$ & $p \wedge \neg q$ & $\neg (p \wedge \neg q)$ & $\neg (p \wedge \neg q) \Rightarrow p$}
       \T & \T & \F & \F & \F & \T & \F \\
       \T & \F & \F & \T & \T & \F & \T \\
       \F & \T & \T & \F & \F & \T & \T \\
       \F & \F & \T & \T & \F & \T & \T
      \end{truthtable}
      
      \subexc{}
  
      \begin{truthtable}
        {c|c|c|c|c}
        {$p$ & $q$ & $r$ & $q \Rightarrow r$ & $p \Rightarrow (q \Rightarrow r)$}
      \T & \T & \T & \T & \T \\
      \T & \T & \F & \F & \F \\
      \T & \F & \T & \T & \T \\
      \T & \F & \F & \T & \T \\
      \F & \T & \T & \T & \T \\
      \F & \T & \F & \F & \T \\
      \F & \F & \T & \T & \T \\
      \F & \F & \F & \T & \T
      \end{truthtable}
    \end{subexcs}
  
    \exc{}
    \begin{subexcs}
      \subexc{}
      \begin{truthtable}
        {c|c|c|c|c|e}
        {$p$ & $q$ & $\neg p$ & $\neg q$ & $\neg p \vee \neg q$ & $q \Leftrightarrow (\neg p \vee \neg q)$}
        \T & \T & \F & \F & \F & \F \\
        \T & \F & \F & \T & \T & \F \\
        \F & \T & \T & \F & \T & \T \\
        \F & \F & \T & \T & \T & \F \\
      \end{truthtable}
  
      $q \Leftrightarrow (\neg p \vee \neg q)$ is not a tautology.
  
      \subexc{}
      \begin{truthtable}
        {c|c|c|c|c|c|c|e}
        {$p$ & $q$ & $r$ & $p \Rightarrow q$ & $q \Rightarrow r$ & $p \Rightarrow r$ & $(p \Rightarrow q) \wedge (q \Rightarrow r)$ & $\left[ (p \Rightarrow q) \wedge (q \Rightarrow r) \right] \Rightarrow (p \Rightarrow r)$}
        \T & \T & \T & \T & \T & \T & \T & \T \\
        \T & \T & \F & \T & \F & \F & \F & \T \\
        \T & \F & \T & \F & \T & \T & \F & \T \\
        \T & \F & \F & \F & \T & \F & \F & \T \\
        \F & \T & \T & \T & \T & \T & \T & \T \\
        \F & \T & \F & \T & \F & \T & \F & \T \\
        \F & \F & \T & \T & \T & \T & \T & \T \\
        \F & \F & \F & \T & \T & \T & \T & \T 
      \end{truthtable}
  
      $\left[ (p \Rightarrow q) \wedge (q \Rightarrow r) \right] \Rightarrow (p \Rightarrow r)$ is a tautology.
    \end{subexcs}
  
    \exc{}
  
    I start by simplifying the expression, inserting $q$ as $T$
    \begin{align*}
      \left(q \Rightarrow \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow (\neg r \wedge q)\right] &\equiv 
      \left(T \Rightarrow \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow (\neg r \wedge T)\right] \\
        &\equiv \left(\neg T \vee \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow \neg r \right] \\
        &\equiv \left(F \vee \left[ (\neg p \vee r) \wedge \neg s \right]\right) \wedge \left[\neg s \Rightarrow \neg r \right] \\
        &\equiv \left[ (\neg p \vee r) \wedge \neg s \right] \wedge \left[\neg s \Rightarrow \neg r \right] \\
    \end{align*}
  
    \begin{truthtable}
      {c|c|c|c|c|c|c|c|c|c}
      {$p$ & $r$ & $s$ & $\neg p$ & $\neg r$ & $\neg s$ & $\neg p \vee r$ & $(\neg p \vee r) \wedge \neg s$ & $\neg s \Rightarrow \neg r$ & $\left[ (\neg p \vee r) \wedge \neg s \right] \wedge \left[\neg s \Rightarrow \neg r \right]$}
      \T & \T & \T & \F & \F & \F & \T & \F & \T & \F \\
      \T & \T & \F & \F & \F & \T & \T & \T & \F & \F \\
      \T & \F & \T & \F & \T & \F & \F & \F & \T & \F \\
      \T & \F & \F & \F & \T & \T & \F & \F & \T & \F \\
      \F & \T & \T & \T & \F & \F & \T & \F & \T & \F \\
      \F & \T & \F & \T & \F & \T & \T & \T & \F & \F \\
      \F & \F & \T & \T & \T & \F & \T & \F & \T & \F \\
      \erow{}
      \F & \F & \F & \T & \T & \T & \T & \T & \T & \T
    \end{truthtable}
  
    The statement is only true when $p$, $r$ and $s$ are false.
  
    \exc{}
    \begin{subexcs}
      \subexc{}
      \begin{truthtable}
        {c|c|c|c|e|c|c|e}
        {$p$ & $q$ & $r$ & $q \wedge r$ & $p \Rightarrow (q \wedge r)$ & $p \Rightarrow q$ & $p \Rightarrow r$ & $(p \Rightarrow q) \wedge (p \Rightarrow r)$}
        \T & \T & \T & \T & \T & \T & \T & \T \\
        \T & \T & \F & \F & \F & \T & \F & \F \\
        \T & \F & \T & \F & \F & \F & \T & \F \\
        \T & \F & \F & \F & \F & \F & \F & \F \\
        \F & \T & \T & \F & \T & \T & \T & \T \\
        \F & \T & \F & \F & \T & \T & \T & \T \\
        \F & \F & \T & \F & \T & \T & \T & \T \\
        \F & \F & \F & \F & \T & \T & \T & \T       
      \end{truthtable}
  
      \subexc{}
      \begin{truthtable}
        {c|c|c|c|e|c|c|e}
        {$p$ & $q$ & $r$ & $q \vee r$ & $p \Rightarrow (q \vee r)$ & $\neg r$ & $p \Rightarrow q$ & $\neg r \Rightarrow (p \Rightarrow q)$}
        \T & \T & \T & \T & \T & \F & \T & \T \\
        \T & \T & \F & \T & \T & \T & \T & \T \\
        \T & \F & \T & \T & \T & \F & \F & \T \\
        \T & \F & \F & \F & \F & \T & \F & \F \\
        \F & \T & \T & \T & \T & \F & \T & \T \\
        \F & \T & \F & \T & \T & \T & \T & \T \\
        \F & \F & \T & \T & \T & \F & \T & \T \\
        \F & \F & \F & \F & \T & \T & \T & \T
      \end{truthtable}
    \end{subexcs} 

    
  
    \exc{}
    \begin{subexcs}
      \subexc{}
      \begin{align*}
        \neg((p \wedge q) \Rightarrow r) &\equiv \neg(\neg(p \wedge q) \vee r) \\
                       &\equiv \neg\neg(p \wedge q) \wedge \neg r \\
                       &\equiv (p \wedge q) \wedge \neg r \\
                       &\equiv p \wedge q \wedge \neg r \\
      \end{align*}
  
      \subexc{}
      \begin{align*}
        \neg(p \Rightarrow (\neg q \wedge r)) &\equiv \neg(\neg p \vee (\neg q \wedge r)) \\
                         &\equiv \neg\neg p \wedge \neg(\neg q \wedge r) \\
                         &\equiv p \wedge (\neg\neg q \vee \neg r) \\
                         &\equiv p \wedge (q \vee \neg r)
      \end{align*}
    \end{subexcs}
  
    \exc{}
    \begin{truthtable}
      {c|c|c|c|c|e|e}
      {$\alpha$ & $\beta$ & $\gamma$ & $\alpha \vee \beta$ & $\beta \vee \gamma$ & $(\alpha \vee \beta) \vee \gamma$ & $\alpha \vee (\beta \vee \gamma)$}
      \T & \T & \T & \T & \T & \T & \T \\
      \T & \T & \F & \T & \T & \T & \T \\
      \T & \F & \T & \T & \T & \T & \T \\
      \T & \F & \F & \T & \F & \T & \T \\
      \F & \T & \T & \T & \T & \T & \T \\
      \F & \T & \F & \T & \T & \T & \T \\
      \F & \F & \T & \F & \T & \T & \T \\
      \F & \F & \F & \F & \F & \F & \F
    \end{truthtable}
  
    \exc{}
    \begin{subexcs}
      \subexc{}
      \begin{truthtable}
        {c|c|c|e}
        {$p$ & $q$ & $p \vee q$ & $p \Rightarrow (p \vee q)$}
        \T & \T & \T & \T \\
        \T & \F & \T & \T \\
        \F & \T & \T & \T \\
        \F & \F & \F & \T \\
      \end{truthtable}
      $p \Rightarrow (p \vee q)$ is a tautology
  
      \subexc{} Because $\neg(p \Rightarrow (p \vee q))$ is the negation of $p \Rightarrow (p \vee q)$, which we have already evaluated to be a tautology, this has to be a contradiction and thus unsatisfiable.
  
      \subexc{}
      \begin{truthtable}
        {c|c|c|e}
        {$p$ & $q$ & $p \Rightarrow q$ & $p \Rightarrow (p \Rightarrow q)$}
        \T & \T & \T & \T \\
        \T & \F & \F & \F \\
        \F & \T & \T & \T \\
        \F & \F & \T & \T \\
      \end{truthtable}
      $p \Rightarrow (p \Rightarrow q)$ is satisfiable.
    \end{subexcs}
  
    \exc{}
    \begin{subexcs}
      \subexc{}
        $\neg p \Rightarrow (q \Leftrightarrow r)$
  
      \subexc{}
        $r \Rightarrow \neg p$
  
      \subexc{}
        $\neg r \wedge (p \wedge q)$
  
      \subexc{}
        $p \Rightarrow (r \wedge q)$
  
      \subexc{}
        $\neg q \wedge r$
    \end{subexcs}
  \end{excs}
  

\end{document}