You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\title{Math for CS 2015/2019 solutions to ``In-Class Problems Week 3, Tue. (Session 5)''}
13
13
\author{https://github.com/spamegg1}
@@ -19,45 +19,45 @@ \section{Problem 1}
19
19
For each of the logical formulas, indicate whether or not it is true when the domain of discourse is $\mathbb{N}$ (the nonnegative integers $0, 1, 2, \ldots$), $\mathbb{Z}$ (the integers), $\mathbb{Q}$ (the rationals), $\mathbb{R}$ (the real numbers), and $\mathbb{C}$ (the complex numbers). Add a brief explanation to the few cases that merit one.
20
20
21
21
\subsection{(a)}
22
-
$\exists x(x^2 = 2)$
22
+
$\exists x(x^2 = 2)$
23
23
\begin{proof}
24
-
Not true in $\mathbb{N}$, $\mathbb{Z}$ or in $\mathbb{Q}$ because $\sqrt{2}$ is irrational.
24
+
Not true in $\mathbb{N}$, $\mathbb{Z}$ or in $\mathbb{Q}$ because $\sqrt{2}$ is irrational.
25
25
26
-
True in $\mathbb{R}$ and $\mathbb{C}$ because $\sqrt{2} \in\mathbb{R}$ and $\mathbb{R}$ is a subset of $\mathbb{C}$.
26
+
True in $\mathbb{R}$ and $\mathbb{C}$ because $\sqrt{2} \in\mathbb{R}$ and $\mathbb{R}$ is a subset of $\mathbb{C}$.
27
27
\end{proof}
28
28
29
29
\subsection{(b)}
30
30
$\forall x \exists y (x^2 = y)$
31
31
\begin{proof}
32
-
True in all 5 domains. Basically it states that ``this domain is closed under the operation of taking the square of a number.'' The square of a nonnegative integer is a nonnegative integer, the square of an integer is an integer, the square of a rational number is a rational number... and so on.
32
+
True in all 5 domains. Basically it states that ``this domain is closed under the operation of taking the square of a number.'' The square of a nonnegative integer is a nonnegative integer, the square of an integer is an integer, the square of a rational number is a rational number... and so on.
33
33
\end{proof}
34
34
35
35
\subsection{(c)}
36
36
$\forall y \exists x (x^2 = y)$
37
37
\begin{proof}
38
-
This one states the existence of square roots for all numbers in the domain. Only true in $\mathbb{C}$ and false in the other 4 domains.
38
+
This one states the existence of square roots for all numbers in the domain. Only true in $\mathbb{C}$ and false in the other 4 domains.
39
39
40
-
For $\mathbb{N}$, $\mathbb{Z}$ and $\mathbb{Q}$, let $y = 2$ which is a member of all 3 domains, but $x = \pm\sqrt{2}$ are not members of any of the 3 domains.
40
+
For $\mathbb{N}$, $\mathbb{Z}$ and $\mathbb{Q}$, let $y = 2$ which is a member of all 3 domains, but $x = \pm\sqrt{2}$ are not members of any of the 3 domains.
41
41
42
-
For $\mathbb{R}$, let $y = -1$ which does not have a real square root.
42
+
For $\mathbb{R}$, let $y = -1$ which does not have a real square root.
43
43
\end{proof}
44
44
45
45
\subsection{(d)}
46
46
$\forall x \neq0\,\,\exists y (xy = 1) $
47
47
\begin{proof}
48
-
This means that every nonzero member of the domain has a multiplicative inverse.
48
+
This means that every nonzero member of the domain has a multiplicative inverse.
49
49
50
-
True in $\mathbb{Q}$, $\mathbb{R}$ and $\mathbb{C}$: for all $x$ in one of these domains, $y = 1/x$ also exists in that domain.
50
+
True in $\mathbb{Q}$, $\mathbb{R}$ and $\mathbb{C}$: for all $x$ in one of these domains, $y = 1/x$ also exists in that domain.
51
51
52
-
But false in $\mathbb{N}$ and $\mathbb{Z}$: let $x = 2$ which is a member of these two domains, but $y = 1/2$ is not in these two domains.
52
+
But false in $\mathbb{N}$ and $\mathbb{Z}$: let $x = 2$ which is a member of these two domains, but $y = 1/2$ is not in these two domains.
53
53
\end{proof}
54
54
55
55
\subsection{(e)}
56
56
$\exists x \exists y (x + 2y = 2\text{ AND } 2x + 4y = 5)$
57
57
\begin{proof}
58
-
False in all 5 domains.
58
+
False in all 5 domains.
59
59
60
-
This is a system of linear equations. If we multiply the second equation by 2 we get $2x + 4y = 4$. So $2x + 4y$ has to be simultaneously equal to 4 and equal to 5, which is impossible. So there exist no such $x, y$ in {\it any domain}.
60
+
This is a system of linear equations. If we multiply the first equation by 2 we get $2x + 4y = 4$. So $2x + 4y$ has to be simultaneously equal to 4 and equal to 5, which is impossible. So there exist no such $x, y$ in {\it any domain}.
61
61
\end{proof}
62
62
63
63
\section{Problem 2}
@@ -67,59 +67,59 @@ \section{Problem 2}
67
67
68
68
Here are some examples of formulas and their English translations. Names for these predicates are listed in the third column so that you can reuse them in your solutions (as we do in the definition of the predicate NO-1s below).
69
69
$$
70
-
\begin{array}{|l|c|l|}
71
-
\text{Meaning} & \text{Formula} & \text{Name}\\
72
-
\hline
73
-
x \text{ is a prefix of } y & \exists z(xz = y) & \text{PREFIX}(x, y)\\
74
-
x \text{ is a substring of } y & \exists u \exists v(uxv = y) & \text{SUBSTRING}(x, y)\\
75
-
x \text{ is empty or a string of } 0\text{s} & \text{NOT(SUBSTRING}(1,x)) & \text{NO-1s}(x)
76
-
\end{array}
70
+
\begin{array}{|l|c|l|}
71
+
\text{Meaning} & \text{Formula} & \text{Name}\\
72
+
\hline
73
+
x \text{ is a prefix of } y & \exists z(xz = y) & \text{PREFIX}(x, y)\\
74
+
x \text{ is a substring of } y & \exists u \exists v(uxv = y) & \text{SUBSTRING}(x, y)\\
75
+
x \text{ is empty or a string of } 0\text{s} & \text{NOT(SUBSTRING}(1,x)) & \text{NO-1s}(x)
76
+
\end{array}
77
77
$$
78
78
79
79
\subsection{(a)}
80
80
$x$ consists of three copies of some string.
81
81
\begin{proof}
82
-
$\exists u (uuu = x)$
82
+
$\exists u (uuu = x)$
83
83
\end{proof}
84
84
85
85
\subsection{(b)}
86
86
$x$ is an even-length string of 0’s.
87
87
\begin{proof}
88
-
NO-1s$(x)$ AND $\exists y (yy = x)$
88
+
NO-1s$(x)$ AND $\exists y (yy = x)$
89
89
\end{proof}
90
90
91
91
\subsection{(c)}
92
92
$x$ does not contain both a 0 and a 1.
93
93
\begin{proof}
94
-
NOT(SUBSTRING$(0,x)$ AND SUBSTRING$(1, x)$)
94
+
NOT(SUBSTRING$(0,x)$ AND SUBSTRING$(1, x)$)
95
95
\end{proof}
96
96
97
97
\subsection{(d)}
98
98
$x$ is the binary representation of $2^k + 1$ for some integer $k \geq0$.
99
99
\begin{proof}
100
-
$x = 10\text{ OR }\exists y ((1y1 = x)$ AND NO-1s$(y)$)
100
+
$x = 10\text{ OR }\exists y ((1y1 = x)$ AND NO-1s$(y)$)
101
101
\end{proof}
102
102
103
103
\subsection{(e)}
104
104
An elegant, slightly trickier way to define NO-1s$(x)$ is:
105
105
106
106
\begin{center}
107
-
PREFIX$(x, 0x)$ (*)
107
+
PREFIX$(x, 0x)$ (*)
108
108
\end{center}
109
109
110
110
Explain why (*) is true only when $x$ is a string of 0’s.
111
111
\begin{proof}
112
-
First we need to argue that when $x$ contains no 1s, then (*) is true. Indeed, assume $x$ is a string consisting of $n$ 0s. Then $0x$ is a string consisting of $n+1$ 0s. So $x$ is a prefix of $0x$.
113
-
114
-
Now we need to argue that if $x$ contains a 1, then (*) is false. Assume that $x$ contains a 1. Let $n$ be the first digit from the left where a 1 occurs in $x$. In other words, from the left to the right, $x$ starts out with $n - 1$ 0s, followed by a 1, followed by other digits:
115
-
$$
116
-
x = 00\ldots001\ldots\text{ (the 1 occurs at the $n$th place)}
117
-
$$
118
-
Now the string $0x$ starts with $n$ 0s, followed by a 1:
119
-
$$
120
-
0x = 000\ldots001\ldots\text{ (the 1 occurs at the $n+1$st place)}
121
-
$$
122
-
Therefore $x$ cannot be a prefix of $0x$, otherwise $0x$ would have a 1 in the $n$th place, which it does not.
112
+
First we need to argue that when $x$ contains no 1s, then (*) is true. Indeed, assume $x$ is a string consisting of $n$ 0s. Then $0x$ is a string consisting of $n+1$ 0s. So $x$ is a prefix of $0x$.
113
+
114
+
Now we need to argue that if $x$ contains a 1, then (*) is false. Assume that $x$ contains a 1. Let $n$ be the first digit from the left where a 1 occurs in $x$. In other words, from the left to the right, $x$ starts out with $n - 1$ 0s, followed by a 1, followed by other digits:
115
+
$$
116
+
x = 00\ldots001\ldots\text{ (the 1 occurs at the $n$th place)}
117
+
$$
118
+
Now the string $0x$ starts with $n$ 0s, followed by a 1:
119
+
$$
120
+
0x = 000\ldots001\ldots\text{ (the 1 occurs at the $n+1$st place)}
121
+
$$
122
+
Therefore $x$ cannot be a prefix of $0x$, otherwise $0x$ would have a 1 in the $n$th place, which it does not.
123
123
\end{proof}
124
124
125
125
\section{Problem 3}
@@ -129,31 +129,31 @@ \section{Problem 3}
129
129
130
130
The domain of discourse should be the set of students in the class; in addition, the only predicates that you may use are: equality, and $E(x, y)$ meaning that “$x$ has sent e-mail to $y$.”
131
131
\begin{proof}
132
-
``Besides possibly himself'' means that the student might or might not have emailed himself.
132
+
``Besides possibly himself'' means that the student might or might not have emailed himself.
133
133
134
-
``At most two other'' means that the student might have emailed 0, 1 or 2 other people.
134
+
``At most two other'' means that the student might have emailed 0, 1 or 2 other people.
135
135
136
-
So there are 6 possibilities. Using $\wedge$ for AND, $\vee$ for OR, $\neg$ for NOT, $\leftrightarrow$ for IFF:
136
+
So there are 6 possibilities. Using $\wedge$ for AND, $\vee$ for OR, $\neg$ for NOT, $\leftrightarrow$ for IFF:
137
137
138
-
Student emailed nobody: $\exists s \forall z (\neg E(s,z))$,
138
+
Student emailed nobody: $\exists s \forall z (\neg E(s,z))$,
139
139
140
-
Student emailed himself only: $\exists s \forall z (E(s,z) \leftrightarrow z = s)$,
140
+
Student emailed himself only: $\exists s \forall z (E(s,z) \leftrightarrow z = s)$,
141
141
142
-
Student emailed one other person only: $\exists s \exists x (\neg(x = s) \wedge\forall z (E(s,z) \leftrightarrow z = x))$
142
+
Student emailed one other person only: $\exists s \exists x (\neg(x = s) \wedge\forall z (E(s,z) \leftrightarrow z = x))$
143
143
144
-
Student emailed himself and one other person only:
144
+
Student emailed himself and one other person only:
145
145
146
-
$\exists s \exists x (\neg(x = s) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = s))$
146
+
$\exists s \exists x (\neg(x = s) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = s))$
147
147
148
-
Student emailed two other persons only:
148
+
Student emailed two other persons only:
149
149
150
-
$\exists s \exists x \exists y (\neg(x = s) \wedge\neg(y = s) \wedge\neg(x = y) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = y))$
150
+
$\exists s \exists x \exists y (\neg(x = s) \wedge\neg(y = s) \wedge\neg(x = y) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = y))$
151
151
152
-
Student emailed himself and two other persons only:
152
+
Student emailed himself and two other persons only:
153
153
154
-
$\exists s \exists x \exists y (\neg(x = s) \wedge\neg(y = s) \wedge\neg(x = y) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = y \vee z = s))$
154
+
$\exists s \exists x \exists y (\neg(x = s) \wedge\neg(y = s) \wedge\neg(x = y) \wedge\forall z (E(s,z) \leftrightarrow z = x \vee z = y \vee z = s))$
155
155
156
-
So we can join these formulas with OR's between them to get the desired formula.
156
+
So we can join these formulas with OR's between them to get the desired formula.
157
157
\end{proof}
158
158
159
159
\section{Problem 4}
@@ -162,113 +162,113 @@ \section{Problem 4}
162
162
\subsection{(a)}
163
163
$\forall x \exists y P(x, y)$ IMPLIES $\exists y \forall x P(x, y)$
164
164
\begin{proof}
165
-
Define the domain to be the integers $\mathbb{Z}$. Define the predicate $P$ to mean: $P(x, y)$ iff $x < y$.
165
+
Define the domain to be the integers $\mathbb{Z}$. Define the predicate $P$ to mean: $P(x, y)$ iff $x < y$.
166
166
167
-
Notice that $\forall x \exists y P(x, y)$ is true. For every integer $x$, there is another integer $y$ that is strictly bigger than $x$ (just take $y = x+1$).
167
+
Notice that $\forall x \exists y P(x, y)$ is true. For every integer $x$, there is another integer $y$ that is strictly bigger than $x$ (just take $y = x+1$).
168
168
169
-
However the converse $\exists y \forall x P(x, y)$ is false, because it states that there exists one specific integer $y$ that's bigger than all other integers.
169
+
However the converse $\exists y \forall x P(x, y)$ is false, because it states that there exists one specific integer $y$ that's bigger than all other integers.
170
170
\end{proof}
171
171
172
172
\subsection{(b)}
173
173
$\exists y \forall x P(x, y)$ IMPLIES $\forall x \exists y P(x, y)$
174
174
\begin{proof}
175
-
This implication is valid, let's prove it.
175
+
This implication is valid, let's prove it.
176
176
177
-
1. Assume $\exists y \forall x P(x, y)$ is true.
177
+
1. Assume $\exists y \forall x P(x, y)$ is true.
178
178
179
-
2. Want to prove: $\forall x \exists y P(x, y)$.
179
+
2. Want to prove: $\forall x \exists y P(x, y)$.
180
180
181
-
3. To prove (2), assume $x_0$ is an arbitrarily chosed but fixed element in the domain. We want to show $\exists y P(x_0, y)$.
181
+
3. To prove (2), assume $x_0$ is an arbitrarily chosed but fixed element in the domain. We want to show $\exists y P(x_0, y)$.
182
182
183
-
4. By (1) there exists a fixed element $y_0$ in the domain such that $\forall x P(x, y_0)$ is true.
183
+
4. By (1) there exists a fixed element $y_0$ in the domain such that $\forall x P(x, y_0)$ is true.
184
184
185
-
5. By (4) $P(x_0, y_0)$ is true.
185
+
5. By (4) $P(x_0, y_0)$ is true.
186
186
187
-
6. By (5) $\exists y P(x_0, y)$ is true.
187
+
6. By (5) $\exists y P(x_0, y)$ is true.
188
188
189
-
7. Since $x_0$ was arbitrarily chosen, by (6) we have $\forall x \exists y P(x, y)$ is true.
189
+
7. Since $x_0$ was arbitrarily chosen, by (6) we have $\forall x \exists y P(x, y)$ is true.
190
190
\end{proof}
191
191
192
192
\section{Problem 5 (Supplemental Problem)}
193
193
A certain cabal within the Math for Computer Science course staff is plotting to make the final exam ridiculously hard. (“Problem 1. Prove the Poincare Conjecture starting from the axioms of ZFC. Express your answer in khipu—the knot language of the Incas.”) The only way to stop their evil plan is to determine exactly who is in the cabal. The course staff consists of seven people:
194
194
195
195
\begin{center}
196
-
$\{$Adam, Tom, Albert, Annie, Ben, Elizabeth, Siggig$\}$
196
+
$\{$Adam, Tom, Albert, Annie, Ben, Elizabeth, Siggig$\}$
197
197
\end{center}
198
198
199
199
The cabal is a subset of these seven. A membership roster has been found and appears below, but it is deviously encrypted in logic notation. The predicate cabal indicates who is in the cabal; that is, cabal$(x)$ is true if and only if $x$ is a member. Translate each statement below into English and deduce who is in the cabal.
200
200
201
201
\subsection{(a)}
202
202
$\exists x \exists y \exists z(x \neq y$ AND $x \neq z$ AND $y \neq z$ AND cabal$(x)$ AND cabal$(y)$ AND cabal$(z))$
203
203
\begin{proof}
204
-
There are (at least) 3 different people, who are all members of the cabal.
204
+
There are (at least) 3 different people, who are all members of the cabal.
205
205
\end{proof}
206
206
\subsection{(b)}
207
207
NOT(cabal(Siggi) AND cabal(Annie))
208
208
\begin{proof}
209
-
Siggi and Annie are not both in the cabal.
209
+
Siggi and Annie are not both in the cabal.
210
210
\end{proof}
211
211
\subsection{(c)}
212
212
cabal(Elizabeth) IMPLIES $\forall x$ cabal$(x)$
213
213
\begin{proof}
214
-
If Elizabeth is in the cabal, then so is everyone else (all 7).
214
+
If Elizabeth is in the cabal, then so is everyone else (all 7).
215
215
\end{proof}
216
216
\subsection{(d)}
217
217
cabal(Annie) IMPLIES cabal(Siggi)
218
218
\begin{proof}
219
-
If Annie is in the cabal, then so is Siggi.
219
+
If Annie is in the cabal, then so is Siggi.
220
220
\end{proof}
221
221
\subsection{(e)}
222
222
(cabal(Ben) OR cabal(Albert)) IMPLIES NOT(cabal(Tom))
223
223
\begin{proof}
224
-
If either Ben or Albert is in the cabal, then Tom isn't.
224
+
If either Ben or Albert is in the cabal, then Tom isn't.
225
225
\end{proof}
226
226
\subsection{(f)}
227
227
(cabal(Ben) OR cabal(Siggi)) IMPLIES NOT(cabal(Adam))
228
228
\begin{proof}
229
-
If either Ben or Siggi is in the cabal, then Adam isn't.
229
+
If either Ben or Siggi is in the cabal, then Adam isn't.
230
230
\end{proof}
231
231
\subsection{(g)}
232
232
Now use these facts to explain exactly who is on the cabal and why.
233
233
\begin{proof}
234
-
1. By (b), we know that there is at least 1 person in the domain who is NOT in the cabal.
234
+
1. By (b), we know that there is at least 1 person in the domain who is NOT in the cabal.
235
235
236
-
2. By (1), not everyone is in the cabal.
236
+
2. By (1), not everyone is in the cabal.
237
237
238
-
3. By (2) and (c), Elizabeth cannot be in the cabal. (If Elizabeth is in the cabal, then everyone has to be in the cabal, which contradicts (2).)
238
+
3. By (2) and (c), Elizabeth cannot be in the cabal. (If Elizabeth is in the cabal, then everyone has to be in the cabal, which contradicts (2).)
239
239
240
-
4. By (d) and (b), Annie cannot be in the cabal. (If Annie is in the cabal, then by (d) Siggie would be in the cabal too, but they can't be both in the cabal because of (b).)
240
+
4. By (d) and (b), Annie cannot be in the cabal. (If Annie is in the cabal, then by (d) Siggie would be in the cabal too, but they can't be both in the cabal because of (b).)
241
241
242
-
5. Now let's argue by cases:
242
+
5. Now let's argue by cases:
243
243
244
-
6. Case 1: Ben is in the cabal.
244
+
6. Case 1: Ben is in the cabal.
245
245
246
-
6.1. By (e) and (6), Tom is not in the cabal.
246
+
6.1. By (e) and (6), Tom is not in the cabal.
247
247
248
-
6.2. By (e) and (6), Adam is not in the cabal.
248
+
6.2. By (e) and (6), Adam is not in the cabal.
249
249
250
-
6.3. So in this case, Elizabeth, Annie, Tom and Adam are not in the cabal. So the remaining 3 people Ben, Albert, Siggie must be in the cabal by (a).
250
+
6.3. So in this case, Elizabeth, Annie, Tom and Adam are not in the cabal. So the remaining 3 people Ben, Albert, Siggie must be in the cabal by (a).
251
251
252
-
7. Case 2: Ben is not in the cabal. (So now 3 people: Ben, Elizabeth, Annie are not in the cabal. We need to check the remaining 4 people Adam, Tom, Albert, Siggi.)
252
+
7. Case 2: Ben is not in the cabal. (So now 3 people: Ben, Elizabeth, Annie are not in the cabal. We need to check the remaining 4 people Adam, Tom, Albert, Siggi.)
253
253
254
-
7.1. Subcase 2.1: Albert is in the cabal.
254
+
7.1. Subcase 2.1: Albert is in the cabal.
255
255
256
-
7.1.1. By (e) and (7.1), Tom is not in the cabal.
256
+
7.1.1. By (e) and (7.1), Tom is not in the cabal.
257
257
258
-
7.1.2. Now we are left with 3 people: Siggi, Albert, Adam. By (a) they must be all members of the cabal.
258
+
7.1.2. Now we are left with 3 people: Siggi, Albert, Adam. By (a) they must be all members of the cabal.
259
259
260
-
7.1.3. Since Siggi is in the cabal, by (f) Adam is not in the cabal, which is a contradiction! Therefore Subcase 2.1 is not possible.
260
+
7.1.3. Since Siggi is in the cabal, by (f) Adam is not in the cabal, which is a contradiction! Therefore Subcase 2.1 is not possible.
261
261
262
-
7.2. Subcase 2.2: Albert is not in the cabal.
262
+
7.2. Subcase 2.2: Albert is not in the cabal.
263
263
264
-
7.2.1. So now 4 people: Ben, Albert, Elizabeth, Annie are not in the cabal.
264
+
7.2.1. So now 4 people: Ben, Albert, Elizabeth, Annie are not in the cabal.
265
265
266
-
7.2.2. By (a), the remaining 3 people: Siggi, Tom, Adam must be in the cabal.
266
+
7.2.2. By (a), the remaining 3 people: Siggi, Tom, Adam must be in the cabal.
267
267
268
-
7.2.3. Once again, since Siggi is in the cabal, by (f) Adam is not in the cabal, which is a contradiction! Therefore Subcase 2.2 is also not possible.
268
+
7.2.3. Once again, since Siggi is in the cabal, by (f) Adam is not in the cabal, which is a contradiction! Therefore Subcase 2.2 is also not possible.
269
269
270
-
7.3. By (7.1.3) and (7.2.3) we see that Case 2 leads to a contradiction, so it's impossible.
270
+
7.3. By (7.1.3) and (7.2.3) we see that Case 2 leads to a contradiction, so it's impossible.
271
271
272
-
8. Therefore the only possible conclusion is the one at the end of Case 1: Ben, Albert, Siggie are in the cabal and nobody else.
272
+
8. Therefore the only possible conclusion is the one at the end of Case 1: Ben, Albert, Siggie are in the cabal and nobody else.
0 commit comments