Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Методичка дискретка(англ).doc
Скачиваний:
2
Добавлен:
12.11.2019
Размер:
1.33 Mб
Скачать

58

Ministry of Education and Science of Ukraine

Donetsk National Technical University

INTRODUCTION TO DISCRETE MATHEMATICS

(Summary of Lectures)

V. N. Pavlysh

dep. of numerical mathematics and programming

(For the students of English Engineering faculty)

Donetsk 2006

Министерство образования и науки Украины

Донецкий национальный технический университет

ВВЕДЕНИЕ В ДИСКРЕТНУЮ МАТЕМАТИКУ

(конспект лекций)

В.Н. Павлыш

кафедра вычислительной математики и программирования

(на английском языке)

(Для студентов английского технического факультета)

Донецк 2006

Министерство образования и науки Украины

Донецкий национальный технический университет

ВВЕДЕНИЕ В ДИСКРЕТНУЮ МАТЕМАТИКУ

(конспект лекций)

(Для студентов английского технического факультета)

Рассмотрено

на заседании кафедры вычислительной математики и программирования

протокол № 7 от 14.02.2006

(на английском языке)

Утверждено

на заседании учебно-издательского совета ДонНТУ

протокол № от 2006

Донецк 2006

УДК 681.3.06 (071)

Введение в дискретную математику (конспект лекций). (Для студентов английского технического факультета)/ Сост. В.Н. Павлыш (на англ. языке).- Донецк, Доннту.- 60с.

Составитель: В.Н. Павлыш, доцент.

Рецензент: С.А. Ковалев, доцент.

Донецк 2006

1. Sets, sequences and functions

This chapter is introductory and contains a relatively large number of fundamental definitions and notations. Much of the material is probably familiar, although perhaps with different notation or at a different level of mathematical precision.

1.1 Some Special Sets

In the past few decades it has become traditional to use set theory as the underlying basis for mathematics. That is, the concepts of “set” and “membership” are taken as basic undefined terms and the rest of mathe­matics is defined or described in these terms. A set is a collection of objects; the definition of a set must be unambiguous in the sense that it must be possible to decide whether particular objects belong to the set. We will usually denote sets by capital letters, such as A, B, S or X. Objects are usually denoted by lowercase letters, such as a, b, s or x. An object a that belongs to a set S is called a member of S or element of S. If a is an object and A is a set, we write a  A to mean that a is a member of A and a A to mean that a is not a member of A. The symbol  can be read as a verb phrase “is an element of,” “belongs to” or “is in” or as the preposition “in,” depending on context.

Specific sets can be written in a variety of ways. A few especially common and important sets will be given their own names, i.e., their own symbols. We will reserve the symbol N for the set of natural numbers:

N = {0, 1, 2, 3, 4, 5, 6, ...}.

Note that we include 0 among the natural numbers.

We write P for the set of positive integers:

P = {1, 2, 3, 4, 5, 6, 7, ...}.

Many mathematics texts write this set as N instead. The set of all integers, positive, zero or negative, will be denoted by Z [for the German word “Zahl”]. Numbers of the form m/n where m Z, n Z and n  0 are called rational numbers [since they are ratios of integers]. The set of all rational numbers is denoted by Q. The set of all real numbers, rational or not, is denoted by R. Thus R contains all the numbers in Q, and R also contain and many, many other numbers. Small finite sets can be listed using braces { } and commas. For example, {2, 4, 6, 8, 10} is the set consisting of the five positive even integers less than 12, and {2, 3, 5, 7, 11, 13, 17, 19} consists of the eight primes less than 20. Two sets are equal if they contain the same elements. Thus

{2, 4, 6, 8, 10} = {10, 8, 6, 4, 2} = {2, 8, 2, 6, 2, 10, 4, 2};

the order of the listing is irrelevant and there is no advantage [or harm] in listing elements more than once.

Large finite sets and even infinite sets can be listed with the aid of the mathematician's etceteras, namely three dots,…, provided that the meaning of the three dots is clear. Thus {1, 2, 3,..., 1000} represents the set of positive integers less than or equal to 1000, and {3, 6, 9, 12,...} presumably represents the infinite set of positive integers that are divisible by 3. On the other hand the meaning of {1, 2, 3, 5, 8,...} may be less then perfectly clear. The somewhat vague use of three dots is not always satisfactory, especially in computer science, and we will develop tech­niques for unambiguously describing such sets without using dots.

Sets are often described by properties of their elements using the notation

{ : }.

A variable [n or x, for instance] is indicated before the colon, and the properties are given after the colon. For example,

{n : n N and n is even}

represents the set of nonnegative even integers, i.e., the set {0, 2, 4, 6, 8,10,..}.The colon is always read “seen that” so the above is read “the set of all n such that n is in N and n is even.” Similarly,

{x : x R and 1  x < 3}

