Week 5 at a glance

We will be learning and practicing to:

TODO:

Project due May 7, 2024. No review quiz this week.

Test 1, in class this week, on Friday May 3, 2024. The test covers material in Weeks 1 through 4 and Monday of Week 5. To study for the exam, we recommend reviewing class notes (e.g. annotations linked on the class website, podcast, supplementary video from the class website), reviewing homework (and its posted sample solutions), and in particular *working examples* (extra examples in lecture notes, review quizzes, discussion examples) and getting feedback (office hours and Piazza). Some practice questions (and their solutions) are available on the class website, linked from Week 5 and from the Assignments page.

Week 5 Monday: Nested Quantifiers

Recall the definitions: The set of RNA strands \(S\) is defined (recursively) by: \[\begin{array}{ll} \textrm{Basis Step: } & \texttt{A}\in S, \texttt{C}\in S, \texttt{U}\in S, \texttt{G}\in S \\ \textrm{Recursive Step: } & \textrm{If } s \in S\textrm{ and }b \in B \textrm{, then }sb \in S \end{array}\] where \(sb\) is string concatenation.

The function rnalen that computes the length of RNA strands in \(S\) is defined recursively by: \[\begin{array}{llll} & & \textit{rnalen} : S & \to \mathbb{Z}^+ \\ \textrm{Basis Step:} & \textrm{If } b \in B\textrm{ then } & \textit{rnalen}(b) & = 1 \\ \textrm{Recursive Step:} & \textrm{If } s \in S\textrm{ and }b \in B\textrm{, then } & \textit{rnalen}(sb) & = 1 + \textit{rnalen}(s) \end{array}\]

The function basecount that computes the number of a given base \(b\) appearing in a RNA strand \(s\) is defined recursively by: \[\begin{array}{llll} & & \textit{basecount} : S \times B & \to \mathbb{N} \\ \textrm{Basis Step:} & \textrm{If } b_1 \in B, b_2 \in B & \textit{basecount}(~(b_1, b_2)~) & = \begin{cases} 1 & \textrm{when } b_1 = b_2 \\ 0 & \textrm{when } b_1 \neq b_2 \\ \end{cases} \\ \textrm{Recursive Step:} & \textrm{If } s \in S, b_1 \in B, b_2 \in B &\textit{basecount}(~(s b_1, b_2)~) & = \begin{cases} 1 + \textit{basecount}(~(s, b_2)~) & \textrm{when } b_1 = b_2 \\ \textit{basecount}(~(s, b_2)~) & \textrm{when } b_1 \neq b_2 \\ \end{cases} \end{array}\]

Alternating nested quantifiers

\[\forall s \in S ~\exists n \in \mathbb{N} ~(~basecount(~(s,\texttt{U})~) = n~)\]

In English: For each strand, there is a nonnnegative integer that counts the number of occurrences of \(\texttt{U}\) in that strand.
\[\exists n \in \mathbb{N} ~\forall s \in S ~(~basecount(~(s,\texttt{U})~) = n~)\]

In English: There is a nonnnegative integer that counts the number of occurrences of \(\texttt{U}\) in every strand.

Are these statements true or false?

\[\forall s \in S ~\exists b\in B ~(~basecount(~(s,b)~) = 3~)\]

In English: For each RNA strand there is a base that occurs 3 times in this strand.
Write the negation and use De Morgan’s law to find a logically equivalent version where the negation is applied only to the \(BC\) predicate (not next to a quantifier).

Is the original statement True or False?

Proof strategies

When a predicate \(P(x)\) is over a finite domain:

Suppose \(P(x)\) is a predicate over a domain \(D\).

  1. True or False: To translate the statement “There are at least two elements in \(D\) where the predicate \(P\) evaluates to true", we could write \[\exists x_1 \in D \, \exists x_2 \in D \, (P(x_1) \wedge P(x_2))\]

  2. True or False: To translate the statement “There are at most two elements in \(D\) where the predicate \(P\) evaluates to true", we could write \[\forall x_1 \in D \, \forall x_2 \in D \, \forall x_3 \in D \, \left(~ (~P(x_1) \wedge P(x_2) \wedge P(x_3) ~) \to (~ x_1 = x_2 \vee x_2 = x_3 \vee x_1 = x_3~)~\right)\]

Week 5 Wednesday: Proof Strategies and Sets

Definitions:

A set is an unordered collection of elements. When \(A\) and \(B\) are sets, \(A = B\) (set equality) means \[\forall x ( x\in A \leftrightarrow x \in B)\]

When \(A\) and \(B\) are sets, \(A \subseteq B\) (“\(A\) is a subset of \(B\)") means \[\forall x (x \in A \to x \in B)\]

When \(A\) and \(B\) are sets, \(A \subsetneq B\) (“\(A\) is a proper subset of \(B\)") means \[(A\subseteq B) \wedge (A \neq B)\]

To prove that one set is a subset of another, e.g. to show \(A \subseteq B\):

To prove that two sets are equal, e.g. to show \(A = B\):

Example: \(\{ 43, 7, 9 \} = \{ 7, 43, 9, 7\}\)

Prove or disprove: \(\{ \texttt{A}, \texttt{C}, \texttt{U}, \texttt{G}\} \subseteq \{ \texttt{A}\texttt{A}, \texttt{A}\texttt{C}, \texttt{A}\texttt{U}, \texttt{A}\texttt{G}\}\)

Prove or disprove: For some set \(B\), \(\emptyset \in B\).

Prove or disprove: For every set \(B\), \(\emptyset \in B\).

Prove or disprove: The empty set is a subset of every set.

Prove or disprove: The empty set is a proper subset of every set.

Prove or disprove: \(\{ 4, 6 \} \subseteq \{ n \mid \exists c \in \mathbb{Z} ( n = 4c) \}\)

Prove or disprove: \(\{ 4, 6 \} \subseteq \{ n ~\textbf{mod}~10 \mid \exists c \in \mathbb{Z} ( n = 4c) \}\)

Cartesian product: When \(A\) and \(B\) are sets, \[A \times B = \{ (a,b) \mid a \in A \wedge b \in B \}\]

Example: \(\{43, 9\} \times \{9, \mathbb{Z}\} =\)

Example: \(\mathbb{Z} \times \emptyset =\)

Union: When \(A\) and \(B\) are sets, \[A \cup B = \{ x \mid x \in A \vee x \in B \}\]

Example: \(\{43, 9\} \cup \{9, \mathbb{Z}\} =\)

Example: \(\mathbb{Z} \cup \emptyset =\)

Intersection: When \(A\) and \(B\) are sets, \[A \cap B = \{ x \mid x \in A \wedge x \in B \}\] Example: \(\{43, 9\} \cap \{9,\mathbb{Z}\} =\)

Example: \(\mathbb{Z} \cap \emptyset =\)

Set difference: When \(A\) and \(B\) are sets,

\[A - B = \{ x \mid x \in A \wedge x \notin B \}\]

Example: \(\{43, 9\} - \{9, \mathbb{Z}\} =\)

Example: \(\mathbb{Z} - \emptyset =\)

Disjoint sets: sets \(A\) and \(B\) are disjoint means \(A \cap B = \emptyset\)

Example: \(\{43, 9\}, \{9, \mathbb{Z}\}\) are not disjoint

Example: The sets \(\mathbb{Z}\) and \(\emptyset\) are disjoint

Power set: When \(U\) is a set, \(\mathcal{P}(U) = \{ X \mid X \subseteq U\}\)

Example: \(\mathcal{P}(\{43, 9\}) =\)

Example: \(\mathcal{P}(\emptyset) =\)