Uploaded by mastro1729

Adobe Scan 26-Sep-2022

advertisement
Homework Solutions
1 la P(la. 0)) - {0. {a}.(0).(a,0}.
1b. S e PT) (in words: every ee
Since
S is
assumed to
be
a
subset
s n element of T) is guarantecd to be true
of T
S C P(T) (in words: every clement ol S is a subset of T) is possibly rue (eg
11
S ( f o l }and T = {a.,{a}) and possiby false (e.g., ifS = T = j a )
P(S) E P(T) (in words: every s
S = {u) and T
an element of T) is possibly true (e.g. if
= {a,0.{a)) and possy lalse (e.g.. if S = T= {a).
pLSLCP(T) (in words: every suos
since S is assumed to
be
a
dIs a subset of T) is guaranteed to be true
subset of T.
lc. (a, b, a), (a, b, 6), (a, b, c), (a, c, a), (a, C, b), (a, c, c)}
ld. No. It is never possible that 2 n
U, because e e *nr" (i.e., the empty string is
a string over both alphabets)
1e.
f45 6
20 0D
2.
3 1
2
0
4 0
1
2
2a.
2b,c. P Q R(PV-R)A(-PVQ) (P»Q)
TT
TT
TT
F
T
TFT
TF
(Q
R)
F
F
FF
F
FT TF
T
FF
T
TF
FFFT
2d.
(Vr
¬
Z) (3y
¬
R)
Plr,y) is true by letting y
=
r+0.5, for example.
(Vr E R) (3y E Z) P(z,y ) is lalse since any integer r
is a counterexainple.
integer y such
r
<y <r+lifa is an integer.)
y E R) (Vr ¬ Z) -P(r, y) is true by letting y be any
hteget
that
(T here is ho
y
e Z) (Va ¬ R) ~PlT.u) is false, that is, (Vye Z) (3r ¬ R) P(r.u) is true by letting
r = y - 0.5, for example.
3.
3n. Cousider any such G, and assume every node has degree at lenst .
To see that G is
connected, consider any two distinct nodes u and v. Now we do a case analysis: If {u,v}
is an edge, then ol course there is a path (of length 1) between u and v. Now assuming
u, v) is not an edge, tuS and v's neighbors must all be among the other n - 2 nodes.
Since u's neighbor set has size 2
which is more than half of the other n -2 nodes,
aund similarly for ' s neighbor set, the intersection of these two sets is nonempty. That
is, u and v have at east one common neighbor w. Then u-w-v is a path (ol length
2
3b. Consider any such G and m, and suppose there does not exista node u that has Out-
degree at least m/n. By De Morgan's law, this means that outdeg(u) < m/n lfor every
node u.
The sum of the outdegrees of all nodes equals the number of edges (since
each edge contributes to the outdegree of exactly one node), so G's number of edges is
outdeg(u) < m / n =n m/n = m. That is, G does not have at least m edges
Homework 2 Solutions
I.
la. Suppose for contradiction it 's not t e S e lhat either everybody las at least one Iriend or
everybody has at least one enemy.
Dy De Morgan, tlhis means somebody has no iriends
call this person A-and somelbody ins ho enemies-call this person B. Note that A and
B must be different people. Since A nas no friends, A and B must not be friends. Since
B has no eneinies, A and B must not be enemies. But this is a contradiction since every
pair of people is eit her friends
b. :
or
enemies,
We give a direct proof. Suppose there are at least two almost-blue columns. For
every way of choosing two pebbles fron each column, each almost-blue column must
have at least one blue pebble chosen since the column has at most one gray pebble
Thus at least two of the chosen pebbles will be blue and in different columns.
:
We give a contrapositive proof. Suppose there is at most one almost-blue columi.
Then we claim there is a way of choosing two pebbles from each column such that at
most one column has a blue pebble chosen. Namely, for each non-almost- blue column
there are at least two gray pebbles, so choose two of those, and if there is an almost-blue
column then it doesn't matter which two pebbles we pick from it.
2.
2a. Q = {go. g1, 42, g3, 94} in left-to-right order
= {a, b
a
90
b
91
91
92
92
1
93
93
44
g4 94
90
4
go is the start state
F {44
2b. {w E {a, b}* : w contains abba as a substring}
of the pattern abba
go: have not just seen any prefix
a
the
seen
prefix
g1: have just
92: have
g3: have
just
just
seen
the
seen
the
prefix ab
prefix abb
q4: have seen the whole pattern abba at some point in the past
3
3a.
0
0
3b.
-8
/0.1
0CO
0
0
4. No. Although (B o C) U (Co B) C A, the other direction does not hold since, e.g., 101 E A
but 101 g BoC since no prelix of 101 is in B, and 101 g Co B since no suffix of 101 is in B.
b
5.
b
a
b
a
a
r
Homework3
Solutions
.la. Q={41.2.93)
= {a,b
b
g1,92
state
g1 is the start
F
l92}
1b.
b
ae
ae
beb
It is in the language since at least one computation path leads to the accept state q2 after
reading the whole input (without geting stuck). In this particular case, there happens
to be only one accepting computation path.
lc.
a,b
2
2
o.1
3. N:
N':
-8
and
state)
path
The string 1 is accepted by both N (by the
state).
N' (by the computation path that stays at the start
that
c o m p u t a t i o n
N and N
because they get stuck at the start state
4a.
(bb ubbb)et(a Ue)
4b
a(buc) u bE(aUc) U CE(a ub)
4c. 0 (10"(1Ue)
Another answer: (0u 10)*(1 UE)
Another answer: (1 uE)(0UO1)
4d.
00+ U 100+ u 0t10* u 001
4e.
10
U °'1'
The
leaves
the
start
is rejected
string 0
by
both
4 Solutions
Homew
la.
-((0Ua)E U_))0 Ja)
1b.#a ubu/u (#(a ub))'
0
a
u
#
a))
lowed by
#'s
but they must eventually be
any# in the middle can
would
with
/
look
like
the end of the cominent.
followed by a or b, since
being follirectly before the end of the comment
There can also be
(which
any number of
hat 15,
don't need
2
2a.
w
e
be
to
{0,1}
:
w
followed by
consists
a
or
more
b
0
of an optico
followed by an even number of 1s}
2b. E:
0:
:
0UE:
11:
(11):
0O-0-0
-O-LO-OLO
(0uE)(11)":
-0
oc'a UaUb
Cc
bc'a Uc
Cc'b
bec Ue
bc'b Ua
4a.
Let
0P10P 1 0 1 ,
d
consider s y va
8
=
xyz.
Then y
exists within
the
first group of Os since Iryl p. S o t
nglage since either its length is not a
multiple of 3, or the first third od a?s bas oniy s while at least one of the other thirds
in not only Os (as lul >0 pushen thefirst ) out of the first third).
Ab.
Lets =
1P01P, and consider any validsplit =
ry2. Then y erists within the first groaup
of ls since lay| S p. So rfPz = z 4 the language since the nunber of Is after the first
0 is still p, but the number of Is beloare the lhrst 0 is < p (since lul > 0.
4c. Let s = (P12+10", which isin thelanguage since i =p Sp=k. Consider any valid
splits
zyz. Then y exists within the first group of Os since |zyl S p. Comparing zyfz
to zyz, i became p + lul but j = 2p+ 1 and k =pstayed the same. Nowi
2p< j
since lul p , and i > p = k since ul>0. Thussy'z g the language since neither i 2j
nor i
k.
2
Download