represents the set of all real numbers that are greater than or equal to 1 and less than 3. The number 1 belongs to the set, but 3 does not. Just to streamline notation, the last two sets can be written as

{n  N: n is even} and x  R: 1  x <3}.

The first set is then read “the set of all n in N such that n is even.”

Another way to list a set is to specify a rule for obtaining its elements using some other set of elements. For example, {n2 : n  N} represents the set of all integers that are the squares of integers in N, i.e.,

{n2 : n  N} = {m  N :m = n2 for some n  N} ={0, 1, 4, 9, 16, 25, 36,...}.

Note that this set equals {n2 : n  Z}. Similarly, {(- l)n : n  N} represents the set obtained by evaluating (- l)n for all n  N, so that

{(- l)n : n  N} = {-1,1}.

This set has only two elements.

Now consider two sets S and T. We say that S is a subset of T pro­vided that every element of S belongs to T. If S is a subset of T, we write S T. The symbol  can be read as “is a subset of.” We also frequently say, “S is contained in T” in case S T, but note the potential for con­fusion if we also say, “x is contained in T” when we mean “xT.” Con­tainment for a subset and containment for elements mean quite different things.

Two sets S and T are equal if they have exactly the same elements. Thus S = T if and only if S T and T S.

EXAMPLE 1

  1. We have PN, NZ, ZQ, QR. As with the familiar inequality

, we can run these assertions together:

P  N  Z  Q  R.

(b) Since 2 is the only even prime, we have

{n  P : n is prime and n  3}  {n  P : n is odd}.

(c) Consider again any set S. Obviously x S implies x S, and so S S. That is, we regard a set as a subset of itself. This is why we use the notation  rather than . This usage is analogous to our usage of  for real numbers. The inequality x 5 is valid for many numbers, such as 3,1 and -73. It is also valid for x = 5, i.e., 55. This last inequality looks a bit peculiar because we actually know more, namely 5=5. But 55 says that “5 is less than 5 or else 5 is equal to 5,” and this is a true statement. Similarly, S S is true even though we know more, namely S = S. Statements like “5 = 5,” “5  5,” “S = S” or “S S” do no harm and are often useful to call attention to the fact that a particular case of a more general statement is valid. ■1

We will occasionally write T  S to mean that T  S and T  S, i.e., T is a subset of S different from S. This usage of  is analogous to our usage of < for real numbers. If T  S, we say that T is a proper subset of S.

We next introduce notation for some special subsets of R, called intervals. For a, b R with a < b, we define

[a, b] = {xR :a x b}; (a, b) = {x R :a < x < b};

[a, b) = {x R :a x < b}; (a, b] = {x R :a < x b}.

The general rule is that brackets [ , ] signify that the endpoints are to be included and parentheses ( , ) signify that they are to be excluded. Intervals of the form [a, b] are called closed; those of the form (a, b) are open. It is also convenient to use the term “interval” for some unbounded sets that we describe using the symbols  and - , which do not repre­sent real numbers but are simply part of the notation for the sets. Thus

[a, ) = {x R :a x}; (a, ) = {x R :a < x};

(-,b] = {:xR : x b}; (-,b) = {xR : x < b}.

Set and interval notation must be dealt with carefully. For example, [0,1], (0,1) and {0,1} all denote different sets. In fact, the intervals [0,1] and (0,1) are infinite sets, while {0,1} has only two elements.

Consider the following sets:

{nN:2<n<3}, {xR:x2<0},

{rQ:r2=2}, {xR:x2+1=0}.

These sets have one property in commons They contain no elements. From a strictly logical point of view, they all contain the same elements and so they are equal in spite of the different descriptions. This unique set having no elements at all is called the empty set. We will use two notations for it, the suggestive { } and the standard . The symbol  is not a Greek phi ; it is borrowed from the Norwegian alphabet and non-Norwegians should read it as “empty set.” We regard  as a subset of every set S because we regard the statement “x   implies xS” as logically true in a vacuous sense.

Sets are objects, so they can be members of other sets. The set {{1, 2}, {1, 3}, {2}, {3}} has four members, namely the sets {1,2}, {1, 3}, {2} and {3}. If we had a box containing two sacks full of marbles, we would consider it to be a box of sacks rather than a box of marbles, so it would contain two members. Similarly, if A is a set, then {A} is a set with one member, namely A, no matter how many members A itself has. A box containing an empty sack contains something, namely a sack, so it is not an empty box. In the same way, {} is a set with one member, whereas  is a set with no members, so {} and  are different sets. We have   {} and even   {}, but  .

The set of all subsets of a set S is called the power set of S and will be denoted P(S). Clearly the empty set  and the set S itself are ele­ments of P(S), i.e.,   P(S) and S  P(S).

EXAMPLE 2

(a) We have P() = {} since  is the only subset of .

(b) Consider a typical one-element set, say S = {a}. Then P(S) = {, {a}} has two elements.

