1 / 25

Discrete Structures

Discrete Structures. Li Tak Sing( 李德成 ) mt263f -11- 12.ppt. Counting Strings. The set A* of all strings over a finite alphabet A is countably infinite. Proof. A* is the union of A 0 , A 1 ,... Since each A n is finite, therefore the union of these finite sets are countable.

scott-miles
Download Presentation

Discrete Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Discrete Structures Li Tak Sing(李德成) mt263f-11-12.ppt

  2. Counting Strings • The set A* of all strings over a finite alphabet A is countably infinite. • Proof. A* is the union of A0, A1,... Since each An is finite, therefore the union of these finite sets are countable.

  3. Uncountable sets • Diagonalization • Let A be an alphabet with two or more symbols and let So, S1, ..., Sn, ..., be countable listing of sequences of the form Sn=(ano, an1,....), where aniA. The sequences are listed as the rows of the following infinite matrix:

  4. Then there is a sequence S=(b0, b1, b2,..) over A that is not in the original list. We can construct S from the list of diagonal elements (a00, a11, a22,...) by changing each element so that bnann for each n.

  5. Uncountability of the reals. • We can have a bijection between R and the set U of real numbers between 0 and 1. Therefore |U|=|R|. • An example of such functions: • Assume that U is countable. Therefore, there is a bijection between U and N. In other words, we can call the elements as:, , ,.... Since all the elements of U are numbers between 0 and 1, we can consider them as list of decimal digits. Using the last rule, there must be a decimal number which are not in the list. Therefore, such bijection does not exist and therefore U is uncountable. Hence, R is uncountable.

  6. Limits on computability • The set of programs for a programming language is countably infinite. • Programs can be considers as strings over a particular set of alphabets, therefore, according to the countability of strings, programs are countabily infinite.

  7. Not everything is computable • We only have countable programs, therefore we can only generate countable number of results. • For example, there are uncountable real numbers. So we cannot use programs to generate all the real numbers as we only have countable programs.

  8. Higher cardinalities • |A|<|power(A)| • Proof. This is true for finite A. • For infinite A, we see that for each element of A, say x, {x} is an element of A. So we can see that |A| is at lease less than or equal to |power(A)|. • Would it be possible that |A|=|power(A)|?

  9. Higher cardinalities • Assume that that is the case, therefore there is a bijection between A and power(A). So each x in A is associated with a subset Sx of A. Now, consider the subset:S={xA|xSx} • There is an y such that S=Sy • Now, ySy y Sy and y Sy  ySy • Therefore, contradition and such bijection does not exist. • Therefore |A|<|power(A)|

  10. There are uncountably many languages over a finite alphabet • A language is a subset of all the strings over a set of alphabets. So all the languages over a set of alphabets form the power set of all the strings over a set of alphabets. • Since the set of all strings over a set of alphabets is countably infinite, the power set is uncountably infinite.

  11. Examples • Show that the cardinality of the odd integers is the same as the cardinality of the integers. • Show that the set of even natural numbers have the same cardinality as the set Z of integers. • Prove that the open intervals of real numbers (1,2) and (4,10) have the same cardinality.

  12. Solution • There is a bijection between odd integers and all integers:Therefore |odd integers|=|Z| • There is a bijectionbetween even natural integers and integers.

  13. Solution • There is a bijection between (1,2) and (4,10):

  14. Construction Techniques • Inductively Defined Sets • Basis: Specify one or more elements of s. • Induction: Give one or more rules to construct new elements of S from existing elements of S. • Closure: State that S consists exactly of the elements obtained by the basis and induction steps.

  15. Examples • Consider how to define the following sets inductively: • {4,2,0,-2 ...} • {2, 6,18, 54,….} • {4,-8, 16, -32,...} • {...,-6,-3,0,3,6,...}

  16. Solution • Basis: induction: • Basis: induction: • Basis: induction: • Basis: induction:

  17. Strings • All strings over A* • Basis: A* • Induction: if sA* and aA, then asA*.

  18. String examples • Show how to generate the following set of strings inductively. • S={ab, aabb, aaabbb,....} • S={aba, aabaa, aaabaaa,.....} • S={ab, abab, ababab,...} • S={am(bc)n|m,nN}

  19. Solution • Basis: induction: • Basis: induction: • Basis: induction: • Basis: induction:

  20. Lists • All lists over A • Basis: <> lists(A). • Induction: If xA and Llists(A), then cons(x,L)list(A).

  21. Lists examples • Write the inductive definiton for the sets: • C={L|Llists({a,b}) where a's and b's alternate} • S={x|x lists(N) and x has even length}

  22. Solution • Basis:induction: • Basis:induction:

  23. Binary trees • All binary trees over A • Basis: <>B. • Induction: if x A and L,R B, then tree(L,x,R) B.

  24. Binary trees • Write an inductive definition for each of the following Binary trees • All binary trees over {a} • The set of binary trees over {a} where each node has two identical subtrees.

  25. Solution • Basis: induction: • Basis: induction:

More Related