\documentclass[fontsize=11pt]{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage[utf8]{inputenc} \usepackage[margin=0.75in]{geometry} \title{CSC110 Fall 2021 Assignment 2: Logic, Constraints, and Nested Data} \author{Azalea Gui & Peter Lin} \date{\today} \begin{document} \maketitle \section*{Part 1: Predicate Logic} \begin{enumerate} \item[1.] \begin{enumerate} \item[1.] When $D_1 = [0,\infty) $ \\ Statement 1 is True because every number $x \in D_1$ is smaller than a $y \in D_1$ (For example, $y=x+1>x$). \\ Statement 2 is False because when $y=0$, there isn't an $x \in D_1$ smaller than $y$. \item[2.] When $D_2 = \mathbb{Z}$ \\ Statement 1 is True because every integer $x$ is smaller than some integer $y$ (For example, $y=x+1>x$). \\ Statement 2 is True because every integer $y$ is greater than some integer $x$ (For example, $x=y-1$, and $\geq$ operators. \item For a section $s \in S$, $s[2]$ represents a tuple of meeting times. You may use standard set operations and quantifiers for these tuples (pretend they are sets). For example, we can say: \begin{itemize} \item $\forall s \in S,~ s[2] \subseteq M$ \item $\forall s \in S,~ \forall m \in s[2],~ m[1] < m[2]$ \end{itemize} \item Finally, for a schedule $sc \in SC$, you can use the notation $sc.sections$ to refer to a set of all sections in that schedule. You can use quantifiers with that set of schedules as well, e.g. $\forall s \in sc.sections,~ ...$ \end{itemize} \textbf{Predicate for meeting times conflicting:} % TODO: fill in the predicate definition for two meeting times conflicting \begin{align*} MeetingTimesConflict(m_1, m_2) : m_1[0] == m_2[0] \land m_1[2] > m_2[1] \land m_2[2] > m_1[1] \\ \qquad \text{where $m_1, m_2 \in M$} \end{align*} \smallskip \textbf{Predicate for sections conflicting:} % TODO: fill in the predicate definition for two sections conflicting. % Use the MeetingTimesConflict predicate in your response. \begin{align*} SectionsConflict(s_1, s_2) : (s_1[1]=\text{'Y'} \lor s_2[1]=\text{'Y'} \lor s_1[1] = s_2[1]) \land \\ \exists m_1 \in s_1[2], \exists m_2 \in s_2[2], \text { s.t. } MeetingTimesConflict(m_1, m_2) \\ \qquad \text{where $s_1, s_2 \in S$} \end{align*} \smallskip \textbf{Predicate for valid schedule:} % TODO: fill in the predicate definition for a schedule being valid. % Use the SectionsConflict predicate in your response. \begin{align*} IsValidSchedule(sc) : \forall s_1, s_2 \in sc.sections, SectionsConflict(s_1, s_2) \Rightarrow s_1 = s_2 \qquad \text{where $sc \in SC$} \end{align*} \item[(b)] Complete this part in the provided \texttt{a2\_part3.py} starter file. Do \textbf{not} include your solution in this file. \end{enumerate} \item[3.] \begin{enumerate} \item[(a)] You may use all notation from question 2(a). Note that a course $c \in C$ is a tuple, and $c[2]$ is a set of sections, and so can be quantified over: $\forall s \in c[2], ...$. \smallskip \textbf{Predicate for section-schedule compatibility:} % TODO: fill in the predicate definition for a section being compatible with a schedule. \begin{align*} IsCompatibleSection(sc, s) : \forall s_1 \in sc.sections, \neg SectionsConflict(s, s_1) \qquad \text{where $sc \in SC, s \in S$} \end{align*} \smallskip \textbf{Predicate for course-schedule compatibility:} % TODO: fill in the predicate definition for a course being compatible with a schedule. % Use IsCompatibleSection in your response. \begin{align*} IsCompatibleCourse(sc, c) : \exists s \in c[2] \text{ s.t. } IsCompatibleSection(sc, s) \qquad \text{where $sc \in SC, c \in C$} \end{align*} \item[(b)] Complete this part in the provided \texttt{a2\_part3.py} starter file. Do \textbf{not} include your solution in this file. \end{enumerate} \end{enumerate} \section*{Part 4: Processing Raw Data} Complete this part in the provided \texttt{a2\_part4.py} starter file. Do \textbf{not} include your solution in this file. \end{document}