(c) If S = {a, b} and a b, then P(S) = {, {a}, {b}, {a, b}} has four elements.

(d) If S = {a, b, c} has three elements, then

P(S) = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}

has eight members.

(e) Let S be a finite set. Note that if S has n elements , then P(S) has 2n elements, as shown in parts (a) to (d) above.

(f) If S is infinite, then P(S) is also infinite, of course. ■

We introduce one more special kind of set, denoted by Σ*, that will recur throughout the text. Our goal is to allow a rather general, but precise mathematical treatment of languages. First we define an alphabet to be a finite nonempty set Σ [capital Greek sigma] whose members are symbols, often called letters of Σ, and which is subject to some minor restrictions that we will discuss at the end of this section. Given an al­phabet Σ, a word is any finite string of letters from Σ. Finally, we denote the set of all words using letters from Σ by Σ* [sigma-star]. Any subset of Σ* is called a language over Σ.

EXAMPLE 3

  1. Let Σ = {a, b, c, a,..., z} consist of the twenty-six letters of the English alphabet. Any string of letters from Σ belongs to Σ. Thus Σ contains math, is, fun, aint, lieblich, amour, zzyzzoomph, etcetera, etc. Since Σ* contains a, aa, aaa, aaaa, aaaaa, etc., Σ* is clearly an infinite set. To be definite, we could define the American language L to be the subset of Σ* consisting of words in the latest edition of Webster's New World Dictionary of the American Language. Thus

L = {a, aachen, aardvark, aardwolf,..., zymurgy},

a large but finite set.

  1. To _get simple examples and yet illustrate the ideas, we will frequently take Σ

to be a 2-element set {a, b}. In this case Σ* contains a, b, ab, ba, bob,

babbabb, etc.; again Σ* is infinite.

  1. If Σ = {0,1}, then the set B of words in Σ* that begin with 1 is exactly the set

of binary notations for positive integers. That is,

B = {1,10,11,100,101,110,111.1000,1001....}. ■

There is a special word in Σ* somewhat analogous to the empty set, called the empty word or null word; it is the string with no letters at all and is denoted by λ [lowercase Greek lambda].

EXAMPLE 4

(a) If Σ={a, b}then

Σ* = {λ, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, bob, bba,...}.

  1. If Σ={0,1,2}, then

Σ* = {λ, 0,1, 2, 00, 01, 02, 10, 11,12, 20, 21, 22, 000, 001, 002,...}.

(c) If Σ = {a}, then

Σ* = {λ, a, aa, aaa, aaaa, aaaaa, aaaaaa,...}.

This example doesn't contain any very useful languages, but it will serve to illustrate concepts later on.

(d) Various computer languages fit our definition of language. For example, the alphabet Σ for one version of ALGOL has 113 elements; Σ includes letters, the digits 0,1, 2, ..., 9 and a variety of operators, includ­ing sequential operators such as “go to” and “if.” As usual, Σ* contains all possible finite strings of letters from Σ, without regard to meaning. The subset of Σ* consisting of those strings accepted for execution by an ALGOL compiler on a given computer is a well-defined and useful subset of Σ*; we could call it the ALGOL language determined by the compiler. ■

As promised, we now discuss the restrictions needed for Σ. A problem can arise if the letters in Σ are themselves built out of other letters, either from Σ or from some other alphabet. For example, if Σ contains as letters the symbols a, b and ab, then the string aab could be taken to be a string of three letters a, a and b from Σ or as a string of two letters a and ab. There is no way to tell which it should be, and a machine reading in the letters a, a, b one at a time would find it impossible to assign a unique meaning to the input. To take another example, if Σ contained ab, aba and bob, the input string ababab could be interpreted as either (ab)(ab)(ab) or (aba)(bab). To avoid these and related problems, we will not allow Σ to contain any letters that are themselves strings beginning with the letters in Σ. Thus Σ = {a, b, c}, Σ = {a, b, ca} and Σ = {a, b, Ab} are allowed, but Σ = {a, b, c, ac} and even Σ = {a, b, ac} are not.

With this agreement, we can unambiguously define length(w) for a word w in Σ* to be the number of letters from Σ in w, counting each appearance of a letter. For example, if Σ = {a, b}, then length(aab) = length(bab) = 3. If Σ = {a, b, Ab], then length (abbAb) = 4. We also define length(λ) = 0.

One final note: We will use w, w1, etc. as variable names for words. This practice should cause no confusion even though w also happens to be a letter of the English alphabet.

EXAMPLE 5

If Σ = {a, b} and A = {w Σ* : length(w) = 2}, then A = {aa, ab, ba, bb}.

If

B = {w *:length(w) is even},

then B is the infinite set {, aa, ab, ba, bb, aaaa, aaab,aaba, aabb,...}.

Note that A is a subset of B. ■