\synctex=1
\documentclass[
   paper=a4,
   fontsize=11pt,
   parskip=no,       % FIXME: I want this to be `half`, but that breaks *all* my spacing rn
   fleqn             % Align math left? o_O
]{scrartcl}

\usepackage[svgnames]{xcolor}
\usepackage{graphics}
\usepackage[
   textheight=700px,
   head=18.27997pt
]{geometry}
\usepackage{etoolbox}

\usepackage{scrlayer-scrpage}
\usepackage{enumitem}   % To adjust the spacing of multiline ‘definition lists’
\usepackage{multicol}

\usepackage{mathtools}
\usepackage{amsfonts,amsthm,amssymb}
\usepackage[math-style=TeX]{unicode-math}
   \setmathfont{xits-math.otf}
%  \setmathfont[Scale=MatchLowercase,math-style=upright,vargreek-shape=unicode]{Neo Euler}
%  \setmathfont[range=\mathbfsfit/{greek,Greek,latin,Latin}]{EB Garamond}

\usepackage{fontspec}
   %\defaultfontfeatures{}
   \setmainfont{EB Garamond}[Numbers={OldStyle,Proportional}]
   \setsansfont{Linux Biolinum O}
   \setmonofont{Fantasque Sans Mono}
\setkomafont{disposition}{\normalfont}
\usepackage{bm}         % Bold-math handling

\usepackage{url}        % Pretty, line-breaking URLs                                            \url
\usepackage{currfile}   % Get the current filename (for the footer)                    \currfilename
\usepackage{lastpage}   % A reference to the page-number of the last page         \pageref{LastPage}

\usepackage{blindtext}

%%% === Layout ===
%\pagestyle{empty}
\automark[subsection]{section}
\pagestyle{scrheadings}

%%% Title
\setkomafont{author}{\scshape}

\title{Assignment 2}
\subtitle{CS 330}
\author{elliottcable}

%%% Header / footer
\setkomafont{pagehead}{\normalfont\sffamily\upshape}
\setkomafont{pagefoot}{\normalfont\sffamily\upshape}
\setkomafont{pagenumber}{\normalfont\sffamily\upshape}

\renewcommand\pagemark{{\usekomafont{pagenumber}%
   \thepage\nobreakspace of\nobreakspace\pageref{LastPage}%
}}

\lohead{\bfseries\headmark}    %% Top left on odd pages (and single-sided)
\rohead{\bfseries\pagemark}    %% Top right on odd pages (and single-sided)
\lofoot{\ttfamily\currfilename}
\rofoot{\today}
\chead{}                       %% Top center
\cfoot{}                       %% Bottom center

%%% Headings
%\usepackage{sectsty}
%   \sectionfont{%
%      \usefont{OT1}{phv}{b}{n}%
%      \sectionrule{0pt}{0pt}{-5pt}{3pt} }

%%% Patch the title to remove the date
\makeatletter
\patchcmd{\@maketitle}% <cmd>
   {{\usekomafont{date}{\@date \par}}%
      \vskip \z@ \@plus 1em}% <search>
   {}% <replace>
   {}{}% <success><failure>
\makeatother

%%% Columns
\setlength\columnsep{3.5em}
\setlength{\columnseprule}{0.5pt}
\def\columnseprulecolor{\color{gray}}

%%% Text
\setlength{\parindent}{3ex}
\setlength{\mathindent}{1em}

%%% Macros
% ‘Boolean true’ (and false)
\newcommand{\BT}{$\bm{\mathsf{T}}$}
\newcommand{\BF}{$\bm{\mathsf{F}}$}
\renewcommand{\qed}{\hfill\blacksquare}

