Download Homework #3

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Infinitesimal wikipedia , lookup

Georg Cantor's first set theory article wikipedia , lookup

Infinite monkey theorem wikipedia , lookup

Hyperreal number wikipedia , lookup

Series (mathematics) wikipedia , lookup

Addition wikipedia , lookup

Four color theorem wikipedia , lookup

List of first-order theories wikipedia , lookup

Collatz conjecture wikipedia , lookup

Order theory wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Infinity wikipedia , lookup

Transcript
Assignment #2
COMP 3200
Spring 2012
Prof. Stucki
1) Construct deterministic finite automata accepting each of the following languages. In (a)-(c) the alphabet is
= {0,1}. In (d)-(e) the alphabet is ASCII and you can specify transitions with character classes.
a)
b)
c)
d)
e)
{w | w begins with a 1 and ends with a 0}
{w | w contains at least 3 1s}
{w | w has length at least 3 and its third symbol is a 0}
{w | w is an integer literal}
{w | w is a Java comment}
2) Now construct non-deterministic finite automata for each of the languages in (1).
3) Give state transition diagrams of NFAs recognizing the following languages. In all cases, the alphabet is {0, 1}.
(a)
{w | w ends with 00} with three states
(b)
{w | w contains an even number of 0s, or exactly two 1s} with six states
(c)
{w | w contains the either the substring 010 or the substring 100} with six states
(d)
{0} with two states
(e)
{1, 00, 111} with five states
Homework #2 Solution
C SC 381
Spring 2008
Prof. Stucki
1) 1.5.2, p. 29
Base:
IH:
IS:
2) 1.5.3, p. 29
Show by induction that n4 – 4n2 is divisible by 3 for all n
0.
n = 0 04 – 4(0)2 = 0, which is certainly divisible by 3.
Assume that 3 | k4 – 4k2 for 0 k n
Show that 3 | (n+1)4 – 4(n+1)2
(n+1)4 – 4(n+1)2 = (n4 + 4n3 + 6n2 + 4n + 1) – (4n2 + 8n + 4)
= (n4 – 4n2) + (4n3 + 6n2 + 4n + 1 – 8n – 4)
= (n4 – 4n2) + (4n3 + 6n2 – 4n – 3)
= (n4 – 4n2) + 3(n3 + 2n2 – n – 1) + n3 – n
= (n4 – 4n2) + 3(n3 + 2n2 – n – 1) + (n – 1) n (n + 1)
In this last expression, the IH tells us the first term is divisible by 3, the middle term is
explicitly divisible by 3, and the last term, as the product of three consecutive numbers, must
have a factor of 3.
What is wrong with the purported proof (in textbook) that all horses are the same color?
The problem is that the asserted base case of one horse is not the correct one. Consider the case when
n + 1 = 2. Call the horses in the set Bucephalus and Mister Ed. When you discard Bucephalus, ―all
the remaining horses,‖ meaning {Mister Ed}, ―have the same color‖ by the inductive hypothesis. Call
this color c1. Put Bucephalus back into the set and ―discard another.‖ The only possibility is Mister
Ed. This time ―all the remaining horses,‖ referring to {Bucephalus}, ―have the same color.‖ Call this
color c2. So Bucephalus and Mister Ed have the same color as ―the ones that were not discarded
either time,‖ which we shall call c3. That is c1 = c2 = c3. But when n + 1 = 2, there are no horses in the
set that were never discarded, so there are no horses of color c3 to which we can apply the ―is the
same color as‖ relation to conclude c1 = c3 or c2 = c3, and no meaningful fixed value for c3. Since the
induction fails to show that if the claim holds for 1 horse, then the claim holds for two horses, the
entire proof fails.
Notice that if a proper base case were established, then the proof would show that all horses have the
same color—if any set of two horses were all the same color, then any set of three would be, etc.
3) 1.5.6, p. 29
Show that in any group of at least two people there are at least two persons that have the same
number of acquaintances within the group. (Use the pigeonhole principle.)
The pigeonhole primciple says that there is no one-to-one function from a set A of pigeons to a set B
of holes, whenever |A| > |B|. So to demonstrate that at least two people in our group (―pigeons‖) know
the same number of people within the group (―fit into the same pigeonhole‖), we must show that the
set P of people has a greater cardinality than the set R of ―possible number of people that a person
could know.‖ We know that |P| = n.
For this group of n people, we assume that ―knowing‖ is not reflexive (we could also have assumed
that ―knowing‖ is reflexive; only a few minor details of the proof would be changed). So a person p
can know anywhere from 0 to n – 1 people in the group (i.e., can know no one, or can know everyone,
or anywhere in between). Consider the set of numbers of people the p could know. That set R is
{0, 1, …, n – 1}, and clearly has n elements.
If there is a person p who knows everyone in the group, then there cannot also be a person r who
knows nobody else. Either p and r know each other (and thus r knows someone), or they do not (and
thus p does not know everyone). Thus R can contain either 0 or n – 1, but not both, so in no case can
R have a cardinality of more than n – 1.
As |P| = n, this demonstrates that |R| < |P|, so there is no one-to-one function from R to P, so by the
pigeonhole principle at least two people must know the same number of people within the group.
4) 1.5.7, p. 29
Suppose we try to prove, by an argument exactly parallel to the proof of Theorem 1.5.2, that the
set of all finite subsets of is uncountable. What goes, wrong?
When we take the complement of a finite subset of , the set we obtain will be infinite. Thus the
―new‖ diagonal set is not a finite subset of . As such it did not need to be included in our
enumeration, so its absence from that enumeration poses no problem.
5) 1.5.8, p. 29
Give examples to show that the intersection of two countably infinite sets can be either finite or
countably infinite, and that the intersection of two uncountable sets can be finite, countably
infinite, or uncountable.
The intersection of two countably infinite sets can be either finite or countably infinite:
The intersection of the odd naturals with the even naturals is the empty set, which is
finite.
The intersection of the prime integers with the odd integers is the odd primes, which is
countably infinite.
On the other hand, the intersection of two uncountably infinite sets can be finite, countably infinite,
or uncountably infinite:
The intersection of 2 with the set of all real numbers is empty, and thus finite.
The intersection of 2
with {2 2 }
is , which is countably infinite.
The intersection of 2 with itself is uncountable. Likewise, the intersection of the interval
[0. 6)
with the interval (5, 10] is the interval (5, 6), which is uncountable.
6) 1.6.1, p. 40
a)
Are the following sets closed under the following operations? If not, what are the respective
closures?
The odd integers under multiplication.
Yes, the product of any two odd integers is an odd integer (Can you prove this?).
b) The positive integers under division.
No,
c)
+
, the positive rational numbers, is the closure of the positive integers under division.
The negative integers under subtraction.
No, the closure of the negative integers under subtraction is , the set of all integers.
d) The negative integers under multiplication.
No, the closure is the set of all non-zero integers.
e)
The odd integers under division.
No, the closure is the set of all rational with only odd numerators and denominators.
7) 1.6.2, p. 40
What is the reflexive transitive closure R* of the relation R = {(a, b), (a, c), (a, d), (d, c), (d, e)}?
Draw a directed graph representing R*.
a
b
c
e
d
8) 1.6.3, p. 41
Is the transitive closure of the symmetric closure of a binary relation necessarily reflexive?
Prove it or give a counterexample.
No. Let R be the empty relation on any non-empty set S. R is its own symmetric closure, and its own
transitive closure, but remains non-reflexive.
9) 1.6.5, p. 41
Give an example of a binary relation that is not reflexive but has a transitive closure that is
reflexive.
The relation {(0, 1), (1, 0)} on the set {0, 1} is not reflexive, but its transitive closure is the relation
{(0, 0), (0, 1), (1, 0), (1, 1)}.