% ‘Logical math’ and ‘logical variable’
%\definecolor{light-gray}{gray}{0.89}
%\newcommand{\Pm}[1]{\colorbox{light-gray}{\ensuremath{\mathsf{#1}}}}
%\newcommand{\Pv}[1]{\colorbox{light-gray}{\ensuremath{\mathit{#1}}}}
\newcommand{\Pm}[1]{\ensuremath{\mathsf{#1}}}
\newcommand{\Pv}[1]{\ensuremath{\mathit{#1}}}

%\usepackage{showframe}

%%% === Content ===
\begin{document}
\maketitle

% ==== ==== ====
\section*{1.4 | № 48}
\begin{addmargin}[2.5em]{2.5em}{\sffamily
      “Establish these logical equivalences, where \Pv{x} does not occur as a free variable in
      \Pm{A}. Assume that the domain is nonempty.”
}\end{addmargin}

\begin{multicols}{2}
\begin{enumerate}[
      leftmargin=0pt, labelsep=0.25em,
      label=\textsf{\textbf{\alph*)}}
]
\raggedcolumns

   % The \begin{aligned} mess is to center an equation *and* keep it on the same line as the item.
   \item\hfil$\begin{aligned}[t]
      \Pm{\forall x (A \rightarrow P(x)) \equiv A \rightarrow \forall x P(x)}
   \end{aligned}$

   In both the left- and right-hand sides, there are two basic cases of truth: the first where
   \Pm{A} is \BF, and the second where it is \BT.
   \begin{description}[labelwidth=1em, labelsep=0em, leftmargin=1em]
      \item[F]
      When \Pm{A} is \BF, we find that the implication \Pm{A \rightarrow P(x)} is \textit{always}
      vacuously true, regardless of the value of \Pm{P(x)}.

      Since this reasoning applies to the expressions on both sides of the equivalence, regardless
      of the presence or absence of quantification around \Pm{A}, in this case, the expressions are
      confirmed equivalent.

      \item[T]
      When \Pm{A} is \BT, we can conclude that the truth-value of the left-hand expression relies
      entirely on that of \Pm{P(x)}, quantified by \Pm{\forall x}. As this is exactly what is
      expressed by the right-hand side, we can conclude that in this case, too, the expressions are
      equivalent.
   \end{description}

   As we have shown the two expressions to be equivalent in every case, we can conclude them to be
   logically equivalent. \qed

\columnbreak

   \item\hfil$\begin{aligned}[t]
      \Pm{\exists x (A \rightarrow P(x)) \equiv A \rightarrow \exists x P(x)}
   \end{aligned}$

   As with the previous, there are two cases for both of these expressions: the first, where \Pm{A}
   is \BF, and a second where it is \BT.
   \begin{description}[labelwidth=1em, labelsep=0em, leftmargin=1em]
      \item[F]
      Again, here, the implication \Pm{A \rightarrow P(x)} is vacuously true.

      Also again, as this reasoning applies to the both expressions, regardless
      of the quantification, in this case, the expressions are equivalent.

      \item[T]
      When \Pm{A} is \BT, the truth-value of the left-hand expression relies on that of \Pm{P(x)},
      quantified by \Pm{\exists x}. As this is, again, exactly what is expressed by the right-hand
      side, we conclude that these expressions are equivalent. \qed
   \end{description}

\end{enumerate}
\end{multicols}

% ==== ==== ====
\section*{1.4 | № 62}
\begin{addmargin}[2.5em]{2.5em}{\sffamily
   “Let \Pm{P(x)}, \Pm{Q(x)}, \Pm{R(x)}, and \Pm{S(x)} be the statements ‘\Pv{x} is a duck,’ ‘\Pv{x}
   is one of my poultry,’ ‘\Pv{x} is an officer,’ and ‘\Pv{x} is willing to waltz,’ respectively.
   Express each of these statements using quantifiers; logical connectives; and \Pm{P(x)},
   \Pm{Q(x)}, \Pm{R(x)}, and \Pm{S(x)}.”
}\end{addmargin}

\begin{enumerate}[
      leftmargin=0pt, labelsep=0.25em,
      label=\textsf{\textbf{\alph*)}}
]
\begin{multicols}{2}
\raggedcolumns

   \item “No ducks are willing to waltz.”
   \\ \Pm{¬\exists x (\: P(x) \wedge S(x) \:)}

   \item “No officers ever decline to waltz.”
   \\ \Pm{¬\exists x (\: R(x) \wedge ¬S(x) \:)}

   \item “All my poultry are ducks.”
   \\ \Pm{\forall x (\: Q(x) \rightarrow P(x) \:)}

   \item “My poultry are not officers.”
   \\ \Pm{\forall x (\: Q(x) \rightarrow ¬R(x) \:)}

\end{multicols}

   \item “Does \textit{d} follow from \textit{a}, \textit{b}, and \textit{c}? If not, is there a
   correct conclusion?”

   Yes, \textit{d} follows from \textit{a}, \textit{b}, and \textit{c}.

\end{enumerate}

% ==== ==== ====
\section*{1.5 | № 6}
\begin{addmargin}[2.5em]{2.5em}{\sffamily
   “Let \Pm{C(x, y)} mean that student \Pv{x} is enrolled in class \Pv{y}, where the domain for
   \Pv{x} consists of all students in your school and the domain for \Pv{y} consists of all classes
   being given at your school. Express each of these statements by a simple English sentence.”
}\end{addmargin}

\begin{enumerate}[
      leftmargin=0pt, labelsep=0.25em,
      label=\textsf{\textbf{\alph*)}}
]
\begin{multicols}{2}
\raggedcolumns

   \item \Pm{C(\, \textsf{Randy Goldberg}, \textsf{CS 252} \,)}
   \\ “Randy Goldberg is enrolled in CS 252.”

   \item \Pm{\exists x C(\, x, \textsf{MATH 695} \,)}
   \\ “Somebody is enrolled in MATH 695.”

   \item \Pm{\exists y C(\, \textsf{Carol Sitea}, y \,)}
   \\ “Carol Sitea is enrolled in a class.”

   \item \Pm{\exists x (\; C(\, x, \textsf{MATH 222} \,) \wedge C(\, x, \textsf{CS 252} \,) \;)}
   \\ “Someone is enrolled in both MATH 222 and CS 252.”

   \item \Pm{\exists x \exists y \forall z (\;
      (x ≠ y) \wedge (\, C(x, z) \rightarrow C(y, z) \,) \;)}
   \\ “There is a student who is only in classes that a particular second student is \textit{also}
   in.”

   \item \Pm{\exists x \exists y \forall z (\;
      (x ≠ y) \wedge (\, C(x, z) \leftrightarrow C(y, z) \,) \;)}
   \\ “There are two students who share all of the same class enrollments.”

\end{multicols}
\end{enumerate}

% ==== ==== ====
\section*{1.5 | № 16}
\begin{addmargin}[2.5em]{2.5em}{\sffamily
   “A discrete mathematics class contains 1 mathematics major who is a freshman, 12 mathematics
   majors who are sophomores, 15 computer science majors who are sophomores, 2 mathematics majors
   who are juniors, 2 computer science majors who are juniors, and 1 computer science major who is a
   senior. Express each of these statements in terms of quantifiers and then determine its truth
   value.”
}\end{addmargin}

\vspace{1em}
\noindent\textit{Given that \Pm{M(x, y)} means “\Pm{x} is a \Pm{y} major,” and \Pm{Y(x, y)} means
“\Pm{x} is in their \Pm{y} year of study,”}

\begin{enumerate}[
      leftmargin=0pt, labelsep=0.25em,
      label=\textsf{\textbf{\alph*)}}
]
\begin{multicols}{2}
\raggedcolumns

   \item “There is a student in the class who is a junior.”
   \\ \Pm{\exists s Y(\, s, \textsf{junior} \,)
      : \textsf{\textbf{T}}}

   \item “Every student in the class is a computer science major.”
   \\ \Pm{\forall s M(\, s, \textsf{CS} \,)
      : \textsf{\textbf{F}}}

   \item “There is a student in the class who is neither a mathematics major nor a junior.”
   \\ \Pm{\exists s (\; ¬M(\, s, \textsf{Math} \,) \wedge ¬Y(\, s, \textsf{junior} \,) \;)
      : \textsf{\textbf{T}}}

\columnbreak

   \item “Every student in the class is either a sophomore or a computer science major.”
   \\ \Pm{\forall s (\; M(\, s, \textsf{CS} \,) \vee Y(\, s, \textsf{sophomore} \,) \;)
      : \textsf{\textbf{F}}}

   \item “There is a major such that there is a student in the class in every year of study with
   that major.”
   \\ \Pm{\exists m \forall y \exists s (\: M(s, m) \wedge Y(s, y) \:)
      : \textsf{\textbf{F}}}

\end{multicols}
\end{enumerate}

% ==== ==== ====
\section*{1.5 | № 36}
\begin{addmargin}[2.5em]{2.5em}{\sffamily
   “Express each of these statements using quantifiers. Then form the negation of hte statement so
   that no negation is to the left of the quantifier. Next, express the negation in simple English.
   (Do not simply use the phrase “It is not the case that …”)
}\end{addmargin}

\begin{enumerate}[
      leftmargin=0pt, labelsep=0.25em,
      label=\textsf{\textbf{\alph*)}}
]
\begin{multicols}{2}
\raggedcolumns

   \item “No one has lost more than one thousand dollars playing the lottery.”

\end{multicols}
\end{enumerate}


\end{document}
